[pypy-commit] pypy issue-2592: pop and pop_end return values
mattip
pypy.commits at gmail.com
Thu Jun 22 16:24:44 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch: issue-2592
Changeset: r91632:7fc61a836a84
Date: 2017-06-22 23:09 +0300
http://bitbucket.org/pypy/pypy/changeset/7fc61a836a84/
Log: pop and pop_end return values
diff --git a/pypy/module/cpyext/sequence.py b/pypy/module/cpyext/sequence.py
--- a/pypy/module/cpyext/sequence.py
+++ b/pypy/module/cpyext/sequence.py
@@ -346,11 +346,11 @@
def pop(self, w_list, index):
w_list.switch_to_object_strategy()
- w_list.strategy.pop(w_list, index)
+ return w_list.strategy.pop(w_list, index)
def pop_end(self, w_list):
w_list.switch_to_object_strategy()
- w_list.strategy.pop_end(w_list)
+ return w_list.strategy.pop_end(w_list)
def insert(self, w_list, index, w_item):
w_list.switch_to_object_strategy()
diff --git a/pypy/module/cpyext/test/test_listobject.py b/pypy/module/cpyext/test/test_listobject.py
--- a/pypy/module/cpyext/test/test_listobject.py
+++ b/pypy/module/cpyext/test/test_listobject.py
@@ -154,7 +154,9 @@
l = module.newlist()
p = l.pop()
assert p == 1000
- assert l == [3, -5]
+ p = l.pop(0)
+ assert p == 3
+ assert l == [-5]
def test_list_macros(self):
"""The PyList_* macros cast, and calls expecting that build."""
More information about the pypy-commit
mailing list