Skip to content

Commit f118729

Browse files
Merge remote-tracking branch 'upstream/main' into tail-call
2 parents da2b792 + 75b628a commit f118729

File tree

80 files changed

+3777
-2133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3777
-2133
lines changed

Doc/c-api/init.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ Process-wide parameters
622622
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
623623
624624
.. deprecated-removed:: 3.13 3.15
625-
Get :data:`sys.executable` instead.
625+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
626+
(:data:`sys.executable`) instead.
626627
627628
628629
.. c:function:: wchar_t* Py_GetPrefix()
@@ -644,8 +645,10 @@ Process-wide parameters
644645
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
645646
646647
.. deprecated-removed:: 3.13 3.15
647-
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
648-
:ref:`virtual environments <venv-def>` need to be handled.
648+
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
649+
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
650+
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
651+
<venv-def>` need to be handled.
649652
650653
651654
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -690,9 +693,11 @@ Process-wide parameters
690693
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
691694

692695
.. deprecated-removed:: 3.13 3.15
693-
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
694-
:ref:`virtual environments <venv-def>` need to be handled.
695-
696+
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
697+
(:data:`sys.base_exec_prefix`) instead. Use
698+
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
699+
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need
700+
to be handled.
696701

697702
.. c:function:: wchar_t* Py_GetProgramFullPath()
698703
@@ -712,7 +717,8 @@ Process-wide parameters
712717
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
713718

714719
.. deprecated-removed:: 3.13 3.15
715-
Get :data:`sys.executable` instead.
720+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
721+
(:data:`sys.executable`) instead.
716722

717723

718724
.. c:function:: wchar_t* Py_GetPath()
@@ -740,8 +746,8 @@ Process-wide parameters
740746
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
741747

742748
.. deprecated-removed:: 3.13 3.15
743-
Get :data:`sys.path` instead.
744-
749+
Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
750+
(:data:`sys.path`) instead.
745751

746752
.. c:function:: const char* Py_GetVersion()
747753
@@ -926,8 +932,8 @@ Process-wide parameters
926932
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
927933
928934
.. deprecated-removed:: 3.13 3.15
929-
Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment
930-
variable instead.
935+
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
936+
:envvar:`PYTHONHOME` environment variable instead.
931937
932938
933939
.. _threads:

Doc/c-api/module.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,6 @@ state:
523523
524524
On success, return ``0``. On error, raise an exception and return ``-1``.
525525
526-
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
527-
raised in this case.
528-
529526
Example usage::
530527
531528
static int
@@ -540,6 +537,10 @@ state:
540537
return res;
541538
}
542539
540+
To be convenient, the function accepts ``NULL`` *value* with an exception
541+
set. In this case, return ``-1`` and just leave the raised exception
542+
unchanged.
543+
543544
The example can also be written without checking explicitly if *obj* is
544545
``NULL``::
545546

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'changes',
2929
'glossary_search',
3030
'lexers',
31+
'misc_news',
3132
'pydoc_topics',
3233
'pyspecific',
3334
'sphinx.ext.coverage',

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,35 @@ Pending removal in Python 3.15
1010
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.
1111
* :c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro:
1212
Use :c:type:`wchar_t` instead.
13-
* Python initialization functions:
13+
* Python initialization functions, deprecated in Python 3.13:
1414

15-
* :c:func:`PySys_ResetWarnOptions`:
16-
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
17-
* :c:func:`Py_GetExecPrefix`:
18-
Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead.
1915
* :c:func:`Py_GetPath`:
20-
Get :data:`sys.path` instead.
16+
Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
17+
(:data:`sys.path`) instead.
2118
* :c:func:`Py_GetPrefix`:
22-
Get :data:`sys.base_prefix` and :data:`sys.prefix` instead.
19+
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
20+
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
21+
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
22+
<venv-def>` need to be handled.
23+
* :c:func:`Py_GetExecPrefix`:
24+
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
25+
(:data:`sys.base_exec_prefix`) instead. Use
26+
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
27+
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need to
28+
be handled.
2329
* :c:func:`Py_GetProgramFullPath`:
24-
Get :data:`sys.executable` instead.
30+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
31+
(:data:`sys.executable`) instead.
2532
* :c:func:`Py_GetProgramName`:
26-
Get :data:`sys.executable` instead.
33+
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
34+
(:data:`sys.executable`) instead.
2735
* :c:func:`Py_GetPythonHome`:
28-
Get :c:func:`PyConfig_Get("home") <PyConfig_Get>`
29-
or the :envvar:`PYTHONHOME` environment variable instead.
36+
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
37+
:envvar:`PYTHONHOME` environment variable instead.
3038

