]> granicus.if.org Git - python/commitdiff
_pickle: Fix whichmodule() (#3358)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 5 Sep 2017 21:30:16 +0000 (23:30 +0200)
committerChristian Heimes <christian@python.org>
Tue, 5 Sep 2017 21:30:16 +0000 (14:30 -0700)
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().

Fix coverity report: CID 1417269.

Modules/_pickle.c

index 2a3e73988d4c6e96f22022c17226bc40567209e8..25255368a10bc5a6072ff5e4db5c766fbba0d72f 100644 (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;
 }