[pygobject] Use PyLong_Type.tp_new for GLib.Pid



commit 2d203b7529c95ba4461a5a6d4c6b67169fabc4cf
Author: Benjamin Berg <benjamin sipsolutions net>
Date:   Mon Aug 5 17:04:15 2013 +0200

    Use PyLong_Type.tp_new for GLib.Pid
    
    For GLib.Pid the original implementation for __new__ needs to be used,
    as it is able to initialize the integer correctly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705451

 gi/_glib/pygspawn.c      |    1 +
 tests/test_subprocess.py |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gi/_glib/pygspawn.c b/gi/_glib/pygspawn.c
index 07adbff..2cda307 100644
--- a/gi/_glib/pygspawn.c
+++ b/gi/_glib/pygspawn.c
@@ -262,5 +262,6 @@ pyglib_spawn_register_types(PyObject *d)
     PyGPid_Type.tp_methods = pyg_pid_methods;
     PyGPid_Type.tp_init = pyg_pid_tp_init;
     PyGPid_Type.tp_free = (freefunc)pyg_pid_free;
+    PyGPid_Type.tp_new = PYGLIB_PyLong_Type.tp_new;
     PYGLIB_REGISTER_TYPE(d, PyGPid_Type, "Pid");
 }
diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py
index 26308e8..ef4c35e 100644
--- a/tests/test_subprocess.py
+++ b/tests/test_subprocess.py
@@ -107,6 +107,7 @@ class TestProcess(unittest.TestCase):
         self.assertEqual(stdin, None)
         self.assertEqual(stdout, None)
         self.assertEqual(stderr, None)
+        self.assertNotEqual(pid, 0)
         pid.close()
         id = GLib.child_watch_add(GLib.PRIORITY_HIGH, pid, cb, 12345)
         self.assertEqual(self.loop.get_context().find_source_by_id(id).priority,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]