[issue3933] presence of .pythonstartup.py causes __main__.__file__ to be set incorrectly

Jean-Paul Calderone report at bugs.python.org
Mon Sep 22 15:57:17 CEST 2008


Jean-Paul Calderone <exarkun at divmod.com> added the comment:

Any buggy behavior might be relied on by applications.  Taken to the
extreme, you can never have a bug-fix release of Python.

__file__ from PYTHONSTARTUP breaks the warnings module.  It would be
difficult for an application to rely on __main__.__file__ being set,
since $PYTHONSTARTUP is only read in interactive mode - when it's a
human using Python, not a program.  Of course another process could run
Python interactively in a child process and then rely on __file__, sure.
 But why is that valid?  It's not like __file__ *means* something there
- it's just the value of PYTHONSTARTUP.

But I guess I don't really care anymore.  I understand why warnings are
being reported incorrectly now, so I doubt this affects /me/ anymore. 
It seems like it'd be better to reduce confusion for other people too,
but that's not up to me.

Thanks for pointing out where it was fixed in 2.6.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3933>
_______________________________________


More information about the Python-bugs-list mailing list