[pygobject] fix handling of UINT64 and INT64 arguments in py3k



commit 0e72e28c6c5502c7db5103cf1299c9f0e6689fdd
Author: John (J5) Palmieri <johnp redhat com>
Date:   Thu Sep 9 18:44:11 2010 -0400

    fix handling of UINT64 and INT64 arguments in py3k
    
    * decode to the right sized C long
    
    https://bugzilla.gnome.org/show_bug.cgi?id=615872

 gi/pygi-argument.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index affc54e..1f8b652 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -669,11 +669,13 @@ _pygi_argument_from_object (PyObject   *object,
                 break;
             }
 
-            if (PYGLIB_PyLong_Check (number)) {
-                value = PYGLIB_PyLong_AS_LONG (number);
-            } else {
+#if PY_VERSION_HEX < 0x03000000
+            if (PyInt_Check (number)) {
+                value = PyInt_AS_LONG (number);
+            } else
+#endif
+            if (PyLong_Check (number))
                 value = PyLong_AsUnsignedLongLong (number);
-            }
 
             arg.v_uint64 = value;
 
@@ -691,11 +693,13 @@ _pygi_argument_from_object (PyObject   *object,
                 break;
             }
 
-            if (PYGLIB_PyLong_Check (number)) {
-                value = PYGLIB_PyLong_AS_LONG (number);
-            } else {
+#if PY_VERSION_HEX < 0x03000000
+            if (PyInt_Check (number)) {
+                value = PyInt_AS_LONG (number);
+            } else 
+#endif 
+            if (PyLong_Check (number))
                 value = PyLong_AsLongLong (number);
-            }
 
             arg.v_int64 = value;
 



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