[pypy-commit] pypy default: fix issue #2592 - cpyext list.pop, pop_end must return a value
mattip
pypy.commits at gmail.com
Thu Jun 22 16:24:48 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r91634:ee2e575b6008
Date: 2017-06-22 23:11 +0300
http://bitbucket.org/pypy/pypy/changeset/ee2e575b6008/
Log: fix issue #2592 - cpyext list.pop, pop_end must return a value
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
@@ -151,6 +151,13 @@
# tp_as_sequence should be filled, but tp_as_number should be NULL
assert module.test_tp_as_() == 3
+ l = module.newlist()
+ p = l.pop()
+ assert p == 1000
+ p = l.pop(0)
+ assert p == 3
+ assert l == [-5]
+
def test_list_macros(self):
"""The PyList_* macros cast, and calls expecting that build."""
module = self.import_extension('foo', [
More information about the pypy-commit
mailing list