[issue29144] Implicit namespace packages in Python 3.6

Nick Coghlan report at bugs.python.org
Wed Jul 19 23:24:45 EDT 2017


Nick Coghlan added the comment:

At the Python level, the rules are simple: the first directory on sys.path that contains an __init__.py file is identified as a self-contained package. It is then up to that __init__.py file to emulate namespace package behaviour (by extending __path__) if that's what the author intended.

Nothing changed in Python 3.6 in terms of that, and it's been that way ever since native namespace packages were introduced.

So if there's a behavioural change in the pkg_resources namespace emulation in going from Python 3.5 to 3.6 that occurs with both old & new versions of setuptools, then I see two main possible candidates for that:

1. Something changed in one of the APIs that setuptools uses to recalculate __path__

2. Something changed in importlib where we're not respecting runtime changes to __path__ properly, and are instead relying on either __spec__.submodule_search_locations or a stale cached version of __path__

Neither of those is something we *intended* to change in 3.6, so I think it's reasonable to categorise this as 3.6 regression at the standard library level (even though setuptools will likely need to work around it anyway, given the earliest we'll be able to fix it is in 3.6.3)

----------
keywords: +3.6regression
stage:  -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29144>
_______________________________________


More information about the Python-bugs-list mailing list