Author: Maciej Fijalkowski <[email protected]>
Branch: rpython-bytearray
Changeset: r59556:f65667ea3759
Date: 2012-12-26 12:21 +0200
http://bitbucket.org/pypy/pypy/changeset/f65667ea3759/
Log: one more test
diff --git a/pypy/rpython/rbytearray.py b/pypy/rpython/rbytearray.py
--- a/pypy/rpython/rbytearray.py
+++ b/pypy/rpython/rbytearray.py
@@ -9,7 +9,10 @@
class __extend__(pairtype(AbstractByteArrayRepr, AbstractByteArrayRepr)):
def rtype_add((r_b1, r_b2), hop):
- xxx
+ if hop.s_result.is_constant():
+ return hop.inputconst(r_b1, hop.s_result.const)
+ v_b1, v_b2 = hop.inputargs(r_b1, r_b2)
+ return hop.gendirectcall(r_b1.ll.ll_strconcat, v_b1, v_b2)
class __extend__(pairtype(AbstractByteArrayRepr, AbstractStringRepr)):
def rtype_add((r_b1, r_s2), hop):
diff --git a/pypy/rpython/test/test_rbytearray.py
b/pypy/rpython/test/test_rbytearray.py
--- a/pypy/rpython/test/test_rbytearray.py
+++ b/pypy/rpython/test/test_rbytearray.py
@@ -28,3 +28,9 @@
ll_res = self.interpret(f2, [llstr("def")])
assert hlbytearray(ll_res) == "defa"
+
+ def f3(x):
+ return bytearray(hlstr(x)) + bytearray("a")
+
+ ll_res = self.interpret(f3, [llstr("def")])
+ assert hlbytearray(ll_res) == "defa"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit