Misc/stable_abi.toml2336:[const.PyBUF_READ]2338:[const.PyBUF_WRITE]Python/import.c3506: data = PyMemoryView_FromMemory((char *)info.data, info.size, PyBUF_READ);3547: if (PyObject_GetBuffer(dataobj, &buf, PyBUF_READ) != 0) {Include/pybuffer.h113:#define PyBUF_WRITEABLE PyBUF_WRITABLE137:#define PyBUF_READ 0x100138:#define PyBUF_WRITE 0x200Objects/memoryobject.c740: PyBUF_READ or PyBUF_WRITE. view->format is set to "B" (unsigned bytes).750: assert(flags == PyBUF_READ || flags == PyBUF_WRITE);756: readonly = (flags == PyBUF_WRITE) ? 0 : 1;952: buffertype={PyBUF_READ, PyBUF_WRITE} and order={'C', 'F'ortran, or 'A'ny}.957: As usual, if buffertype=PyBUF_WRITE, the exporter's buffer must be writable,963: Otherwise, if the buffertype is PyBUF_READ, the memoryview will be974: assert(buffertype == PyBUF_READ || buffertype == PyBUF_WRITE);982: if (buffertype == PyBUF_WRITE && view->readonly) {992: if (buffertype == PyBUF_WRITE) {2095: x->mview = PyMemoryView_FromMemory(x->item, itemsize, PyBUF_WRITE);Lib/test/test_buffer.py888: contig = get_contiguous(result, PyBUF_READ, order)1278: self.assertRaises(TypeError, get_contiguous, nd, PyBUF_READ, 961)1279: self.assertRaises(UnicodeEncodeError, get_contiguous, nd, PyBUF_READ,1281: self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'Z')2487: self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'C')2488: self.assertRaises(ValueError, get_contiguous, nd, PyBUF_READ, 'F')2489: self.assertRaises(ValueError, get_contiguous, nd[::-1], PyBUF_READ, 'C')3981: self.assertRaises(TypeError, get_contiguous, {}, PyBUF_READ, 'F')3984: self.assertRaises(BufferError, get_contiguous, b'x', PyBUF_WRITE, 'C')3988: self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'A')3993: m = get_contiguous(nd, PyBUF_READ, order)4000: m = get_contiguous(nd, PyBUF_READ, order)4007: m = get_contiguous(nd, PyBUF_WRITE, order)4018: m = get_contiguous(nd, PyBUF_READ, order)4026: m = get_contiguous(nd, PyBUF_READ, order)4032: m = get_contiguous(nd, PyBUF_WRITE, order)4038: m = get_contiguous(nd, PyBUF_WRITE, order)4045: m = get_contiguous(nd, PyBUF_READ, order)4054: m = get_contiguous(nd, PyBUF_READ, order)4064: m = get_contiguous(nd, PyBUF_WRITE, order)4067: self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'F')4068: m = get_contiguous(nd, PyBUF_READ, order)4074: m = get_contiguous(nd, PyBUF_WRITE, order)4077: self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE, 'C')4078: m = get_contiguous(nd, PyBUF_READ, order)4084: self.assertRaises(BufferError, get_contiguous, nd, PyBUF_WRITE,4086: m = get_contiguous(nd, PyBUF_READ, order)4091: m = get_contiguous(nd, PyBUF_READ, 'C')Modules/_pickle.c1403: PyObject *buf_obj = PyMemoryView_FromMemory(buf, n, PyBUF_WRITE);Modules/_testbuffer.c413: mview = PyMemoryView_FromMemory(ptr, itemsize, PyBUF_WRITE);582: mview = PyMemoryView_FromMemory(ptr, itemsize, PyBUF_READ);711: mview = PyMemoryView_FromMemory(item, base->itemsize, PyBUF_WRITE);2399: "buffertype must be PyBUF_READ or PyBUF_WRITE");2407: if (type != PyBUF_READ && type != PyBUF_WRITE) {2878: PyModule_AddIntMacro(m, PyBUF_READ);2879: PyModule_AddIntMacro(m, PyBUF_WRITE);
Uh oh!
There was an error while loading.Please reload this page.
It used to be:
I documented these values there, because they are primarily used in
memoryview
. Grep:📚 Documentation preview 📚:https://cpython-previews--114669.org.readthedocs.build/