[pypy-commit] pypy cpyext-from2: translation fixes

mattip pypy.commits at gmail.com
Fri Jan 6 08:50:12 EST 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-from2
Changeset: r89394:09411e996fff
Date: 2017-01-06 15:45 +0200
http://bitbucket.org/pypy/pypy/changeset/09411e996fff/

Log:	translation fixes

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
@@ -35,12 +35,13 @@
     """
     Fills a newly allocated PyMemoryViewObject with the given W_MemoryView object.
     """
+    assert isinstance(w_obj, W_MemoryView)
     py_obj = rffi.cast(PyMemoryViewObject, py_obj)
     view = py_obj.c_view
     ndim = w_obj.buf.getndim()
     if ndim >= Py_MAX_NDIMS:
         # XXX warn?
-        return view
+        return
     fill_Py_buffer(space, w_obj.buf, view)
     try:
         view.c_buf = rffi.cast(rffi.VOIDP, w_obj.buf.get_raw_address())
@@ -108,7 +109,7 @@
     object.  The object must be a memoryview instance; this macro doesn't
     check its type, you must do it yourself or you will risk crashes."""
     # XXX move to a c-macro
-    py_memobj = rffi.cast(PyMemoryViewObject, pyobj) # no inc_ref
+    py_memobj = rffi.cast(PyMemoryViewObject, pyobj)
     return py_memobj.c_view
 
 def fill_Py_buffer(space, buf, view):


More information about the pypy-commit mailing list