Skip to content

Conversation

@kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Jan 24, 2026

@kumaraditya303 kumaraditya303 marked this pull request as ready for review February 2, 2026 16:27
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) February 9, 2026 12:55
@kumaraditya303 kumaraditya303 merged commit dd30f16 into python:main Feb 9, 2026
47 checks passed

#define PyDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
static inline PyDateTime_CAPI *

Choose a reason for hiding this comment

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

Sup non invert,'s ok!

PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
static inline PyDateTime_CAPI *
_PyDateTime_IMPORT(void) {
PyDateTime_CAPI *val = _Py_atomic_load_ptr(&PyDateTimeAPI);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm now seeing this error in external code that includes datetime.h:

…/cpython_install/include/python3.15/datetime.h:201:22: error: cannot initialize a variable of type 'PyDateTime_CAPI *' with an rvalue of type 'void *'
  201 |     PyDateTime_CAPI *val = _Py_atomic_load_ptr(&PyDateTimeAPI);
      |                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Probably just missing a cast.

Copy link
Member

Choose a reason for hiding this comment

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

Do you get the error with C or C++?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, there is a compiler error in C++. I wrote #144667 to add the missing cast, but also to add checks for compiler warnings (to test_cext and test_cppext).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants