Debian Codegraph @

testdata/python-dev/cur/1606884253.000001.mbox:2,

raw
1 From: Mark Hammond <[email protected]>
2 To: [email protected]
3 Subject: [Python-Dev] Buffer interface in abstract.c?
4 Date: Tue, 03 Aug 1999 10:41:23 +1000
5 Message-ID: <001001bedd48$ea796280$1101a8c0@bobcat>
6 MIME-Version: 1.0
7 Content-Type: multipart/mixed; boundary="===============6301840427696015601=="
8
9 --===============6301840427696015601==
10 Content-Type: text/plain; charset="utf-8"
11 Content-Transfer-Encoding: 7bit
12
13 Hi all,
14 Im trying to slowly wean myself over to the buffer interfaces.
15
16 My exploration so far indicates that, for most cases, simply replacing
17 "PyString_FromStringAndSize" with "PyBuffer_FromMemory" handles the vast
18 majority of cases, and is preferred when the data contains arbitary bytes.
19 PyArg_ParseTuple("s#", ...) still works correctly as we would hope.
20
21 However, performing this explicitly is a pain. Looking at getargs.c, the
22 code to achieve this is a little too convoluted to cut-and-paste each time.
23
24 Therefore, I would like to propose these functions to be added to
25 abstract.c:
26
27 int PyObject_GetBufferSize();
28 void *PyObject_GetReadWriteBuffer(); /* or "char *"? */
29 const void *PyObject_GetReadOnlyBuffer();
30
31 Although equivalent functions exist for the buffer object, I can't see the
32 equivalent abstract implementations - ie, that work with any object
33 supporting the protocol.
34
35 Im willing to provide a patch if there is agreement a) the general idea is
36 good, and b) my specific spelling of the idea is OK (less likely -
37 PyBuffer_* seems better, but loses any implication of being abstract?).
38
39 Thoughts?
40
41 Mark.
42
43
44
45 --===============6301840427696015601==--
46
47