Submitter | Gregory Szorc |
---|---|
Date | Nov. 22, 2016, 4:13 a.m. |
Message ID | <fccc56be8db71e11d146.1479788015@ubuntu-vm-main> |
Download | mbox | patch |
Permalink | /patch/17689/ |
State | Accepted |
Headers | show |
Comments
queued thanks > On Nov 21, 2016, at 11:13 PM, Gregory Szorc <gregory.szorc@gmail.com> wrote: > > # HG changeset patch > # User Gregory Szorc <gregory.szorc@gmail.com> > # Date 1479787971 28800 > # Mon Nov 21 20:12:51 2016 -0800 > # Node ID fccc56be8db71e11d146da4bd36f2ed4e26b6d9f > # Parent c84baff8c3d45579fc0cb03492ced5c8f745749c > httppeer: document why super() isn't used > > Adding a follow-up to document lack of super() per Augie's > request. > > diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py > --- a/mercurial/httppeer.py > +++ b/mercurial/httppeer.py > @@ -39,6 +39,9 @@ def decompressresponse(response, engine) > > # We need to wrap reader.read() so HTTPException on subsequent > # reads is also converted. > + # Ideally we'd use super() here. However, if ``reader`` isn't a new-style > + # class, this can raise: > + # TypeError: super() argument 1 must be type, not classobj > origread = reader.read > class readerproxy(reader.__class__): > def read(self, *args, **kwargs): > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -39,6 +39,9 @@ def decompressresponse(response, engine) # We need to wrap reader.read() so HTTPException on subsequent # reads is also converted. + # Ideally we'd use super() here. However, if ``reader`` isn't a new-style + # class, this can raise: + # TypeError: super() argument 1 must be type, not classobj origread = reader.read class readerproxy(reader.__class__): def read(self, *args, **kwargs):