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

Augie Fackler raf at durin42.com
Fri Jan 8 09:11:18 CST 2016


On Jan 8, 2016 8:53 AM, "Yuya Nishihara" <yuya at tcha.org> wrote:
>
> 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].

Yep. hasattr() is problematic until Python 3.2. KeyboardInterrupt was added
as a one-off ignore in 2.6, but they felt it too dangerous to actually fix
things all the way.

>
>  [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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20160108/6e447a9f/attachment.html>


More information about the Mercurial-devel mailing list