Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHGf98da1349212: policy: remove Python 2.7 compatibility code
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/policy.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
a8179903860b | 115d13143c72 | Gregory Szorc | Feb 21 2022, 2:36 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | D12339 ui: use input() directly | |
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
# PyPy doesn't load C extensions. | # PyPy doesn't load C extensions. | ||||
# | # | ||||
# The canonical way to do this is to test platform.python_implementation(). | # The canonical way to do this is to test platform.python_implementation(). | ||||
# But we don't import platform and don't bloat for it here. | # But we don't import platform and don't bloat for it here. | ||||
if '__pypy__' in sys.builtin_module_names: | if '__pypy__' in sys.builtin_module_names: | ||||
policy = b'cffi' | policy = b'cffi' | ||||
# Environment variable can always force settings. | # Environment variable can always force settings. | ||||
if sys.version_info[0] >= 3: | |||||
if 'HGMODULEPOLICY' in os.environ: | if 'HGMODULEPOLICY' in os.environ: | ||||
policy = os.environ['HGMODULEPOLICY'].encode('utf-8') | policy = os.environ['HGMODULEPOLICY'].encode('utf-8') | ||||
else: | |||||
policy = os.environ.get('HGMODULEPOLICY', policy) | |||||
def _importfrom(pkgname, modname): | def _importfrom(pkgname, modname): | ||||
# from .<pkgname> import <modname> (where . is looked through this module) | # from .<pkgname> import <modname> (where . is looked through this module) | ||||
fakelocals = {} | fakelocals = {} | ||||
pkg = __import__(pkgname, globals(), fakelocals, [modname], level=1) | pkg = __import__(pkgname, globals(), fakelocals, [modname], level=1) | ||||
try: | try: | ||||
fakelocals[modname] = mod = getattr(pkg, modname) | fakelocals[modname] = mod = getattr(pkg, modname) |