Comments
Patch
@@ -17,18 +17,17 @@ import sys
#
# c - require C extensions
# allow - allow pure Python implementation when C loading fails
# py - only load pure Python modules
modulepolicy = '@MODULELOADPOLICY@'
# By default, require the C extensions for performance reasons.
if modulepolicy == '@' 'MODULELOADPOLICY' '@':
- # TODO change to 'c' once installer is changed.
- modulepolicy = 'allow'
+ modulepolicy = 'c'
# Environment variable can always force settings.
modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy)
# Modules that have both Python and C implementations. See also the
# set of .py files under mercurial/pure/.
_dualmodules = set([
'mercurial.base85',
@@ -74,21 +73,19 @@ class hgimporter(object):
# for some installations to have .py files under mercurial/*.
# Loading Python modules when we expected C versions could result
# in a) poor performance b) loading a version from a previous
# Mercurial version, potentially leading to incompatibility. Either
# scenario is bad. So we verify that modules loaded from
# mercurial/* are C extensions. If the current policy allows the
# loading of .py modules, the module will be re-imported from
# mercurial/pure/* below.
- # TODO uncomment once setup.py is updated to actually install
- # into mercurial/pure.
- #if modinfo[2][2] != imp.C_EXTENSION:
- # raise ImportError('.py version of %s found where C '
- # 'version should exist' % name)
+ if modinfo[2][2] != imp.C_EXTENSION:
+ raise ImportError('.py version of %s found where C '
+ 'version should exist' % name)
except ImportError:
if modulepolicy == 'c':
raise
# Could not load the C extension and pure Python is allowed. So
# try to load them.
from . import pure