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 r.david.murray
Recipients brett.cannon, eric.snow, m.nijland, ncoghlan, r.david.murray
Date 2016-07-18.00:30:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468801823.91.0.969142609412.issue27543@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-07-18 00:30:24r.david.murraysetrecipients: + r.david.murray, brett.cannon, ncoghlan, eric.snow, m.nijland
2016-07-18 00:30:23r.david.murraysetmessageid: <1468801823.91.0.969142609412.issue27543@psf.upfronthosting.co.za>
2016-07-18 00:30:23r.david.murraylinkissue27543 messages
2016-07-18 00:30:22r.david.murraycreate