Mercurial > public > mercurial-scm > hg
comparison mercurial/httppeer.py @ 30484:d1b97fc87f55
httppeer: document why super() isn't used
Adding a follow-up to document lack of super() per Augie's
request.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Nov 2016 20:12:51 -0800 |
parents | ef9f197188ec |
children | 07bcd1bf6151 |
comparison
equal
deleted
inserted
replaced
30483:8491845a75b2 | 30484:d1b97fc87f55 |
---|---|
37 except httplib.HTTPException: | 37 except httplib.HTTPException: |
38 raise IOError(None, _('connection ended unexpectedly')) | 38 raise IOError(None, _('connection ended unexpectedly')) |
39 | 39 |
40 # We need to wrap reader.read() so HTTPException on subsequent | 40 # We need to wrap reader.read() so HTTPException on subsequent |
41 # reads is also converted. | 41 # reads is also converted. |
42 # Ideally we'd use super() here. However, if ``reader`` isn't a new-style | |
43 # class, this can raise: | |
44 # TypeError: super() argument 1 must be type, not classobj | |
42 origread = reader.read | 45 origread = reader.read |
43 class readerproxy(reader.__class__): | 46 class readerproxy(reader.__class__): |
44 def read(self, *args, **kwargs): | 47 def read(self, *args, **kwargs): |
45 try: | 48 try: |
46 return origread(*args, **kwargs) | 49 return origread(*args, **kwargs) |