MCPcopy Create free account
hub / github.com/apache/fory / resolve_python_collection_kind

Function resolve_python_collection_kind

python/pyfory/cpp/pyfory.cc:539–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537};
538
539static PythonCollectionKind
540resolve_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
556static void set_buffer_error(const Error &error) {
557 PyErr_SetString(PyExc_BufferError, error.to_string().c_str());

Calls

no outgoing calls

Tested by

no test coverage detected