Skip to content

Traceback Shows Too Much Info For Class Definition Exception #129145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ericsnowcurrently opened this issue Jan 21, 2025 · 1 comment
Open

Traceback Shows Too Much Info For Class Definition Exception #129145

ericsnowcurrently opened this issue Jan 21, 2025 · 1 comment
Labels
3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented Jan 21, 2025

Bug report

Bug description:

Given the following:

class Meta(type):
    def __prepare__(cls, *args, **kwargs):
        raise Exception

class Spam(metaclass=Meta):
    a = 1
    b = 2
    c = 3
    d = 4
    e = 5
    f = 6

I get:

Traceback (most recent call last):
  File "<python-input-10>", line 1, in <module>
    class Spam(metaclass=Meta):
    ...<5 lines>...
        f = 6
  File "<python-input-9>", line 3, in __prepare__
    raise Exception

I would expect this to only show the compound statement's "header":

Traceback (most recent call last):
  File "<python-input-10>", line 1, in <module>
    class Spam(metaclass=Meta):
  File "<python-input-9>", line 3, in __prepare__
    raise Exception

CC @iritkatriel

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

@ericsnowcurrently ericsnowcurrently added 3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Jan 21, 2025
@Eclips4
Copy link
Member

Eclips4 commented Jan 21, 2025

cc @pablogsal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants