Skip to content

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-SpinnerFidget-Spinner commented Jun 25, 2025

The problem is that we are checking for the latest C assuming only GCC and Clang supports it, but in reality MSVC supports it (on some configurations) too.

The fix is to account for MSVC.

@Fidget-Spinner
Copy link
MemberAuthor

Verified locally that building with clang-cl also works.

@zooba
Copy link
Member

Change looks fine to me, though I haven't dug into why the availability differs. If this works, then I guess it's fine.

@Fidget-SpinnerFidget-Spinner merged commit a88b49c into python:mainJun 25, 2025
40 checks passed
@Fidget-SpinnerFidget-Spinner deleted the fix-latest-c branch June 25, 2025 15:02
@Fidget-Spinner
Copy link
MemberAuthor

Thanks Steve!

@chris-eibl
Copy link
Member

I am on Mobile, but LGTM

// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
// _Py_NULL is defined as nullptr.
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
#if (defined(__GNUC__) || defined(__clang__)) && \
Copy link
Member

Choose a reason for hiding this comment

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

Since there are other C compilers in the wild, it would be better to check for !defined(_MSC_VER) instead of being specific about GCC and clang.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Hmm you're right. Do you want to open a PR for this?

Copy link
Member

Choose a reason for hiding this comment

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

I created #135987 : can you test it with MSC with /std:clatest?

AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Sign up for freeto 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.

4 participants

@Fidget-Spinner@zooba@chris-eibl@vstinner