mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-65961: Raise DeprecationWarning
when __package__
differs from __spec__.parent
(#97879)
Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
parent
2016bc54a2
commit
c206e53bb7
9 changed files with 45 additions and 102 deletions
|
@ -1573,7 +1573,7 @@ resolve_name(PyThreadState *tstate, PyObject *name, PyObject *globals, int level
|
|||
goto error;
|
||||
}
|
||||
else if (equal == 0) {
|
||||
if (PyErr_WarnEx(PyExc_ImportWarning,
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"__package__ != __spec__.parent", 1) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue