Amaury Forgeot d'Arc <amaur...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue8787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com