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 diegorusso committed Apr 17, 2024
1 parent 5df00b4 commit cf33c8f
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 cf33c8f

Please sign in to comment.