#include "Python.h" #include "errcode.h" #include "state.h" /* Traverse and remember all f-string buffers, in order to be able to restore them after reallocating tok->buf */ void _PyLexer_remember_fstring_buffers(struct tok_state *tok) { … } /* Traverse and restore all f-string buffers after reallocating tok->buf */ void _PyLexer_restore_fstring_buffers(struct tok_state *tok) { … } /* Read a line of text from TOK into S, using the stream in TOK. Return NULL on failure, else S. On entry, tok->decoding_buffer will be one of: 1) NULL: need to call tok->decoding_readline to get a new line 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and stored the result in tok->decoding_buffer 3) PyByteArrayObject *: previous call to tok_readline_recode did not have enough room (in the s buffer) to copy entire contents of the line read by tok->decoding_readline. tok->decoding_buffer has the overflow. In this case, tok_readline_recode is called in a loop (with an expanded buffer) until the buffer ends with a '\n' (or until the end of the file is reached): see tok_nextc and its calls to tok_reserve_buf. */ int _PyLexer_tok_reserve_buf(struct tok_state *tok, Py_ssize_t size) { … }