Show More
@@ -159,16 +159,16 def _runcatch(req): | |||
|
159 | 159 | elif m in "zlib".split(): |
|
160 | 160 | ui.warn(_("(is your Python install correct?)\n")) |
|
161 | 161 | except IOError, inst: |
|
162 | if hasattr(inst, "code"): | |
|
162 | if util.safehasattr(inst, "code"): | |
|
163 | 163 | ui.warn(_("abort: %s\n") % inst) |
|
164 | elif hasattr(inst, "reason"): | |
|
164 | elif util.safehasattr(inst, "reason"): | |
|
165 | 165 | try: # usually it is in the form (errno, strerror) |
|
166 | 166 | reason = inst.reason.args[1] |
|
167 | 167 | except (AttributeError, IndexError): |
|
168 | 168 | # it might be anything, for example a string |
|
169 | 169 | reason = inst.reason |
|
170 | 170 | ui.warn(_("abort: error: %s\n") % reason) |
|
171 | elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE: | |
|
171 | elif util.safehasattr(inst, "args") and inst.args[0] == errno.EPIPE: | |
|
172 | 172 | if ui.debugflag: |
|
173 | 173 | ui.warn(_("broken pipe\n")) |
|
174 | 174 | elif getattr(inst, "strerror", None): |
@@ -338,7 +338,7 class cmdalias(object): | |||
|
338 | 338 | ui.debug("alias '%s' shadows command '%s'\n" % |
|
339 | 339 | (self.name, self.cmdname)) |
|
340 | 340 | |
|
341 | if hasattr(self, 'shell'): | |
|
341 | if util.safehasattr(self, 'shell'): | |
|
342 | 342 | return self.fn(ui, *args, **opts) |
|
343 | 343 | else: |
|
344 | 344 | try: |
@@ -506,7 +506,7 def _checkshellalias(lui, ui, args): | |||
|
506 | 506 | cmd = aliases[0] |
|
507 | 507 | fn = entry[0] |
|
508 | 508 | |
|
509 | if cmd and hasattr(fn, 'shell'): | |
|
509 | if cmd and util.safehasattr(fn, 'shell'): | |
|
510 | 510 | d = lambda: fn(ui, *args[1:]) |
|
511 | 511 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {}) |
|
512 | 512 |
General Comments 0
You need to be logged in to leave comments.
Login now