_pickle: Fix whichmodule() (#3358)

_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().

Fix coverity report: CID 1417269.
This commit is contained in:
Victor Stinner 2017-09-05 23:30:16 +02:00 committed by Christian Heimes
parent 564a2c68ad
commit af46eb8d5f
1 changed files with 1 additions and 1 deletions

View File

@ -1705,7 +1705,7 @@ whichmodule(PyObject *global, PyObject *dotted_path)
/* If no module is found, use __main__. */
module_name = _PyUnicode_FromId(&PyId___main__);
Py_INCREF(module_name);
Py_XINCREF(module_name);
return module_name;
}