[PATCH STABLE] sslutil: guard against broken certifi installations (issue5406)

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Oct 19 17:45:30 UTC 2016


> On Oct 19, 2016, at 12:07, Gábor STEFANIK <Gabor.STEFANIK at nng.com> wrote:
> 
> -----Original Message-----
>> From: Kevin Bullock [mailto:kbullock+mercurial at ringworld.org]
>> Sent: Wednesday, October 19, 2016 6:18 PM
>> To: Gábor STEFANIK <Gabor.STEFANIK at nng.com>
>> Cc: mercurial-devel at mercurial-scm.org
>> Subject: Re: [PATCH STABLE] sslutil: guard against broken certifi installations
>> (issue5406)
>> 
>> You've gone from catching an ImportError to swallowing all exceptions.
> 
> Intentional. ImportError is not the only thing that can be thrown here;
> e.g. if "certifi" is actually some unrelated module with no "where()" method.
> 
> No reason to let certifi crash Hg under any circumstances.

I have a hard time imagining how another module named "certifi" without a where() method would show up on any sane system.

As Greg said, bare `except:` is banned in Mercurial. Catch the exceptions you expect might happen, none others.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock




More information about the Mercurial-devel mailing list