[issue46891] Crash in ModuleType subclass with __slots__
Ronald Oussoren
report at bugs.python.org
Tue Mar 1 16:25:06 EST 2022
New submission from Ronald Oussoren <ronaldoussoren at mac.com>:
The following crashes the interpreter in Python 3.11, and works fine in older versions:
# --- script.py
import types
class MyModule (types.ModuleType):
__slots__ = (
"_MyModule__a",
"_MyModule__b",
)
def __init__(self, name):
super().__init__(name)
m = MyModule("name")
# -- end of file
The key in this is the ``__slots__`` definition: The script does not crash without ``__slots__``, or with a slots tuple with 1 item.
This is a reproducer based on code in PyObjC.
----------
components: Interpreter Core
keywords: 3.11regression
messages: 414294
nosy: ronaldoussoren
priority: normal
severity: normal
stage: needs patch
status: open
title: Crash in ModuleType subclass with __slots__
type: crash
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46891>
_______________________________________
More information about the Python-bugs-list
mailing list