Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 12961:eb911eca9ee9 legacy-trunk
Christopher Fandrich <cfandrich@8cs.com>:
Fix memory leak in initializing __debug__.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 20 Jun 2000 04:54:19 +0000 |
| parents | ecddb2ed4c75 |
| children | 1d0407960953 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Mon Jun 19 13:41:54 2000 +0000 +++ b/Python/bltinmodule.c Tue Jun 20 04:54:19 2000 +0000 @@ -2364,7 +2364,7 @@ PyObject * _PyBuiltin_Init() { - PyObject *mod, *dict; + PyObject *mod, *dict, *debug; mod = Py_InitModule4("__builtin__", builtin_methods, builtin_doc, (PyObject *)NULL, PYTHON_API_VERSION); @@ -2375,9 +2375,12 @@ return NULL; if (PyDict_SetItemString(dict, "Ellipsis", Py_Ellipsis) < 0) return NULL; - if (PyDict_SetItemString(dict, "__debug__", - PyInt_FromLong(Py_OptimizeFlag == 0)) < 0) + debug = PyInt_FromLong(Py_OptimizeFlag == 0); + if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { + Py_XDECREF(debug); return NULL; + } + Py_XDECREF(debug); return mod; }
