[PATCH 1 of 6] mercurial: implement a source transforming module loader on Python 3

Yuya Nishihara yuya at tcha.org
Thu Jun 9 10:49:43 EDT 2016


On Tue, 31 May 2016 22:52:58 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1464759986 25200
> #      Tue May 31 22:46:26 2016 -0700
> # Node ID 867ebaa1ca956c76022655eb1f7a6f39da42b5a4
> # Parent  48b38b16a8f83ea98ebdf0b370f59fd90dc17935
> mercurial: implement a source transforming module loader on Python 3

I agree this approach will be less hurt, and it seems good choice to process
the code transformation at token level than AST level for simplicity.

> +    class hgpathentryfinder(importlib.abc.PathEntryFinder):
> +        """A sys.meta_path finder that uses a custom module loader."""

I'm not sure if this should be PathEntryFinder or MetaPathFinder. Python doc
says "meta path finder is a finder returned by a search of sys.meta_path,"
and we're using sys.meta_path.

https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder


More information about the Mercurial-devel mailing list