Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tokenize.py emits spurious NEWLINE if file ends on a comment without a newline #105435

Closed
Assignees
lysnikolaou
Labels
type-bugAn unexpected behavior, bug, or error
@aroberge

Description

@aroberge

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'

Linked PRs

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp