Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Closed
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Tested on official docker image python3.13.0b4-bullseye. pycore_interp.h causes compiler error when included from C++ file. No problem when included from C file.
mypackage/_good.c:
#include"Python.h"#definePy_BUILD_CORE 1 #include"internal/pycore_interp.h"mypackage/_bad.cpp (same content as above):
#include"Python.h" #definePy_BUILD_CORE1 #include"internal/pycore_interp.h"setup.py:
fromsetuptoolsimportExtension, find_packages, setupdefget_ext_modules(): ext_good=Extension(name="mypackage.a", sources=['mypackage/_good.c']) ext_bad=Extension(name="mypackage.b", sources=['mypackage/_bad.cpp']) return [ext_good, ext_bad] metadata=dict( name='debugthis', packages=find_packages(include=["mypackage"]) ) metadata['ext_modules'] =get_ext_modules() setup(**metadata)Running python setup.py build produces error:
running build running build_py copying mypackage/__init__.py -> build/lib.linux-x86_64-cpython-313/mypackage running build_ext building 'mypackage.a' extension creating build/temp.linux-x86_64-cpython-313 creating build/temp.linux-x86_64-cpython-313/mypackage gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.13 -c mypackage/_good.c -o build/temp.linux-x86_64-cpython-313/mypackage/_good.o gcc -pthread -shared build/temp.linux-x86_64-cpython-313/mypackage/_good.o -L/usr/local/lib -o build/lib.linux-x86_64-cpython-313/mypackage/a.cpython-313-x86_64-linux-gnu.so building 'mypackage.b' extension gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.13 -c mypackage/_bad.cpp -o build/temp.linux-x86_64-cpython-313/mypackage/_bad.o In file included from /usr/local/include/python3.13/internal/mimalloc/mimalloc.h:429, from /usr/local/include/python3.13/internal/pycore_mimalloc.h:39, from /usr/local/include/python3.13/internal/pycore_interp.h:31, from mypackage/_bad.cpp:4: /usr/include/c++/10/type_traits:56:3: error: template with C linkage 56 | template<typename _Tp, _Tp __v> | ^~~~~~~~ In file included from mypackage/_bad.cpp:4: /usr/local/include/python3.13/internal/pycore_interp.h:4:1: note: ‘extern "C"’ linkage started here 4 | extern "C"{| ^~~~~~~~~~ ... CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
cdce8p
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error