31-
See also the :c:func:`PyConfig_Get` function.
39+
The `pythoncapi-compat project
40+
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
41+
:c:func:`PyConfig_Get` on Python 3.13 and older.
3242

3343
* Functions to configure Python's initialization, deprecated in Python 3.11:
3444

@@ -40,6 +50,8 @@ Pending removal in Python 3.15
4050
Set :c:member:`PyConfig.program_name` instead.
4151
* :c:func:`!Py_SetPythonHome()`:
4252
Set :c:member:`PyConfig.home` instead.
53+
* :c:func:`PySys_ResetWarnOptions`:
54+
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
4355

4456
The :c:func:`Py_InitializeFromConfig` API should be used with
4557
:c:type:`PyConfig` instead.

Doc/library/exceptions.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,13 @@ The following exceptions are the exceptions that are usually raised.
562562

563563
Raised when the interpreter finds an internal error, but the situation does not
564564
look so serious to cause it to abandon all hope. The associated value is a
565-
string indicating what went wrong (in low-level terms).
565+
string indicating what went wrong (in low-level terms). In :term:`CPython`,
566+
this could be raised by incorrectly using Python's C API, such as returning
567+
a ``NULL`` value without an exception set.
566568

567-
You should report this to the author or maintainer of your Python interpreter.
569+
If you're confident that this exception wasn't your fault, or the fault of
570+
a package you're using, you should report this to the author or maintainer
571+
of your Python interpreter.
568572
Be sure to report the version of the Python interpreter (``sys.version``; it is
569573
also printed at the start of an interactive Python session), the exact error
570574
message (the exception's associated value) and if possible the source of the

Doc/library/shutil.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ the use of userspace buffers in Python as in "``outfd.write(infd.read())``".
512512

513513
On macOS `fcopyfile`_ is used to copy the file content (not metadata).
514514

515-
On Linux and Solaris :func:`os.sendfile` is used.
515+
On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used.
516+
517+
On Solaris :func:`os.sendfile` is used.
516518

517519
On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB
518520
instead of 64 KiB) and a :func:`memoryview`-based variant of
@@ -527,6 +529,10 @@ file then shutil will silently fallback on using less efficient
527529
.. versionchanged:: 3.14
528530
Solaris now uses :func:`os.sendfile`.
529531

532+
.. versionchanged:: next
533+
Copy-on-write or server-side copy may be used internally via
534+
:func:`os.copy_file_range` on supported Linux filesystems.
535+
530536
.. _shutil-copytree-example:
531537

532538
copytree example

Doc/license.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ Project, https://www.wide.ad.jp/. ::
374374
may be used to endorse or promote products derived from this software
375375
without specific prior written permission.
376376

377-
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
377+
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS "AS IS" AND
378378
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
379379
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
380380
ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
@@ -583,7 +583,7 @@ interface::
583583
notice, this list of conditions and the following disclaimer in the
584584
documentation and/or other materials provided with the distribution.
585585

586-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
586+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
587587
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
588588
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
589589
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
@@ -884,7 +884,7 @@ sources unless the build is configured ``--with-system-libffi``::
884884

885885
Permission is hereby granted, free of charge, to any person obtaining
886886
a copy of this software and associated documentation files (the
887-
``Software''), to deal in the Software without restriction, including
887+
"Software"), to deal in the Software without restriction, including
888888
without limitation the rights to use, copy, modify, merge, publish,
889889
distribute, sublicense, and/or sell copies of the Software, and to
890890
permit persons to whom the Software is furnished to do so, subject to
@@ -893,7 +893,7 @@ sources unless the build is configured ``--with-system-libffi``::
893893
The above copyright notice and this permission notice shall be included
894894
in all copies or substantial portions of the Software.
895895

896-
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
896+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
897897
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
898898
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
899899
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
@@ -1122,7 +1122,7 @@ The file is distributed under the 2-Clause BSD License::
11221122
notice, this list of conditions and the following disclaimer in the
11231123
documentation and/or other materials provided with the distribution.
11241124

1125-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1125+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
11261126
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11271127
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11281128
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,

Doc/make.bat

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,14 @@ goto end
127127
:build
128128
if not exist "%BUILDDIR%" mkdir "%BUILDDIR%"
129129

130-
rem PY_MISC_NEWS_DIR is also used by our Sphinx extension in tools/extensions/pyspecific.py
131-
if not defined PY_MISC_NEWS_DIR set PY_MISC_NEWS_DIR=%BUILDDIR%\%1
132-
if not exist "%PY_MISC_NEWS_DIR%" mkdir "%PY_MISC_NEWS_DIR%"
130+
if not exist build mkdir build
133131
if exist ..\Misc\NEWS (
134-
echo.Copying Misc\NEWS to %PY_MISC_NEWS_DIR%\NEWS
135-
copy ..\Misc\NEWS "%PY_MISC_NEWS_DIR%\NEWS" > nul
132+
echo.Copying existing Misc\NEWS file to Doc\build\NEWS
133+
copy ..\Misc\NEWS build\NEWS > nul
136134
) else if exist ..\Misc\NEWS.D (
137135
if defined BLURB (
138136
echo.Merging Misc/NEWS with %BLURB%
139-
%BLURB% merge -f "%PY_MISC_NEWS_DIR%\NEWS"
137+
%BLURB% merge -f build\NEWS
140138
) else (
141139
echo.No Misc/NEWS file and Blurb is not available.
142140
exit /B 1

Doc/tools/extensions/availability.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from docutils import nodes
88
from sphinx import addnodes
9+
from sphinx.locale import _ as sphinx_gettext
910
from sphinx.util import logging
1011
from sphinx.util.docutils import SphinxDirective
1112

@@ -55,7 +56,7 @@ class Availability(SphinxDirective):
5556
final_argument_whitespace = True
5657

5758
def run(self) -> list[nodes.container]:
58-
title = "Availability"
59+
title = sphinx_gettext("Availability")
5960
refnode = addnodes.pending_xref(
6061
title,
6162
nodes.inline(title, title, classes=["xref", "std", "std-ref"]),

0 commit comments

Comments
 (0)