| 3977 | |
| 3978 | |
| 3979 | SWIGINTERN int |
| 3980 | SWIG_AsVal_long (PyObject *obj, long* val) |
| 3981 | { |
| 3982 | #if PY_VERSION_HEX < 0x03000000 |
| 3983 | if (PyInt_Check(obj)) { |
| 3984 | if (val) *val = PyInt_AsLong(obj); |
| 3985 | return SWIG_OK; |
| 3986 | } else |
| 3987 | #endif |
| 3988 | if (PyLong_Check(obj)) { |
| 3989 | long v = PyLong_AsLong(obj); |
| 3990 | if (!PyErr_Occurred()) { |
| 3991 | if (val) *val = v; |
| 3992 | return SWIG_OK; |
| 3993 | } else { |
| 3994 | PyErr_Clear(); |
| 3995 | return SWIG_OverflowError; |
| 3996 | } |
| 3997 | } |
| 3998 | #ifdef SWIG_PYTHON_CAST_MODE |
| 3999 | { |
| 4000 | int dispatch = 0; |
| 4001 | long v = PyInt_AsLong(obj); |
| 4002 | if (!PyErr_Occurred()) { |
| 4003 | if (val) *val = v; |
| 4004 | return SWIG_AddCast(SWIG_OK); |
| 4005 | } else { |
| 4006 | PyErr_Clear(); |
| 4007 | } |
| 4008 | if (!dispatch) { |
| 4009 | double d; |
| 4010 | int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); |
| 4011 | if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { |
| 4012 | if (val) *val = (long)(d); |
| 4013 | return res; |
| 4014 | } |
| 4015 | } |
| 4016 | } |
| 4017 | #endif |
| 4018 | return SWIG_TypeError; |
| 4019 | } |
| 4020 | |
| 4021 | |
| 4022 | SWIGINTERN int |
no test coverage detected