Message270671
The same example can be constructed for python3 by modifying the imports.
I think what is happening here is that if a has not yet been imported, then when 'from .a import test' is done, the import machinery loads a and then defines 'a' in the local namespace, overriding the previous 'import package.b as a'. On the other hand, if a has already been imported, the import machinery finds 'a' in sys.modules and skips the import-and-set-name-in-local-namespace step.
IMO the bug is that 'a' gets set at all when 'from a import test' is done, but the fact that it does so has a long history. |
|
Date |
User |
Action |
Args |
2016-07-18 00:30:24 | r.david.murray | set | recipients:
+ r.david.murray, brett.cannon, ncoghlan, eric.snow, m.nijland |
2016-07-18 00:30:23 | r.david.murray | set | messageid: <1468801823.91.0.969142609412.issue27543@psf.upfronthosting.co.za> |
2016-07-18 00:30:23 | r.david.murray | link | issue27543 messages |
2016-07-18 00:30:22 | r.david.murray | create | |
|