Fixed the core issue (nil was not working as return value of a factory method)

This commit is contained in:
Matthias Koefferlein
2026-08-25 20:36:29 +02:00
parent 3c669eb5eb
commit a6900e091e
4 changed files with 26 additions and 1 deletions
+11
View File
@@ -146,6 +146,13 @@ class PyGFactory(pya.GFactory):
def f(self, z):
return PyGObject(z)
class PyNilGFactory(pya.GFactory):
def __init__(self):
super(PyNilGFactory, self).__init__()
# reimplementation of "virtual GObject *f(int)"
def f(self, z):
return None
class BasicTest(unittest.TestCase):
def test_00(self):
@@ -3255,6 +3262,10 @@ class BasicTest(unittest.TestCase):
go = None
self.assertEqual(pya.GObject.g_inst_count(), gc)
gf = PyNilGFactory()
go = pya.GFactory.create_f(gf, 17)
self.assertEqual(go is None, True)
# fallback to __rmul__ for not implemented __mul__
def test_90(self):