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

Sebastian report at bugs.python.org
Tue May 25 10:33:45 CEST 2010


Sebastian <python.10.webmaster at spamgourmet.com> added the comment:

Oh, damn. I really forgot the argv filename thing. Nevermind :)

But back to topic. __file__ might be not the best solution for that. What does Python when embedded, and __file__ is not set? That can happen when the source of your code is not a file (multiline textbox, ...)

I would simply follow the way how the traceback solves this. Just print out the filename passed to:

Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags)
PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags)
[...]

----------

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


More information about the Python-bugs-list mailing list