Open
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