]> granicus.if.org Git - python/commitdiff
start() and stop() methods: return None where there is no exception;
authorFred Drake <fdrake@acm.org>
Fri, 8 Feb 2002 21:27:50 +0000 (21:27 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 8 Feb 2002 21:27:50 +0000 (21:27 +0000)
returning NULL causes the interpreter to raise a SystemError.
Noted by Anthony Baxter at Python 10.

Modules/_hotshot.c

index ebaf37c3578eac885a2a6af9691e8eaa67eef6c1..f88629dc4f32c73155ea76e7b7383be0bd50f3d3 100644 (file)
@@ -1180,8 +1180,11 @@ profiler_start(ProfilerObject *self, PyObject *args)
     PyObject *result = NULL;
 
     if (PyArg_ParseTuple(args, ":start")) {
-        if (is_available(self))
+        if (is_available(self)) {
             do_start(self);
+            result = Py_None;
+            Py_INCREF(result);
+        }
     }
     return result;
 }
@@ -1198,8 +1201,11 @@ profiler_stop(ProfilerObject *self, PyObject *args)
     if (PyArg_ParseTuple(args, ":stop")) {
         if (!self->active)
             PyErr_SetString(ProfilerError, "profiler not active");
-        else
+        else {
             do_stop(self);
+            result = Py_None;
+            Py_INCREF(result);
+        }
     }
     return result;
 }