Lines Matching refs:format

48      base object. shape, strides, suboffsets and format are read-only for
126 PyMem_Free(self->master.format);
243 with the same logical structure: format, itemsize, ndim and shape
265 /* This is not a general function for determining format equivalence.
269 format. This is a performance hack that could be rewritten (if properly
276 assert(dest->format && src->format);
277 dfmt = dest->format[0] == '@' ? dest->format+1 : dest->format;
278 sfmt = src->format[0] == '@' ? src->format+1 : src->format;
534 dest->format = src->format ? src->format : "B";
724 PyBUF_READ or PyBUF_WRITE. view->format is set to "B" (unsigned bytes).
811 /* Copy the format string from a base object that might vanish. */
821 mbuf->master.format = strcpy(cp, fmt);
835 2) src->format is copied to the master buffer and released
838 passes the altered format pointer to PyBuffer_Release().
861 if (mbuf_copy_format(mbuf, src->format) < 0) {
1117 /* Casting format and shape */
1189 /* Cast a memoryview's data type to 'format'. The input array must be
1190 C-contiguous. At least one of input-format, output-format must have
1194 cast_to_1D(PyMemoryViewObject *mv, PyObject *format)
1208 asciifmt = PyUnicode_AsASCIIString(format);
1215 "memoryview: destination format must be a native single "
1216 "character format prefixed with an optional '@'");
1220 if ((get_native_fmtchar(&srcchar, view->format) < 0 ||
1232 view->format = (char *)get_native_fmtstr(PyBytes_AS_STRING(asciifmt));
1233 if (view->format == NULL) {
1234 /* NOT_REACHED: get_native_fmtchar() already validates the format. */
1347 1-D output according to 'format'. At least one of input-format,
1348 output-format must have byte size.
1359 format: unicode
1362 Cast a memoryview to a new format or shape.
1366 memoryview_cast_impl(PyMemoryViewObject *self, PyObject *format,
1406 if (cast_to_1D(mv, format) < 0)
1465 point. The equality calcsize(format) = itemsize does _not_ hold
1467 view->format = NULL;
1501 if (view->format != NULL) {
1505 "memoryview: cannot cast to unsigned bytes if the format flag "
1509 /* product(shape) * itemsize = len and calcsize(format) = itemsize
1539 /* Optimized pack/unpack for all native format specifiers */
1544 1) Include format string in the error message.
1552 "memoryview: invalid type for format '%s'", fmt);
1560 "memoryview: invalid value for format '%s'", fmt);
1682 /* Unpack a single item. 'fmt' can be any native format character in struct
1764 "memoryview: format %s not supported", fmt);
1775 /* Pack a single item. 'fmt' can be any native format character in
1917 "memoryview: format %s not supported", fmt);
1927 for unpacking. An unpacker can handle the format passed to unpack_from().
1931 PyObject *unpack_from; /* Struct.unpack_from(format) */
1966 /* Return a new unpacker for the given format. */
1973 PyObject *format = NULL;
1989 format = PyBytes_FromString(fmt);
1990 if (format == NULL)
1993 structobj = PyObject_CallOneArg(Struct, format);
2015 Py_XDECREF(format);
2051 /* allow explicit form of native format */
2057 fmt = (view->format[0] == '@') ? view->format+1 : view->format;
2062 "memoryview: unsupported format %s", view->format);
2129 with native format strings are supported. */
2343 with the type specified by view->format. Otherwise, the item is a sub-view.
2674 /* StructError: invalid or unknown format -> not equal */
2708 single element native format, the comparison uses a fast path (gcc creates
2879 if (get_native_fmtchar(&vfmt, vv->format) < 0)
2881 if (get_native_fmtchar(&wfmt, ww->format) < 0)
2884 /* Use struct module unpacking. NOTE: Even for equal format strings,
2889 unpack_v = struct_get_unpacker(vv->format, vv->itemsize);
2894 unpack_w = struct_get_unpacker(ww->format, ww->itemsize);
2960 ret = get_native_fmtchar(&fmt, view->format);
3046 return PyUnicode_FromString(self->view.format);
3122 "A string containing the format (in struct module style)\n"
3148 {"format", (getter)memory_format_get, NULL, memory_format_doc},