[PATCH 4 of 8] posix: remove is-comparisons with non-singletons

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Nov 16 14:36:15 CST 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1289939758 -3600
# Branch stable
# Node ID 3b589b8fe25cfa29ac827cd00462d5fdc2fe7abf
# Parent  72e7c8769e4bb6cbfec1e796fd06e3416da51b26
posix: remove is-comparisons with non-singletons.

Comparing integers by identity relies on a CPython implementation
detail of caching integers between -5 and 256.[1] ENOENT ought to fall
safely within these limits, but you never know...

[1] <http://docs.python.org/c-api/int.html#PyInt_FromLong>

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -144,7 +144,7 @@ if sys.platform == 'darwin':
         try:
             fd = os.open(path, O_SYMLINK)
         except OSError, err:
-            if err.errno is errno.ENOENT:
+            if err.errno == errno.ENOENT:
                 return path
             raise
 


More information about the Mercurial-devel mailing list