swig/swig-python-Python-3.13-deprecates-PyWeakref_GET_OBJECT.patch
Jitka Plesnikova 13bd2333c5 Resolves: RHEL-32325
- 4.2.1 bump
- Fix gcc's -Wformat-security warning in R Raise function
- OCaml 5.2.0 ppc64le fix
- Add support for Python 3.13
2024-07-09 18:38:37 +02:00

28 lines
835 B
Diff

From 7f0f267630386c41fbf44a0f6115d2555ba82451 Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Thu, 13 Jun 2024 15:32:46 +0200
Subject: [PATCH] Python 3.13 deprecates PyWeakref_GET_OBJECT
Closes #2863
---
Lib/python/pyrun.swg | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg
index 8381f16d27f..f7305eff108 100644
--- a/Lib/python/pyrun.swg
+++ b/Lib/python/pyrun.swg
@@ -1343,7 +1343,12 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
(void)obj;
# ifdef PyWeakref_CheckProxy
if (PyWeakref_CheckProxy(pyobj)) {
+#if PY_VERSION_HEX >= 0x030D0000
+ PyWeakref_GetRef(pyobj, &pyobj);
+ Py_DECREF(pyobj);
+#else
pyobj = PyWeakref_GET_OBJECT(pyobj);
+#endif
if (pyobj && SwigPyObject_Check(pyobj))
return (SwigPyObject*) pyobj;
}