File: Update-refcount-tests-in-3.14-less-refcounts-are-done.patch

package info (click to toggle)
pygobject 3.50.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,420 kB
  • sloc: python: 23,164; ansic: 22,948; sh: 468; makefile: 74; xml: 35
file content (171 lines) | stat: -rw-r--r-- 6,523 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From: Arjan Molenaar <gaphor@gmail.com>
Date: Sun, 13 Jul 2025 19:41:53 +0200
Subject: Update refcount tests: in 3.14 less refcounts are done

Origin: upstream, 3.54.0, commit:0972c8b49040c08416648eca5ec9aac7a340666f
---
 tests/test_gobject.py           | 16 ++++++++++----
 tests/test_object_marshaling.py |  4 +++-
 tests/test_signal.py            | 48 ++++++++++++++++++++++++++++-------------
 3 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/tests/test_gobject.py b/tests/test_gobject.py
index 1d29a7c..eaaf320 100644
--- a/tests/test_gobject.py
+++ b/tests/test_gobject.py
@@ -314,22 +314,30 @@ class TestPythonReferenceCounting(unittest.TestCase):
     def test_new_instance_has_two_refs(self):
         obj = GObject.GObject()
         if hasattr(sys, "getrefcount"):
-            self.assertEqual(sys.getrefcount(obj), 2)
+            self.assertEqual(
+                sys.getrefcount(obj), 2 if sys.version_info < (3, 14) else 1
+            )
 
     def test_new_instance_has_two_refs_using_gobject_new(self):
         obj = GObject.new(GObject.GObject)
         if hasattr(sys, "getrefcount"):
-            self.assertEqual(sys.getrefcount(obj), 2)
+            self.assertEqual(
+                sys.getrefcount(obj), 2 if sys.version_info < (3, 14) else 1
+            )
 
     def test_new_subclass_instance_has_two_refs(self):
         obj = A()
         if hasattr(sys, "getrefcount"):
-            self.assertEqual(sys.getrefcount(obj), 2)
+            self.assertEqual(
+                sys.getrefcount(obj), 2 if sys.version_info < (3, 14) else 1
+            )
 
     def test_new_subclass_instance_has_two_refs_using_gobject_new(self):
         obj = GObject.new(A)
         if hasattr(sys, "getrefcount"):
-            self.assertEqual(sys.getrefcount(obj), 2)
+            self.assertEqual(
+                sys.getrefcount(obj), 2 if sys.version_info < (3, 14) else 1
+            )
 
 
 class TestContextManagers(unittest.TestCase):
diff --git a/tests/test_object_marshaling.py b/tests/test_object_marshaling.py
index d52ff54..d162cd7 100644
--- a/tests/test_object_marshaling.py
+++ b/tests/test_object_marshaling.py
@@ -109,7 +109,9 @@ class TestVFuncsWithObjectArg(unittest.TestCase):
 
         gc.collect()
         if hasattr(sys, "getrefcount"):
-            self.assertEqual(sys.getrefcount(vfuncs), 2)
+            self.assertEqual(
+                sys.getrefcount(vfuncs), 2 if sys.version_info < (3, 14) else 1
+            )
         self.assertEqual(vfuncs.__grefcount__, 1)
 
         del vfuncs
diff --git a/tests/test_signal.py b/tests/test_signal.py
index 8a935fd..89a2c57 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -1415,18 +1415,24 @@ class _RefCountTestBase(object):
             return value // 2
 
         callback_ref = weakref.ref(callback)
-        self.assertEqual(sys.getrefcount(callback), 2)
+        self.assertEqual(
+            sys.getrefcount(callback), 2 if sys.version_info < (3, 14) else 1
+        )
 
         obj = self.Object()
-        obj.connect('sig-with-int64-prop', callback)
-        self.assertEqual(sys.getrefcount(callback), 3)
+        obj.connect("sig-with-int64-prop", callback)
+        self.assertEqual(
+            sys.getrefcount(callback), 3 if sys.version_info < (3, 14) else 2
+        )
 
         del callback
         self.assertEqual(sys.getrefcount(callback_ref()), 2)
 
         res = obj.emit('sig-with-int64-prop', 42)
         self.assertEqual(res, 21)
-        self.assertEqual(sys.getrefcount(callback_ref), 2)
+        self.assertEqual(
+            sys.getrefcount(callback_ref), 2 if sys.version_info < (3, 14) else 1
+        )
 
         del obj
         self.assertIsNone(callback_ref())
@@ -1437,18 +1443,24 @@ class _RefCountTestBase(object):
             return value // 2
 
         callback_ref = weakref.ref(callback)
-        self.assertEqual(sys.getrefcount(callback), 2)
+        self.assertEqual(
+            sys.getrefcount(callback), 2 if sys.version_info < (3, 14) else 1
+        )
 
         obj = self.Object()
-        handler_id = obj.connect('sig-with-int64-prop', callback)
-        self.assertEqual(sys.getrefcount(callback), 3)
+        handler_id = obj.connect("sig-with-int64-prop", callback)
+        self.assertEqual(
+            sys.getrefcount(callback), 3 if sys.version_info < (3, 14) else 2
+        )
 
         del callback
         self.assertEqual(sys.getrefcount(callback_ref()), 2)
 
         res = obj.emit('sig-with-int64-prop', 42)
         self.assertEqual(res, 21)
-        self.assertEqual(sys.getrefcount(callback_ref), 2)
+        self.assertEqual(
+            sys.getrefcount(callback_ref), 2 if sys.version_info < (3, 14) else 1
+        )
 
         obj.disconnect(handler_id)
         self.assertIsNone(callback_ref())
@@ -1459,18 +1471,24 @@ class _RefCountTestBase(object):
             return value // 2
 
         callback_ref = weakref.ref(callback)
-        self.assertEqual(sys.getrefcount(callback), 2)
+        self.assertEqual(
+            sys.getrefcount(callback), 2 if sys.version_info < (3, 14) else 1
+        )
 
         obj = self.Object()
-        obj.connect('sig-with-int64-prop', callback)
-        self.assertEqual(sys.getrefcount(callback), 3)
+        obj.connect("sig-with-int64-prop", callback)
+        self.assertEqual(
+            sys.getrefcount(callback), 3 if sys.version_info < (3, 14) else 2
+        )
 
         del callback
         self.assertEqual(sys.getrefcount(callback_ref()), 2)
 
         res = obj.emit('sig-with-int64-prop', 42)
         self.assertEqual(res, 21)
-        self.assertEqual(sys.getrefcount(callback_ref), 2)
+        self.assertEqual(
+            sys.getrefcount(callback_ref), 2 if sys.version_info < (3, 14) else 1
+        )
 
         obj.disconnect_by_func(callback_ref())
         self.assertIsNone(callback_ref())
@@ -1482,11 +1500,11 @@ class _RefCountTestBase(object):
 
         data = self.PyData()
         data_ref = weakref.ref(data)
-        self.assertEqual(sys.getrefcount(data), 2)
+        self.assertEqual(sys.getrefcount(data), 2 if sys.version_info < (3, 14) else 1)
 
         obj = self.Object()
-        obj.connect('sig-with-int64-prop', callback, data)
-        self.assertEqual(sys.getrefcount(data), 3)
+        obj.connect("sig-with-int64-prop", callback, data)
+        self.assertEqual(sys.getrefcount(data), 3 if sys.version_info < (3, 14) else 2)
 
         del data
         self.assertEqual(sys.getrefcount(data_ref()), 2)