summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-21 17:15:52 (GMT)
committerGitHub <noreply@github.com>2023-08-21 17:15:52 (GMT)
commit21c0844742cf15db8e56e8848ecbb2e25f314aed (patch)
tree67737687dce08f38f3f4048c2142ec35a253fe3c /Modules
parentdb55383829ccd5ce80c551d60f26851346741fdf (diff)
downloadcpython-21c0844742cf15db8e56e8848ecbb2e25f314aed.zip
cpython-21c0844742cf15db8e56e8848ecbb2e25f314aed.tar.gz
cpython-21c0844742cf15db8e56e8848ecbb2e25f314aed.tar.bz2
gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221)
* pycore_intrinsics.h does nothing if included twice (add #ifndef and #define). * Update Tools/cases_generator/generate_cases.py to generate the Py_BUILD_CORE test. * _bz2, _lzma, _opcode and zlib extensions now define the Py_BUILD_CORE_MODULE macro to use internal headers (pycore_code.h, pycore_intrinsics.h and pycore_blocks_output_buffer.h).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bz2module.c4
-rw-r--r--Modules/_lzmamodule.c4
-rw-r--r--Modules/_opcode.c4
-rw-r--r--Modules/zlibmodule.c4
4 files changed, 16 insertions, 0 deletions
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index 0a84f25..3d0d4ee 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -1,5 +1,9 @@
/* _bz2 - Low-level Python interface to libbzip2. */
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
#include <bzlib.h>
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index c548f8f..eb90c30 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -5,6 +5,10 @@
*/
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index 4f85e7e..3e13dbb 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -1,3 +1,7 @@
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
#include "compile.h"
#include "opcode.h"
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index a98a37a..9b76afa 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -3,6 +3,10 @@
/* Windows users: read Python's PCbuild\readme.txt */
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include "Python.h"
#include "zlib.h"