[python3 hgloader] .pyc pre-generation

Blaise Thorn blaise at mail.ru
Sun Aug 4 19:29:03 UTC 2019


On 04.08.2019 21:26, Gregory Szorc wrote:
> For Python 3, there is no way to generate "proper" .pyc files since the .pyc files we write aren't recognized as valid by a normal Python 3 interpreter without Mercurial's custom module importer.

Allow me to clarify: by "pristine" I meant "normal", and by "proper" -- appropriate for running Mercurial with hgloader.

> address the issue by having the installer write out .pyc files containing the bytecode that Mercurial's module importer would have produced

Is there a user-accessible hack to do this now?
(My understanding is that prepending each pristine .pyc with HG<VERSION> would not be enough, since your token replacement does not happen for .pyc currently produced during the installation.)

and we'll have some way to short-circuit our custom module importer so it doesn't attempt source transformation at import time.

My understanding was that it would work right now with a "normal" .pyc for mercurial/__init__.py (which activates hgloader) and with HG-.pyc for everything else. And then it would work even without source .py.

-- 
βþ



More information about the Mercurial mailing list