Author: Matti Picus <matti.pi...@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', [ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit