[issue11441] compile() raises SystemError if called from except clause

Amaury Forgeot d'Arc report at bugs.python.org
Wed Mar 9 00:37:54 CET 2011

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

Why is the exception normalized at the end? I suppose it's because when value is an exception instance, it's replaced by a tuple, but the original value has to be recreated at the end. So in some cases, the SyntaxError object is created twice...

If PyErr_NormalizeException() can't be avoided, I suggest to call it at the start, just after PyErr_Fetch, and use the PySyntaxErrorObject* structure directly to get the file name and line numbers.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list