René's URL Explorer Experiment


Title: Tokenize does not roundtrip {{ after \n · Issue #125008 · python/cpython · GitHub

Open Graph Title: Tokenize does not roundtrip {{ after \n · Issue #125008 · python/cpython

X Title: Tokenize does not roundtrip {{ after \n · Issue #125008 · python/cpython

Description: Bug report Bug description: import tokenize, io source_code = r''' f"""{80 * '*'}\n{{test}}{{details}}{{test2}}\n{80 * '*'}""" ''' tokens = tokenize.generate_tokens(io.StringIO(source_code).readline) x = tokenize.untokenize((t,s) for t, ...

Open Graph Description: Bug report Bug description: import tokenize, io source_code = r''' f"""{80 * '*'}\n{{test}}{{details}}{{test2}}\n{80 * '*'}""" ''' tokens = tokenize.generate_tokens(io.StringIO(source_code).readlin...

X Description: Bug report Bug description: import tokenize, io source_code = r''' f"""{80 * '*'}\n{{test}}{{details}}{{test2}}\n{80 * '*'}""" ''&#...

Opengraph URL: https://github.com/python/cpython/issues/125008

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tokenize does not roundtrip {{ after \\n","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n```python\r\nimport tokenize, io\r\nsource_code = r'''\r\nf\"\"\"{80 * '*'}\\n{{test}}{{details}}{{test2}}\\n{80 * '*'}\"\"\"\r\n'''\r\ntokens = tokenize.generate_tokens(io.StringIO(source_code).readline)\r\nx = tokenize.untokenize((t,s) for t, s, *_ in tokens)\r\nprint(x)\r\n```\r\n\r\nExpected:\r\n```\r\n\r\nf\"\"\"{80 *'*'}\\n{{test}}{{details}}{{test2}}\\n{80 *'*'}\"\"\"\r\n\r\n```\r\n\r\nGot:\r\n```\r\n\r\nf\"\"\"{80 *'*'}\\n{test}}{{details}}{{test2}}\\n{80 *'*'}\"\"\"\r\n\r\n```\r\n\r\nNote the absence of a second { in the {{ after the \\n — but in no other positions.\r\n\r\nUnlike some other roundtrip failures of tokenize, some of which are minor infelicities, this one actually creates a syntactically invalid program on roundtrip, which is quite bad. You get a `SyntaxError: f-string: single '}' is not allowed` when trying to use the results.\r\n\r\n### CPython versions tested on:\r\n\r\n3.12\r\n\r\n### Operating systems tested on:\r\n\r\nLinux, Windows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-125013\n* gh-125020\n* gh-125021\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/wyattscarpenter","@type":"Person","name":"wyattscarpenter"},"datePublished":"2024-10-05T17:48:05Z","url":"https://github.com/python/cpython/issues/125008"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3db6b3b7-02a2-c574-fbdc-87355730ae93
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9498:2B41BC:CF9EE7:11669F3:6B005231
html-safe-noncef32fb74b7a905fd902de2f89743ac131f6b8344c9c78d59ec0a1f1447c11d325
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDk4OjJCNDFCQzpDRjlFRTc6MTE2NjlGMzo2QjAwNTIzMSIsInZpc2l0b3JfaWQiOiIyNTgxNTE1MDAxNTcxMzMyNjU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac0a8fe4ff70ae822c82759ec04dd7e4acdfa6686e7e35ddf4fb28d43c7f2aa39b
hovercard-subject-tagissue:2568237292
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/125008/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3fa05ea88279b527f91f89f8c6f0ecb8e35e3974748b6db3cc0aa9c61dd52c3f/python/cpython/issues/125008
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3fa05ea88279b527f91f89f8c6f0ecb8e35e3974748b6db3cc0aa9c61dd52c3f/python/cpython/issues/125008
og:image:altBug report Bug description: import tokenize, io source_code = r''' f"""{80 * '*'}\n{{test}}{{details}}{{test2}}\n{80 * '*'}""" ''' tokens = tokenize.generate_tokens(io.StringIO(source_code).readlin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewyattscarpenter
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/125008#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F125008
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F125008
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/125008
Reloadhttps://github.com/python/cpython/issues/125008
Reloadhttps://github.com/python/cpython/issues/125008
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/125008
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/125008
Tokenize does not roundtrip {{ after \nhttps://github.com/python/cpython/issues/125008#top
https://github.com/pablogsal
https://github.com/lysnikolaou
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
topic-parserhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-parser%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/wyattscarpenter
wyattscarpenterhttps://github.com/wyattscarpenter
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issue-2568237292
gh-125008: Fix tokenize.untokenize roundtrip for \n{{ #125013https://github.com/python/cpython/pull/125013
[3.13] gh-125008: Fix tokenize.untokenize roundtrip for \n{{ (GH-125013) #125020https://github.com/python/cpython/pull/125020
[3.12] gh-125008: Fix tokenize.untokenize roundtrip for \n{{ (GH-125013) #125021https://github.com/python/cpython/pull/125021
wyattscarpenterhttps://github.com/wyattscarpenter
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Oct 5, 2024https://github.com/python/cpython/issues/125008#event-14528513452
https://github.com/wyattscarpenter
wyattscarpenterhttps://github.com/wyattscarpenter
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issuecomment-2395132666
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issuecomment-2395139905
PEP-701https://peps.python.org/701
AlexWaygoodhttps://github.com/AlexWaygood
pablogsalhttps://github.com/pablogsal
lysnikolaouhttps://github.com/lysnikolaou
on Oct 5, 2024https://github.com/python/cpython/issues/125008#event-14528568877
AlexWaygoodhttps://github.com/AlexWaygood
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
on Oct 5, 2024https://github.com/python/cpython/issues/125008#event-14528588973
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issuecomment-2395141894
Eclips4https://github.com/Eclips4
topic-parserhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-parser%22
on Oct 5, 2024https://github.com/python/cpython/issues/125008#event-14528656993
https://github.com/tomasr8
tomasr8https://github.com/tomasr8
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issuecomment-2395197075
https://github.com/tomasr8
tomasr8https://github.com/tomasr8
on Oct 5, 2024https://github.com/python/cpython/issues/125008#issuecomment-2395205539
cpython/Lib/tokenize.pyhttps://github.com/python/cpython/blob/16cd6cc86b3ba20074ae3eefb61aeb24ee1544f7/Lib/tokenize.py#L187-L208
16cd6cchttps://github.com/python/cpython/commit/16cd6cc86b3ba20074ae3eefb61aeb24ee1544f7
PRhttps://github.com/python/cpython/pull/115171
pablogsalhttps://github.com/pablogsal
on Oct 6, 2024https://github.com/python/cpython/issues/125008#event-14530576428
gh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (#125013)https://github.com/python/cpython/commit/db23b8bb13863fcd88ff91bc22398f8e0312039e
gh-125008https://github.com/python/cpython/issues/125008
#125013https://github.com/python/cpython/pull/125013
db23b8bhttps://github.com/python/cpython/commit/db23b8bb13863fcd88ff91bc22398f8e0312039e
miss-islingtonhttps://github.com/miss-islington
on Oct 6, 2024https://github.com/python/cpython/issues/125008#event-14530576883
pythongh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (pyth…https://github.com/miss-islington/cpython/commit/9b7c8af6ec1c5548fa8bd13791a1f1a70d8f17e0
pythongh-125008https://github.com/python/cpython/issues/125008
pyth…https://github.com/python/cpython/pull/125013
9b7c8afhttps://github.com/miss-islington/cpython/commit/9b7c8af6ec1c5548fa8bd13791a1f1a70d8f17e0
pythongh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (pyth…https://github.com/miss-islington/cpython/commit/acc2968085efe35a3eabfdf01ca5e21a5f82c14b
pythongh-125008https://github.com/python/cpython/issues/125008
pyth…https://github.com/python/cpython/pull/125013
acc2968https://github.com/miss-islington/cpython/commit/acc2968085efe35a3eabfdf01ca5e21a5f82c14b
pablogsalhttps://github.com/pablogsal
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 6, 2024https://github.com/python/cpython/issues/125008#event-14530579233
pablogsalhttps://github.com/pablogsal
on Oct 6, 2024https://github.com/python/cpython/issues/125008#event-14530614360
[3.12] gh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (GH-…https://github.com/python/cpython/commit/db4b382b1faad575a0f630d71462c610661235ea
gh-125008https://github.com/python/cpython/issues/125008
GH-…https://github.com/python/cpython/pull/125013
db4b382https://github.com/python/cpython/commit/db4b382b1faad575a0f630d71462c610661235ea
[3.13] gh-125008: Fix `tokenize.untokenize` roundtrip for `\n{{` (GH-…https://github.com/python/cpython/commit/b30da225cfe86f22d0d838af2c15908277191608
gh-125008https://github.com/python/cpython/issues/125008
GH-…https://github.com/python/cpython/pull/125013
b30da22https://github.com/python/cpython/commit/b30da225cfe86f22d0d838af2c15908277191608
wyattscarpenterhttps://github.com/wyattscarpenter
on Oct 7, 2024https://github.com/python/cpython/issues/125008#event-14532350937
implement workaround for \n{{ roundtripping bughttps://github.com/wyattscarpenter/mypy/commit/ef13623265fbb194e99d99e177162420673e2a8e
ef13623https://github.com/wyattscarpenter/mypy/commit/ef13623265fbb194e99d99e177162420673e2a8e
https://github.com/wyattscarpenter
wyattscarpenterhttps://github.com/wyattscarpenter
on Oct 26, 2024https://github.com/python/cpython/issues/125008#issuecomment-2439638938
https://github.com/hauntsaninja/mypy_primerhttps://github.com/hauntsaninja/mypy_primer
https://github.com/tomasr8
tomasr8https://github.com/tomasr8
on Oct 26, 2024https://github.com/python/cpython/issues/125008#issuecomment-2439664643
cpython/Lib/test/test_tokenize.pyhttps://github.com/python/cpython/blob/26d627779f79d8d5650fe7be348432eccc28f8f9/Lib/test/test_tokenize.py#L1822-L1835
26d6277https://github.com/python/cpython/commit/26d627779f79d8d5650fe7be348432eccc28f8f9
#126010https://github.com/python/cpython/pull/126010
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/125008
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/125008
lysnikolaouhttps://github.com/lysnikolaou
pablogsalhttps://github.com/pablogsal
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
topic-parserhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-parser%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.