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.

classification
Title: Add PyType_GetModuleByDef to the public & limited API
Type: Stage: patch review
Components: C API Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: petr.viktorin, shihai1991
Priority: normal Keywords: patch

Created on 2022-02-02 16:55 by petr.viktorin, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31081 merged petr.viktorin, 2022-02-02 17:00
Messages (3)
msg412378 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2022-02-02 16:55
_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
msg413082 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2022-02-11 16:22
New changeset 204946986feee7bc80b233350377d24d20fcb1b8 by Petr Viktorin in branch 'main':
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
https://github.com/python/cpython/commit/204946986feee7bc80b233350377d24d20fcb1b8
msg413083 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2022-02-11 16:23
It's in public API, adding it to limited is still pending.
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90771
2022-02-11 16:23:15petr.viktorinsetmessages: + msg413083
2022-02-11 16:22:16petr.viktorinsetmessages: + msg413082
2022-02-09 01:31:08shihai1991setnosy: + shihai1991
2022-02-02 17:00:44petr.viktorinsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29264
2022-02-02 16:55:22petr.viktorincreate