-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PEP 007: Add C99 Flexible Array Member to the required feature list. #1349
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
Conversation
https://en.wikipedia.org/wiki/Flexible_array_member Required to fix undefined C behavior. https://bugs.python.org/issue40120
So far testing on the PR including the buildbot tests have revealed no compilers that have a problem with this 21 year old syntax. If there were any stick in the mud i'd have expected it to be msvc, but even that seems happy. Allowing this avoids undefined behavior. I'm assuming we shouldn't retroactively declare this for existing releases so I'm just stating 3.9 and beyond. Anyone who needs this fixed to build older versions can locally patch or find a compiler flag to avoid undefined behavior issues with the existing code. |
opened a discussion on https://discuss.python.org/t/pep-7-update-to-allow-c99-flexible-array-member-syntax/3796 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. I assume the refleak failures are unrelated?
There is a known leak: https://bugs.python.org/issue40115 |
I'm fine with the change, but I would prefer to first merge the PR and wait a few days to ensure that it doesn't break anything. |
Given this feature is not compatible with C++ if we adopt it, it'd need to be on internal-only structs and never anything in a public .h file. :/ |
C++11 has |
That's a good motivation to make more and more structures opaque :-)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, if we put that in a public header file, it would break compilation on C++ (ex: pybind11) :-(
Maybe we should just avoid to use this feature in public header files, only in the C files?
I suggest to close this PR for now. It can be reopened once https://bugs.python.org/issue40120 will be resolved. https://bugs.python.org/issue40120 is a complex issue. There is a big concern about C++ compatibility :-( |
Thanks Victor A |
Seems like closing this has resulted in bpo-40120 going active again 😄 |
Closing things does wonders for getting people to care :) |
PEP 007: Add C99 Flexible Array Member to the required feature list.
https://en.wikipedia.org/wiki/Flexible_array_member
Required to fix undefined C behavior.
https://bugs.python.org/issue40120
See also python/cpython#19232 which will use this.