-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
There are several problems that I see with _lsprof.Profiler.enable()
method:
Lines 783 to 787 in d384050
if (PyObject_CallMethod(monitoring, "use_tool_id", "is", self->tool_id, "cProfile") == NULL) { PyErr_Format(PyExc_ValueError, "Another profiling tool is already active"); Py_DECREF(monitoring); return NULL; } PyErr_Clear()
call to show that this is intentional- Also, the same code does not decrement the refcount of the result, it is
None
right now (which is immortal), but we still prefer to do the refcount for such objects, where possible - This code ignores possible exceptions:
Lines 795 to 799 in d384050
Py_XDECREF(PyObject_CallMethod(monitoring, "register_callback", "iiO", self->tool_id, (1 << callback_table[i].event), callback)); Py_DECREF(callback); all_events |= (1 << callback_table[i].event);
I will send a PR.
Linked PRs
tomasr8
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error