| 71 | } |
| 72 | |
| 73 | static inline long as_long_then_delete(PyObject* value, long default_value) { |
| 74 | ScopedPyObject scope(value); |
| 75 | long v = PyInt_AsLong(value); |
| 76 | if (INT_CONV_ERROR_OCCURRED(v)) { |
| 77 | PyErr_Clear(); |
| 78 | return default_value; |
| 79 | } |
| 80 | return v; |
| 81 | } |
| 82 | |
| 83 | template <typename T> |
| 84 | static PyObject* decode_impl(PyObject* args) { |