diff contrib/check-code.py @ 31483:413b44003462

py3: add __bool__ to every class defining __nonzero__ __nonzero__ was renamed to __bool__ in Python 3. This patch simply aliases __bool__ to __nonzero__ for every class implementing __nonzero__.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 13 Mar 2017 12:40:14 -0700
parents 455677a7667f
children c0c4e14ee597
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Mar 13 21:58:43 2017 -0700
+++ b/contrib/check-code.py	Mon Mar 13 12:40:14 2017 -0700
@@ -318,7 +318,7 @@
      'legacy exception syntax; use "as" instead of ","'),
     (r':\n(    )*( ){1,3}[^ ]', "must indent 4 spaces"),
     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
-    (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
+    (r'\bdef\s+__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
     (r'os\.path\.join\(.*, *(""|\'\')\)',
      "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
     (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),