Using PyLong_Foo where appropriate (I think)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4245 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
28e7de397b
commit
a060864465
2 changed files with 7 additions and 5 deletions
|
|
@ -12,10 +12,12 @@ PyObject* SwigInt_FromBool(bool b) {
|
||||||
return PyInt_FromLong(b ? 1L : 0L);
|
return PyInt_FromLong(b ? 1L : 0L);
|
||||||
}
|
}
|
||||||
double SwigNumber_Check(PyObject* o) {
|
double SwigNumber_Check(PyObject* o) {
|
||||||
return PyFloat_Check(o) || PyInt_Check(o);
|
return PyFloat_Check(o) || PyInt_Check(o) || PyLong_Check(o);
|
||||||
}
|
}
|
||||||
double SwigNumber_AsDouble(PyObject* o) {
|
double SwigNumber_AsDouble(PyObject* o) {
|
||||||
return (PyFloat_Check(o) ? PyFloat_AsDouble(o) : double(PyInt_AsLong(o)));
|
return PyFloat_Check(o) ? PyFloat_AsDouble(o)
|
||||||
|
: (PyInt_Check(o) ? double(PyInt_AsLong(o))
|
||||||
|
: double(PyLong_AsLong(o)));
|
||||||
}
|
}
|
||||||
PyObject* SwigString_FromString(const std::string& s) {
|
PyObject* SwigString_FromString(const std::string& s) {
|
||||||
return PyString_FromString(s.c_str());
|
return PyString_FromString(s.c_str());
|
||||||
|
|
|
||||||
|
|
@ -714,13 +714,13 @@ namespace std {
|
||||||
specialize_std_vector(bool,PyInt_Check,PyInt_AsLong,SwigInt_FromBool);
|
specialize_std_vector(bool,PyInt_Check,PyInt_AsLong,SwigInt_FromBool);
|
||||||
specialize_std_vector(int,PyInt_Check,PyInt_AsLong,PyInt_FromLong);
|
specialize_std_vector(int,PyInt_Check,PyInt_AsLong,PyInt_FromLong);
|
||||||
specialize_std_vector(short,PyInt_Check,PyInt_AsLong,PyInt_FromLong);
|
specialize_std_vector(short,PyInt_Check,PyInt_AsLong,PyInt_FromLong);
|
||||||
specialize_std_vector(long,PyInt_Check,PyInt_AsLong,PyInt_FromLong);
|
specialize_std_vector(long,PyLong_Check,PyLong_AsLong,PyLong_FromLong);
|
||||||
specialize_std_vector(unsigned int,PyInt_Check,\
|
specialize_std_vector(unsigned int,PyInt_Check,\
|
||||||
PyInt_AsLong,PyInt_FromLong);
|
PyInt_AsLong,PyInt_FromLong);
|
||||||
specialize_std_vector(unsigned short,PyInt_Check,\
|
specialize_std_vector(unsigned short,PyInt_Check,\
|
||||||
PyInt_AsLong,PyInt_FromLong);
|
PyInt_AsLong,PyInt_FromLong);
|
||||||
specialize_std_vector(unsigned long,PyInt_Check,\
|
specialize_std_vector(unsigned long,PyLong_Check,\
|
||||||
PyInt_AsLong,PyInt_FromLong);
|
PyLong_AsUnsignedLong,PyLong_UnsignedLong);
|
||||||
specialize_std_vector(double,SwigNumber_Check,\
|
specialize_std_vector(double,SwigNumber_Check,\
|
||||||
SwigNumber_AsDouble,PyFloat_FromDouble);
|
SwigNumber_AsDouble,PyFloat_FromDouble);
|
||||||
specialize_std_vector(float,SwigNumber_Check,\
|
specialize_std_vector(float,SwigNumber_Check,\
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue