Skip to content

Commit 2ba6f68

Browse files
authored
gh-85283: Fix _ctypes_test build on Windows in release mode (#111005)
Define Py_BUILD_CORE to not attempt to link the extension to python3.lib (which fails).
1 parent 0f9d0fb commit 2ba6f68

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Modules/_ctypes/_ctypes_test.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
22
#define Py_LIMITED_API 0x030d0000
33

4+
// gh-85283: On Windows, Py_LIMITED_API requires Py_BUILD_CORE to not attempt
5+
// linking the extension to python3.lib (which fails). Py_BUILD_CORE_MODULE is
6+
// needed to import Python symbols. Then Python.h undefines Py_BUILD_CORE and
7+
// Py_BUILD_CORE_MODULE if Py_LIMITED_API is defined.
8+
#define Py_BUILD_CORE
9+
#define Py_BUILD_CORE_MODULE
10+
411
#include <Python.h>
512

613
#include <stdio.h> // printf()

0 commit comments

Comments
 (0)