demandimport: strictly compare identity of proxy object
This looks better, and __eq__() may be overridden in an undesired way.
--- a/hgdemandimport/demandimportpy2.py Tue May 23 08:49:01 2017 -0700
+++ b/hgdemandimport/demandimportpy2.py Mon May 01 13:43:31 2017 +0900
@@ -130,12 +130,12 @@
subload(mod, x)
# Replace references to this proxy instance with the actual module.
- if locals and locals.get(head) == self:
+ if locals and locals.get(head) is self:
locals[head] = mod
for modname in modrefs:
modref = sys.modules.get(modname, None)
- if modref and getattr(modref, head, None) == self:
+ if modref and getattr(modref, head, None) is self:
setattr(modref, head, mod)
object.__setattr__(self, r"_module", mod)