[issue31588] SystemError in class creation in case of a metaclass with a bad __prepare__() method
Nick Coghlan
report at bugs.python.org
Wed Sep 27 06:06:13 EDT 2017
Nick Coghlan <ncoghlan at gmail.com> added the comment:
There's no __prepare__ method in 2.7, so that version can't be affected by this.
For 3.6 and 3.7, I can't reproduce the reported SystemError. Instead, I get:
```
>>> class BadMetaclass(type):
... def __prepare__(*args):
... pass
...
>>> class Foo(metaclass=BadMetaclass):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in Foo
TypeError: 'NoneType' object is not subscriptable
```
The error remains the same if I add `@classmethod` to the __prepare__ definition.
That's still thoroughly cryptic and worth changing, but indicates the test should be checking the error message details, not just the error type.
----------
versions: -Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31588>
_______________________________________
More information about the Python-bugs-list
mailing list