gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)

Accept spaces in "#  define Py_LIMITED_API 0x030d0000".
This commit is contained in:
Victor Stinner 2024-03-11 23:42:18 +01:00 • committed by GitHub
parent 06e29a224f
commit 2b67fc57f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 35 additions and 45 deletions

View file

@ -1,7 +1,6 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -2,10 +2,9 @@
posixshmem - A Python extension that provides shm_open() and shm_unlink() posixshmem - A Python extension that provides shm_open() and shm_unlink()
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -3,10 +3,9 @@
* using the SystemConfiguration framework. * using the SystemConfiguration framework.
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -11,10 +11,9 @@
* *
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.13 for PyModule_Add() on Windows // Need limited C API version 3.13 for PyModule_Add() on Windows
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030d0000 # define Py_LIMITED_API 0x030d0000
#endif #endif

View file

@ -4,10 +4,9 @@
#undef Py_BUILD_CORE_MODULE #undef Py_BUILD_CORE_MODULE
#undef Py_BUILD_CORE_BUILTIN #undef Py_BUILD_CORE_BUILTIN
// For now, AC only supports the limited C API version 3.13
#include "pyconfig.h" // Py_GIL_DISABLED #include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED #ifndef Py_GIL_DISABLED
// For now, only limited C API 3.13 is supported
# define Py_LIMITED_API 0x030d0000 # define Py_LIMITED_API 0x030d0000
#endif #endif

View file

@ -5,7 +5,6 @@
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED #include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED #ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x03020000 # define Py_LIMITED_API 0x03020000
#endif #endif

View file

@ -3,10 +3,9 @@
* DCE compatible Universally Unique Identifier library. * DCE compatible Universally Unique Identifier library.
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -1,9 +1,8 @@
/* Errno module */ /* Errno module */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -1,7 +1,6 @@
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.13 for PySys_Audit() // Need limited C API version 3.13 for PySys_Audit()
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030d0000 # define Py_LIMITED_API 0x030d0000
#endif #endif

View file

@ -62,10 +62,9 @@
pass pass
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -5,8 +5,8 @@
* See the xxlimited module for an extension module template. * See the xxlimited module for an extension module template.
*/ */
// Test the limited C API version 3.5
#include "pyconfig.h" // Py_GIL_DISABLED #include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED #ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x03050000 # define Py_LIMITED_API 0x03050000
#endif #endif

View file

@ -35,10 +35,9 @@
winsound.PlaySound(None, 0) winsound.PlaySound(None, 0)
*/ */
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
// Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED // Need limited C API version 3.12 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#include "pyconfig.h" // Py_GIL_DISABLED
#ifndef Py_GIL_DISABLED
# define Py_LIMITED_API 0x030c0000 # define Py_LIMITED_API 0x030c0000
#endif #endif

View file

@ -66,8 +66,9 @@ from libclinic import ClinicError
# #
# match '#define Py_LIMITED_API' # Match '#define Py_LIMITED_API'.
LIMITED_CAPI_REGEX = re.compile(r'#define +Py_LIMITED_API') # Match '# define Py_LIMITED_API 0x030d0000' (without the version).
LIMITED_CAPI_REGEX = re.compile(r'# *define +Py_LIMITED_API')
class Sentinels(enum.Enum): class Sentinels(enum.Enum):