Title: `\r`s introduced after codec decoding cause `SystemError` · Issue #145234 · python/cpython · GitHub
Open Graph Title: `\r`s introduced after codec decoding cause `SystemError` · Issue #145234 · python/cpython
X Title: `\r`s introduced after codec decoding cause `SystemError` · Issue #145234 · python/cpython
Description: Bug report Bug description: Found by OSS-Fuzz. The testcase is: #coding=U7+AA0'' resulting in: $ ./python -c "import py_compile; py_compile.compile('testcase')" Sorry: SystemError: Parser/string_parser.c:286: bad argument to internal fun...
Open Graph Description: Bug report Bug description: Found by OSS-Fuzz. The testcase is: #coding=U7+AA0'' resulting in: $ ./python -c "import py_compile; py_compile.compile('testcase')" Sorry: SystemError: Parser/string_pa...
X Description: Bug report Bug description: Found by OSS-Fuzz. The testcase is: #coding=U7+AA0'' resulting in: $ ./python -c "import py_compile; py_compile.compile('testcase')" Sorry: Sys...
Opengraph URL: https://github.com/python/cpython/issues/145234
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`\\r`s introduced after codec decoding cause `SystemError`","articleBody":"# Bug report\n\n### Bug description:\n\n[Found by OSS-Fuzz](https://issues.oss-fuzz.com/issues/464230016).\n\nThe testcase is:\n\n```py\n#coding=U7+AA0''\n```\n\nresulting in:\n\n```\n$ ./python -c \"import py_compile; py_compile.compile('testcase')\"\nSorry: SystemError: Parser/string_parser.c:286: bad argument to internal function\n```\n\nI gather this is because `+AA0` decodes to `\\r` in UTF-7, however, `_PyTokenizer_translate_newlines` is called before the codec decoding so it slips by and blows up (at least it apologizes😆). I think it could be fixed by calling `_PyTokenizer_translate_newlines` again after decoding if a `\\r` is introduced, WDYT?\n\ncc @lysnikolaou @pablogsal \n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-145276\n* gh-145281\n* gh-145310\n* gh-145312\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/StanFromIreland","@type":"Person","name":"StanFromIreland"},"datePublished":"2026-02-25T21:25:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/145234/cpython/issues/145234"}
| 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:e792eefc-331e-9685-a5e5-79fc35d41f3b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B20E:16C3D3:654126A:8E42600:6A50319C |
| html-safe-nonce | 493d1a3f98a7b4f0a453e15a89eb02e22172c0851372f23f4fcb9e128173c63e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjBFOjE2QzNEMzo2NTQxMjZBOjhFNDI2MDA6NkE1MDMxOUMiLCJ2aXNpdG9yX2lkIjoiNTU5ODg5MjI5MzM3NTQwNjQ5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fc8342767d1ccbf691eb2f626cccef6cc2fd53b31a9c2ad2f6861b41e589e174 |
| hovercard-subject-tag | issue:3991913891 |
| 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/145234/issue_layout |
| twitter:image | https://opengraph.githubassets.com/15e258849cea4b097afac625ab9c4e13c209c46aaf4e97fb6e5f62754891ba9e/python/cpython/issues/145234 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/15e258849cea4b097afac625ab9c4e13c209c46aaf4e97fb6e5f62754891ba9e/python/cpython/issues/145234 |
| og:image:alt | Bug report Bug description: Found by OSS-Fuzz. The testcase is: #coding=U7+AA0'' resulting in: $ ./python -c "import py_compile; py_compile.compile('testcase')" Sorry: SystemError: Parser/string_pa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | StanFromIreland |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | d90666eaf032b7eb8975a378efe38e37f4ebb96c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width