[pypy-commit] pypy newmemoryview-app-level: w_userdata was unused, make sure view.obj is not NULL

mattip pypy.commits at gmail.com
Mon Feb 25 02:25:25 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: newmemoryview-app-level
Changeset: r96157:42a82e91006e
Date: 2019-02-24 22:42 +0200
http://bitbucket.org/pypy/pypy/changeset/42a82e91006e/

Log:	w_userdata was unused, make sure view.obj is not NULL

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
@@ -41,7 +41,9 @@
     fill_Py_buffer(space, w_obj.view, view)
     try:
         view.c_buf = rffi.cast(rffi.VOIDP, w_obj.view.get_raw_address())
-        view.c_obj = make_ref(space, w_userdata)
+        # not used in PyPy to keep something alive,
+        # but some c-extensions check the type without checking for NULL
+        view.c_obj = make_ref(space.w_None)
         rffi.setintfield(view, 'c_readonly', w_obj.view.readonly)
     except ValueError:
         w_s = w_obj.descr_tobytes(space)


More information about the pypy-commit mailing list