Skip to content

MAINT: replace ob_type access with Py_TYPE in PyArray_CheckExact#30705

Merged
seberg merged 1 commit intonumpy:mainfrom
ngoldbaum:ob-type-fix
Jan 22, 2026
Merged

MAINT: replace ob_type access with Py_TYPE in PyArray_CheckExact#30705
seberg merged 1 commit intonumpy:mainfrom
ngoldbaum:ob-type-fix

Conversation

@ngoldbaum
Copy link
Copy Markdown
Member

@ngoldbaum ngoldbaum commented Jan 21, 2026

Directly accessing ob_type like this will not be possible in a future ABI where PyObject is opaque (#30704). Py_TYPE is in the stable ABI starting in Python 3.14 and has been available outside the stable ABI forever, so we can use that instead to avoid accessing CPython internal details.

@ngoldbaum ngoldbaum added 03 - Maintenance 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) labels Jan 21, 2026
@ngoldbaum ngoldbaum added the 09 - Backport-Candidate PRs tagged should be backported label Jan 22, 2026
@seberg
Copy link
Copy Markdown
Member

seberg commented Jan 22, 2026

I guess we still use it in a few places in C code, could update, but no need here (as this is interesting for public API).

Let's put this in, thanks Nathan.

@seberg seberg merged commit ae26ca5 into numpy:main Jan 22, 2026
76 checks passed
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

03 - Maintenance 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants