Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 65391:f98c3e2fd055
fix refleak
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 16 Oct 2010 03:12:39 +0000 |
| parents | 292b1df01bad |
| children | fd5135cbd928 |
line wrap: on
line diff
--- a/Python/import.c Sat Oct 16 01:20:45 2010 +0000 +++ b/Python/import.c Sat Oct 16 03:12:39 2010 +0000 @@ -3462,7 +3462,7 @@ char buf[MAXPATHLEN+1]; PyObject *pathbytes; char *cpathname; - PyObject *debug_override = Py_None; + PyObject *debug_override = NULL; int debug = !Py_OptimizeFlag; if (!PyArg_ParseTupleAndKeywords( @@ -3470,9 +3470,11 @@ PyUnicode_FSConverter, &pathbytes, &debug_override)) return NULL; - if (debug_override != Py_None) - if ((debug = PyObject_IsTrue(debug_override)) < 0) - return NULL; + if (debug_override != NULL && + (debug = PyObject_IsTrue(debug_override)) < 0) { + Py_DECREF(pathbytes); + return NULL; + } cpathname = make_compiled_pathname( PyBytes_AS_STRING(pathbytes),
