bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c#14814
bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c#14814methane merged 1 commit intopython:masterfrom
Conversation
Commit b1263d5 causes GCC 9.1.0 to give a warning in Objects/descrobject.c.
|
Hi, @methane. Can you please merge this PR? |
|
The cast seems too complex to just avoid the warning. But I'm not sure there is a better way. If you want to this merged, please provide all casts you tried and demonstrate this is the simplest way to fix the warning. |
|
This is the standard way to avoid those warnings, there are many places in CPython with casts like that. It's also documented to do this: https://docs.python.org/3.8/extending/extending.html#keyword-parameters-for-extension-functions |
|
See bpo-33012 for the discussion about those casts. As far as I know, this is indeed the simplest way to cast between incompatible function pointers which does not generate warnings with GCC 9 and which does not rely on undefined behaviour and which is compatible with C++. |
|
OK, thank you. |
|
Thanks @ZackerySpytz for the PR, and @methane for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
Sorry, @ZackerySpytz and @methane, I could not cleanly backport this to |
Commit b1263d5 causes GCC 9.1.0 to give a warning in Objects/descrobject.c.
Commit b1263d5 causes GCC 9.1.0 to give a warning in Objects/descrobject.c.
Commit b1263d5 causes GCC 9.1.0 to give a warning in Objects/descrobject.c.
Commit b1263d5 causes GCC 9.1.0 to
give a warning in Objects/descrobject.c.
https://bugs.python.org/issue37337