Skip to content

Incorrect syntax error #133999

Closed
Closed
@tom-pytel

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

self-assigned this
on May 14, 2025
sobolevn

sobolevn commented on May 14, 2025

@sobolevn
Member

This is a regression from my commit. Sorry! Fixing

added 2 commits that reference this issue on May 15, 2025

pythongh-133999: Fix `except` parsing regression in 3.14

d60a061

pythongh-133999: Fix `except` parsing regression in 3.14

f5eb02c
added a commit that references this issue on May 17, 2025

gh-133999: Fix `except` parsing regression in 3.14 (#134035)

84914ad

7 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Incorrect syntax error · Issue #133999 · python/cpython

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant