[PATCH 1 of 8] mail: remove code to support < Python 2.7

Gregory Szorc gregory.szorc at gmail.com
Sat May 13 15:54:33 EDT 2017


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1494699164 25200
#      Sat May 13 11:12:44 2017 -0700
# Node ID 776aa5e07de8cab3a7382e14bf27b44dd7e9f086
# Parent  78496ac300255e9996b3e282086661afc08af37c
mail: remove code to support < Python 2.7

This code was added in 594b98846ce1. Since we no longer support
Python <2.7, it can be removed.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -24,26 +24,6 @@ from . import (
     util,
 )
 
-_oldheaderinit = email.header.Header.__init__
-def _unifiedheaderinit(self, *args, **kw):
-    """
-    Python 2.7 introduces a backwards incompatible change
-    (Python issue1974, r70772) in email.Generator.Generator code:
-    pre-2.7 code passed "continuation_ws='\t'" to the Header
-    constructor, and 2.7 removed this parameter.
-
-    Default argument is continuation_ws=' ', which means that the
-    behavior is different in <2.7 and 2.7
-
-    We consider the 2.7 behavior to be preferable, but need
-    to have an unified behavior for versions 2.4 to 2.7
-    """
-    # override continuation_ws
-    kw['continuation_ws'] = ' '
-    _oldheaderinit(self, *args, **kw)
-
-setattr(email.header.Header, '__init__', _unifiedheaderinit)
-
 class STARTTLS(smtplib.SMTP):
     '''Derived class to verify the peer certificate for STARTTLS.
 


More information about the Mercurial-devel mailing list