Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r88592:f863a942eb67
Date: 2016-11-23 20:00 +0000
http://bitbucket.org/pypy/pypy/changeset/f863a942eb67/
Log: Use default's implementation of PyMemoryView_FromBuffer
diff --git a/pypy/module/cpyext/memoryobject.py
b/pypy/module/cpyext/memoryobject.py
--- a/pypy/module/cpyext/memoryobject.py
+++ b/pypy/module/cpyext/memoryobject.py
@@ -112,12 +112,10 @@
The memoryview object then owns the buffer represented by view, which
means you shouldn't try to call PyBuffer_Release() yourself: it
will be done on deallocation of the memoryview object."""
- if not view.c_buf:
- raise oefmt(space.w_ValueError,
- "cannot make memory view from a buffer with a NULL data "
- "pointer")
- buf = CBuffer(space, view.c_buf, view.c_len, view.c_obj)
- return space.wrap(W_MemoryView(buf))
+ w_obj = from_ref(space, view.c_obj)
+ if isinstance(w_obj, W_MemoryView):
+ return w_obj
+ return space.call_method(space.builtin, "memoryview", w_obj)
@cpython_api([PyObject], PyObject)
def PyMemoryView_GET_BASE(space, w_obj):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit