| 1021 | } |
| 1022 | |
| 1023 | static PyObject * |
| 1024 | record_desc_vectorcall(PyObject *type, PyObject *const *args, size_t nargsf, |
| 1025 | PyObject *kwnames) |
| 1026 | { |
| 1027 | PyObject *mapping; |
| 1028 | PyObject *keys; |
| 1029 | ApgRecordDescObject *o; |
| 1030 | Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 1031 | |
| 1032 | if (kwnames != NULL && PyTuple_GET_SIZE(kwnames) != 0) { |
| 1033 | PyErr_SetString(PyExc_TypeError, "RecordDescriptor() takes no keyword arguments"); |
| 1034 | return NULL; |
| 1035 | } |
| 1036 | |
| 1037 | if (nargs != 2) { |
| 1038 | PyErr_Format(PyExc_TypeError, |
| 1039 | "RecordDescriptor() takes exactly 2 arguments (%zd given)", nargs); |
| 1040 | return NULL; |
| 1041 | } |
| 1042 | |
| 1043 | mapping = args[0]; |
| 1044 | keys = args[1]; |
| 1045 | |
| 1046 | if (!PyTuple_CheckExact(keys)) { |
| 1047 | PyErr_SetString(PyExc_TypeError, "keys must be a tuple"); |
| 1048 | return NULL; |
| 1049 | } |
| 1050 | |
| 1051 | o = PyObject_GC_New(ApgRecordDescObject, (PyTypeObject *)type); |
| 1052 | if (o == NULL) { |
| 1053 | return NULL; |
| 1054 | } |
| 1055 | |
| 1056 | Py_INCREF(mapping); |
| 1057 | o->mapping = mapping; |
| 1058 | |
| 1059 | Py_INCREF(keys); |
| 1060 | o->keys = keys; |
| 1061 | |
| 1062 | PyObject_GC_Track(o); |
| 1063 | return (PyObject *)o; |
| 1064 | } |
| 1065 | |
| 1066 | /* Fallback wrapper for when there is no vectorcall support */ |
| 1067 | static PyObject * |
no test coverage detected