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/2003-October/039788.html below:

[Python-Dev] Deprecate the buffer object?

[Python-Dev] Deprecate the buffer object? [Python-Dev] Deprecate the buffer object?Neil Schemenauer nas-python at python.ca
Wed Oct 29 17:44:55 EST 2003
On Wed, Oct 29, 2003 at 02:41:54PM +1300, Greg Ewing wrote:
> There's no doubt that the current implementation of it is
> unacceptably dangerous, but I haven't yet seen an argument
> that convinces me that it couldn't be fixed if desired.

Okay.  Perhaps I am missing something but would fixing it be as
simple as adding another field to the tp_as_buffer struct?

    /* references returned by the buffer functins are valid while
     * the object remains alive */
    #define PyBuffer_FLAG_SAFE 1

Then in stringobject.c (and elsewhere as appropriate):

    static PyBufferProcs buffer_as_buffer = {
        (getreadbufferproc)buffer_getreadbuf,
        (getwritebufferproc)buffer_getwritebuf,
        (getsegcountproc)buffer_getsegcount,
        (getcharbufferproc)buffer_getcharbuf,
        PyBuffer_FLAG_SAFE,
    };

Then change bufferobject so that it can only be created from objects
that set PyBuffer_FLAG_SAFE.

  Neil

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