bpo-43816: add 'extern "C"' to pyctype.h#25365
Conversation
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com>
|
Any idea why |
Sorry, something went wrong.
|
Thanks @andrewvaughanj for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Sorry, something went wrong.
|
Thanks @andrewvaughanj for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
|
Sorry @andrewvaughanj and @vstinner, I had trouble checking out the |
Sorry, something went wrong.
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com> (cherry picked from commit 54db51c) Co-authored-by: Andrew V. Jones <andrewvaughanj@gmail.com>
|
Thanks @andrewvaughanj for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
Signed-off-by: Andrew V. Jones <andrew.jones@vector.com> (cherry picked from commit 54db51c) Co-authored-by: Andrew V. Jones <andrewvaughanj@gmail.com>
Issue
With Python 3.9.4, and when compiling with Visual Studio 2019, we have noticed that the variable
_Py_ctype_tableis not scoped with in anextern "C"block, and where the Python library (python39.lib) has been compiled with a C compiler.This causes an issue when trying to refer to
_Py_ctype_tablefrom a C++ file, as the compiler tries to name-mangle the use of_Py_ctype_table, but the linker cannot then tie the mangled name to non-mangled named frompython39.lib.Example:
Compilation:
With
cl.exe:A naïve check of Python.h (e126547) seems to suggest that:
extern "C"extern "C"For the 8 that do not contain
extern "C", none of these usePyAPI_DATA. This leads me to believe that it is an oversight thatpyctype.hdoes not haveextern "C"Resolution
This PR resolves this issue by adding an
extern "C"declaration to the top ofpyctype.h(if compiling as C++).Signed-off-by: Andrew V. Jones andrew.jones@vector.com
https://bugs.python.org/issue43816