Message190034
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. |
|
Date |
User |
Action |
Args |
2013-05-25 23:21:02 | brett.cannon | set | recipients:
+ brett.cannon |
2013-05-25 23:21:02 | brett.cannon | set | messageid: <1369524062.03.0.920595154239.issue18065@psf.upfronthosting.co.za> |
2013-05-25 23:21:02 | brett.cannon | link | issue18065 messages |
2013-05-25 23:21:01 | brett.cannon | create | |
|