Skip to content

Incorrect syntax error #133999

Description

@tom-pytel

Bug report

Bug description:

>>> try: 1/0
... except Exception as exc: raise from exc
... 
  File "<python-input-0>", line 2
    except Exception as exc: raise from exc
                        ^^^
SyntaxError: cannot use except statement with name

Should be:

>>> try: 1/0
... except: raise from ValueError()
... 
  File "<python-input-2>", line 2
    except: raise from ValueError()
                  ^^^^
SyntaxError: invalid syntax

CPython versions tested on:

CPython main branch, 3.14

Operating systems tested on:

Linux

Linked PRs

Activity

  1. self-assigned this
    on May 14, 2025
  2. sobolevn commented on May 14, 2025

    @sobolevn
    Member

    This is a regression from my commit. Sorry! Fixing

  3. added 2 commits that reference this issue on May 15, 2025
  4. added a commit that references this issue on May 17, 2025
  5. added a commit that references this issue on May 19, 2025
  6. added a commit that references this issue on May 19, 2025
  7. added a commit that references this issue on Jun 6, 2025
  8. added 2 commits that reference this issue on Jul 12, 2025
  9. added 2 commits that reference this issue on Aug 4, 2025
  10. added a commit that references this issue on Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions