A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-March/117283.html below:

[Python-Dev] Assertion in _PyManagedBuffer_FromObject()

[Python-Dev] Assertion in _PyManagedBuffer_FromObject() [Python-Dev] Assertion in _PyManagedBuffer_FromObject()Stefan Krah stefan at bytereef.org
Sat Mar 3 13:52:18 CET 2012
Nick Coghlan <ncoghlan at gmail.com> wrote:
> 2. the current check is too strict (it should just check for obj !=
> NULL, not obj == &exporter)

Yes. For anyone who is interested, see issue #14181.


> 3. the current check is in the wrong place (it should be in PyObject_GetBuffer)

Agreed, since it's not memoryview specific. But I don't think we even
need to check for obj != NULL. view.obj was undocumented, and since 3.0
Include/object.h contains this:


typedef struct bufferinfo {
    void *buf;
    PyObject *obj;        /* owned reference */


So it would be somewhat audacious to set this field to NULL. But even if
existing code uses the view.obj==NULL scheme from PyBuffer_FillInfo()
correctly, it will still work in the new implementation.

I'd just prefer to forbid this in the documentation, because it's much
easier to remember: getbuffer "returns" a new reference or NULL.



Stefan Krah



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4