mirror of
https://github.com/python/cpython.git
synced 2025-11-02 22:51:25 +00:00
parent
5eaf772980
commit
c0cde4da2a
1 changed files with 9 additions and 7 deletions
|
|
@ -1906,11 +1906,10 @@ PyImport_ImportFrozenModule(char *name)
|
||||||
if (co == NULL)
|
if (co == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (!PyCode_Check(co)) {
|
if (!PyCode_Check(co)) {
|
||||||
Py_DECREF(co);
|
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"frozen object %.200s is not a code object",
|
"frozen object %.200s is not a code object",
|
||||||
name);
|
name);
|
||||||
return -1;
|
goto err_return;
|
||||||
}
|
}
|
||||||
if (ispackage) {
|
if (ispackage) {
|
||||||
/* Set __path__ to the package name */
|
/* Set __path__ to the package name */
|
||||||
|
|
@ -1918,22 +1917,25 @@ PyImport_ImportFrozenModule(char *name)
|
||||||
int err;
|
int err;
|
||||||
m = PyImport_AddModule(name);
|
m = PyImport_AddModule(name);
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return -1;
|
goto err_return;
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
s = PyString_InternFromString(name);
|
s = PyString_InternFromString(name);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return -1;
|
goto err_return;
|
||||||
err = PyDict_SetItemString(d, "__path__", s);
|
err = PyDict_SetItemString(d, "__path__", s);
|
||||||
Py_DECREF(s);
|
Py_DECREF(s);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
goto err_return;
|
||||||
}
|
}
|
||||||
m = PyImport_ExecCodeModuleEx(name, co, "<frozen>");
|
m = PyImport_ExecCodeModuleEx(name, co, "<frozen>");
|
||||||
Py_DECREF(co);
|
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return -1;
|
goto err_return;
|
||||||
|
Py_DECREF(co);
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
return 1;
|
return 1;
|
||||||
|
err_return:
|
||||||
|
Py_DECREF(co);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue