aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2025-05-18 22:21:06 +0300
committerGitHub <noreply@github.com>2025-05-18 22:21:06 +0300
commit9983c7d4416cac8deb2fded1ec9c7daf786c3a02 (patch)
tree31543aedaf1a6d2b2418f365f67be6e8c0a5227e /Lib/tarfile.py
parent5cbc8c632e860941602e8f7da9aab52fae40aca6 (diff)
downloadcpython-9983c7d4416cac8deb2fded1ec9c7daf786c3a02.tar.gz
cpython-9983c7d4416cac8deb2fded1ec9c7daf786c3a02.zip
gh-133890: Handle UnicodeEncodeError in tarfile (GH-134147)
UnicodeEncodeError is now handled the same way as OSError during TarFile member extraction.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 13889d76802..212b71f6509 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -2439,7 +2439,7 @@ class TarFile(object):
unfiltered = tarinfo
try:
tarinfo = filter_function(tarinfo, path)
- except (OSError, FilterError) as e:
+ except (OSError, UnicodeEncodeError, FilterError) as e:
self._handle_fatal_error(e)
except ExtractError as e:
self._handle_nonfatal_error(e)
@@ -2460,7 +2460,7 @@ class TarFile(object):
self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
set_attrs=set_attrs,
numeric_owner=numeric_owner)
- except OSError as e:
+ except (OSError, UnicodeEncodeError) as e:
self._handle_fatal_error(e)
except ExtractError as e:
self._handle_nonfatal_error(e)