Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c146bf

Browse files
committed
start() and stop() methods: return None where there is no exception;
returning NULL causes the interpreter to raise a SystemError. Noted by Anthony Baxter at Python 10.
1 parent fa2e4c2 commit 2c146bf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Modules/_hotshot.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,11 @@ profiler_start(ProfilerObject *self, PyObject *args)
11801180
PyObject *result = NULL;
11811181

11821182
if (PyArg_ParseTuple(args, ":start")) {
1183-
if (is_available(self))
1183+
if (is_available(self)) {
11841184
do_start(self);
1185+
result = Py_None;
1186+
Py_INCREF(result);
1187+
}
11851188
}
11861189
return result;
11871190
}
@@ -1198,8 +1201,11 @@ profiler_stop(ProfilerObject *self, PyObject *args)
11981201
if (PyArg_ParseTuple(args, ":stop")) {
11991202
if (!self->active)
12001203
PyErr_SetString(ProfilerError, "profiler not active");
1201-
else
1204+
else {
12021205
do_stop(self);
1206+
result = Py_None;
1207+
Py_INCREF(result);
1208+
}
12031209
}
12041210
return result;
12051211
}

0 commit comments

Comments
 (0)