[PATCH 2 of 2] check-code: look for misuse of __bool__

Yuya Nishihara yuya at tcha.org
Tue Sep 16 10:59:27 CDT 2014


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1410881317 -32400
#      Wed Sep 17 00:28:37 2014 +0900
# Node ID 161fd3b412acce6ff0d364d41618bd1a627b3877
# Parent  41ce9361751ce40497dcbf29ec2d84ef0fbc7593
check-code: look for misuse of __bool__

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -299,6 +299,7 @@ pypats = [
     (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
      "missing _() in ui message (use () to hide false-positives)"),
     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
+    (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
   ],
   # warnings
   [


More information about the Mercurial-devel mailing list