-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error