[issue38457] __package__ is None in __init__.py until an import is used

2019-10-20 Thread Nick Coghlan
Nick Coghlan added the comment: Yes, this is a design flaw in the Python 2 import system - it derives `__package__` from `__name__` the first time it needs the information and `__package__` isn't already set. The problem was fixed for the Python 3 series by way of PEP 451, which made substa

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-18 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-18 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +brett.cannon, eric.snow, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-18 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-13 Thread Yuval S
Yuval S added the comment: * It should be python[23] -m x.test, of course. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-12 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue38457] __package__ is None in __init__.py until an import is used

2019-10-12 Thread Yuval S
New submission from Yuval S : In Python 2.7, the __package__ variable isn't set when __init__.py is run, until an import is done. In Python 3.5, it is set correctly. e.g. # mkdir x && echo "print(__package__)" | tee x/__init__.py x/test.py # python2 x.test None x # python3 x.test x x # echo -