1.1 --- a/importer.py Tue Dec 06 22:58:16 2016 +0100
1.2 +++ b/importer.py Wed Dec 07 01:05:36 2016 +0100
1.3 @@ -477,8 +477,28 @@
1.4 need initialising before the callable can be used.
1.5 """
1.6
1.7 - return ref.has_kind("<function>") and self.function_defaults.get(ref.get_origin()) or \
1.8 - ref.has_kind("<class>") and self.function_defaults.get("%s.__init__" % ref.get_origin())
1.9 + # Find the function or method associated with the reference.
1.10 +
1.11 + if ref.has_kind("<function>"):
1.12 + origin = ref.get_origin()
1.13 + elif ref.has_kind("<class>"):
1.14 + origin = "%s.__init__" % ref.get_origin()
1.15 + else:
1.16 + return False
1.17 +
1.18 + # Find any defaults for the function or method.
1.19 +
1.20 + defaults = self.function_defaults.get(origin)
1.21 + if not defaults:
1.22 + return False
1.23 +
1.24 + # Identify non-constant defaults.
1.25 +
1.26 + for name, ref in defaults:
1.27 + if not ref.is_constant_alias():
1.28 + return True
1.29 +
1.30 + return False
1.31
1.32 def order_modules(self):
1.33