Repository navigation
Convert _ctypes extension module to multi-phase init #117142
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancement
on Mar 22, 2024 - addedextension-modulesC modules in the Modules dirC modules in the Modules dir
on Mar 22, 2024 - added 2 commits that reference this issue
on Apr 2, 2024 - changed the title
[-]Isolate the _ctypes extension module[/-][+]Convert _ctypes extension module to multi-phase init[/+]on May 8, 2024 Could anyone add this open issue to the base issue's todo (
port _ctypesbranch) as a checked (finished) leaf? Thanks.Reacted by Petr Viktorin10 remaining items
In my understanding of #117181 (comment), the
closure_fcnfunction incallbacks.cneeds a new compatiblePyGILState_Ensure()faimily like #59956 (comment) to enablePy_MOD_PER_INTERPRETER_GIL_SUPPORTED?Issue #55124 in 2011 has an experimantal patch: https://bugs.python.org/file20417/gilstateinterp.patch
Reacted by Eric SnowAlso mmap-based closure allocation needs a mutex, and I don't know how thread-safe the libffi API is. There might be other things.
FYI,
PyGILState_Ensure()should work fine with subinterpreters, as of 3.12. It was necessary to fix that for per-interpreter GIL.Regarding mmap and libffi, aren't those resolved for free-threading builds?
- added a commit that references this issue
on Jun 3, 2024
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Feature or enhancement
Proposal:
This issue is available to keep track of PRs, following the heap type conversion completed at #114314.
TODO:
[ ] Makerejectedfree_listinmalloc_closure.cper-module variables.StgInfoduring a finalization: comment.Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED(DONE): comment.FUTURE?:
Py_MOD_PER_INTERPRETER_GIL_SUPPORTEDafter a compatiblePyGILState_Ensure()is introduced, see also the links below.Links to documents:
Links to previous discussion of this feature:
PyGILState_Ensure()for sub-interpreters:_ctypespatch (2011)Linked PRs
globals-to-fix.tsv#117544