Title: untokenize of specially crafted escaped characters does not round trip properly · Issue #125821 · python/cpython · GitHub
Open Graph Title: untokenize of specially crafted escaped characters does not round trip properly · Issue #125821 · python/cpython
X Title: untokenize of specially crafted escaped characters does not round trip properly · Issue #125821 · python/cpython
Description: Bug report Bug description: this small program does not roundtrip through tokenize / untokenize -- it appears to mishandle the escaped quote as a \N{NAMED ESCAPE} bar = 1 print(f"{bar} \"{{SNOWMAN}} {{foo}}") this is what it produces aft...
Open Graph Description: Bug report Bug description: this small program does not roundtrip through tokenize / untokenize -- it appears to mishandle the escaped quote as a \N{NAMED ESCAPE} bar = 1 print(f"{bar} \"{{SNOWMAN}...
X Description: Bug report Bug description: this small program does not roundtrip through tokenize / untokenize -- it appears to mishandle the escaped quote as a \N{NAMED ESCAPE} bar = 1 print(f"{bar} \"...
Opengraph URL: https://github.com/python/cpython/issues/125821
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"untokenize of specially crafted escaped characters does not round trip properly","articleBody":"# Bug report\n\n### Bug description:\n\nthis small program does not roundtrip through `tokenize` / `untokenize` -- it appears to mishandle the escaped quote as a `\\N{NAMED ESCAPE}`\n\n```python\nbar = 1\nprint(f\"{bar} \\\"{{SNOWMAN}} {{foo}}\")\n```\n\nthis is what it produces after a round of untokenization:\n\n```console\n$ python3 t.py t3.py \nbar = 1\nprint(f\"{bar} \\\"{ SNOWMAN}} {{foo}}\")\n```\n\nannoyingly, `tokenize_rt` suffers from a different related bug which is why I was investigating this to begin with. an aside, the handling of curly braces in 3.12+ tokenization is a huge pain!\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/asottile","@type":"Person","name":"asottile"},"datePublished":"2024-10-21T23:35:32Z","url":"https://github.com/python/cpython/issues/125821"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:be065a08-7ee6-22e2-d4d1-66baec1d5150 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B8A:9EA06:2FD6:4451:6B005FB6 |
| html-safe-nonce | c059406a5554c44c1971be97d719081e909b5d3b8d7bfaa1e1d251bafca18df9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjhBOjlFQTA2OjJGRDY6NDQ1MTo2QjAwNUZCNiIsInZpc2l0b3JfaWQiOiIxMzAzOTkwNjkzMjA2NzEyMjQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 932e8648732417137acaacd00f434d063b2877b6fca2173ac07498e4b431ab7b |
| hovercard-subject-tag | issue:2603883855 |
| 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/125821/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de377e52276229ae04a1950b2bd6184d73f971e936a1481c8f261acd06d18314/python/cpython/issues/125821 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de377e52276229ae04a1950b2bd6184d73f971e936a1481c8f261acd06d18314/python/cpython/issues/125821 |
| og:image:alt | Bug report Bug description: this small program does not roundtrip through tokenize / untokenize -- it appears to mishandle the escaped quote as a \N{NAMED ESCAPE} bar = 1 print(f"{bar} \"{{SNOWMAN}... |
| 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 | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width