Title: 3.12: tokenize adds a newline when it is not there · Issue #105259 · python/cpython · GitHub
Open Graph Title: 3.12: tokenize adds a newline when it is not there · Issue #105259 · python/cpython
X Title: 3.12: tokenize adds a newline when it is not there · Issue #105259 · python/cpython
Description: Bug report tokenize adds a concrete newline character when it is not present. this breaks any sort of roundtrip source generation and pycodestyle's end-of-file checker here's an example of a file containing a single byte (generated via e...
Open Graph Description: Bug report tokenize adds a concrete newline character when it is not present. this breaks any sort of roundtrip source generation and pycodestyle's end-of-file checker here's an example of a file c...
X Description: Bug report tokenize adds a concrete newline character when it is not present. this breaks any sort of roundtrip source generation and pycodestyle's end-of-file checker here's an example of ...
Opengraph URL: https://github.com/python/cpython/issues/105259
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3.12: tokenize adds a newline when it is not there","articleBody":"\u003c!--\r\n If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n# Bug report\r\n\r\ntokenize adds a concrete newline character when it is not present. this breaks any sort of roundtrip source generation and pycodestyle's end-of-file checker\r\n\r\nhere's an example of a file containing a single byte (generated via `echo -n 1 \u003e t.py`)\r\n\r\n```console\r\n# hd -c t.py \r\n00000000 31 |1|\r\n0000000 1 \r\n0000001\r\n# python3.12 -m tokenize t.py\r\n0,0-0,0: ENCODING 'utf-8' \r\n1,0-1,1: NUMBER '1' \r\n1,1-1,2: NEWLINE '\\n' \r\n2,0-2,0: ENDMARKER '' \r\n# python3.11 -m tokenize t.py\r\n0,0-0,0: ENCODING 'utf-8' \r\n1,0-1,1: NUMBER '1' \r\n1,1-1,2: NEWLINE '' \r\n2,0-2,0: ENDMARKER '' \r\n```\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: 3.12 dbd7d7c8e1\r\n- Operating system and architecture: ubuntu 22.04 LTS x86_64\r\n\r\ncc @pablogsal\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-105364\n* gh-105367\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/asottile","@type":"Person","name":"asottile"},"datePublished":"2023-06-02T22:32:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/105259/cpython/issues/105259"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e42da608-c9ec-df3a-2ff6-14710971b104 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7A2:22EDB8:CA8B77:111CEBE:696AC283 |
| html-safe-nonce | 49a889b51d54dc8c70adeba8cbbf802a121dee67a0e59cee15e95ab43eef8a41 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0EyOjIyRURCODpDQThCNzc6MTExQ0VCRTo2OTZBQzI4MyIsInZpc2l0b3JfaWQiOiI4OTI1ODY5MDUxNDE3OTAzNzQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c1524f2ca76fbcdad7ad717f6f54addbbb3eb946c8c27c8e145a00dba6ec29b7 |
| hovercard-subject-tag | issue:1738896877 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/105259/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a611c7a160b47ae43288b55911fd7dc05566bb5ccf99984f314a302c386914e/python/cpython/issues/105259 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a611c7a160b47ae43288b55911fd7dc05566bb5ccf99984f314a302c386914e/python/cpython/issues/105259 |
| og:image:alt | Bug report tokenize adds a concrete newline character when it is not present. this breaks any sort of roundtrip source generation and pycodestyle's end-of-file checker here's an example of a file c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | asottile |
| hostname | github.com |
| expected-hostname | github.com |
| None | 986b6a1d774985095564e64d6963d11f094da3d0e2bfda2ab1a27d63662eb033 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 89ad2112b9c4e11df6a0c13c8c1f8eedd36b0977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width