mirror of
https://github.com/python/cpython.git
synced 2025-10-04 06:06:44 +00:00
[3.6] bpo-31492: Fix assertion failures in case of a module with a bad __name__ attribute. (GH-3620). (#3773)
(cherry picked from commit 6db7033192
)
This commit is contained in:
parent
a1c49f6f09
commit
f0db2dfda7
4 changed files with 20 additions and 4 deletions
|
@ -5254,6 +5254,10 @@ import_from(PyObject *v, PyObject *name)
|
|||
if (pkgname == NULL) {
|
||||
goto error;
|
||||
}
|
||||
if (!PyUnicode_Check(pkgname)) {
|
||||
Py_CLEAR(pkgname);
|
||||
goto error;
|
||||
}
|
||||
fullmodname = PyUnicode_FromFormat("%U.%U", pkgname, name);
|
||||
Py_DECREF(pkgname);
|
||||
if (fullmodname == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue