diff options
author | neonene <53406459+neonene@users.noreply.github.com> | 2024-09-18 07:18:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-18 07:18:19 (GMT) |
commit | 646f16bdeed6ebe1069e1d64886fbaa26edac75c (patch) | |
tree | 44baf199481af36108124d0a5015a28816041b9d /Include | |
parent | 79a74102362996bbd4ff5d410a0d57d43c236da4 (diff) | |
download | cpython-646f16bdeed6ebe1069e1d64886fbaa26edac75c.zip cpython-646f16bdeed6ebe1069e1d64886fbaa26edac75c.tar.gz cpython-646f16bdeed6ebe1069e1d64886fbaa26edac75c.tar.bz2 |
gh-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot (GH-124163)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/cpython/object.h | 1 | ||||
-rw-r--r-- | Include/object.h | 4 | ||||
-rw-r--r-- | Include/typeslots.h | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h index e1024dd..9d09274 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -269,6 +269,7 @@ typedef struct _heaptypeobject { struct _dictkeysobject *ht_cached_keys; PyObject *ht_module; char *_ht_tpname; // Storage for "tp_name"; see PyType_FromModuleAndSpec + void *ht_token; // Storage for the "Py_tp_token" slot struct _specialization_cache _spec_cache; // For use by the specializer. #ifdef Py_GIL_DISABLED Py_ssize_t unique_id; // ID used for thread-local refcounting diff --git a/Include/object.h b/Include/object.h index abfdb6c..7124f58 100644 --- a/Include/object.h +++ b/Include/object.h @@ -391,6 +391,10 @@ PyAPI_FUNC(PyObject *) PyType_FromMetaclass(PyTypeObject*, PyObject*, PyType_Spe PyAPI_FUNC(void *) PyObject_GetTypeData(PyObject *obj, PyTypeObject *cls); PyAPI_FUNC(Py_ssize_t) PyType_GetTypeDataSize(PyTypeObject *cls); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030E0000 +PyAPI_FUNC(int) PyType_GetBaseByToken(PyTypeObject *, void *, PyTypeObject **); +#define Py_TP_USE_SPEC NULL +#endif /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); diff --git a/Include/typeslots.h b/Include/typeslots.h index e91caa1..a7f3017 100644 --- a/Include/typeslots.h +++ b/Include/typeslots.h @@ -90,3 +90,7 @@ /* New in 3.14 */ #define Py_tp_vectorcall 82 #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030E0000 +/* New in 3.14 */ +#define Py_tp_token 83 +#endif |