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@7312 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a663b62852
commit
bba18606ea
1 changed files with 11 additions and 11 deletions
|
|
@ -52,13 +52,6 @@
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal(unsigned long)(PyObject *obj, unsigned long *val)
|
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)) {
|
if (PyLong_Check(obj)) {
|
||||||
unsigned long v = PyLong_AsUnsignedLong(obj);
|
unsigned long v = PyLong_AsUnsignedLong(obj);
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
|
|
@ -69,6 +62,13 @@ SWIGINTERN int
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (PyInt_Check(obj)) {
|
||||||
|
long v = PyInt_AsLong(obj);
|
||||||
|
if (v >= 0) {
|
||||||
|
if (val) *val = v;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (val) {
|
if (val) {
|
||||||
SWIG_type_error("unsigned long", obj);
|
SWIG_type_error("unsigned long", obj);
|
||||||
}
|
}
|
||||||
|
|
@ -154,10 +154,6 @@ SWIGINTERN int
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal(long)(PyObject * obj, long* val)
|
SWIG_AsVal(long)(PyObject * obj, long* val)
|
||||||
{
|
{
|
||||||
if (PyInt_Check(obj)) {
|
|
||||||
if (val) *val = PyInt_AsLong(obj);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (PyLong_Check(obj)) {
|
if (PyLong_Check(obj)) {
|
||||||
long v = PyLong_AsLong(obj);
|
long v = PyLong_AsLong(obj);
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
|
|
@ -168,6 +164,10 @@ SWIGINTERN int
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (PyInt_Check(obj)) {
|
||||||
|
if (val) *val = PyInt_AsLong(obj);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (val) {
|
if (val) {
|
||||||
SWIG_type_error("long", obj);
|
SWIG_type_error("long", obj);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue