• Guido van Rossum's avatar
    Changes by Greg Stein (code) and GvR (design). · 36eef3c1
    Guido van Rossum yazdı
    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.
    36eef3c1
object.h 18.1 KB