Skip to content

Commit 346a6cc

Browse files
committed
Corrected the "oops" dump
Now works in both Python 2 and 3
1 parent 1942522 commit 346a6cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javaobj.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
# Standard library
4646
import logging
47+
import os
4748
import struct
4849
import sys
4950

@@ -787,6 +788,9 @@ def _create_hexdump(self, src, length=16):
787788
for x in range(256))
788789
pattern = "{{0:04X}} {{1:<{0}}} {{2}}\n".format(length * 3)
789790

791+
# Convert raw data to str (Python 3 compatibility)
792+
src = to_str(src, 'latin-1')
793+
790794
result = []
791795
for i in range(0, len(src), length):
792796
s = src[i:i + length]
@@ -869,7 +873,8 @@ def _oops_dump_state(self):
869873
log_error("Stream seeking back at -16 byte (2nd line is an actual "
870874
"position!):")
871875

872-
self.object_stream.seek(-16, mode=1)
876+
# Do not use a keyword argument
877+
self.object_stream.seek(-16, os.SEEK_CUR)
873878
the_rest = self.object_stream.read()
874879

875880
if len(the_rest):

0 commit comments

Comments
 (0)