diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2022-10-16 22:26:09 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2022-10-16 22:27:46 +0300 |
commit | 2194f503e17619bcd36b4289902d13457aac638e (patch) | |
tree | cafb71f7044ec9752543d5696295a7584927d249 /meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez | |
parent | bdfb8a9cebc292bab790500a6439e4d83ec57bdf (diff) | |
download | openbmc-2194f503e17619bcd36b4289902d13457aac638e.tar.xz |
subtree updates
meta-arm: 0164b4ca7a..13199c55c0:
Adam Johnston (1):
arm-bsp/linux-yocto: Upgrade kernel to v5.19 for N1SDP
Anton Antonov (4):
meta-arm/trusted-services: Use GCC toolchain for specific TS recipes only.
arm/trusted-services: Remove patches merged upstream
arm/trusted-services: Remove remaining patches merged upstream
arm/trusted-services: include documentation
Davidson K (1):
arm-bsp/linux-arm64-ack: make it compatible with gcc-12 for TC
Emekcan (2):
arm-bsp/linux-yocto: update RPMSG_CTRL config for corstone1000
arm-bsp/kernel: Fix TEE driver bug for corstone1000
Jon Mason (3):
CI: trusted services as a feature instead of a machine
CI: cleanups for targets and removed tests
arm-bsp: zephyr removal
Peter Hoyes (1):
arm/lib: Do not log FVP return codes < 0
Ross Burton (2):
arm/optee-spdevkit: remove
CI: restrict compression threading
Rui Miguel Silva (1):
arm-bsp/corstone1000: bump kernel version to 5.19
Rupinderjit Singh (1):
arm: update Android common kernel
Satish Kumar (4):
arm-bsp/u-boot: corstone1000: esrt support
arm-bsp/trusted-firmware-m: corstone1000: bump tfm SHA
arm-bsp/trusted-firmware-m: corstone1000: fix sournce dir of libmetal and openamp
arm-bsp/trusted-firmware-m: corstone1000: secure debug code checkout from yocto
Sumit Garg (2):
arm-toolchain: update Arm GCC to 11.3
external-arm-toolchain: Enable 11.3.rel1 support
Vishnu Banavath (1):
arm-bsp/corstone500: upgrade kernel to v5.19
meta-raspberrypi: 45d56d82b7..fc5f80a47e:
Devendra Tewari (3):
rpi-cmdline: Leave cma value to kernel default
libcamera: Tweak to build for Raspberry Pi
rpi-libcamera-apps: add new recipe
Martin Jansa (1):
lirc: rename bbappend to match 0.10.%
Zygmunt Krynicki (2):
ci: fix typo: unconditionally
ci: fix apparent typo in file patterns
meta-openembedded: ce0b93fc12..6529e5f963:
Alexander Kanavin (3):
python3-cchardet: depend on cython
python3-gevent: make compatible with python 3.11
python3-pybluez: add python 3.11 patch
Anuj Mittal (1):
opencv: fix reproducibility issues
Devendra Tewari (2):
libcamera: Bump SRCREV and add libyaml to DEPENDS
libcamera: Remove boost from DEPENDS
Fabio Estevam (1):
spice: Include aarch64 to COMPATIBLE_HOST
Federico Pellegrin (2):
chrony: add pkgconfig class as pkg-config is explicitly searched for
chrony: correct parameter to configure to disable readline usage
Hao Jiang (1):
mctp: install the .target files
Jiaqing Zhao (1):
openldap: Upgrade 2.5.12 -> 2.5.13
Khem Raj (2):
open62541: Disable lto on riscv/clang
python3-gevent: Upgrade to 22.8.0
Leon Anavi (10):
python3-networkx: Upgrade 2.8.6 -> 2.8.7
python3-coverage: Upgrade 6.4.4 -> 6.5.0
python3-rdflib: Upgrade 6.1.1 -> 6.2.0
python3-tabulate: Upgrade 0.8.10 -> 0.9.0
python3-imageio: Upgrade 2.22.0 -> 2.22.1
python3-astroid: Upgrade 2.12.10 -> 2.12.11
python3-jsonref: Upgrade 0.2 -> 0.3.0
python3-sentry-sdk: Upgrade 1.5.12 -> 1.9.10
python3-greenlet: Upgrade 1.1.3 -> 1.1.3.post0
python3-xmltodict: Upgrade 0.12.0 -> 0.13.0
Markus Volk (2):
blueman: upgrade 2.2.4 -> 2.3.2
gtkmm3: upgrade 3.24.5 -> 3.24.7
Martin Jansa (2):
re2: fix branch name from master to main
jack: fix compatibility with python-3.11
Mathieu Dubois-Briand (3):
mbedtls: Fix CVE product name
mbedtls: Update to 2.28.1 version
mbedtls: Whitelist CVE-2021-43666, CVE-2021-45451
Matthias Klein (1):
paho-mqtt-c: upgrade 1.3.10 -> 1.3.11
Michael Opdenacker (1):
tio: correct license information
Mingli Yu (1):
mariadb: not use qemu to run cross-compiled binaries
S. Lockwood-Childs (1):
x265: support aarch64
Thomas Perrot (1):
spitools: remove unused BPV variable
Vyacheslav Yurkov (1):
opcua: Add new recipe
Wang Mingyu (20):
ctags: upgrade 5.9.20220925.0 -> 5.9.20221002.0
dnfdragora: upgrade 2.1.2 -> 2.1.3
dool: upgrade 1.0.0 -> 1.1.0
freeglut: upgrade 3.2.1 -> 3.4.0
gspell: upgrade 1.11.1 -> 1.12.0
hwdata: upgrade 0.362 -> 0.363
iperf3: upgrade 3.11 -> 3.12
libnet-dns-perl: upgrade 1.34 -> 1.35
lirc: upgrade 0.10.1 -> 0.10.2
metacity: upgrade 3.44.0 -> 3.46.0
flatbuffers: upgrade 2.0.8 -> 22.9.29
opencl-headers: upgrade 2022.09.23 -> 2022.09.30
php: upgrade 8.1.10 -> 8.1.11
poppler: upgrade 22.09.0 -> 22.10.0
xfstests: upgrade 2022.09.04 -> 2022.09.25
links: upgrade 2.27 -> 2.28
st: upgrade 0.8.5 -> 0.9
python3-requests-toolbelt: upgrade 0.9.1 -> 0.10.0
Add nativesdk-systemd-systemctl as dependency of dnf-plugin-tui
dnf-plugin-tui: Add nativesdk
Yi Zhao (4):
strongswan: upgrade 5.9.7 -> 5.9.8
open-vm-tools: upgrade 11.3.5 -> 12.1.0
dhcp-relay: upgrade 4.4.3 -> 4.4.3-P1
frr: Security fix CVE-2022-37032
zhengrq.fnst (5):
python3-protobuf: upgrade 4.21.6 -> 4.21.7
stunnel: upgrade 5.65 -> 5.66
python3-web3: upgrade 5.31.0 -> 5.31.1
wolfssl: upgrade 5.5.0 -> 5.5.1
python3-xmlschema: upgrade 2.1.0 -> 2.1.1
meta-security: 824d2762f6..e8e7318189:
Armin Kuster (3):
apparmor: update to 3.0.7
libgssglue: update to 0.7
cryptmount: update to 6.0
Michael Haener (1):
tpm: update the linux-yocto rule with the one from sanity-meta-tpm class
poky: 5200799866..3e5faccfaf:
Johan Korsnes (1):
migration guides: 3.4: remove spurious space in example
Lee Chee Yang (1):
migration guides: add release notes for 4.0.4
Michael Opdenacker (35):
manuals: improve initramfs details
manuals: add references to the "do_fetch" task
manuals: add reference to the "do_install" task
manuals: add references to the "do_build" task
manuals: add reference to "do_configure" task
manuals: add reference to the "do_compile" task
manuals: add references to the "do_deploy" task
manuals: add references to the "do_image" task
manuals: add references to the "do_package" task
manuals: add references to the "do_package_qa" task
overview-manual: concepts.rst: add reference to "do_packagedata" task
manuals: add references to the "do_patch" task
manuals: add references to "do_package_write_*" tasks
ref-manual: variables.rst: add reference to "do_populate_lic" task
manuals: add reference to the "do_populate_sdk" task
overview-manual: concepts.rst: add reference to "do_populate_sdk_ext" task
manuals: add references to "do_populate_sysroot" task
manuals: add references to the "do_unpack" task
dev-manual: common-tasks.rst: add reference to "do_clean" task
manuals: add references to the "do_cleanall" task
ref-manual: tasks.rst: add references to the "do_cleansstate" task
manuals: add references to the "do_devshell" task
dev-manual: common-tasks.rst: add reference to "do_listtasks" task
manuals: add references to the "do_bundle_initramfs" task
manuals: add references to the "do_rootfs" task
ref-manual: tasks.rst: add reference to the "do_kernel_checkout" task
manuals: add reference to the "do_kernel_configcheck" task
manuals: add references to the "do_kernel_configme" task
ref-manual: tasks.rst: add reference to the "do_kernel_metadata" task
migration-guides: add reference to the "do_shared_workdir" task
ref-manual: tasks.rst: add reference to the "do_validate_branches" task
ref-manual: tasks.rst: add reference to the "do_image_complete" task
ref-manual: system-requirements: Ubuntu 22.04 now supported
overview-manual: concepts.rst: fix formating and add references
ref-manual/faq.rst: update references to products built with OE / Yocto Project
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I14d679e25bd1c7545bc2d0f545f876aeb0a333b4
Diffstat (limited to 'meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez')
-rw-r--r-- | meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch | 454 |
1 files changed, 454 insertions, 0 deletions
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch new file mode 100644 index 0000000000..af4869f735 --- /dev/null +++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch @@ -0,0 +1,454 @@ +From f83d38687fec2239c517037453ed4a2191279796 Mon Sep 17 00:00:00 2001 +From: Victor Stinner <vstinner@python.org> +Date: Fri, 28 Jan 2022 00:14:04 +0100 +Subject: [PATCH] Port to Python 3.11 (#410) + +* Replace "arg == Py_None" with Py_IsNone(arg) +* Replace arg->ob_type with Py_TYPE(arg) +* Replace "Py_TYPE(obj) = type" with Py_SET_TYPE(obj, type). +* Copy pythoncapi_compat.h from: + https://github.com/pythoncapi/pythoncapi_compat +* pythoncapi_compat.h provides Py_SET_TYPE() and Py_IsNone() to old + Python versions. + +Upstream-Status: Backport [https://github.com/pybluez/pybluez/commit/5096047f90a1f6a74ceb250aef6243e144170f92] +Signed-off-by: Alexander Kanavin <alex@linutronix.de> +--- + bluez/btmodule.c | 14 +- + bluez/pythoncapi_compat.h | 364 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 372 insertions(+), 6 deletions(-) + create mode 100644 bluez/pythoncapi_compat.h + +diff --git a/bluez/btmodule.c b/bluez/btmodule.c +index 912a489..b61f74a 100644 +--- a/bluez/btmodule.c ++++ b/bluez/btmodule.c +@@ -21,6 +21,8 @@ Local naming conventions: + #include "btmodule.h" + #include "structmember.h" + ++#include "pythoncapi_compat.h" ++ + #include <stdio.h> + #include <unistd.h> + #include <stdlib.h> +@@ -678,7 +680,7 @@ sock_settimeout(PySocketSockObject *s, PyObject *arg) + { + double timeout; + +- if (arg == Py_None) ++ if (Py_IsNone(arg)) + timeout = -1.0; + else { + timeout = PyFloat_AsDouble(arg); +@@ -1752,7 +1754,7 @@ bt_btohl(PyObject *self, PyObject *args) + else + return PyErr_Format(PyExc_TypeError, + "expected int/long, %s found", +- arg->ob_type->tp_name); ++ Py_TYPE(arg)->tp_name); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; + return PyInt_FromLong(btohl(x)); +@@ -1816,7 +1818,7 @@ bt_htobl(PyObject *self, PyObject *args) + else + return PyErr_Format(PyExc_TypeError, + "expected int/long, %s found", +- arg->ob_type->tp_name); ++ Py_TYPE(arg)->tp_name); + return PyInt_FromLong(htobl(x)); + } + +@@ -1889,7 +1891,7 @@ bt_setdefaulttimeout(PyObject *self, PyObject *arg) + { + double timeout; + +- if (arg == Py_None) ++ if (Py_IsNone(arg)) + timeout = -1.0; + else { + timeout = PyFloat_AsDouble(arg); +@@ -2980,8 +2982,8 @@ PyMODINIT_FUNC + init_bluetooth(void) + #endif + { +- Py_TYPE(&sock_type) = &PyType_Type; +- Py_TYPE(&sdp_session_type) = &PyType_Type; ++ Py_SET_TYPE(&sock_type, &PyType_Type); ++ Py_SET_TYPE(&sdp_session_type, &PyType_Type); + #if PY_MAJOR_VERSION >= 3 + PyObject *m = PyModule_Create(&moduledef); + #else +diff --git a/bluez/pythoncapi_compat.h b/bluez/pythoncapi_compat.h +new file mode 100644 +index 0000000..e660b61 +--- /dev/null ++++ b/bluez/pythoncapi_compat.h +@@ -0,0 +1,364 @@ ++// Header file providing new functions of the Python C API to old Python ++// versions. ++// ++// File distributed under the MIT license. ++// Copyright Contributors to the pythoncapi_compat project. ++// ++// Homepage: ++// https://github.com/pythoncapi/pythoncapi_compat ++// ++// Latest version: ++// https://raw.githubusercontent.com/pythoncapi/pythoncapi_compat/master/pythoncapi_compat.h ++// ++// SPDX-License-Identifier: MIT ++ ++#ifndef PYTHONCAPI_COMPAT ++#define PYTHONCAPI_COMPAT ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include <Python.h> ++#include "frameobject.h" // PyFrameObject, PyFrame_GetBack() ++ ++ ++// Compatibility with Visual Studio 2013 and older which don't support ++// the inline keyword in C (only in C++): use __inline instead. ++#if (defined(_MSC_VER) && _MSC_VER < 1900 \ ++ && !defined(__cplusplus) && !defined(inline)) ++# define inline __inline ++# define PYTHONCAPI_COMPAT_MSC_INLINE ++ // These two macros are undefined at the end of this file ++#endif ++ ++ ++// Cast argument to PyObject* type. ++#ifndef _PyObject_CAST ++# define _PyObject_CAST(op) ((PyObject*)(op)) ++#endif ++#ifndef _PyObject_CAST_CONST ++# define _PyObject_CAST_CONST(op) ((const PyObject*)(op)) ++#endif ++ ++ ++// bpo-42262 added Py_NewRef() to Python 3.10.0a3 ++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_NewRef) ++static inline PyObject* _Py_NewRef(PyObject *obj) ++{ ++ Py_INCREF(obj); ++ return obj; ++} ++#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj)) ++#endif ++ ++ ++// bpo-42262 added Py_XNewRef() to Python 3.10.0a3 ++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_XNewRef) ++static inline PyObject* _Py_XNewRef(PyObject *obj) ++{ ++ Py_XINCREF(obj); ++ return obj; ++} ++#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj)) ++#endif ++ ++ ++// See https://bugs.python.org/issue42522 ++#if !defined(_Py_StealRef) ++static inline PyObject* __Py_StealRef(PyObject *obj) ++{ ++ Py_DECREF(obj); ++ return obj; ++} ++#define _Py_StealRef(obj) __Py_StealRef(_PyObject_CAST(obj)) ++#endif ++ ++ ++// See https://bugs.python.org/issue42522 ++#if !defined(_Py_XStealRef) ++static inline PyObject* __Py_XStealRef(PyObject *obj) ++{ ++ Py_XDECREF(obj); ++ return obj; ++} ++#define _Py_XStealRef(obj) __Py_XStealRef(_PyObject_CAST(obj)) ++#endif ++ ++ ++// bpo-39573 added Py_SET_REFCNT() to Python 3.9.0a4 ++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_REFCNT) ++static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) ++{ ++ ob->ob_refcnt = refcnt; ++} ++#define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt) ++#endif ++ ++ ++// Py_SETREF() and Py_XSETREF() were added to Python 3.5.2. ++// It is excluded from the limited C API. ++#if (PY_VERSION_HEX < 0x03050200 && !defined(Py_SETREF)) && !defined(Py_LIMITED_API) ++#define Py_SETREF(op, op2) \ ++ do { \ ++ PyObject *_py_tmp = _PyObject_CAST(op); \ ++ (op) = (op2); \ ++ Py_DECREF(_py_tmp); \ ++ } while (0) ++ ++#define Py_XSETREF(op, op2) \ ++ do { \ ++ PyObject *_py_tmp = _PyObject_CAST(op); \ ++ (op) = (op2); \ ++ Py_XDECREF(_py_tmp); \ ++ } while (0) ++#endif ++ ++ ++// bpo-43753 added Py_Is(), Py_IsNone(), Py_IsTrue() and Py_IsFalse() ++// to Python 3.10.0b1. ++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_Is) ++# define Py_Is(x, y) ((x) == (y)) ++#endif ++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsNone) ++# define Py_IsNone(x) Py_Is(x, Py_None) ++#endif ++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsTrue) ++# define Py_IsTrue(x) Py_Is(x, Py_True) ++#endif ++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsFalse) ++# define Py_IsFalse(x) Py_Is(x, Py_False) ++#endif ++ ++ ++// bpo-39573 added Py_SET_TYPE() to Python 3.9.0a4 ++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE) ++static inline void ++_Py_SET_TYPE(PyObject *ob, PyTypeObject *type) ++{ ++ ob->ob_type = type; ++} ++#define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type) ++#endif ++ ++ ++// bpo-39573 added Py_SET_SIZE() to Python 3.9.0a4 ++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE) ++static inline void ++_Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size) ++{ ++ ob->ob_size = size; ++} ++#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size) ++#endif ++ ++ ++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1 ++#if PY_VERSION_HEX < 0x030900B1 ++static inline PyCodeObject* ++PyFrame_GetCode(PyFrameObject *frame) ++{ ++ assert(frame != NULL); ++ assert(frame->f_code != NULL); ++ return (PyCodeObject*)Py_NewRef(frame->f_code); ++} ++#endif ++ ++static inline PyCodeObject* ++_PyFrame_GetCodeBorrow(PyFrameObject *frame) ++{ ++ return (PyCodeObject *)_Py_StealRef(PyFrame_GetCode(frame)); ++} ++ ++ ++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1 ++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION) ++static inline PyFrameObject* ++PyFrame_GetBack(PyFrameObject *frame) ++{ ++ assert(frame != NULL); ++ return (PyFrameObject*)Py_XNewRef(frame->f_back); ++} ++#endif ++ ++#if !defined(PYPY_VERSION) ++static inline PyFrameObject* ++_PyFrame_GetBackBorrow(PyFrameObject *frame) ++{ ++ return (PyFrameObject *)_Py_XStealRef(PyFrame_GetBack(frame)); ++} ++#endif ++ ++ ++// bpo-39947 added PyThreadState_GetInterpreter() to Python 3.9.0a5 ++#if PY_VERSION_HEX < 0x030900A5 ++static inline PyInterpreterState * ++PyThreadState_GetInterpreter(PyThreadState *tstate) ++{ ++ assert(tstate != NULL); ++ return tstate->interp; ++} ++#endif ++ ++ ++// bpo-40429 added PyThreadState_GetFrame() to Python 3.9.0b1 ++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION) ++static inline PyFrameObject* ++PyThreadState_GetFrame(PyThreadState *tstate) ++{ ++ assert(tstate != NULL); ++ return (PyFrameObject *)Py_XNewRef(tstate->frame); ++} ++#endif ++ ++#if !defined(PYPY_VERSION) ++static inline PyFrameObject* ++_PyThreadState_GetFrameBorrow(PyThreadState *tstate) ++{ ++ return (PyFrameObject *)_Py_XStealRef(PyThreadState_GetFrame(tstate)); ++} ++#endif ++ ++ ++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a5 ++#if PY_VERSION_HEX < 0x030900A5 ++static inline PyInterpreterState * ++PyInterpreterState_Get(void) ++{ ++ PyThreadState *tstate; ++ PyInterpreterState *interp; ++ ++ tstate = PyThreadState_GET(); ++ if (tstate == NULL) { ++ Py_FatalError("GIL released (tstate is NULL)"); ++ } ++ interp = tstate->interp; ++ if (interp == NULL) { ++ Py_FatalError("no current interpreter"); ++ } ++ return interp; ++} ++#endif ++ ++ ++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a6 ++#if 0x030700A1 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION) ++static inline uint64_t ++PyThreadState_GetID(PyThreadState *tstate) ++{ ++ assert(tstate != NULL); ++ return tstate->id; ++} ++#endif ++ ++ ++// bpo-37194 added PyObject_CallNoArgs() to Python 3.9.0a1 ++#if PY_VERSION_HEX < 0x030900A1 ++static inline PyObject* ++PyObject_CallNoArgs(PyObject *func) ++{ ++ return PyObject_CallFunctionObjArgs(func, NULL); ++} ++#endif ++ ++ ++// bpo-39245 made PyObject_CallOneArg() public (previously called ++// _PyObject_CallOneArg) in Python 3.9.0a4 ++#if PY_VERSION_HEX < 0x030900A4 ++static inline PyObject* ++PyObject_CallOneArg(PyObject *func, PyObject *arg) ++{ ++ return PyObject_CallFunctionObjArgs(func, arg, NULL); ++} ++#endif ++ ++ ++// bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3 ++#if PY_VERSION_HEX < 0x030A00A3 ++static inline int ++PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value) ++{ ++ Py_XINCREF(value); ++ int res = PyModule_AddObject(module, name, value); ++ if (res < 0) { ++ Py_XDECREF(value); ++ } ++ return res; ++} ++#endif ++ ++ ++// bpo-40024 added PyModule_AddType() to Python 3.9.0a5 ++#if PY_VERSION_HEX < 0x030900A5 ++static inline int ++PyModule_AddType(PyObject *module, PyTypeObject *type) ++{ ++ const char *name, *dot; ++ ++ if (PyType_Ready(type) < 0) { ++ return -1; ++ } ++ ++ // inline _PyType_Name() ++ name = type->tp_name; ++ assert(name != NULL); ++ dot = strrchr(name, '.'); ++ if (dot != NULL) { ++ name = dot + 1; ++ } ++ ++ return PyModule_AddObjectRef(module, name, (PyObject *)type); ++} ++#endif ++ ++ ++// bpo-40241 added PyObject_GC_IsTracked() to Python 3.9.0a6. ++// bpo-4688 added _PyObject_GC_IS_TRACKED() to Python 2.7.0a2. ++#if PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION) ++static inline int ++PyObject_GC_IsTracked(PyObject* obj) ++{ ++ return (PyObject_IS_GC(obj) && _PyObject_GC_IS_TRACKED(obj)); ++} ++#endif ++ ++// bpo-40241 added PyObject_GC_IsFinalized() to Python 3.9.0a6. ++// bpo-18112 added _PyGCHead_FINALIZED() to Python 3.4.0 final. ++#if PY_VERSION_HEX < 0x030900A6 && PY_VERSION_HEX >= 0x030400F0 && !defined(PYPY_VERSION) ++static inline int ++PyObject_GC_IsFinalized(PyObject *obj) ++{ ++ return (PyObject_IS_GC(obj) && _PyGCHead_FINALIZED((PyGC_Head *)(obj)-1)); ++} ++#endif ++ ++ ++// bpo-39573 added Py_IS_TYPE() to Python 3.9.0a4 ++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_IS_TYPE) ++static inline int ++_Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) { ++ return ob->ob_type == type; ++} ++#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type) ++#endif ++ ++ ++// Py_UNUSED() was added to Python 3.4.0b2. ++#if PY_VERSION_HEX < 0x030400B2 && !defined(Py_UNUSED) ++# if defined(__GNUC__) || defined(__clang__) ++# define Py_UNUSED(name) _unused_ ## name __attribute__((unused)) ++# else ++# define Py_UNUSED(name) _unused_ ## name ++# endif ++#endif ++ ++ ++#ifdef PYTHONCAPI_COMPAT_MSC_INLINE ++# undef inline ++# undef PYTHONCAPI_COMPAT_MSC_INLINE ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++#endif // PYTHONCAPI_COMPAT +-- +2.30.2 + |