-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
New tier 2 counters break some C extensions due to order of field mismatch #117549
Comments
Oh, I think I see what it is. I swapped the order in which the fields |
Yeah, I'm planning on making a PR. I think that's all it is ... though I think it's not a compiler flag so much as they are compiling C++ which is maybe strict about these things. |
…#117551) Otherwise it might not compile with C++ (or certain C compilers/flags?).
…alizer (python#117551) Otherwise it might not compile with C++ (or certain C compilers/flags?).
Apparently, designated initializers are a C++20 feature, i.e. they require a really recent C++ compiler with appropriate configuration. I see this in MSVC with Py3.13a6, so I don't think it's fixed:
|
The reason why this appears on user side is probably that Cython needs to include The discussion that lead to this change is here: |
So if I changed pycore_backoff.h to use something like this, the problem will be solved? diff --git a/Include/internal/pycore_backoff.h b/Include/internal/pycore_backoff.h
index decf92bc419..50e88487a52 100644
--- a/Include/internal/pycore_backoff.h
+++ b/Include/internal/pycore_backoff.h
@@ -44,7 +44,10 @@ make_backoff_counter(uint16_t value, uint16_t backoff)
{
assert(backoff <= 15);
assert(value <= 0xFFF);
- return (_Py_BackoffCounter){.backoff = backoff, .value = value};
+ _Py_BackoffCounter counter;
+ counter.value = value;
+ counter.backoff = backoff;
+ return counter;
}
static inline _Py_BackoffCounter I know there's another place this is used in that header, I'll fix that too. I'll whip up a PR. |
Probably, yes. Looks good to me. I'm not sure how to reproduce the issue locally, though, because GCC seems to be fairly relaxed about non-standard features whereas MSVC has the tendency to simply not support them, and I don't have MSVC on my side. |
Okay, I've asked you to review gh-118580 anyways, since we're so close to the beta1 release date. Hopefully it'll go in over the weekend and somebody else reading this can test with a nightly build or something. Otherwise we can of course revise this after beta1. |
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.
The fix has been merged, let's keep this issue open for a bit to wait for confirmation that this fixes things. |
Closing now. If you find a problem with this in beta 1, leave a comment here and I'll reopen. |
…#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.
Bug report
Bug description:
@tacaswell reported here:
#177144 appears to have broken building scipy
conformed scipy builds with 63bbe77
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: