]> granicus.if.org Git - python/commit
Changes by Greg Stein (code) and GvR (design).
authorGuido van Rossum <guido@python.org>
Thu, 8 Oct 1998 02:10:56 +0000 (02:10 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 8 Oct 1998 02:10:56 +0000 (02:10 +0000)
commit36eef3c1739cdec3956e5ad86b5887985d249302
treeb80a458d9f15ffd149102a534af166ac1708eb5a
parent7e1e57494ce8001a61c1cb420034a9bb0955dd62
Changes by Greg Stein (code) and GvR (design).

Add a new member to the PyBufferProcs struct, bf_getcharbuffer.  For
backward compatibility, this member should only be used (this includes
testing for NULL!) when the flag Py_TPFLAGS_HAVE_GETCHARBUFFER is set
in the type structure, below.  Note that if its flag is not set, we
may be looking at an extension module compiled for 1.5.1, which will
have garbage at the bf_getcharbuffer member (because the struct wasn't
as long then).  If the flag is one, the pointer may still be NULL.
The function found at this member is used in a similar manner as
bf_getreadbuffer, but it is known to point to 8-bit character data.
(See discussion in getargs.c checked in later.)

As a general feature for extending the type structure and the various
structures that (may) hang off it in a backwards compatible way, we
rename the tp_xxx4 "spare" slot to tp_flags.  In 1.5.1 and before,
this slot was always zero.  In 1.5.1, it may contain various flags
indicating extra fields that weren't present in 1.5.1.  The only flag
defined so far is for the bf_getcharbuffer member of the PyBufferProcs
struct.

Note that the new spares (tp_xxx5 - tp_xxx8), once they become used,
should also be protected by a flag (or flags) in tp_flags.
Include/object.h