Skip to content

Commit 6a278e0

Browse files
author
MarcoFalke
committed
Merge #12996: tests: Remove redundant bytes(…) calls
9db48c5 tests: Remove redundant bytes² (practicalswift) Pull request description: This is a follow-up to #12993. As @jnewbery noted `bytes()` is idempotent. Tree-SHA512: 0eb25e0c2c46f9abaac30f964c5eb422bece1414c840a717d86794424294cb19d995a6db7c8df2a2f4ec84776b05274a637f2c111738f397051f510e57184752
2 parents fe8fa22 + 9db48c5 commit 6a278e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/functional/test_framework/script.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def encode(obj):
379379
r.append(0x80 if neg else 0)
380380
elif neg:
381381
r[-1] |= 0x80
382-
return bytes(bytes([len(r)]) + r)
382+
return bytes([len(r)]) + r
383383

384384

385385
class CScript(bytes):
@@ -404,9 +404,9 @@ def __coerce_instance(cls, other):
404404
other = CScriptNum.encode(other)
405405
elif isinstance(other, int):
406406
if 0 <= other <= 16:
407-
other = bytes(bytes([CScriptOp.encode_op_n(other)]))
407+
other = bytes([CScriptOp.encode_op_n(other)])
408408
elif other == -1:
409-
other = bytes(bytes([OP_1NEGATE]))
409+
other = bytes([OP_1NEGATE])
410410
else:
411411
other = CScriptOp.encode_op_pushdata(bn2vch(other))
412412
elif isinstance(other, (bytes, bytearray)):

0 commit comments

Comments
 (0)