Skip to content

Commit

Permalink
pythongh-116417: Build _testinternalcapi with limited C API version 3…
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored and adorilson committed Mar 25, 2024
1 parent a0ec499 commit 7a6d35c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Modules/_testlimitedcapi/heaptype_relative.c
@@ -1,3 +1,9 @@
// Need limited C API version 3.12 for PyType_FromMetaclass()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
# define Py_LIMITED_API 0x030c0000
#endif

#include "parts.h"
#include <stddef.h> // max_align_t
#include <string.h> // memset
Expand Down
5 changes: 3 additions & 2 deletions Modules/_testlimitedcapi/parts.h
Expand Up @@ -7,8 +7,9 @@
#include "pyconfig.h" // Py_GIL_DISABLED

// Use the limited C API
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 // 3.12
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
// need limited C API version 3.5 for PyModule_AddFunctions()
# define Py_LIMITED_API 0x03050000
#endif

// Make sure that the internal C API cannot be used.
Expand Down
6 changes: 6 additions & 0 deletions Modules/_testlimitedcapi/vectorcall_limited.c
@@ -1,5 +1,11 @@
/* Test Vectorcall in the limited API */

// Need limited C API version 3.12 for PyObject_Vectorcall()
#include "pyconfig.h" // Py_GIL_DISABLED
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
# define Py_LIMITED_API 0x030c0000
#endif

#include "parts.h"
#include "clinic/vectorcall_limited.c.h"

Expand Down

0 comments on commit 7a6d35c

Please sign in to comment.