Message 398938 - Python tracker (original) (raw)

Maybe this can be revisited now.

I've started the work already (albeit rather slowly 😄). Importlib has been updated to prefer spec.parent of package and warns when the values are not equal. Next step will be to raise an ImportWarning when package is defined but spec.parent is not (then DeprecationWarning after that).

For loader I got Python 3.10 to fall back on to spec.loader. Next step is https://bugs.python.org/issue42132 to update C code to set spec where appropriate. From there the check for equivalence can go in (which then leads to the warnings).

I have not started with cached yet, so next step is making sure all uses fall back on spec.

So, to be clear, the steps I have been following are:

  1. Make sure all code falls back on spec when appropriate (one release)
  2. Raise an ImportWarning when values differ (one release)
  3. Make spec take precedence over old attribute (one release)
  4. Raise an ImportWarning when having to fall back to older attribute (two releases)
  5. Raise a DeprecationWarning when falling back on older attribute (two releases)
  6. Clean up code