# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-05-17 00:02:36 # Node ID bac14dbbbfab840cb683f842ba52d959f5585ff7 # Parent ad1ce3c7af720c8034b84416a9951553af2fcfcb py3: use setattr() to assign new class attribute The old method produces error 'object does not supports item assignment'. So setattr() is used to assign a new class attribute via __dict__ . diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -41,7 +41,7 @@ def _unifiedheaderinit(self, *args, **kw kw['continuation_ws'] = ' ' _oldheaderinit(self, *args, **kw) -email.Header.Header.__dict__['__init__'] = _unifiedheaderinit +setattr(email.header.Header, '__init__', _unifiedheaderinit) class STARTTLS(smtplib.SMTP): '''Derived class to verify the peer certificate for STARTTLS.