Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
This issue, which was reported inhttps://bugs.python.org/issue35107#msg328884 for much older Python versions in the case where a file ended on a comment, has resurfaced for Python 3.12.
Python 3.12.0b2 (tags/v3.12.0b2:e6c0efa, Jun 6 2023, 15:37:48) [MSC v.1935 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import tokenize>>> import io>>> tokenize.untokenize(tokenize.generate_tokens(io.StringIO('#').readline))'#\n'Note that the problem also arises in the following example:
>>> tokenize.untokenize(tokenize.generate_tokens(io.StringIO('a\n ').readline))'a\n \n'