Author: Antonio Cuni <[email protected]>
Branch:
Changeset: r55221:3bb8238312eb
Date: 2012-05-31 11:53 +0200
http://bitbucket.org/pypy/pypy/changeset/3bb8238312eb/
Log: kill support for passing integers to bytearray.count. It does not
work on CPython
diff --git a/pypy/objspace/std/bytearrayobject.py
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -285,19 +285,6 @@
def str__Bytearray(space, w_bytearray):
return space.wrap(''.join(w_bytearray.data))
-def str_count__Bytearray_Int_ANY_ANY(space, w_bytearray, w_char, w_start,
w_stop):
- char = w_char.intval
- bytearray = w_bytearray.data
- length = len(bytearray)
- start, stop = slicetype.unwrap_start_stop(
- space, length, w_start, w_stop, False)
- count = 0
- for i in range(start, min(stop, length)):
- c = w_bytearray.data[i]
- if ord(c) == char:
- count += 1
- return space.wrap(count)
-
def str_count__Bytearray_ANY_ANY_ANY(space, w_bytearray, w_char, w_start,
w_stop):
w_char = space.wrap(space.bufferstr_new_w(w_char))
w_str = str__Bytearray(space, w_bytearray)
diff --git a/pypy/objspace/std/test/test_bytearrayobject.py
b/pypy/objspace/std/test/test_bytearrayobject.py
--- a/pypy/objspace/std/test/test_bytearrayobject.py
+++ b/pypy/objspace/std/test/test_bytearrayobject.py
@@ -168,7 +168,6 @@
assert bytearray('hello').count('l') == 2
assert bytearray('hello').count(bytearray('l')) == 2
assert bytearray('hello').count(memoryview('l')) == 2
- assert bytearray('hello').count(ord('l')) == 2
assert bytearray('hello').index('e') == 1
assert bytearray('hello').rindex('l') == 3
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit