Skip to content

Commit 07d2d2a

Browse files
committed
Merge #12475: qa: Fix python TypeError in script.py
fa41d68 qa: Fix python TypeError in script.py (MarcoFalke) Pull request description: `__repr__` returns string, so don't mix it with byte strings. This fixes ``` TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' Tree-SHA512: fac06e083f245209bc8a36102217580b0f6186842f4e52a686225111b0b96ff93c301640ff5e7ddef6a5b4f1689071b16a9a8dc80f28e2b060ddee29edd24ec7
2 parents ce56fdd + fa41d68 commit 07d2d2a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/functional/test_framework/script.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,9 @@ def __iter__(self):
526526
yield CScriptOp(opcode)
527527

528528
def __repr__(self):
529-
# For Python3 compatibility add b before strings so testcases don't
530-
# need to change
531529
def _repr(o):
532530
if isinstance(o, bytes):
533-
return b"x('%s')" % hexlify(o).decode('ascii')
531+
return "x('%s')" % hexlify(o).decode('ascii')
534532
else:
535533
return repr(o)
536534

0 commit comments

Comments
 (0)