Skip to content

Incorrect syntax error #133999

@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

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy