| 1306 | /* Unpack the argument tuple */ |
| 1307 | |
| 1308 | SWIGINTERN int |
| 1309 | SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) |
| 1310 | { |
| 1311 | if (!args) { |
| 1312 | if (!min && !max) { |
| 1313 | return 1; |
| 1314 | } else { |
| 1315 | PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", |
| 1316 | name, (min == max ? "" : "at least "), (int)min); |
| 1317 | return 0; |
| 1318 | } |
| 1319 | } |
| 1320 | if (!PyTuple_Check(args)) { |
| 1321 | if (min <= 1 && max >= 1) { |
| 1322 | register int i; |
| 1323 | objs[0] = args; |
| 1324 | for (i = 1; i < max; ++i) { |
| 1325 | objs[i] = 0; |
| 1326 | } |
| 1327 | return 2; |
| 1328 | } |
| 1329 | PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); |
| 1330 | return 0; |
| 1331 | } else { |
| 1332 | register Py_ssize_t l = PyTuple_GET_SIZE(args); |
| 1333 | if (l < min) { |
| 1334 | PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", |
| 1335 | name, (min == max ? "" : "at least "), (int)min, (int)l); |
| 1336 | return 0; |
| 1337 | } else if (l > max) { |
| 1338 | PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", |
| 1339 | name, (min == max ? "" : "at most "), (int)max, (int)l); |
| 1340 | return 0; |
| 1341 | } else { |
| 1342 | register int i; |
| 1343 | for (i = 0; i < l; ++i) { |
| 1344 | objs[i] = PyTuple_GET_ITEM(args, i); |
| 1345 | } |
| 1346 | for (; l < max; ++l) { |
| 1347 | objs[l] = 0; |
| 1348 | } |
| 1349 | return i + 1; |
| 1350 | } |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | /* A functor is a function object with one single object argument */ |
| 1355 | #if PY_VERSION_HEX >= 0x02020000 |
no outgoing calls
no test coverage detected