From 233f1ab7e60b998c2d85b914d49f481ede9207c7 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Tue, 21 Jun 2005 18:55:43 +0000 Subject: [PATCH] change the Int/Long check order, just in case since 'int' could be too permissive git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7312 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pyprimtypes.swg | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Lib/python/pyprimtypes.swg b/Lib/python/pyprimtypes.swg index 4384a856d..df4b6d0bc 100644 --- a/Lib/python/pyprimtypes.swg +++ b/Lib/python/pyprimtypes.swg @@ -52,13 +52,6 @@ SWIGINTERN int SWIG_AsVal(unsigned long)(PyObject *obj, unsigned long *val) { - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return 1; - } - } if (PyLong_Check(obj)) { unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { @@ -69,6 +62,13 @@ SWIGINTERN int return 0; } } + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return 1; + } + } if (val) { SWIG_type_error("unsigned long", obj); } @@ -154,10 +154,6 @@ SWIGINTERN int SWIGINTERN int SWIG_AsVal(long)(PyObject * obj, long* val) { - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return 1; - } if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { @@ -168,6 +164,10 @@ SWIGINTERN int return 0; } } + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return 1; + } if (val) { SWIG_type_error("long", obj); }