From e9148b049cd9b92ebe3ff0e6ed20cc4dc724e8e9 Mon Sep 17 00:00:00 2001 From: Nicholas Piper Date: Mon, 15 May 2006 08:56:09 +0000 Subject: Another attempt at fixing gint64 and guint64 handling. 'Seems to work', this time. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1263 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- bindings/python/gpod.i | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i index 1d5f231..23d8092 100644 --- a/bindings/python/gpod.i +++ b/bindings/python/gpod.i @@ -213,19 +213,21 @@ typedef char gchar; } %typemap(in) guint64 { - unsigned long ival; - ival = PyInt_AsUnsignedLongLongMask($input); - if (PyErr_Occurred()) - SWIG_fail; - $1 = (guint64) ival; + if (PyInt_CheckExact($input)) + $1 = PyInt_AsUnsignedLongLongMask($input); + else + $1 = PyLong_AsUnsignedLongLong($input); + if (PyErr_Occurred()) + SWIG_fail; } %typemap(in) gint64 { - long ival; - ival = PyInt_AsUnsignedLongMask($input); - if (PyErr_Occurred()) - SWIG_fail; - $1 = (gint64) ival; + if (PyInt_CheckExact($input)) + $1 = PyInt_AsLong($input); + else + $1 = PyLong_AsLongLong($input); + if (PyErr_Occurred()) + SWIG_fail; } %typemap(out) guint64 { -- cgit