Skip to content

Backport gh-226 to maintenance/0.4.x: add getter for NumPy ufunc types#233

Merged
antonwolfy merged 1 commit into
maintenance/0.4.xfrom
backport-gh-226
Jun 30, 2026
Merged

Backport gh-226 to maintenance/0.4.x: add getter for NumPy ufunc types#233
antonwolfy merged 1 commit into
maintenance/0.4.xfrom
backport-gh-226

Conversation

@antonwolfy

Copy link
Copy Markdown
Collaborator

Backports #226 to the maintenance/0.4.x branch.

NumPy 2.5 changed how the types property is exposed with ufunc.types, which caused mkl_umath to crash during patching on pre-release NumPy. This adds a _get_ufunc_types getter (defined in _patch_numpy.pyx as cdef extern) that works with NumPy 2.5 and previous versions by accessing the ufunc struct directly.

Additionally slips in changes which prevent attempting to free a nullptr when the patch fails (i.e., due to RuntimeError).

The _patch_numpy.pyx change applies identically to the original PR (the file matched the PR base on this branch). The CHANGELOG entry is placed under a new [dev] section since this branch had no unreleased section.

🤖 Generated with Claude Code

NumPy 2.5+ changed how the types property is exposed in NumPy, causing
indexing on the types to break. Adds a _get_ufunc_types getter defined
as cdef extern that accesses the ufunc struct directly, working with
NumPy 2.5 and previous versions.

Also fixes a bug where patching would attempt to free null pointers when
the patching process fails midway.

Backport of gh-226 to maintenance/0.4.x.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@jharlow-intel jharlow-intel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Build failures are machine

@antonwolfy antonwolfy merged commit a5baae0 into maintenance/0.4.x Jun 30, 2026
108 of 110 checks passed
@antonwolfy antonwolfy deleted the backport-gh-226 branch June 30, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants