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/117237.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
Fri Mar 2 16:30:57 CET 2012
Stefan Behnel <stefan_ml at behnel.de> wrote:
> I keep failing to see the interest in making this an error in the first
> place.

First, it is meant to guard against random pointers in the view.obj
field, precisely because view.obj was undocumented and exporters
might not fill in the field.

Then, as I said, the exporter is exposed on the Python level now:

>>> exporter = b'123'
>>> x = memoryview(exporter)
>>> x.obj == exporter 
True
>>> x.obj
b'123'


> Why would the object that bf_getbuffer() is being called on have to
> be identical with the one that exports the buffer?

It doesn't have to be. This is now possible:

>>> from _testbuffer import *
>>> exporter = b'123'
>>> nd = ndarray(exporter)
>>> m = memoryview(nd)
>>> nd.obj
b'123'
>>> m.obj
<ndarray object at 0x7fbef33677d8>



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