Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r83497:c945e9acf8f8
Date: 2016-04-01 17:03 +0300
http://bitbucket.org/pypy/pypy/changeset/c945e9acf8f8/
Log: test, implement more strategy methods, remove methods implemented in
base class
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
@@ -320,18 +320,6 @@
def getitems_copy(self, w_list):
raise NotImplementedError
- def getitems_bytes(self, w_list):
- return None
-
- def getitems_unicode(self, w_list):
- return None
-
- def getitems_int(self, w_list):
- return None
-
- def getitems_float(self, w_list):
- return None
-
def getstorage_copy(self, w_list):
raise NotImplementedError
@@ -339,11 +327,9 @@
w_list.switch_to_object_strategy()
w_list.strategy.append(w_list, w_item)
- def mul(self, w_list, times):
- raise NotImplementedError
-
def inplace_mul(self, w_list, times):
- raise NotImplementedError
+ w_list.switch_to_object_strategy()
+ w_list.strategy.inplace_mul(w_list, times)
def deleteslice(self, w_list, start, step, slicelength):
raise NotImplementedError
diff --git a/pypy/module/cpyext/test/test_sequence.py
b/pypy/module/cpyext/test/test_sequence.py
--- a/pypy/module/cpyext/test/test_sequence.py
+++ b/pypy/module/cpyext/test/test_sequence.py
@@ -190,6 +190,14 @@
w_sum = space.add(w_l, w_l)
assert space.int_w(space.len(w_sum)) == 10
+ api.PySequence_Fast(w_l, "foo") # converts
+ w_prod = space.mul(w_l, space.wrap(2))
+ assert space.int_w(space.len(w_prod)) == 10
+
+ api.PySequence_Fast(w_l, "foo") # converts
+ w_l.inplace_mul(2)
+ assert space.int_w(space.len(w_l)) == 10
+
class XAppTestSequenceObject(AppTestCpythonExtensionBase):
def test_sequenceobject(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit