Skip to content

GH-31597: [Python] Fix nogil declarations in libarrow_python.pxd - #55964

Open
dorodo0721 wants to merge 1 commit into
apache:mainfrom
dorodo0721:fix/gh-31597-gil-declarations
Open

dorodo0721 wants to merge 1 commit into
apache:mainfrom
dorodo0721:fix/gh-31597-gil-declarations

Conversation

@dorodo0721

Copy link
Copy Markdown

Rationale for this change

Some libarrow_python functions that interact with Python objects or Python C APIs are declared nogil, even though they require the GIL.

What changes are included in this PR?

Move those declarations out of nogil blocks and update their call sites. Keep the pandas conversion functions declared nogil because their implementations may run work on helper threads that acquire the GIL.

Are these changes tested?

  • Built the PyArrow wheel successfully after rebasing.
  • Ran smoke tests for NumPy array conversion, datetime scalar conversion, and tensor conversion.
  • Focused tests passed after rebasing: 144 passed, 20 skipped.

Are there any user-facing changes?

No.

Was AI used for this PR?

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Move Python-object-dependent Cython declarations out of nogil blocks and update their call sites. Preserve nogil for pandas conversion functions that may execute work on helper threads.
@dorodo0721 dorodo0721 changed the title [GH-31597][Python] Fix nogil declarations in libarrow_python.pxd GH-31597: [Python] Fix nogil declarations in libarrow_python.pxd Dec 5, 2026
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.

[Python] Fix nogil declarations on libarrow_python.pxd

1 participant