Skip to content

Conversation

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented May 4, 2024

Apparently in C++ this requires a recent standard version (C++20) and not everyone can switch to that yet. And this header, while internal, is included (possibly indirectly, via pycore_code.h) by some key 3rd party software that does so for speed, and we don't want to require folks to upgrade their C++ standard version when upgrading to Python 3.13.

NOTE: Before merging this I want to double-check that it doesn't slow things down. I'll start a benchmark run on our internal benchmark infrastructure.

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

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

The change looks reasonable to me and should resolve the issue. I couldn't test it because so far I found the problem only with MSVC and I don't have MSVC to test locally. Compiling CPython main with this patch on Linux with g++ and testing it there worked ok for me. Regarding performance, any C/C++ compiler that fails to alias the inlined function call and its return value into a plain value here should blush and rub its face in dirt.

@scoder
Copy link
Contributor

scoder commented May 4, 2024

Thanks for the quick response, I appreciate it.

@gvanrossum
Copy link
Member Author

Benchmarks show nothing unexpected. I'll merge now.

@gvanrossum gvanrossum enabled auto-merge (squash) May 5, 2024 19:11
@gvanrossum gvanrossum merged commit 40cc809 into python:main May 5, 2024
@gvanrossum gvanrossum deleted the backoff-counter-woes branch May 5, 2024 21:01
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
…#118580)

The designated initializer syntax in static inline functions in pycore_backoff.h
causes problems for C++ or MSVC users who aren't yet using C++20.
While internal, pycore_backoff.h is included (indirectly, via pycore_code.h)
by some key 3rd party software that does so for speed.
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