On Mon, 22 Apr 2019 21:22:31 -0400, Ludovic Chabant wrote: > > > > Is there any list of exceptions that are known to be safely > > suppressed? Catching AttributeError, TypeError, etc. seems bad. > > > > In my case, it's just a missing method so AttributeError is what's being > raised I think (see > https://github.com/benjaminp/six/blob/master/six.py#L164). > > My rationale here was that there could be any 3rd party finder in there, > so it might make sense to protect Mercurial from crashing because of > exceptions thrown from other packages. > > However, now that I think about it, another maybe more correct way to > fix this specific bug might be to check for `find_spec` and, if missing, > call `find_module` instead. As per the Python docs (see > https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder), > the latter was deprecated in 3.4, the former is new in 3.4. So my guess > is that _SixMetaPathImporter uses the old API so that it's compatible > with all versions of Python 3 (as Python probably does this fallback on > the old API if the new doesn't exist). > > Would that be better?
Sounds good to me. CC indygreg as he should know the importer API better. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel