This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Mark.Shannon
Date 2021-06-22.09:53:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624355622.79.0.135643740949.issue44486@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-22 09:53:42Mark.Shannonsetrecipients: + Mark.Shannon
2021-06-22 09:53:42Mark.Shannonsetmessageid: <1624355622.79.0.135643740949.issue44486@roundup.psfhosted.org>
2021-06-22 09:53:42Mark.Shannonlinkissue44486 messages
2021-06-22 09:53:42Mark.Shannoncreate