gh-110481: Implement biased reference counting (gh-110764)

This commit is contained in:
Sam Gross 2023-10-30 12:06:09 -04:00 committed by GitHub
parent 05f2f0ac92
commit 6dfb8fe023
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 511 additions and 52 deletions

View file

@ -1,5 +1,11 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
// gh-85283: On Windows, Py_LIMITED_API requires Py_BUILD_CORE to not attempt
// linking the extension to python3.lib (which fails). Py_BUILD_CORE_MODULE is

View file

@ -2,8 +2,12 @@
posixshmem - A Python extension that provides shm_open() and shm_unlink()
*/
#include "pyconfig.h" // Py_NOGIL
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include <Python.h>

View file

@ -3,8 +3,14 @@
* using the SystemConfiguration framework.
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include <Python.h>
#include <SystemConfiguration/SystemConfiguration.h>

View file

@ -11,8 +11,14 @@
*
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
// Need limited C API version 3.13 for PyModule_Add() on Windows
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"

View file

@ -1,4 +1,11 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030c0000 // 3.12
#endif
#include "parts.h"
#include <stddef.h> // max_align_t
#include <string.h> // memset

View file

@ -1,6 +1,13 @@
/* Test Vectorcall in the limited API */
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030c0000 // 3.12
#endif
#include "parts.h"
#include "clinic/vectorcall_limited.c.h"

View file

@ -4,8 +4,14 @@
#undef Py_BUILD_CORE_MODULE
#undef Py_BUILD_CORE_BUILTIN
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
// For now, only limited C API 3.13 is supported
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x030d0000
#endif
/* Always enable assertions */
#undef NDEBUG

View file

@ -4,7 +4,13 @@
* foo, bar), only the first one is called the same as the compiled file.
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x03020000
#endif
#include <Python.h>

View file

@ -3,8 +3,14 @@
* DCE compatible Universally Unique Identifier library.
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
#if defined(HAVE_UUID_H)

View file

@ -1,7 +1,13 @@
/* Errno module */
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
#include <errno.h> // EPIPE

View file

@ -16,8 +16,14 @@
/* MD5 objects */
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
#include "hashlib.h"

View file

@ -1,5 +1,11 @@
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
#include <errno.h> // errno

View file

@ -62,8 +62,14 @@
pass
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
// Need limited C API version 3.13 for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
#define Py_LIMITED_API 0x030d0000
#endif
#include "Python.h"
#include <string.h>

View file

@ -5,7 +5,13 @@
* See the xxlimited module for an extension module template.
*/
#ifndef _MSC_VER
#include "pyconfig.h" // Py_NOGIL
#endif
#ifndef Py_NOGIL
#define Py_LIMITED_API 0x03050000
#endif
#include "Python.h"