You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate eliminating _CXX_API capsule for resource handle functions #1452
PR #1368 uses a PyCapsule mechanism (_CXX_API) to share resource handle functions across Cython modules. This issue is to investigate whether this capsule can be eliminated entirely.
Current Architecture
The _CXX_API capsule exports function pointers from _resource_handles.so to other Cython modules (_buffer.pyx, _stream.pyx, _event.pyx, etc.). The stated rationale is to avoid duplicate static/thread-local state if multiple modules linked the C++ code directly.
Proposed Investigation
Investigate whether Cython modules can call directly into the resource handles code without the capsule indirection:
If resource handle functions are regular cdef functions (non-inline) in _resource_handles.pyx, can other modules cimport and call them directly?
Would this approach correctly share static state through _resource_handles.so?
Are there performance implications for nogil code paths?
Background
When module A cimports a cdef function from module B, the call goes through B.so at runtime via Python's import mechanism. This should mean static state in B stays in one place, potentially making the capsule unnecessary for pure Cython-to-Cython usage.
Activity
Eliminate _CXX_API capsule for resource handle functions
Eliminate _CXX_API capsule for resource handle functions (#1464)