Skip to content

Commit 7a92a27

Browse files
committed
Better Py2 compatibility for V2
1 parent 5797069 commit 7a92a27

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

javaobj/v2/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
Mimics the core API with the new deserializer
44
"""
55

6-
from io import BytesIO
76
from typing import Any, IO, Iterable
87

8+
try:
9+
# Python 2
10+
from StringIO import StringIO as BytesIO
11+
except ImportError:
12+
# Python 3+
13+
from io import BytesIO
14+
915
from .api import ObjectTransformer
1016
from .core import JavaStreamParser
1117
from .transformers import DefaultObjectTransformer, NumpyArrayTransformer

0 commit comments

Comments
 (0)