| 66 | |
| 67 | template <class T> |
| 68 | inline bool vtkPythonGetUnsignedLongLongValue(PyObject* o, T& a) |
| 69 | { |
| 70 | VTK_PYTHON_FLOAT_CHECK(); |
| 71 | |
| 72 | // PyLong_AsUnsignedLongLong will fail if "o" is not a PyLong |
| 73 | if (PyLong_Check(o)) |
| 74 | { |
| 75 | unsigned PY_LONG_LONG i = PyLong_AsUnsignedLongLong(o); |
| 76 | a = static_cast<T>(i); |
| 77 | return (i != static_cast<unsigned PY_LONG_LONG>(-1) || !PyErr_Occurred()); |
| 78 | } |
| 79 | |
| 80 | unsigned long l = PyLong_AsUnsignedLong(o); |
| 81 | a = static_cast<T>(l); |
| 82 | return (l != static_cast<unsigned long>(-1) || !PyErr_Occurred()); |
| 83 | } |
| 84 | |
| 85 | Py_ssize_t vtkPythonGetStringSize(PyObject* o) |
| 86 | { |