New submission from Brett Cannon:
If you import the frozen __phello__ package, you will notice that
__phello__.__path__ == ['__phello__']. While that seems innocuous, that could
potentially lead to incorrect results if there just so happens to be a
directory named __phello__ which contains a file that isn't a frozen submodule
(i.e. FrozenImporter can't find the submodule but PathFinder can find a file
that happens to match the module's name).
So for that reason I want to simply set __path__ = [] for frozen packages. The
language reference for import states setting __path__ to anything makes a
module a package and that it just needs to be an iterable that only returns
strings (http://docs.python.org/3.4/reference/import.html#packages), so an
empty list works. Plus __package__ contains the same information so there is no
lost data by doing this.
Can anyone think of a good reason not to do this? I can't see why someone would
be relying upon this for any reason since the existence of __path__ itself is
enough to determine something is a package.
--
assignee: brett.cannon
components: Interpreter Core
messages: 190034
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: set __path__ = [] for frozen packages
type: behavior
versions: Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18065
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com