mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
The ansi_x3.4_1968 encoding is an alias for ascii, but isn't known in
Python 2.1.3. However it's required by the email tests suite, so poke it into the encodings aliases if it's missing. The is apparently the approved API for doing so. Now we can remove the hexversion shortcircuits in the test suite.
This commit is contained in:
parent
a2a07bce89
commit
d20b66537c
2 changed files with 9 additions and 12 deletions
|
@ -59,3 +59,12 @@ def message_from_file(fp, _class=None, strict=False):
|
|||
from email.Message import Message
|
||||
_class = Message
|
||||
return Parser(_class, strict=strict).parse(fp)
|
||||
|
||||
|
||||
|
||||
# Patch encodings.aliases to recognize 'ansi_x3.4_1968' which isn't a standard
|
||||
# alias in Python 2.1.3, but is used by the email package test suite.
|
||||
from encodings.aliases import aliases # The aliases dictionary
|
||||
if not aliases.has_key('ansi_x3.4_1968'):
|
||||
aliases['ansi_x3.4_1968'] = 'ascii'
|
||||
del aliases # Not needed any more
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue