Skip to content

Commit 4429178

Browse files
committed
Since PyLong_From Long(PY_MONITORING_DEBUGGER_ID) falls to small_int case and can't return NULL. Added assert for extra confidence.
#134411 (comment)
1 parent ae18ce8 commit 4429178

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Python/instrumentation.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,20 +2558,24 @@ PyObject *_Py_CreateMonitoringObject(void)
25582558
err = PyObject_SetAttrString(events, "NO_EVENTS", _PyLong_GetZero());
25592559
if (err) goto error;
25602560
PyObject *val = PyLong_FromLong(PY_MONITORING_DEBUGGER_ID);
2561+
assert(val != NULL);
25612562
err = PyObject_SetAttrString(mod, "DEBUGGER_ID", val);
2562-
Py_XDECREF(val);
2563+
Py_DECREF(val);
25632564
if (err) goto error;
25642565
val = PyLong_FromLong(PY_MONITORING_COVERAGE_ID);
2566+
assert(val != NULL);
25652567
err = PyObject_SetAttrString(mod, "COVERAGE_ID", val);
2566-
Py_XDECREF(val);
2568+
Py_DECREF(val);
25672569
if (err) goto error;
25682570
val = PyLong_FromLong(PY_MONITORING_PROFILER_ID);
2571+
assert(val != NULL);
25692572
err = PyObject_SetAttrString(mod, "PROFILER_ID", val);
2570-
Py_XDECREF(val);
2573+
Py_DECREF(val);
25712574
if (err) goto error;
25722575
val = PyLong_FromLong(PY_MONITORING_OPTIMIZER_ID);
2576+
assert(val != NULL);
25732577
err = PyObject_SetAttrString(mod, "OPTIMIZER_ID", val);
2574-
Py_XDECREF(val);
2578+
Py_DECREF(val);
25752579
if (err) goto error;
25762580
return mod;
25772581
error:

0 commit comments

Comments
 (0)