[Python-checkins] gh-93991: Use boolean instead of 0/1 for condition check (GH-93992)

miss-islington webhook-mailer at python.org
Sun Jun 19 10:13:05 EDT 2022


https://github.com/python/cpython/commit/476d30250811e185615dfb971c6a810cac2093bd
commit: 476d30250811e185615dfb971c6a810cac2093bd
branch: main
author: Lei Zhang <leizhanghello at gmail.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022年06月19日T07:12:59-07:00
summary:
gh-93991: Use boolean instead of 0/1 for condition check (GH-93992)
# gh-93991: Use boolean instead of 0/1 for condition check
files:
M Lib/filecmp.py
diff --git a/Lib/filecmp.py b/Lib/filecmp.py
index 70a4b23c98220..30bd900fa805a 100644
--- a/Lib/filecmp.py
+++ b/Lib/filecmp.py
@@ -157,17 +157,17 @@ def phase2(self): # Distinguish files, directories, funnies
 a_path = os.path.join(self.left, x)
 b_path = os.path.join(self.right, x)
 
- ok = 1
+ ok = True
 try:
 a_stat = os.stat(a_path)
 except OSError:
 # print('Can\'t stat', a_path, ':', why.args[1])
- ok = 0
+ ok = False
 try:
 b_stat = os.stat(b_path)
 except OSError:
 # print('Can\'t stat', b_path, ':', why.args[1])
- ok = 0
+ ok = False
 
 if ok:
 a_type = stat.S_IFMT(a_stat.st_mode)
@@ -242,7 +242,7 @@ def report_full_closure(self): # Report on self and subdirs recursively
 
 methodmap = dict(subdirs=phase4,
 same_files=phase3, diff_files=phase3, funny_files=phase3,
- common_dirs = phase2, common_files=phase2, common_funny=phase2,
+ common_dirs=phase2, common_files=phase2, common_funny=phase2,
 common=phase1, left_only=phase1, right_only=phase1,
 left_list=phase0, right_list=phase0)
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /