[issue8787] warnings inside PyRun_SimpleString() display argv[1]

Amaury Forgeot d'Arc report at bugs.python.org
Tue May 25 10:04:31 CEST 2010


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

Yes, the warnings module tries to display the file name. Inside PyRun_SimpleString(), globals()['__name__'] == '__main__', and the warnings module supposes that argv[1] is the name of the script.

I wonder whether __file__ would be more accurate: it is filled when running a script, but not when running a string. And sys.argv would not be used any more.

----------
assignee:  -> brett.cannon
nosy: +amaury.forgeotdarc, brett.cannon
title: PySys_Get -> warnings inside PyRun_SimpleString() display argv[1]

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


More information about the Python-bugs-list mailing list