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 pitrou
Recipients benjamin.peterson, brett.cannon, donmez, georg.brandl, pitrou, vstinner
Date 2010-11-09.16:34:42
SpamBayes Score 2.7544367e-05
Marked as misclassified No
Message-id <1289320485.67.0.222625931628.issue10372@psf.upfronthosting.co.za>
In-reply-to
Content
One observation is that when the -W option is used, the "warnings" module gets loaded very early and itself imports linecache which then imports tokenize. At this point, the standard IO streams have not been initialized (_io is imported later) and the builtin "open" may not exist at all. So when tokenize references "open", it is a NameError at that point (which explains why the "weird fix" above is actually correct).

As an additional annoyance, when importing Lib/warnings.py fails (for example if you sneak in a "1/0" at the beginning of the file), the exception gets silenced: the NameError above doesn't get printed.
History
Date User Action Args
2010-11-09 16:34:45pitrousetrecipients: + pitrou, brett.cannon, georg.brandl, vstinner, donmez, benjamin.peterson
2010-11-09 16:34:45pitrousetmessageid: <1289320485.67.0.222625931628.issue10372@psf.upfronthosting.co.za>
2010-11-09 16:34:43pitroulinkissue10372 messages
2010-11-09 16:34:42pitroucreate