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

2013-01-11 Thread Brett Cannon
Brett Cannon added the comment: This no longer seems to be a problem in Python 3.2, 3.3, or 3.4. -- resolution: -> out of date status: open -> closed ___ Python tracker ___

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

2011-03-10 Thread Daniel Urban
Daniel Urban added the comment: Err... sorry, I don't understand again: If we get a tuple, create a new, store it without normalization. That's okay, I understand. If we get a SyntaxError instance, then take its args field, create the new tuple. Then call PyErr_NormalizeException(), with: a)

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

2011-03-10 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: I'd choose solution 3, but instead of calling SyntaxError.__init__, call PyErr_NormalizeException(). -- ___ Python tracker ___ _

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

2011-03-10 Thread Daniel Urban
Daniel Urban added the comment: So, I see four possible solutions: 1. If we get a tuple, create the new tuple, normalize the exception, and store it. If we get a SyntaxError instance, use its args, create the new tuple, normalize, and store. (In this case a SyntaxError instance will be crea

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

2011-03-09 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: hmm, you are right, of course. I forgot that e.args is part of the SyntaxError members. -- ___ Python tracker ___ __

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

2011-03-09 Thread Daniel Urban
Daniel Urban added the comment: > You could also call PyErr_NormalizeException at the beginning, and > update the fields directly in the PySyntaxErrorObject structure. No > need to deal with any tuple. Sorry, but I don't really understand. If I call PyErr_NormalizeException at the beginning,

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

2011-03-09 Thread July Tikhonov
Changes by July Tikhonov : Removed file: http://bugs.python.org/file21061/unnamed ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

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

2011-03-09 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > That's why I thought that calling PyErr_NormalizeException with the new > tuple is the simplest thing to do, becuase I guess that'll take care of > all fields automatically. You could also call PyErr_NormalizeException at the beginning, and update the

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

2011-03-09 Thread July Tikhonov
July Tikhonov added the comment: There is an XXX just before the definition of ast_error. Wouldn't it be useful? The idea is to merge ast_error() and ast_error_finish(). This requires redefinition of most functions in ast.c, adding "const char *filename" to their parameters. -- Added f

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

2011-03-08 Thread Daniel Urban
Daniel Urban 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 PyE

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

2011-03-08 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc 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 PyE

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

2011-03-08 Thread Daniel Urban
Daniel Urban added the comment: Okay, here is a new patch with the test in the correct place (I hope). -- Added file: http://bugs.python.org/file21055/issue11441_2.patch ___ Python tracker

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

2011-03-08 Thread Benjamin Peterson
Benjamin Peterson added the comment: You can put the test in test_compile. -- ___ Python tracker ___ ___ Python-bugs-list mailing lis

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

2011-03-08 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan ___ Python tracker ___ ___ Python-bugs-l

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

2011-03-08 Thread Daniel Urban
Daniel Urban added the comment: Here is a patch. I wasn't sure, where to put the test, so I put it in test_ast. -- keywords: +patch Added file: http://bugs.python.org/file21054/issue11441.patch ___ Python tracker

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

2011-03-08 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Right. In most cases, "PyErr_SetObject(PyExc_SyntaxError, tuple);" will store the untouched tuple in tstate->curexc_value, *except* when "Implicit exception chaining" occurs, in which case the exception is normalized. ast_error_finish() should not expec

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

2011-03-08 Thread Daniel Urban
Daniel Urban added the comment: Apparently ast_error_finish calls PyTuple_GetItem with a value that is not a tuple, but a SyntaxError instance (in Python/ast.c line 112). It seems that ast_error_finish expects that PyErr_Fetch will return the exception value as a tuple, and in some cases thi

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

2011-03-08 Thread July Tikhonov
New submission from July Tikhonov : Normal: >>> compile('1 = 1', '', 'exec') Traceback (most recent call last): File "", line 1, in File "", line 1 SyntaxError: can't assign to literal SystemError is raised instead of SyntaxError: >>> try: abcde ... except NameError: ... compile('1 = 1', '