[New-bugs-announce] [issue44486] Modules should alway have a dictionary

Mark Shannon report at bugs.python.org
Tue Jun 22 05:53:42 EDT 2021


New submission from Mark Shannon <mark at hotpy.org>:

It is possible to create a module without a dictionary:
m = types.ModuleType.__new__(types.ModuleType)

But that is the only way to create to a module without a dict; all other means of creating a module, both in Python and in the C API, result in a fully formed module.

Existing code expects that modules will always have a dictionary, e.g.
https://github.com/python/cpython/blob/3.10/Include/internal/pycore_moduleobject.h#L35

We should change types.ModuleType.__new__ to properly initialize the module.

----------
assignee: Mark.Shannon
messages: 396316
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Modules should alway have a dictionary
type: behavior

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


More information about the New-bugs-announce mailing list