[Python-checkins] _pickle: Fix whichmodule() (#3358)

Christian Heimes webhook-mailer at python.org
Tue Sep 5 17:30:20 EDT 2017


https://github.com/python/cpython/commit/af46eb8d5f23c6f4e69a6a1f579fac8c2250b7c2
commit: af46eb8d5f23c6f4e69a6a1f579fac8c2250b7c2
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: Christian Heimes <christian at python.org>
date: 2017-09-05T14:30:16-07:00
summary:

_pickle: Fix whichmodule() (#3358)

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

Fix coverity report: CID 1417269.

files:
M Modules/_pickle.c

diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 2a3e73988d4..25255368a10 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;
 }
 



More information about the Python-checkins mailing list