Use Python 3.13.0a4 PyCFunctionFastWithKeywords

This commit is contained in:
Karolina Surma 2024-02-21 12:37:58 +01:00
parent f800157870
commit e728dde39c
2 changed files with 53 additions and 0 deletions

50
6003.patch Normal file
View File

@ -0,0 +1,50 @@
From 829611469a979f499f3658fba632c9d9fe96933e Mon Sep 17 00:00:00 2001
From: Victor Stinner <vstinner@python.org>
Date: Fri, 16 Feb 2024 09:02:35 +0100
Subject: [PATCH] Use Python 3.13a4 PyCFunctionFastWithKeywords
Python 3.13a4 adds a public PyCFunctionFastWithKeywords and
PyCFunctionFast types and removes the private
_PyCFunctionFastWithKeywords and _PyCFunctionFast types:
* https://github.com/python/cpython/commit/9e3729bbd77fb9dcaea6a06ac760160136d80b79
* https://github.com/python/cpython/pull/114627
* https://github.com/capi-workgroup/decisions/issues/11
---
Cython/Utility/CythonFunction.c | 2 +-
Cython/Utility/ModuleSetupCode.c | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c
index 2a3b67335d2..646e3f5ff3a 100644
--- a/Cython/Utility/CythonFunction.c
+++ b/Cython/Utility/CythonFunction.c
@@ -1019,7 +1019,7 @@ static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func,
return NULL;
}
- return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
+ return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
}
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 785fcc653ef..03373b50f13 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -907,8 +907,13 @@ class __Pyx_FakeReference {
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
Py_ssize_t nargs, PyObject *kwnames);
#else
- #define __Pyx_PyCFunctionFast _PyCFunctionFast
- #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
+ #if PY_VERSION_HEX >= 0x030d00A4
+ # define __Pyx_PyCFunctionFast PyCFunctionFast
+ # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
+ #else
+ # define __Pyx_PyCFunctionFast _PyCFunctionFast
+ # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
+ #endif
#endif
#if CYTHON_METH_FASTCALL

View File

@ -13,6 +13,9 @@ License: Apache-2.0
URL: http://www.cython.org
Source: https://github.com/cython/cython/archive/%{version}/Cython-%{version}.tar.gz
# Use Python 3.13.0a4 PyCFunctionFastWithKeywords
Patch: https://github.com/cython/cython/pull/6003.patch
BuildRequires: python3-devel
%if %{with tests}