Skip to content

Commit af46eb8

Browse files
vstinnertiran
authored andcommitted
_pickle: Fix whichmodule() (#3358)
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with Py_XINCREF(). Fix coverity report: CID 1417269.
1 parent 564a2c6 commit af46eb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/_pickle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ whichmodule(PyObject *global, PyObject *dotted_path)
17051705

17061706
/* If no module is found, use __main__. */
17071707
module_name = _PyUnicode_FromId(&PyId___main__);
1708-
Py_INCREF(module_name);
1708+
Py_XINCREF(module_name);
17091709
return module_name;
17101710
}
17111711

0 commit comments

Comments
 (0)