Skip to content

Add getter for NumPy ufunc types to patching#226

Open
ndgrigorian wants to merge 1 commit into
mainfrom
fix-for-numpy-2.5
Open

Add getter for NumPy ufunc types to patching#226
ndgrigorian wants to merge 1 commit into
mainfrom
fix-for-numpy-2.5

Conversation

@ndgrigorian

Copy link
Copy Markdown
Collaborator

NumPy 2.5 has changed how types property is exposed with ufunc.types. This caused mkl_umath to crash during patching on pre-release NumPy.

This PR adds a getter, _get_ufunc_types, defined in _patch_numpy.pyx as cdef extern. This getter works with NumPy 2.5 and previous versions by accessing the ufunc struct directly.

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

NumPy 2.5+ changed how types property is exposed in NumPy, causing indexing on the types to break

also fixes a bug where patching would attempt to free null pointers when patching process fails midway
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.

1 participant