forked from pool/python-cffi
* Add support for Python 3.13.
* In API mode, when you get a function from a C library by writing
`fn = lib.myfunc`, you get an object of a special type for
performance reasons, instead of a `<cdata 'C-function-type'>`.
Before version 1.17 you could only call such objects.
You could write `ffi.addressof(lib, "myfunc")` in order to get
a real `<cdata>` object, based on the idea that in these cases
in C you'd usually write `&myfunc` instead of `myfunc`. In
version 1.17, the special object `lib.myfunc` can now be passed
in many places where CFFI expects
a regular `<cdata>` object. For example, you can now pass
it as a callback to a C function call, or write it inside a C
structure field of the correct pointer-to-function type, or use
`ffi.cast()` or `ffi.typeof()` on it.
- drop py313-compat.patch, py313-use-format-unraisable.patch,
py313-use-hashpointer.patch (upstream)
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=99
33 lines
883 B
Diff
33 lines
883 B
Diff
From c27335f0f8e1e4436082236e92ddabe1b8324d22 Mon Sep 17 00:00:00 2001
|
|
From: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
|
|
Date: Wed, 7 Feb 2024 09:12:08 -0800
|
|
Subject: [PATCH] use public Py_HashPointer API on 3.13+ (#52)
|
|
|
|
* use public Py_HashPointer API on 3.13+
|
|
|
|
* Wrong direction in the conditional
|
|
|
|
---------
|
|
|
|
Co-authored-by: Armin Rigo <armin.rigo@gmail.com>
|
|
---
|
|
src/c/_cffi_backend.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/src/c/_cffi_backend.c b/src/c/_cffi_backend.c
|
|
index cb82e16d..14fe9106 100644
|
|
--- a/src/c/_cffi_backend.c
|
|
+++ b/src/c/_cffi_backend.c
|
|
@@ -2466,7 +2466,11 @@ static Py_hash_t cdata_hash(PyObject *v)
|
|
}
|
|
Py_DECREF(vv);
|
|
}
|
|
+#if PY_VERSION_HEX < 0x030D0000
|
|
return _Py_HashPointer(((CDataObject *)v)->c_data);
|
|
+#else
|
|
+ return Py_HashPointer(((CDataObject *)v)->c_data);
|
|
+#endif
|
|
}
|
|
|
|
static Py_ssize_t
|