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 @@ -196,7 +196,9 @@ def look_next() -> bool:
196
196
codes = self ._new_charset ("B" )
197
197
elif char in code128 .A :
198
198
codes = self ._new_charset ("A" )
199
+ assert self ._charset != "C"
199
200
if len (self ._digit_buffer ) == 1 :
201
+ # Flush the remaining single digit from the buffer
200
202
codes .append (self ._convert (self ._digit_buffer [0 ]))
201
203
self ._digit_buffer = ""
202
204
elif self ._charset == "B" :
@@ -268,7 +270,8 @@ def _build(self) -> list[int]:
268
270
code_num = self ._convert_or_buffer (char )
269
271
if code_num is not None :
270
272
encoded .append (code_num )
271
- # Finally look in the buffer
273
+ # If we finish in charset C with a single digit remaining in the buffer,
274
+ # switch to charset B and flush out the buffer.
272
275
if len (self ._digit_buffer ) == 1 :
273
276
encoded .extend (self ._new_charset ("B" ))
274
277
encoded .append (self ._convert (self ._digit_buffer [0 ]))
You can’t perform that action at this time.
0 commit comments