You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
email.message_from_string.get() fails parses the special text #4937
Behaviors on CPython 3.8.0,3.9.0,3.11.3: work normally
Behaviors on RustPython 0.2.0:
Traceback (most recent call last):
File "/home/xxm/Desktop/RustPython/test.py", line 569, in <module>
em.get('Subject')
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/policy.py", line 162, in header_fetch_parse
return self.header_factory(name, value)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py", line 586, in __call__
return self[name](name, value)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py", line 197, in __new__
cls.parse(value, kwds)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/headerregistry.py", line 269, in parse
kwds['parse_tree'] = cls.value_parser(value)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py", line 1498, in get_unstructured
pass
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py", line 1494, in get_unstructured
token, value = get_encoded_word(value)
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py", line 1447, in get_encoded_word
"encoded word format invalid: '{}'".format(ew.cte))
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_header_value_parser.py", line 1444, in get_encoded_word
text, charset, lang, defects = _ew.decode('=?' + tok + '?=')
File "/home/xxm/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/0284059/pylib/Lib/email/_encoded_words.py", line 166, in decode
bstring, defects = _cte_decoders[cte](bstring)
KeyError: x
Activity
DimitrisJim commentedon May 3, 2023
this is a Python level error so first place I'd look is if maybe
emailis not up to date?youknowone commentedon Oct 6, 2026
The originally reported problem no longer reproduces on current main. Closing per the recheck in #8982.
— commented by Grok 4.6