python issue30681 is fixed with Python 3.10
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
# along with pyquarantine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from sys import version_info
|
||||||
import encodings
|
import encodings
|
||||||
|
|
||||||
|
|
||||||
@@ -150,6 +151,24 @@ def get_obs_local_part(value):
|
|||||||
setattr(email._header_value_parser, "get_obs_local_part", get_obs_local_part)
|
setattr(email._header_value_parser, "get_obs_local_part", get_obs_local_part)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# add charset alias for windows-874 #
|
||||||
|
#######################################
|
||||||
|
#
|
||||||
|
# https://bugs.python.org/issue17254
|
||||||
|
#
|
||||||
|
# fix: https://github.com/python/cpython/pull/10237
|
||||||
|
|
||||||
|
aliases = encodings.aliases.aliases
|
||||||
|
|
||||||
|
for alias in ["windows-874", "windows_874"]:
|
||||||
|
if alias not in aliases:
|
||||||
|
aliases[alias] = "cp874"
|
||||||
|
|
||||||
|
setattr(encodings.aliases, "aliases", aliases)
|
||||||
|
|
||||||
|
|
||||||
|
if version_info.major == 3 and version_info.minor < 10:
|
||||||
# https://bugs.python.org/issue30681
|
# https://bugs.python.org/issue30681
|
||||||
#
|
#
|
||||||
# fix: https://github.com/python/cpython/pull/22090
|
# fix: https://github.com/python/cpython/pull/22090
|
||||||
@@ -210,20 +229,3 @@ def parse(cls, value, kwds):
|
|||||||
|
|
||||||
|
|
||||||
setattr(email.headerregistry.DateHeader, "parse", parse)
|
setattr(email.headerregistry.DateHeader, "parse", parse)
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# add charset alias for windows-874 #
|
|
||||||
#######################################
|
|
||||||
#
|
|
||||||
# https://bugs.python.org/issue17254
|
|
||||||
#
|
|
||||||
# fix: https://github.com/python/cpython/pull/10237
|
|
||||||
|
|
||||||
aliases = encodings.aliases.aliases
|
|
||||||
|
|
||||||
for alias in ["windows-874", "windows_874"]:
|
|
||||||
if alias not in aliases:
|
|
||||||
aliases[alias] = "cp874"
|
|
||||||
|
|
||||||
setattr(encodings.aliases, "aliases", aliases)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user