This is an archive of the discontinued Mercurial Phabricator instance.

extensions: don't crash if __file__ not defined
Needs RevisionPublic

Authored by indygreg on Mar 31 2020, 11:29 PM.

Details

Reviewers
marmoute
Group Reviewers
hg-reviewers
Summary

This attribute isn't present in PyOxidizer when loading modules
from memory.

Before, this code was crashing under PyOxidizer. After, it simply
yields unexpected results. This still isn't great (we need a better
mechanism to discover extensions when modules aren't loaded from
the filesystem). But it is strictly better since we no longer
get tracebacks.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

indygreg created this revision.Mar 31 2020, 11:29 PM
marmoute requested changes to this revision.Apr 1 2020, 4:17 AM
marmoute added a subscriber: marmoute.
marmoute added inline comments.
mercurial/extensions.py
709

Maybe mention that the result if "wrong" here? If I understand you commit message fine, this change does not make this code work as expected. It only prevent a crash. If I got this right, it would be useful to mention it in the comment.

This revision now requires changes to proceed.Apr 1 2020, 4:17 AM