Lines Matching defs:arg
501 converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
529 if (!PySequence_Check(arg) || PyBytes_Check(arg)) {
535 arg == Py_None ? "None" : Py_TYPE(arg)->tp_name);
539 len = PySequence_Size(arg);
561 item = PySequence_GetItem(arg, i);
587 convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags,
595 msg = converttuple(arg, &format, p_va, flags, levels, msgbuf,
601 msg = convertsimple(arg, &format, p_va, flags,
619 const char *expected, PyObject *arg)
624 arg == Py_None ? "None" : Py_TYPE(arg)->tp_name);
628 converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
631 assert(arg != NULL);
639 arg == Py_None ? "None" : Py_TYPE(arg)->tp_name);
656 convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
676 long ival = PyLong_AsLong(arg);
697 unsigned long ival = PyLong_AsUnsignedLongMask(arg);
707 long ival = PyLong_AsLong(arg);
728 unsigned long ival = PyLong_AsUnsignedLongMask(arg);
738 long ival = PyLong_AsLong(arg);
759 unsigned long ival = PyLong_AsUnsignedLongMask(arg);
772 iobj = _PyNumber_Index(arg);
784 long ival = PyLong_AsLong(arg);
795 if (PyLong_Check(arg))
796 ival = PyLong_AsUnsignedLongMask(arg);
798 return converterr("int", arg, msgbuf, bufsize);
805 long long ival = PyLong_AsLongLong(arg);
816 if (PyLong_Check(arg))
817 ival = PyLong_AsUnsignedLongLongMask(arg);
819 return converterr("int", arg, msgbuf, bufsize);
826 double dval = PyFloat_AsDouble(arg);
836 double dval = PyFloat_AsDouble(arg);
847 cval = PyComplex_AsCComplex(arg);
857 if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1)
858 *p = PyBytes_AS_STRING(arg)[0];
859 else if (PyByteArray_Check(arg) && PyByteArray_Size(arg) == 1)
860 *p = PyByteArray_AS_STRING(arg)[0];
862 return converterr("a byte string of length 1", arg, msgbuf, bufsize);
871 if (!PyUnicode_Check(arg))
872 return converterr("a unicode character", arg, msgbuf, bufsize);
874 if (PyUnicode_READY(arg))
877 if (PyUnicode_GET_LENGTH(arg) != 1)
878 return converterr("a unicode character", arg, msgbuf, bufsize);
880 kind = PyUnicode_KIND(arg);
881 data = PyUnicode_DATA(arg);
888 int val = PyObject_IsTrue(arg);
906 if (getbuffer(arg, (Py_buffer*)p, &buf) < 0)
907 return converterr(buf, arg, msgbuf, bufsize);
912 arg, msgbuf, bufsize);
916 count = convertbuffer(arg, (const void **)p, &buf);
918 return converterr(buf, arg, msgbuf, bufsize);
940 if (c == 'z' && arg == Py_None)
942 else if (PyUnicode_Check(arg)) {
944 sarg = PyUnicode_AsUTF8AndSize(arg, &len);
947 arg, msgbuf, bufsize);
948 PyBuffer_FillInfo(p, arg, (void *)sarg, len, 1, 0);
952 if (getbuffer(arg, p, &buf) < 0)
953 return converterr(buf, arg, msgbuf, bufsize);
958 arg, msgbuf, bufsize);
967 if (c == 'z' && arg == Py_None) {
971 else if (PyUnicode_Check(arg)) {
973 sarg = PyUnicode_AsUTF8AndSize(arg, &len);
976 arg, msgbuf, bufsize);
983 Py_ssize_t count = convertbuffer(arg, p, &buf);
985 return converterr(buf, arg, msgbuf, bufsize);
995 if (c == 'z' && arg == Py_None)
997 else if (PyUnicode_Check(arg)) {
998 sarg = PyUnicode_AsUTF8AndSize(arg, &len);
1001 arg, msgbuf, bufsize);
1010 arg, msgbuf, bufsize);
1031 if (c == 'Z' && arg == Py_None) {
1035 else if (PyUnicode_Check(arg)) {
1037 *p = PyUnicode_AsUnicodeAndSize(arg, &len);
1044 arg, msgbuf, bufsize);
1048 if (c == 'Z' && arg == Py_None)
1050 else if (PyUnicode_Check(arg)) {
1052 *p = PyUnicode_AsUnicodeAndSize(arg, &len);
1061 arg, msgbuf, bufsize);
1091 arg, msgbuf, bufsize);
1096 arg, msgbuf, bufsize);
1100 (PyBytes_Check(arg) || PyByteArray_Check(arg))) {
1101 s = arg;
1103 if (PyBytes_Check(arg)) {
1112 else if (PyUnicode_Check(arg)) {
1114 s = PyUnicode_AsEncodedString(arg,
1119 arg, msgbuf, bufsize);
1129 arg, msgbuf, bufsize);
1163 arg, msgbuf, bufsize);
1176 arg, msgbuf, bufsize);
1210 arg, msgbuf, bufsize);
1221 arg, msgbuf, bufsize);
1231 if (PyBytes_Check(arg))
1232 *p = arg;
1234 return converterr("bytes", arg, msgbuf, bufsize);
1240 if (PyByteArray_Check(arg))
1241 *p = arg;
1243 return converterr("bytearray", arg, msgbuf, bufsize);
1249 if (PyUnicode_Check(arg)) {
1250 if (PyUnicode_READY(arg) == -1)
1252 *p = arg;
1255 return converterr("str", arg, msgbuf, bufsize);
1266 if (PyType_IsSubtype(Py_TYPE(arg), type))
1267 *p = arg;
1269 return converterr(type->tp_name, arg, msgbuf, bufsize);
1278 if (! (res = (*convert)(arg, addr)))
1280 arg, msgbuf, bufsize);
1284 arg, msgbuf, bufsize);
1288 *p = arg;
1300 arg, msgbuf, bufsize);
1305 if (PyObject_GetBuffer(arg, (Py_buffer*)p, PyBUF_WRITABLE) < 0) {
1308 arg, msgbuf, bufsize);
1312 return converterr("contiguous buffer", arg, msgbuf, bufsize);
1317 arg, msgbuf, bufsize);
1323 return converterr("(impossible<bad format char>)", arg, msgbuf, bufsize);
1335 convertbuffer(PyObject *arg, const void **p, const char **errmsg)
1337 PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer;
1348 if (getbuffer(arg, &view, errmsg) < 0)
1357 getbuffer(PyObject *arg, Py_buffer *view, const char **errmsg)
1359 if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) {
1851 /* arg present in tuple and in dict */
2251 /* arg present in tuple and in dict */
2450 /* arg present in tuple and in dict */