@@ -177,7 +177,8 @@ next_prepared(struct tok_state *tok, _PyTok_Chunk *chunk)
177177 _PyTok_Span tail = {tok -> inp , tok -> source .base_offset + tok -> source .len };
178178 _PyTok_Off newline = _PyTok_SourceFindByte (& tok -> source , tail , '\n' );
179179 _PyTok_Span line = {tail .start , newline >= 0 ? newline + 1 : tail .end };
180- chunk -> data = (char * )_PyTok_SourceSpanView (& tok -> source , line , & chunk -> len );
180+ chunk -> data = (char * )_PyTok_SourceSpanView (
181+ & tok -> source , line , & chunk -> len );
181182 chunk -> ownership = _PYTOK_CHUNK_BORROWED ;
182183 chunk -> implicit_newline = line .end == tail .end &&
183184 tok -> reader -> prepared_final_newline_is_implicit ;
@@ -607,7 +608,7 @@ _PyTok_ReaderUnderflow(struct tok_state *tok)
607608 _PyTok_ReaderKind kind = reader -> kind ;
608609 int prepared = kind == _PYTOK_READER_PREPARED ;
609610 int streaming = reader_is_streaming (kind );
610- int reset_buffer = ! prepared && tok -> start < 0 &&
611+ int reset_buffer = tok -> start < 0 &&
611612 _PyLexer_CurrentFTString (tok ) == NULL ;
612613
613614 _PyTok_Chunk chunk ;
@@ -665,7 +666,7 @@ _PyTok_ReaderUnderflow(struct tok_state *tok)
665666 tok -> inp = source_start + chunk .len ;
666667 }
667668 else {
668- if (tok -> start < 0 && _PyLexer_CurrentFTString ( tok ) == NULL ) {
669+ if (reset_buffer ) {
669670 tok -> buf_offset = tok -> inp ;
670671 }
671672 tok -> inp += chunk .len ;
@@ -674,9 +675,11 @@ _PyTok_ReaderUnderflow(struct tok_state *tok)
674675
675676 tok -> lineno ++ ;
676677 if (kind == _PYTOK_READER_FILE &&
677- (reader -> encoding == NULL || strcmp (reader -> encoding , "utf-8" ) == 0 ) &&
678+ (reader -> encoding == NULL ||
679+ strcmp (reader -> encoding , "utf-8" ) == 0 ) &&
678680 !_PyTokenizer_ensure_utf8 (
679- _PyTok_SourcePointer (& tok -> source , tok -> cur ), tok , tok -> lineno )) {
681+ _PyTok_SourcePointer (& tok -> source , tok -> cur ),
682+ tok , tok -> lineno )) {
680683 _PyTok_ChunkClear (& chunk );
681684 return 0 ;
682685 }
0 commit comments