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

Christian Heimes webhook-mailer at python.org
Wed Sep 6 00:43:22 EDT 2017


https://github.com/python/cpython/commit/c3c3062169fad11e0e74aa85ff1f3d69c0170d42
commit: c3c3062169fad11e0e74aa85ff1f3d69c0170d42
branch: 3.6
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2017-09-05T21:43:19-07:00
summary:

[3.6] _pickle: Fix whichmodule() (GH-3358) (#3361)

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

Fix coverity report: CID 1417269.
(cherry picked from commit af46eb8)

files:
M Modules/_pickle.c

diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 920b46fc285..ef0a03b1079 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