Skip to content

Commit 3daf86f

Browse files
Merge branch '3.13' into backport-5915a1f-3.13
2 parents 949a0d9 + c68571c commit 3daf86f

8 files changed

Lines changed: 32 additions & 14 deletions

File tree

Doc/library/shutil.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,14 @@ Directory and files operations
381381
If *dst* already exists but is not a directory, it may be overwritten
382382
depending on :func:`os.rename` semantics.
383383

384-
If the destination is on the current filesystem, then :func:`os.rename` is
385-
used. Otherwise, *src* is copied to the destination using *copy_function*
386-
and then removed. In case of symlinks, a new symlink pointing to the target
387-
of *src* will be created as the destination and *src* will be removed.
384+
:func:`os.rename` is preferably used internally when *src* and the destination are on
385+
the same filesystem. In case :func:`os.rename` fails due to :exc:`OSError`
386+
(e.g. the user has write permission to the destination file but not to its parent
387+
directory), this method falls back to using *copy_function*, in which case
388+
*src* is copied to the destination using *copy_function* and then removed.
389+
390+
In case of symlinks, a new symlink pointing to the target of *src* will be
391+
created in or as the destination, and *src* will be removed.
388392

389393
If *copy_function* is given, it must be a callable that takes two arguments,
390394
*src* and the destination, and will be used to copy *src* to the destination

Lib/shutil.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,14 @@ def move(src, dst, copy_function=copy2):
823823
If dst already exists but is not a directory, it may be overwritten
824824
depending on os.rename() semantics.
825825
826-
If the destination is on our current filesystem, then rename() is used.
827-
Otherwise, src is copied to the destination and then removed. Symlinks are
828-
recreated under the new name if os.rename() fails because of cross
829-
filesystem renames.
826+
os.rename() is preferably used if the source and destination are on the
827+
same filesystem. In case os.rename() fails due to OSError (e.g. the user
828+
has write permission to *dst* file but not to its parent directory),
829+
this method falls back to using *copy_function* silently.
830+
Symlinks are also recreated under the new name if os.rename() fails
831+
because of cross filesystem renames.
832+
833+
It's recommended to use os.rename() if atomic move is strictly required.
830834
831835
The optional `copy_function` argument is a callable that will be used
832836
to copy the source or it will be delegated to `copytree`.

Mac/BuildScript/build-installer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ def library_recipes():
264264
tk_patches = ['backport_gh71383_fix.patch', 'tk868_on_10_8_10_9.patch', 'backport_gh110950_fix.patch']
265265

266266
else:
267-
tcl_tk_ver='8.6.17'
268-
tcl_checksum='a3903371efcce8a405c5c245d029e9f6850258a60fa3761c4d58995610949b31'
267+
tcl_tk_ver='8.6.18'
268+
tcl_checksum='14f9af32b1767ff718477a8f974ad03c34341097e6b43f4ce54644ee974e268e'
269269

270-
tk_checksum='e4982df6f969c08bf9dd858a6891059b4a3f50dc6c87c10abadbbe2fc4838946'
270+
tk_checksum='95cd528a80f5e4bdb557af9b14a7197d6860793a3894e25e7c9fad2ed05d4c3c'
271271
tk_patches = []
272272

273273

@@ -378,9 +378,9 @@ def library_recipes():
378378
install=f"make && ranlib libsqlite3.a && make install DESTDIR={shellQuote(os.path.join(WORKDIR, 'libraries'))}",
379379
),
380380
dict(
381-
name="libmpdec 4.0.0",
382-
url="https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.0.tar.gz",
383-
checksum="942445c3245b22730fd41a67a7c5c231d11cb1b9936b9c0f76334fb7d0b4468c",
381+
name="libmpdec 4.0.1",
382+
url="https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.1.tar.gz",
383+
checksum="96d33abb4bb0070c7be0fed4246cd38416188325f820468214471938545b1ac8",
384384
configure_pre=[
385385
"--disable-cxx",
386386
"MACHINE=universal",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a crash, when there's no memory left on a device,
2+
which happened in code compilation.
3+
Now it raises a proper :exc:`MemoryError`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix documentation for :func:`shutil.move` on usage of
2+
:func:`os.rename` since nonatomic move might be used even if the files are
3+
on the same filesystem. Patch by Fang Li
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update macOS installer to use libmpdecimal 4.0.1.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update macOS installer to use Tcl/Tk 8.6.18.

Python/flowgraph.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,7 @@ remove_unused_consts(basicblock *entryblock, PyObject *consts)
20402040

20412041
index_map = PyMem_Malloc(nconsts * sizeof(Py_ssize_t));
20422042
if (index_map == NULL) {
2043+
PyErr_NoMemory();
20432044
goto end;
20442045
}
20452046
for (Py_ssize_t i = 1; i < nconsts; i++) {
@@ -2097,6 +2098,7 @@ remove_unused_consts(basicblock *entryblock, PyObject *consts)
20972098
/* adjust const indices in the bytecode */
20982099
reverse_index_map = PyMem_Malloc(nconsts * sizeof(Py_ssize_t));
20992100
if (reverse_index_map == NULL) {
2101+
PyErr_NoMemory();
21002102
goto end;
21012103
}
21022104
for (Py_ssize_t i = 0; i < nconsts; i++) {

0 commit comments

Comments
 (0)