1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
From: Arjan Molenaar <gaphor@gmail.com>
Date: Sun, 13 Jul 2025 20:12:16 +0200
Subject: Add comment where 3.14 refcount updates hurt
Origin: upstream, 3.54.0, commit:a83b9b3869cd7ea9df31390824945a86785d8422
---
gi/pygi-object.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gi/pygi-object.c b/gi/pygi-object.c
index fc4268b..baba6a3 100644
--- a/gi/pygi-object.c
+++ b/gi/pygi-object.c
@@ -103,6 +103,7 @@ pygi_arg_gobject_out_arg_from_py (PyObject *py_arg, /*in*/
* https://bugzilla.gnome.org/show_bug.cgi?id=693393
*/
gobj = arg->v_pointer;
+ // In Python 3.13 the py_arg refcount is 3, in 3.14 only 1
if (Py_REFCNT (py_arg) == 1 && gobj->ref_count == 1) {
/* If both object ref counts are only 1 at this point (the reference held
* in a return tuple), we assume the GObject will be free'd before reaching
@@ -120,6 +121,7 @@ pygi_arg_gobject_out_arg_from_py (PyObject *py_arg, /*in*/
g_object_force_floating (gobj);
} else {
+ // This may no longer be true, due to differences in refcounting
PyObject *repr = PyObject_Repr (py_arg);
gchar *msg = g_strdup_printf ("Expecting to marshal a borrowed reference for %s, "
"but nothing in Python is holding a reference to this object. "
|