Message120879
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. |
|
Date |
User |
Action |
Args |
2010-11-09 16:34:45 | pitrou | set | recipients:
+ pitrou, brett.cannon, georg.brandl, vstinner, donmez, benjamin.peterson |
2010-11-09 16:34:45 | pitrou | set | messageid: <1289320485.67.0.222625931628.issue10372@psf.upfronthosting.co.za> |
2010-11-09 16:34:43 | pitrou | link | issue10372 messages |
2010-11-09 16:34:42 | pitrou | create | |
|