changeset 29749:ae9a4d6a8d51

demandimport: omit default value of "level" at construction of _demandmod This makes construction of _demandmod require explicit level value, and helps to avoid issues like issue5208 in the future.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 06 Aug 2016 22:24:33 +0900
parents 14f077f7519a
children c1696430254f
files mercurial/demandimport.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/demandimport.py	Sat Aug 06 22:24:33 2016 +0900
+++ b/mercurial/demandimport.py	Sat Aug 06 22:24:33 2016 +0900
@@ -64,8 +64,12 @@
         return importfunc(hgextname, globals, *args, **kwargs)
 
 class _demandmod(object):
-    """module demand-loader and proxy"""
-    def __init__(self, name, globals, locals, level=level):
+    """module demand-loader and proxy
+
+    Specify 1 as 'level' argument at construction, to import module
+    relatively.
+    """
+    def __init__(self, name, globals, locals, level):
         if '.' in name:
             head, rest = name.split('.', 1)
             after = [rest]