mirror of https://github.com/python/cpython
Christopher Fandrich <cfandrich@8cs.com>:
Fix memory leak in initializing __debug__.
This commit is contained in:
parent
91c4e2bf12
commit
5550de3084
|
@ -2364,7 +2364,7 @@ Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices.";
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyBuiltin_Init()
|
_PyBuiltin_Init()
|
||||||
{
|
{
|
||||||
PyObject *mod, *dict;
|
PyObject *mod, *dict, *debug;
|
||||||
mod = Py_InitModule4("__builtin__", builtin_methods,
|
mod = Py_InitModule4("__builtin__", builtin_methods,
|
||||||
builtin_doc, (PyObject *)NULL,
|
builtin_doc, (PyObject *)NULL,
|
||||||
PYTHON_API_VERSION);
|
PYTHON_API_VERSION);
|
||||||
|
@ -2375,9 +2375,12 @@ _PyBuiltin_Init()
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyDict_SetItemString(dict, "Ellipsis", Py_Ellipsis) < 0)
|
if (PyDict_SetItemString(dict, "Ellipsis", Py_Ellipsis) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyDict_SetItemString(dict, "__debug__",
|
debug = PyInt_FromLong(Py_OptimizeFlag == 0);
|
||||||
PyInt_FromLong(Py_OptimizeFlag == 0)) < 0)
|
if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
|
||||||
|
Py_XDECREF(debug);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_XDECREF(debug);
|
||||||
|
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue