Message101606
http://docs.python.org/py3k/c-api/arg.html contains some ambiguous (string or Unicode object) definitions: what is a string? what is an unicode object? Is it a string or not? The problem is that the documentation is for Python2: the code was changed, but not the documentation. I think that it can be replaced by (unicode objet) with lower U to be consistent with (bytes object).
---
There are two functions: getbuffer() and convertbuffer().
getbuffer(): pb=arg->ob_type->tp_as_buffer
- if pb->bf_getbuffer is not NULL: call PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) and PyBuffer_IsContiguous(view, 'C')
- if pb->bf_getbuffer is NULL: call convertbuffer()
convertbuffer() calls PyObject_GetBuffer(arg, &view, PyBUF_SIMPLE).
---
"s#", "y", "z" formats use convertbuffer()
"s", "y*", "z*" formats uses getbuffer().
"t" format reimplements convertbuffer().
"w*" format calls PyObject_GetBuffer(arg, (Py_buffer*)p, PyBUF_WRITABLE) and PyBuffer_IsContiguous((Py_buffer*)p, 'C').
"w" and "w#" formats call PyObject_GetBuffer(arg, &view, PyBUF_SIMPLE).
I think that all these cases should be factorized in one unique function.
Is it a bug, or functions using "s#", "y", "z", "t" formats do really support discontinious buffers?
Related PEP: http://www.python.org/dev/peps/pep-3118/ |
|
Date |
User |
Action |
Args |
2010-03-23 22:29:02 | vstinner | set | recipients:
+ vstinner |
2010-03-23 22:29:01 | vstinner | set | messageid: <1269383341.97.0.71915040037.issue8215@psf.upfronthosting.co.za> |
2010-03-23 22:29:00 | vstinner | link | issue8215 messages |
2010-03-23 22:29:00 | vstinner | create | |
|