@@ -191,7 +191,11 @@ chunk_is_line(const _PyTok_Chunk *chunk)
191191static _PyTok_ReadResult
192192next_prepared (struct tok_state * tok , _PyTok_Chunk * chunk )
193193{
194- const char * source_end = _PyTok_SourceData (& tok -> source ) + tok -> source .len ;
194+ if (tok -> source .len == 0 ) {
195+ return _PYTOK_READ_EOF ;
196+ }
197+ assert (tok -> source .bytes != NULL );
198+ const char * source_end = tok -> source .bytes + tok -> source .len ;
195199 if (tok -> inp == source_end ) {
196200 return _PYTOK_READ_EOF ;
197201 }
@@ -553,18 +557,15 @@ next_interactive(struct tok_state *tok, _PyTok_Chunk *chunk)
553557 _PyTok_ChunkClear (& decoded );
554558 return _PYTOK_READ_ERROR ;
555559 }
556- int implicit_newline ;
557560 chunk -> data = _PyTok_NormalizeNewlines (
558561 decoded .data , decoded .len , 0 , 0 ,
559- & chunk -> len , & implicit_newline );
562+ & chunk -> len , NULL );
560563 _PyTok_ChunkClear (& decoded );
561564 if (chunk -> data == NULL ) {
562- PyErr_NoMemory ();
563565 tok -> done = E_NOMEM ;
564566 return _PYTOK_READ_ERROR ;
565567 }
566568 chunk -> ownership = _PYTOK_CHUNK_PYMEM ;
567- chunk -> implicit_newline = implicit_newline ;
568569 return _PYTOK_READ_LINE ;
569570}
570571
@@ -656,10 +657,6 @@ _PyTok_ReaderUnderflow(struct tok_state *tok)
656657 }
657658
658659 Py_ssize_t scan_len = chunk .len ;
659- if (kind == _PYTOK_READER_INTERACTIVE &&
660- chunk .implicit_newline ) {
661- scan_len -- ;
662- }
663660 if (streaming ) {
664661 if (reset_buffer ) {
665662 reset_streaming_buffer (tok );
0 commit comments