aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/mailbox.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-04-28 21:17:44 +0300
committershadchin <shadchin@yandex-team.com>2024-04-28 21:25:54 +0300
commita55d99a3eb72f90355bc146baeda18aa7eb97352 (patch)
treeb17cfed786effe8b81bba022239d6729f716fbeb /contrib/tools/python3/Lib/mailbox.py
parent67bf49d08acf1277eff4c336021ac22d964bb4c4 (diff)
downloadydb-a55d99a3eb72f90355bc146baeda18aa7eb97352.tar.gz
Update Python 3 to 3.12.3
7d09de7d8b99ea2be554ef0fc61276942ca9c2e1
Diffstat (limited to 'contrib/tools/python3/Lib/mailbox.py')
-rw-r--r--contrib/tools/python3/Lib/mailbox.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/tools/python3/Lib/mailbox.py b/contrib/tools/python3/Lib/mailbox.py
index c8b3444f64..c7f060ce52 100644
--- a/contrib/tools/python3/Lib/mailbox.py
+++ b/contrib/tools/python3/Lib/mailbox.py
@@ -698,9 +698,13 @@ class _singlefileMailbox(Mailbox):
_sync_close(new_file)
# self._file is about to get replaced, so no need to sync.
self._file.close()
- # Make sure the new file's mode is the same as the old file's
- mode = os.stat(self._path).st_mode
- os.chmod(new_file.name, mode)
+ # Make sure the new file's mode and owner are the same as the old file's
+ info = os.stat(self._path)
+ os.chmod(new_file.name, info.st_mode)
+ try:
+ os.chown(new_file.name, info.st_uid, info.st_gid)
+ except (AttributeError, OSError):
+ pass
try:
os.rename(new_file.name, self._path)
except FileExistsError: