Skip to content

MAINT: Convert pocketfft_umath to multi-phase init (PEP 489) #29028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025

Conversation

AA-Turner
Copy link
Contributor

@AA-Turner AA-Turner commented May 21, 2025

@AA-Turner AA-Turner force-pushed the multi-phase/fft branch 2 times, most recently from 074fb12 to 14b4169 Compare May 22, 2025 03:14
@AA-Turner AA-Turner marked this pull request as draft May 24, 2025 06:22
@AA-Turner AA-Turner marked this pull request as ready for review May 28, 2025 13:58
@AA-Turner
Copy link
Contributor Author

cc @seberg. We prevent multiple inits because the static function and type arrays are used in the PyUFuncObject structure.

A

Copy link
Member

@seberg seberg left a comment

Choose a reason for hiding this comment

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

Looks fine with the decref fixed.

FWIW, while I think it's likely a bad idea to create these ufuncs multiple times, I don't actually think it's a problem and this module is actually safe to delete and reload.

(Not saying it will actually get all cleaned up, I would be surprised, but for the most part.)

@AA-Turner
Copy link
Contributor Author

Looks fine with the decref fixed.

Sorry for that, remnants of experimentation.

@AA-Turner
Copy link
Contributor Author

FWIW, while I think it's likely a bad idea to create these ufuncs multiple times, I don't actually think it's a problem and this module is actually safe to delete and reload.

Fair enough, I admit I haven't tried. I think keeping this PR as-is and looking to relax the restriction in a followup may be prudent, though?

@seberg seberg changed the title GH-29021: Convert pocketfft_umath to multi-phase init (PEP 489) MAINT: Convert pocketfft_umath to multi-phase init (PEP 489) May 29, 2025
NULL, /* m_doc */
0, /* m_size */
NULL, /* m_methods */
_pocketfft_umath_slots, /* m_slots */
Copy link
Member

Choose a reason for hiding this comment

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

Now that I scroll through, I would have liked to use .m_base = , etc. but a cleanup for another day.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Designated initialisers are only supported for C++20 -- hence the legacy style.

A

@seberg seberg merged commit 5ab56f6 into numpy:main May 29, 2025
74 checks passed
@AA-Turner AA-Turner deleted the multi-phase/fft branch May 29, 2025 08:41
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