httppeer: make __del__ access to self.urlopener more safe
Some errors could in some cases show unfortunate scary and confusing warnings
from the httppeer delstructors:
abort: nodename nor servname provided, or not known
Exception AttributeError: "'httpspeer' object has no attribute 'urlopener'" in <bound method httpspeer.__del__ of <mercurial.httppeer.httpspeer object at 0x
106e1f5d0>> ignored```
To mute that, take
7b15dd9125b3 to the next level and use getattr in __del__.
--- a/mercurial/httppeer.py Sun Oct 30 06:15:09 2016 +0900
+++ b/mercurial/httppeer.py Mon Oct 31 13:43:48 2016 +0100
@@ -63,8 +63,9 @@
self.requestbuilder = urlreq.request
def __del__(self):
- if self.urlopener:
- for h in self.urlopener.handlers:
+ urlopener = getattr(self, 'urlopener', None)
+ if urlopener:
+ for h in urlopener.handlers:
h.close()
getattr(h, "close_all", lambda : None)()