[pypy-commit] pypy buffer-interface: use make_ref which has a keepalive_until_here() (arigato)
mattip
pypy.commits at gmail.com
Mon Sep 5 10:40:45 EDT 2016
Author: Matti Picus <matti.picus at gmail.com>
Branch: buffer-interface
Changeset: r86882:948af0843de0
Date: 2016-09-05 17:40 +0300
http://bitbucket.org/pypy/pypy/changeset/948af0843de0/
Log: use make_ref which has a keepalive_until_here() (arigato)
diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
--- a/pypy/module/cpyext/buffer.py
+++ b/pypy/module/cpyext/buffer.py
@@ -3,7 +3,7 @@
from rpython.rlib.rarithmetic import widen
from pypy.module.cpyext.api import (
cpython_api, CANNOT_FAIL, Py_buffer, Py_TPFLAGS_HAVE_NEWBUFFER, Py_ssize_tP)
-from pypy.module.cpyext.pyobject import PyObject, as_pyobj, incref
+from pypy.module.cpyext.pyobject import PyObject, make_ref, incref
@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
def PyObject_CheckBuffer(space, pyobj):
@@ -41,8 +41,7 @@
except ValueError:
raise BufferError("could not create buffer from object")
view.c_len = buf.getlength()
- view.c_obj = as_pyobj(space, w_obj)
- incref(space, view.c_obj)
+ view.c_obj = make_ref(space, w_obj)
ndim = buf.getndim()
view.c_itemsize = buf.getitemsize()
rffi.setintfield(view, 'c_readonly', int(buf.readonly))
More information about the pypy-commit
mailing list