File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,9 @@ def look_next():
184
184
codes = self ._new_charset ("B" )
185
185
elif char in code128 .A :
186
186
codes = self ._new_charset ("A" )
187
+ assert self ._charset != "C"
187
188
if len (self ._digit_buffer ) == 1 :
189
+ # Flush the remaining single digit from the buffer
188
190
codes .append (self ._convert (self ._digit_buffer [0 ]))
189
191
self ._digit_buffer = ""
190
192
elif self ._charset == "B" :
@@ -256,7 +258,8 @@ def _build(self):
256
258
code_num = self ._convert_or_buffer (char )
257
259
if code_num is not None :
258
260
encoded .append (code_num )
259
- # Finally look in the buffer
261
+ # If we finish in charset C with a single digit remaining in the buffer,
262
+ # switch to charset B and flush out the buffer.
260
263
if len (self ._digit_buffer ) == 1 :
261
264
encoded .extend (self ._new_charset ("B" ))
262
265
encoded .append (self ._convert (self ._digit_buffer [0 ]))
You can’t perform that action at this time.
0 commit comments