[PATCH 1 of 5] dispatch: make loading extra information from extension extensible

Yuya Nishihara yuya at tcha.org
Fri Jan 8 07:51:05 CST 2016


On Thu, 07 Jan 2016 12:00:38 -0800, Sean Farley wrote:
> Yuya Nishihara <yuya at tcha.org> writes:
> > On Tue, 05 Jan 2016 20:48:34 +0900, FUJIWARA Katsunori wrote:
> >> +            if util.safehasattr(module, objname):
> >
> > Nit: you can use getattr(module, objname, None).
> 
> Should we remove util.safehasattr now?

(CC-ing Augie)

Perhaps no.

hasattr() of Python 2.6 should no longer eat KeyboardInterrupt [1], but it
still ignores Exception [2], whereas our safehasattr() only catches
AttributeError [3].

 [1]: https://bugs.python.org/issue2196
 [2]: https://hg.python.org/cpython/file/v2.7.11/Python/bltinmodule.c#l906
 [3]: https://hg.python.org/cpython/file/v2.7.11/Python/bltinmodule.c#l849


More information about the Mercurial-devel mailing list