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:
196196 codes = self ._new_charset ("B" )
197197 elif char in code128 .A :
198198 codes = self ._new_charset ("A" )
199+ assert self ._charset != "C"
199200 if len (self ._digit_buffer ) == 1 :
201+ # Flush the remaining single digit from the buffer
200202 codes .append (self ._convert (self ._digit_buffer [0 ]))
201203 self ._digit_buffer = ""
202204 elif self ._charset == "B" :
@@ -268,7 +270,8 @@ def _build(self) -> list[int]:
268270 code_num = self ._convert_or_buffer (char )
269271 if code_num is not None :
270272 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.
272275 if len (self ._digit_buffer ) == 1 :
273276 encoded .extend (self ._new_charset ("B" ))
274277 encoded .append (self ._convert (self ._digit_buffer [0 ]))
You can’t perform that action at this time.
0 commit comments