aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/filecmp.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-08-17 21:51:59 +0300
committershadchin <shadchin@yandex-team.com>2024-08-17 22:04:51 +0300
commitee9edbd8878888bafcd0eeb3b528f3ec4311560b (patch)
treed54d8138e50a446904f10a2092719be86af011b7 /contrib/tools/python3/Lib/filecmp.py
parent72cbe4bad58add0912623ba51351ff1db8587249 (diff)
downloadydb-ee9edbd8878888bafcd0eeb3b528f3ec4311560b.tar.gz
Update Python 3 to 3.12.5
https://docs.python.org/release/3.12.5/whatsnew/changelog.html#python-3-12-5-final de86cdeacd3a8653b9ec36e87975886fafcf6dc2
Diffstat (limited to 'contrib/tools/python3/Lib/filecmp.py')
-rw-r--r--contrib/tools/python3/Lib/filecmp.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/tools/python3/Lib/filecmp.py b/contrib/tools/python3/Lib/filecmp.py
index 30bd900fa8..6fdb48f7a3 100644
--- a/contrib/tools/python3/Lib/filecmp.py
+++ b/contrib/tools/python3/Lib/filecmp.py
@@ -160,12 +160,14 @@ class dircmp:
ok = True
try:
a_stat = os.stat(a_path)
- except OSError:
+ except (OSError, ValueError):
+ # See https://github.com/python/cpython/issues/122400
+ # for the rationale for protecting against ValueError.
# print('Can\'t stat', a_path, ':', why.args[1])
ok = False
try:
b_stat = os.stat(b_path)
- except OSError:
+ except (OSError, ValueError):
# print('Can\'t stat', b_path, ':', why.args[1])
ok = False
@@ -280,12 +282,12 @@ def cmpfiles(a, b, common, shallow=True):
# Return:
# 0 for equal
# 1 for different
-# 2 for funny cases (can't stat, etc.)
+# 2 for funny cases (can't stat, NUL bytes, etc.)
#
def _cmp(a, b, sh, abs=abs, cmp=cmp):
try:
return not abs(cmp(a, b, sh))
- except OSError:
+ except (OSError, ValueError):
return 2