mirror of
https://github.com/python/cpython.git
synced 2025-11-10 14:31:24 +00:00
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.
This commit is contained in:
parent
fa2e4c27d2
commit
2c146bfa28
1 changed files with 8 additions and 2 deletions
|
|
@ -1180,8 +1180,11 @@ profiler_start(ProfilerObject *self, PyObject *args)
|
||||||
PyObject *result = NULL;
|
PyObject *result = NULL;
|
||||||
|
|
||||||
if (PyArg_ParseTuple(args, ":start")) {
|
if (PyArg_ParseTuple(args, ":start")) {
|
||||||
if (is_available(self))
|
if (is_available(self)) {
|
||||||
do_start(self);
|
do_start(self);
|
||||||
|
result = Py_None;
|
||||||
|
Py_INCREF(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -1198,8 +1201,11 @@ profiler_stop(ProfilerObject *self, PyObject *args)
|
||||||
if (PyArg_ParseTuple(args, ":stop")) {
|
if (PyArg_ParseTuple(args, ":stop")) {
|
||||||
if (!self->active)
|
if (!self->active)
|
||||||
PyErr_SetString(ProfilerError, "profiler not active");
|
PyErr_SetString(ProfilerError, "profiler not active");
|
||||||
else
|
else {
|
||||||
do_stop(self);
|
do_stop(self);
|
||||||
|
result = Py_None;
|
||||||
|
Py_INCREF(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue