changeset 46653:9306a16ca964

debugcommands: prevent using `is False` I was touching this code in a future patch and marmoute warned about usage of `is False` here. Quoting marmoute: ``` "is False" is going to check if the object you have the very same object in memory than the one Python allocated for False (in practice 0) This will "mostly work" on cpython because of implementation details, but is semantically wrong and can start breaking unexpectedly ``` Differential Revision: https://phab.mercurial-scm.org/D10014
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 16 Feb 2021 20:38:14 +0530
parents 75832107ec07
children 9ea6b75b4a95
files mercurial/debugcommands.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Tue Feb 16 18:43:42 2021 +0530
+++ b/mercurial/debugcommands.py	Tue Feb 16 20:38:14 2021 +0530
@@ -3870,10 +3870,10 @@
         tagsnode = cache.getfnode(node, computemissing=False)
         if tagsnode:
             tagsnodedisplay = hex(tagsnode)
-        elif tagsnode is False:
+        elif tagsnode is None:
+            tagsnodedisplay = b'missing'
+        else:
             tagsnodedisplay = b'invalid'
-        else:
-            tagsnodedisplay = b'missing'
 
         ui.write(b'%d %s %s\n' % (r, hex(node), tagsnodedisplay))