diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-19 16:21:04 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-19 16:21:04 (GMT) |
commit | bf35c156b48bd09febeb74d0a5b218e959d4225b (patch) | |
tree | 5c1304ce5b16efcd28db8043f802fa5b54345231 /Python/ceval.c | |
parent | aa2efcb0bcb80465cfa7114bb20d99c13be57f1c (diff) | |
download | cpython-bf35c156b48bd09febeb74d0a5b218e959d4225b.zip cpython-bf35c156b48bd09febeb74d0a5b218e959d4225b.tar.gz cpython-bf35c156b48bd09febeb74d0a5b218e959d4225b.tar.bz2 |
Fix refleak: PyObject_GetItem returns a new reference, not a borrowed one like PyDict_GetItem.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index a32d685..fde7841 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1940,6 +1940,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) "__build_class__ not found"); break; } + Py_INCREF(x); } else { PyObject *build_class_str = _PyUnicode_FromId(&PyId___build_class__); @@ -1953,7 +1954,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) break; } } - Py_INCREF(x); PUSH(x); break; } @@ -2092,6 +2092,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } if (x == NULL) { x = PyDict_GetItem(f->f_globals, w); + Py_XINCREF(x); if (x == NULL) { if (PyDict_CheckExact(f->f_builtins)) { x = PyDict_GetItem(f->f_builtins, w); @@ -2101,6 +2102,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) NAME_ERROR_MSG, w); break; } + Py_INCREF(x); } else { x = PyObject_GetItem(f->f_builtins, w); @@ -2113,7 +2115,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } } } - Py_INCREF(x); } PUSH(x); DISPATCH(); @@ -2186,7 +2187,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) break; } } - Py_INCREF(x); PUSH(x); DISPATCH(); |