Mercurial > hg
changeset 29192:bac14dbbbfab
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__ .
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 17 May 2016 05:32:36 +0530 |
parents | ad1ce3c7af72 |
children | cd3c6f3ee5e9 |
files | mercurial/mail.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/mail.py Wed May 11 14:18:52 2016 -0700 +++ b/mercurial/mail.py Tue May 17 05:32:36 2016 +0530 @@ -41,7 +41,7 @@ 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.