[New-bugs-announce] [issue31588] SystemError in class creation in case of a metaclass with a bad __prepare__() method

Oren Milman report at bugs.python.org
Tue Sep 26 03:38:12 EDT 2017


New submission from Oren Milman:

The following code causes a SystemError:
class BadMetaclass(type):
    def __prepare__(*args):
        pass

class Foo(metaclass=BadMetaclass):
    pass


This is because builtin___build_class__() assumes that __prepare__() returned a
mapping, and passes it to PyEval_EvalCodeEx(), which passes it to
_PyEval_EvalCodeWithName(), which passes it to _PyFrame_New_NoTrack(), which
raises the SystemError.


This issue seems related to #17421.

----------
components: Interpreter Core
messages: 303019
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: SystemError in class creation in case of a metaclass with a bad __prepare__() method
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31588>
_______________________________________


More information about the New-bugs-announce mailing list