Skip to content

Commit

Permalink
fix Python 3 buffer handling (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas authored Aug 16, 2019
1 parent 119a66d commit ab39f35
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/genpy/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,11 @@ def get_printable_message_args(msg, buff=None, prefix=''):
"""
try:
from cStringIO import StringIO # Python 2.x
python3 = 0
except ImportError:
from io import BytesIO # Python 3.x
python3 = 1
from io import StringIO # Python 3.x

if buff is None:
if python3 == 1:
buff = BytesIO()
else:
buff = StringIO()
buff = StringIO()
for f in msg.__slots__:
if isinstance(getattr(msg, f), Message):
get_printable_message_args(getattr(msg, f), buff=buff, prefix=(prefix+f+'.'))
Expand Down

0 comments on commit ab39f35

Please sign in to comment.