changeset 32418:1651977596c0

check-code: allow skipping hasattr check in py3-only code hasattr is safe in Python 3, and in an upcoming patch we can't use util.safehasattr.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 21 May 2017 13:34:42 -0700
parents f40dc6f7c12f
children d02888308235
files contrib/check-code.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon May 22 01:17:49 2017 -0700
+++ b/contrib/check-code.py	Sun May 21 13:34:42 2017 -0700
@@ -300,7 +300,8 @@
     (r'^\s*(while|if) [01]:',
      "use True/False for constant Boolean expression"),
     (r'(?:(?<!def)\s+|\()hasattr\(',
-     'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
+     'hasattr(foo, bar) is broken on py2, use util.safehasattr(foo, bar) '
+     'instead', r'#.*hasattr-py3-only'),
     (r'opener\([^)]*\).read\(',
      "use opener.read() instead"),
     (r'opener\([^)]*\).write\(',