Skip to content

Commit

Permalink
Merge branch 'italomaia-bytearray-datatype'
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Oct 20, 2016
2 parents e3c31c0 + 8480431 commit c2d0b08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/common/org/python/types/Int.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,15 @@ public org.python.Object __mul__(org.python.Object other) {
return other.__mul__(this);
} else if (other instanceof org.python.types.Bytes){
byte[] other_value = ((org.python.types.Bytes) other).value;
} else if (other instanceof org.python.types.ByteArray) {
byte[] other_value = ((org.python.types.ByteArray) other).value;
int value = Math.max(0, (int) this.value);
int len = other_value.length;
byte[] bytes = new byte[value * len];
for(int i=0; i < value; i++){
System.arraycopy(other_value, 0, bytes, i * len, len);
}
return new org.python.types.Bytes(bytes);
return new org.python.types.ByteArray(bytes);
}
throw new org.python.exceptions.TypeError("unsupported operand type(s) for *: 'int' and '" + other.typeName() + "'");
}
Expand Down
1 change: 0 additions & 1 deletion tests/datatypes/test_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class BinaryIntOperationTests(BinaryOperationTestCase, TranspileTestCase):
'test_modulo_complex',
'test_modulo_frozenset',

'test_multiply_bytearray',
'test_multiply_class',
'test_multiply_complex',
'test_multiply_frozenset',
Expand Down

0 comments on commit c2d0b08

Please sign in to comment.