This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients brett.cannon
Date 2013-05-25.23:21:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1369524062.03.0.920595154239.issue18065@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-05-25 23:21:02brett.cannonsetrecipients: + brett.cannon
2013-05-25 23:21:02brett.cannonsetmessageid: <1369524062.03.0.920595154239.issue18065@psf.upfronthosting.co.za>
2013-05-25 23:21:02brett.cannonlinkissue18065 messages
2013-05-25 23:21:01brett.cannoncreate