[New-bugs-announce] [issue46613] Add PyType_GetModuleByDef to the public & limited API

Petr Viktorin report at bugs.python.org
Wed Feb 2 11:55:22 EST 2022


New submission from Petr Viktorin <encukou at gmail.com>:

_PyType_GetModuleByDef (added in bpo-42100)allows module state access 
from slot methods (like tp_init or nb_add),
the main thing missing from PEP 573 (Module State Access from C 
Extension Methods).
It's time to make it public.

The function itself can be implemented using only limited API, though 
it's a bit tricky to do so correctly (and our implementation uses 
private speedups), so it's better if extension authors can use it as a 
pre-made building block.

Discussed in: https://mail.python.org/archives/list/capi-sig@python.org/thread/WMSDNMQ7A6LE6X4MQW4QAQUKDDL7MJ72/
Note that a bug was found in the CPython optimization recently: bpo-46433

----------
components: C API
messages: 412378
nosy: petr.viktorin
priority: normal
severity: normal
status: open
title: Add PyType_GetModuleByDef to the public & limited API
versions: Python 3.11

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


More information about the New-bugs-announce mailing list