From: Victor Stinner Date: Tue, 5 Sep 2017 21:30:16 +0000 (+0200) Subject: _pickle: Fix whichmodule() (#3358) X-Git-Tag: v3.7.0a1~147 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af46eb8d5f23c6f4e69a6a1f579fac8c2250b7c2;p=thirdparty%2FPython%2Fcpython.git _pickle: Fix whichmodule() (#3358) _PyUnicode_FromId() can return NULL: replace Py_INCREF() with Py_XINCREF(). Fix coverity report: CID 1417269. --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 2a3e73988d4c..25255368a10b 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -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; }