mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Refcounting fixes
This commit is contained in:
parent
ceda83c6a9
commit
b7a5894c64
1 changed files with 7 additions and 3 deletions
|
@ -1356,6 +1356,7 @@ static set_main_loader(PyObject *d, const char *filename, const char *loader_nam
|
||||||
PyInterpreterState *interp;
|
PyInterpreterState *interp;
|
||||||
PyThreadState *tstate;
|
PyThreadState *tstate;
|
||||||
PyObject *loader_type, *loader;
|
PyObject *loader_type, *loader;
|
||||||
|
int result = 0;
|
||||||
/* Get current thread state and interpreter pointer */
|
/* Get current thread state and interpreter pointer */
|
||||||
tstate = PyThreadState_GET();
|
tstate = PyThreadState_GET();
|
||||||
interp = tstate->interp;
|
interp = tstate->interp;
|
||||||
|
@ -1364,12 +1365,15 @@ static set_main_loader(PyObject *d, const char *filename, const char *loader_nam
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
loader = PyObject_CallFunction(loader_type, "ss", "__main__", filename);
|
loader = PyObject_CallFunction(loader_type, "ss", "__main__", filename);
|
||||||
if (loader == NULL ||
|
Py_DECREF(loader_type);
|
||||||
(PyDict_SetItemString(d, "__loader__", loader) < 0)) {
|
if (loader == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (PyDict_SetItemString(d, "__loader__", loader) < 0) {
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
Py_DECREF(loader);
|
Py_DECREF(loader);
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue