Mercurial > hg-stable
diff mercurial/demandimport.py @ 25933:1fc6c02782ab
demandimport: remove support for Python < 2.5
The removed code was to support an __import__ function that doesn't
support the "level" argument. This argument was added in Python 2.5,
which we no longer support.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 08 Aug 2015 15:01:27 -0700 |
parents | 5d0847cd1587 |
children | e283c5d922db |
line wrap: on
line diff
--- a/mercurial/demandimport.py Sat Aug 08 14:42:48 2015 -0700 +++ b/mercurial/demandimport.py Sat Aug 08 15:01:27 2015 -0700 @@ -37,18 +37,11 @@ nothing = object() -try: - # Python 3 doesn't have relative imports nor level -1. - level = -1 - if sys.version_info[0] >= 3: - level = 0 - _origimport(builtins.__name__, {}, {}, None, level) -except TypeError: # no level argument - def _import(name, globals, locals, fromlist, level): - "call _origimport with no level argument" - return _origimport(name, globals, locals, fromlist) -else: - _import = _origimport +# Python 3 doesn't have relative imports nor level -1. +level = -1 +if sys.version_info[0] >= 3: + level = 0 +_import = _origimport def _hgextimport(importfunc, name, globals, *args): try: