changeset 32445:847233374434

demandimport: strictly compare identity of proxy object This looks better, and __eq__() may be overridden in an undesired way.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 01 May 2017 13:43:31 +0900
parents 57d6c0c74b1b
children 63365e9621d6
files hgdemandimport/demandimportpy2.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)