Skip to content

gh-117142: ctypes: Migrate global vars to module state#117189

Merged
encukou merged 12 commits intopython:mainfrom
neonene:ctypes_func
Mar 29, 2024
Merged

gh-117142: ctypes: Migrate global vars to module state#117189
encukou merged 12 commits intopython:mainfrom
neonene:ctypes_func

Conversation

@neonene
Copy link
Contributor

@neonene neonene commented Mar 24, 2024

Separated PR from #117181, keeping global state access:

  • Move global variables into the global state
  • Call functions with the global state attached

I think almost all diffs can be checked mechanically by C compilers except stylistic changes at 9342336.

Unfixed global variables:

File / Func Var name Possible fix
malloc_closure.c
Py_ffi_closure_alloc()
Py_ffi_closure_free()
free_list Move to module-state or
thunk type-state, used by:
_ctypes_alloc_callback()
CThunkObject_dealloc()
malloc_closure.c _pagesize Reload DLL if necessary
cfield.c
_ctypes_get_fielddesc()
initialized Reload DLL if necessary
cfield.c
_ctypes_get_fielddesc()
formattable Reload DLL if necessary
callbacks.c
Call_GetClassObject()
context
(unreachable)
Do not intern (unused str?)
callbacks.c
Call_CanUnloadNow()
context
(unreachable)
Do not intern (unused str?)

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants