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

login
register
mail settings
Submitter Gregory Szorc
Date May 13, 2017, 7:54 p.m.
Message ID <776aa5e07de8cab3a738.1494705273@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/20605/
State Accepted
Headers show

Comments

Gregory Szorc - May 13, 2017, 7:54 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.
Yuya Nishihara - May 14, 2017, 4:30 a.m.
On Sat, 13 May 2017 12:54:33 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@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

Queued with delight, thanks.

Patch

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.