[New-bugs-announce] [issue9125] parser module doesn't like except-as syntax.

Mark Dickinson report at bugs.python.org
Wed Jun 30 16:36:34 CEST 2010

New submission from Mark Dickinson <dickinsm at gmail.com>:

There seems to be a parser module bug for the except-as syntax in Python 2.7.  After applying the attached patch (which adds a test to test_parser), and running test_parser, I get:

FAIL: test_try_stmt (__main__.RoundtripLegalSyntaxTestCase)
Traceback (most recent call last):
  File "Lib/test/test_parser.py", line 237, in test_try_stmt
    self.check_suite("try: pass\nexcept A as e: pass\n")
  File "Lib/test/test_parser.py", line 38, in check_suite
    self.roundtrip(parser.suite, s)
  File "Lib/test/test_parser.py", line 20, in roundtrip
    self.fail("could not roundtrip %r: %s" % (s, why))
AssertionError: could not roundtrip 'try: pass\nexcept A as e: pass\n': Expected node type 12, got 1.

files: parser_except_as_bug.patch
keywords: patch
messages: 108984
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: parser module doesn't like except-as syntax.
versions: Python 2.7
Added file: http://bugs.python.org/file17814/parser_except_as_bug.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list