Title: email.message_from_string.get() fails parses the special text · Issue #4937 · RustPython/RustPython · GitHub
Open Graph Title: email.message_from_string.get() fails parses the special text · Issue #4937 · RustPython/RustPython
X Title: email.message_from_string.get() fails parses the special text · Issue #4937 · RustPython/RustPython
Description: email.message_from_string.get() fails parses the special text "Subject:=?us-ascii?X?value?=", See the following example. test.py import email import email.policy mytext = "Subject:=?us-ascii?X?value?=" em = email.message_from_string(myte...
Open Graph Description: email.message_from_string.get() fails parses the special text "Subject:=?us-ascii?X?value?=", See the following example. test.py import email import email.policy mytext = "Subject:=?us-ascii?X?valu...
X Description: email.message_from_string.get() fails parses the special text "Subject:=?us-ascii?X?value?=", See the following example. test.py import email import email.policy mytext = "Subject:=?...
Opengraph URL: https://github.com/RustPython/RustPython/issues/4937
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"email.message_from_string.get() fails parses the special text","articleBody":"email.message_from_string.get() fails parses the special text \"Subject:=?us-ascii?X?value?=\", See the following example.\r\n\r\ntest.py\r\n```\r\nimport email\r\nimport email.policy\r\n\r\nmytext = \"Subject:=?us-ascii?X?value?=\"\r\nem = email.message_from_string(mytext, policy=email.policy.default)\r\nem.get('Subject')\r\n\r\n```\r\n\r\nBehaviors on CPython 3.8.0,3.9.0,3.11.3: work normally\r\n\r\nBehaviors on RustPython 0.2.0:\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"/home/xxm/Desktop/RustPython/test.py\", line 569, in \u003cmodule>\r\n em.get('Subject')\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/message.py\", line 471, in get\r\n return self.policy.header_fetch_parse(k, v)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/policy.py\", line 162, in header_fetch_parse\r\n return self.header_factory(name, value)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py\", line 586, in __call__\r\n return self[name](name, value)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py\", line 197, in __new__\r\n cls.parse(value, kwds)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py\", line 269, in parse\r\n kwds['parse_tree'] = cls.value_parser(value)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py\", line 1498, in get_unstructured\r\n pass\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py\", line 1494, in get_unstructured\r\n token, value = get_encoded_word(value)\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py\", line 1447, in get_encoded_word\r\n \"encoded word format invalid: '{}'\".format(ew.cte))\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py\", line 1444, in get_encoded_word\r\n text, charset, lang, defects = _ew.decode('=?' + tok + '?=')\r\n File \"/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_encoded_words.py\", line 166, in decode\r\n bstring, defects = _cte_decoders[cte](bstring)\r\nKeyError: x\r\n```\r\n\r\n\r\nEnvironment:\r\nUbuntu 18.04\r\nRustPython 0.2.0 [0284059](https://github.com/RustPython/RustPython/commit/02840593bc56ae416ba2646166628f1712d6cf43)\r\nCPython 3.8.0, 3.9.0, 3.11.3","author":{"url":"https://github.com/xiaxinmeng","@type":"Person","name":"xiaxinmeng"},"datePublished":"2023-04-28T06:04:10Z","url":"https://github.com/RustPython/RustPython/issues/4937"}
| 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:cfa5fa35-75f6-c6a7-a6c4-227197671a01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1B2:157BA1:2F5E1A:40104B:6B002719 |
| html-safe-nonce | 010ae34ebce4b447dfd1455bf89925977351645f0b18e5a5fdb8941390c34282 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUIyOjE1N0JBMToyRjVFMUE6NDAxMDRCOjZCMDAyNzE5IiwidmlzaXRvcl9pZCI6IjI0ODEyMTI1MzQzNjM3OTMxNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 35cb75ebcacce56f0cf69c87ab7f2daac0f5c78a181c4f71a993e80a2d18b244 |
| hovercard-subject-tag | issue:1687953898 |
| 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/RustPython/RustPython/4937/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ce43e8948680c50601317e08564f712f3c01ffefb9b406d07a8e795b14fe9b2c/RustPython/RustPython/issues/4937 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ce43e8948680c50601317e08564f712f3c01ffefb9b406d07a8e795b14fe9b2c/RustPython/RustPython/issues/4937 |
| og:image:alt | email.message_from_string.get() fails parses the special text "Subject:=?us-ascii?X?value?=", See the following example. test.py import email import email.policy mytext = "Subject:=?us-ascii?X?valu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xiaxinmeng |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width