[New-bugs-announce] [issue7161] raise of SyntaxError in codeop was ported incorrectly to Py3
Trundle
report at bugs.python.org
Sat Oct 17 21:25:50 CEST 2009
New submission from Trundle <andy-python at hammerhartes.de>:
The original lines in Lib/codeop.py under Python 2.6:
raise SyntaxError, err1
Those lines were ported to Python 3 as:
raise SyntaxError(err1)
Which is wrong because `err1` is in both cases an instance of
`SyntaxError`. Quote from the language reference: "If the first object
is a class, it becomes the type of the exception. The second object is
used to determine the exception value: If it is an instance of the
class, the instance becomes the exception value." Therefore, the correct
translation of that code is: "raise err1".
The attached patch fixes the issue.
----------
components: Library (Lib)
files: codeop_raise_syntaxerror.patch
keywords: patch
messages: 94185
nosy: Trundle
severity: normal
status: open
title: raise of SyntaxError in codeop was ported incorrectly to Py3
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15157/codeop_raise_syntaxerror.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7161>
_______________________________________
More information about the New-bugs-announce
mailing list