[pypy-commit] pypy default: fix translation
mattip
pypy.commits at gmail.com
Sat May 20 17:07:32 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r91356:c971f0f22925
Date: 2017-05-20 23:45 +0300
http://bitbucket.org/pypy/pypy/changeset/c971f0f22925/
Log: fix translation
diff --git a/pypy/module/cpyext/listobject.py b/pypy/module/cpyext/listobject.py
--- a/pypy/module/cpyext/listobject.py
+++ b/pypy/module/cpyext/listobject.py
@@ -27,7 +27,6 @@
@always_inline
def get_list_storage(space, w_list):
from pypy.module.cpyext.sequence import CPyListStrategy
- assert isinstance(w_list, W_ListObject)
w_list.convert_to_cpy_strategy(space)
return CPyListStrategy.unerase(w_list.lstorage)
@@ -40,6 +39,7 @@
discard a reference to any item that it being replaced; any reference in
list at position i will be leaked.
"""
+ assert isinstance(w_list, W_ListObject)
storage = get_list_storage(space, w_list)
assert 0 <= index < w_list.length()
storage._elems[index] = py_item
@@ -53,10 +53,10 @@
an item already in the list at the affected position.
"""
if not isinstance(w_list, W_ListObject):
- decref(space, w_item)
+ decref(space, py_item)
PyErr_BadInternalCall(space)
if index < 0 or index >= w_list.length():
- decref(space, w_item)
+ decref(space, py_item)
raise oefmt(space.w_IndexError, "list assignment index out of range")
storage = get_list_storage(space, w_list)
py_old = storage._elems[index]
@@ -66,6 +66,7 @@
@cpython_api([rffi.VOIDP, Py_ssize_t], PyObject, result_is_ll=True)
def PyList_GET_ITEM(space, w_list, index):
+ assert isinstance(w_list, W_ListObject)
storage = get_list_storage(space, w_list)
assert 0 <= index < w_list.length()
return storage._elems[index] # borrowed ref
More information about the pypy-commit
mailing list