Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 36840:6bdea0efdab5
util: forward __bool__()/__nonzero__() on fileobjectproxy
In trying to debug the Windows process hang in D2720, I changed the stderr pipe
to the peer to be os.devnull instead. That caused sshpeer._cleanuppipes()[1] to
explode, complaining NoneType has no __iter__ attribute, even though the
previous line checked for None.
[1] https://www.mercurial-scm.org/repo/hg/file/b434965f984e/mercurial/sshpeer.py#l133
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 10 Mar 2018 12:22:08 -0500 |
parents | eca1051e6c22 |
children | 5bc7ff103081 |
comparison
equal
deleted
inserted
replaced
36839:82af07e1ae16 | 36840:6bdea0efdab5 |
---|---|
540 # We only observe some methods. | 540 # We only observe some methods. |
541 if name in ours: | 541 if name in ours: |
542 return object.__getattribute__(self, name) | 542 return object.__getattribute__(self, name) |
543 | 543 |
544 return getattr(object.__getattribute__(self, r'_orig'), name) | 544 return getattr(object.__getattribute__(self, r'_orig'), name) |
545 | |
546 def __nonzero__(self): | |
547 return bool(object.__getattribute__(self, r'_orig')) | |
548 | |
549 __bool__ = __nonzero__ | |
545 | 550 |
546 def __delattr__(self, name): | 551 def __delattr__(self, name): |
547 return delattr(object.__getattribute__(self, r'_orig'), name) | 552 return delattr(object.__getattribute__(self, r'_orig'), name) |
548 | 553 |
549 def __setattr__(self, name, value): | 554 def __setattr__(self, name, value): |