Skip to content

Commit

Permalink
Fix byte-code conversion in new command_mode code
Browse files Browse the repository at this point in the history
The new command_mode code introduced buffering for the byte
codes returned by the serial port, but failed to take into account
Python 3's more strict bytecode/unicode separation.

Fix that by making the buffer a strict bytecode type.

Move the version to 2.0.2 to reflect this important bugfix.
  • Loading branch information
tbird20d committed Feb 8, 2020
1 parent 25e353e commit 293e5d7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions grabserial
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# * restart based on received bytes?
#
# CHANGELOG:
# 2020.02.08 - Version 2.0.2
# - fix byte-string conversion bug introduced by command_mode changes
# (Dang this unicode/bytecode handling in Python 3.0 is a pain!)
# 2020.02.08 - Version 2.0.1
# - rename instantpat to inlinepat (all logic is the same)
# - preserve old --instantpat argument name for compatibility
Expand Down Expand Up @@ -177,7 +180,7 @@ except ImportError:

import serial

VERSION = (2, 0, 1)
VERSION = (2, 0, 2)

verbose = 0 # pylint: disable=I0011,C0103
cmdinput = u"" # pylint: disable=I0011,C0103
Expand Down Expand Up @@ -519,7 +522,7 @@ def grab(arglist, outputfd=sys.stdout):
linetime = 0
newline = 1
curline = ""
xline = ""
xline = b""
vprint("Use Control-C to stop...")

try:
Expand Down Expand Up @@ -734,7 +737,7 @@ def grab(arglist, outputfd=sys.stdout):
elapsed = 0
prev1 = 0
curline = ""
xline = ""
xline = b""
sys.stdout.flush()
if out:
out.flush()
Expand Down

0 comments on commit 293e5d7

Please sign in to comment.