| 537 | }; |
| 538 | |
| 539 | static PythonCollectionKind |
| 540 | resolve_python_collection_kind(PyObject *collection) { |
| 541 | if (PyList_CheckExact(collection)) { |
| 542 | return PythonCollectionKind::List; |
| 543 | } |
| 544 | if (PyTuple_CheckExact(collection)) { |
| 545 | return PythonCollectionKind::Tuple; |
| 546 | } |
| 547 | if (FORY_PY_SET_CHECK_EXACT(collection)) { |
| 548 | return PythonCollectionKind::Set; |
| 549 | } |
| 550 | PyErr_Format(PyExc_TypeError, |
| 551 | "fastpath only supports list/tuple/set collections, got %.200s", |
| 552 | Py_TYPE(collection)->tp_name); |
| 553 | return PythonCollectionKind::List; |
| 554 | } |
| 555 | |
| 556 | static void set_buffer_error(const Error &error) { |
| 557 | PyErr_SetString(PyExc_BufferError, error.to_string().c_str()); |
no outgoing calls
no test coverage detected