Author: Simon Cross <[email protected]>
Branch: remove-string-smm
Changeset: r63429:b969a2ea3352
Date: 2013-04-16 22:09 +0200
http://bitbucket.org/pypy/pypy/changeset/b969a2ea3352/
Log: Use new 'chr' unwrap spec to fix bytearray.insert.
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
@@ -62,12 +62,7 @@
return space.newbytearray(lst)
- def descr_insert(self, space, index, w_val):
- if isinstance(val, int):
- val = chr(val)
- elif len(val) != 1:
- raise OperationError(space.w_ValueError,
- space.wrap("string must be of size 1"))
+ def descr_insert(self, space, index, val):
self.data.insert(index, val)
return space.w_None
diff --git a/pypy/objspace/std/bytearraytype.py
b/pypy/objspace/std/bytearraytype.py
--- a/pypy/objspace/std/bytearraytype.py
+++ b/pypy/objspace/std/bytearraytype.py
@@ -36,8 +36,8 @@
"""
raise NotImplementedError
- @unwrap_spec(index=int)
- def descr_insert(self, space, index, w_val):
+ @unwrap_spec(index=int, val='chr')
+ def descr_insert(self, space, index, val):
"""B.insert(index, int) -> None
Insert a single item into the bytearray before the given index.
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit