Skip to content

COMPAT: Adapt to Numpy 2.0 dtype changes #57780

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
Mar 8, 2024

Conversation

seberg
Copy link
Contributor

@seberg seberg commented Mar 8, 2024

Based on Thomas Li's work, but wanted to try and see that this is right.

Replaces gh-13466.

@seberg seberg requested a review from WillAyd as a code owner March 8, 2024 17:34
@@ -255,5 +257,6 @@ static struct PyModuleDef pandas_datetimemodule = {

PyMODINIT_FUNC PyInit_pandas_datetime(void) {
PyDateTime_IMPORT;
import_array();
Copy link
Member

Choose a reason for hiding this comment

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

So this needs to be called any time you import ndarrayobject.h right? If so, I wonder if it wouldn't be cleaner to move the include here to the header. That way other module that need these datetime functions can simply include / link the pd_datetime capsule and not have to include ndarrayobject.h directly. May be less confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes (if you use any API, but if you don't you only need ndarraytypes.h) but once per compilation unit only (just fixed that).
Places that use pd_datetime.h don't need it (we just need to be sure the init code ran).

Based on Thomas Li's work, but wanted to try and see that this is right.

Co-authored-by: Thomas Li <[email protected]>
@WillAyd
Copy link
Member

WillAyd commented Mar 8, 2024

@lithomas1 this needs backport right?

@lithomas1
Copy link
Member

Mhm

@WillAyd WillAyd added this to the 2.2.2 milestone Mar 8, 2024
@WillAyd WillAyd merged commit 7debc1f into pandas-dev:main Mar 8, 2024
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Mar 8, 2024
@seberg seberg deleted the numpy2-fixup-try2 branch March 8, 2024 20:49
mroeschke pushed a commit that referenced this pull request Mar 8, 2024
…changes) (#57784)

Backport PR #57780: COMPAT: Adapt to Numpy 2.0 dtype changes

Co-authored-by: Sebastian Berg <[email protected]>
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
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.

3 participants