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 Ronan.Lamy
Recipients Aaron.Meurer, Arfrever, Ronan.Lamy, brett.cannon
Date 2012-05-29.01:23:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338254633.85.0.652526441086.issue14938@psf.upfronthosting.co.za>
In-reply-to
Content
my_pkg.__init__ isn't treated as just another module but as a package. That is the reason why the bogus my_pkg.__init__.module1 is created, I guess:

>>> import sys
>>> sorted(name for name in sys.modules if name.startswith('my_'))
[]
>>> import my_pkg.__init__
>>> sorted(name for name in sys.modules if name.startswith('my_'))
['my_pkg', 'my_pkg.__init__', 'my_pkg.__init__.module1', 'my_pkg.module1', 'my_pkg.module2']
>>> sys.modules['my_pkg.module1'].__package__
'my_pkg'
>>> sys.modules['my_pkg.__init__'].__package__
'my_pkg.__init__'

I agree that importing __init__ is a hack, but the way 3.3 reacts to it is nasty, because it can cause a whole application to be executed multiple times.
History
Date User Action Args
2012-05-29 01:23:53Ronan.Lamysetrecipients: + Ronan.Lamy, brett.cannon, Arfrever, Aaron.Meurer
2012-05-29 01:23:53Ronan.Lamysetmessageid: <1338254633.85.0.652526441086.issue14938@psf.upfronthosting.co.za>
2012-05-29 01:23:53Ronan.Lamylinkissue14938 messages
2012-05-29 01:23:52Ronan.Lamycreate