This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients docs@python, pitrou, rhansen, seberg, skrah
Date 2015-02-01.11:36:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422790579.31.0.706699766376.issue23352@psf.upfronthosting.co.za>
In-reply-to
Content
But only Cython does not set suboffsets to NULL and you already have a small 
patch to fix that.

The Python 3 docs say "suboffsets only if needed" and the PEP says the same,
so the situation is not completely undocumented.


I think your doc patch goes too far.  Buffers propagate in unpredictable ways, 
and since the original consumer request is *not stored* in the buffer, setting
unneeded fields to NULL provides a way to figure out the original request.


It is actually *an optimization* to set suboffsets to NULL:  Compliant code
that uses arbitrary buffers always has to check for:

    if (suboffsets != NULL && suboffsets[i] >= 0)
        ...


If suboffsets are consistently NULL, at least hopefully you get branch 
prediction to kick in.


As Sebastian pointed out, it's relatively easy even for slicing/indexing
functions to check for all-negative suboffsets and handle that case.


All this is probably academic, since no one appears to be using suboffsets
at all. :)



Let's keep the status-quo and make this a doc issue for 2.7.
History
Date User Action Args
2015-02-01 11:36:19skrahsetrecipients: + skrah, pitrou, rhansen, docs@python, seberg
2015-02-01 11:36:19skrahsetmessageid: <1422790579.31.0.706699766376.issue23352@psf.upfronthosting.co.za>
2015-02-01 11:36:18skrahlinkissue23352 messages
2015-02-01 11:36:18skrahcreate