compare singletons by identity not equality (closes #16712)
Patch from Serhiy Storchaka.
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 014bcf5..c5640e0 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -1232,7 +1232,7 @@
try:
return func(*args, **kwds)
finally:
- if orig_tz == None:
+ if orig_tz is None:
del os.environ['TZ']
else:
os.environ['TZ'] = orig_tz
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 7028f46..299a146 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -342,7 +342,7 @@
# http://www.mail-archive.com/openssl-users@openssl.org/msg60710.html
pass
self._ssl_closing = False
- if getattr(self, '_ccc', False) == False:
+ if getattr(self, '_ccc', False) is False:
super(SSLConnection, self).close()
else:
pass
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 4e7a37c..f59607b 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -651,7 +651,7 @@
groups = idg.read().strip()
ret = idg.close()
- if ret != None or not groups:
+ if ret is not None or not groups:
raise unittest.SkipTest("need working 'id -G'")
self.assertEqual(
@@ -665,7 +665,7 @@
groups = idg.read().strip()
ret = idg.close()
- if ret != None or not groups:
+ if ret is not None or not groups:
raise unittest.SkipTest("need working 'id -G'")
# 'id -G' and 'os.getgroups()' should return the same
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 6e0c6ee..e5ec85c 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -897,7 +897,7 @@
except TypeError:
tb = sys.exc_info()[2]
# traceback
- if tb != None:
+ if tb is not None:
check(tb, size('2P2i'))
# symtable entry
# XXX