summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 52fbbc8..62e0841 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -196,10 +196,14 @@ static char setdefaultencoding_doc[] =
\n\
Set the current default string encoding used by the Unicode implementation.";
+extern int _PyTrace_Init(void);
+
static PyObject *
sys_settrace(PyObject *self, PyObject *args)
{
PyThreadState *tstate = PyThreadState_Get();
+ if (_PyTrace_Init() == -1)
+ return NULL;
if (args == Py_None)
args = NULL;
else
@@ -220,6 +224,8 @@ static PyObject *
sys_setprofile(PyObject *self, PyObject *args)
{
PyThreadState *tstate = PyThreadState_Get();
+ if (_PyTrace_Init() == -1)
+ return NULL;
if (args == Py_None)
args = NULL;
else