[Python-checkins] cpython: Refcounting fixes
nick.coghlan
python-checkins at python.org
Sun Jul 15 15:21:18 CEST 2012
http://hg.python.org/cpython/rev/27e13497d545
changeset: 78117:27e13497d545
user: Nick Coghlan <ncoghlan at gmail.com>
date: Sun Jul 15 23:21:08 2012 +1000
summary:
Refcounting fixes
files:
Python/pythonrun.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1356,6 +1356,7 @@
PyInterpreterState *interp;
PyThreadState *tstate;
PyObject *loader_type, *loader;
+ int result = 0;
/* Get current thread state and interpreter pointer */
tstate = PyThreadState_GET();
interp = tstate->interp;
@@ -1364,12 +1365,15 @@
return -1;
}
loader = PyObject_CallFunction(loader_type, "ss", "__main__", filename);
- if (loader == NULL ||
- (PyDict_SetItemString(d, "__loader__", loader) < 0)) {
+ Py_DECREF(loader_type);
+ if (loader == NULL) {
return -1;
}
+ if (PyDict_SetItemString(d, "__loader__", loader) < 0) {
+ result = -1;
+ }
Py_DECREF(loader);
- return 0;
+ return result;
}
int
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list