Skip to content

Commit

Permalink
Merge branch 'main' into make-opcode-static
Browse files Browse the repository at this point in the history
  • Loading branch information
markshannon committed Feb 3, 2025
2 parents 536ee25 + 808071b commit 015d000
Show file tree
Hide file tree
Showing 117 changed files with 4,834 additions and 3,163 deletions.
28 changes: 17 additions & 11 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
Get :data:`sys.executable` instead.
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
(:data:`sys.executable`) instead.
.. c:function:: wchar_t* Py_GetPrefix()
Expand All @@ -644,8 +645,10 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
:ref:`virtual environments <venv-def>` need to be handled.
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
<venv-def>` need to be handled.
.. c:function:: wchar_t* Py_GetExecPrefix()
Expand Down Expand Up @@ -690,9 +693,11 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.

.. deprecated-removed:: 3.13 3.15
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
:ref:`virtual environments <venv-def>` need to be handled.
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
(:data:`sys.base_exec_prefix`) instead. Use
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need
to be handled.

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

.. deprecated-removed:: 3.13 3.15
Get :data:`sys.executable` instead.
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
(:data:`sys.executable`) instead.


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

.. deprecated-removed:: 3.13 3.15
Get :data:`sys.path` instead.

Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
(:data:`sys.path`) instead.

.. c:function:: const char* Py_GetVersion()
Expand Down Expand Up @@ -926,8 +932,8 @@ Process-wide parameters
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
.. deprecated-removed:: 3.13 3.15
Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment
variable instead.
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
:envvar:`PYTHONHOME` environment variable instead.
.. _threads:
Expand Down
7 changes: 4 additions & 3 deletions Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,6 @@ state:
On success, return ``0``. On error, raise an exception and return ``-1``.
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
raised in this case.
Example usage::
static int
Expand All @@ -540,6 +537,10 @@ state:
return res;
}
To be convenient, the function accepts ``NULL`` *value* with an exception
set. In this case, return ``-1`` and just leave the raised exception
unchanged.
The example can also be written without checking explicitly if *obj* is
``NULL``::
Expand Down
1 change: 1 addition & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'changes',
'glossary_search',
'lexers',
'misc_news',
'pydoc_topics',
'pyspecific',
'sphinx.ext.coverage',
Expand Down
1 change: 0 additions & 1 deletion Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 24 additions & 12 deletions Doc/deprecations/c-api-pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,35 @@ Pending removal in Python 3.15
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.
* :c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro:
Use :c:type:`wchar_t` instead.
* Python initialization functions:
* Python initialization functions, deprecated in Python 3.13:

* :c:func:`PySys_ResetWarnOptions`:
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
* :c:func:`Py_GetExecPrefix`:
Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead.
* :c:func:`Py_GetPath`:
Get :data:`sys.path` instead.
Use :c:func:`PyConfig_Get("module_search_paths") <PyConfig_Get>`
(:data:`sys.path`) instead.
* :c:func:`Py_GetPrefix`:
Get :data:`sys.base_prefix` and :data:`sys.prefix` instead.
Use :c:func:`PyConfig_Get("base_prefix") <PyConfig_Get>`
(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get("prefix")
<PyConfig_Get>` (:data:`sys.prefix`) if :ref:`virtual environments
<venv-def>` need to be handled.
* :c:func:`Py_GetExecPrefix`:
Use :c:func:`PyConfig_Get("base_exec_prefix") <PyConfig_Get>`
(:data:`sys.base_exec_prefix`) instead. Use
:c:func:`PyConfig_Get("exec_prefix") <PyConfig_Get>`
(:data:`sys.exec_prefix`) if :ref:`virtual environments <venv-def>` need to
be handled.
* :c:func:`Py_GetProgramFullPath`:
Get :data:`sys.executable` instead.
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
(:data:`sys.executable`) instead.
* :c:func:`Py_GetProgramName`:
Get :data:`sys.executable` instead.
Use :c:func:`PyConfig_Get("executable") <PyConfig_Get>`
(:data:`sys.executable`) instead.
* :c:func:`Py_GetPythonHome`:
Get :c:func:`PyConfig_Get("home") <PyConfig_Get>`
or the :envvar:`PYTHONHOME` environment variable instead.
Use :c:func:`PyConfig_Get("home") <PyConfig_Get>` or the
:envvar:`PYTHONHOME` environment variable instead.

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

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

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

The :c:func:`Py_InitializeFromConfig` API should be used with
:c:type:`PyConfig` instead.
Expand Down
3 changes: 3 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ Glossary
and therefore it is never deallocated while the interpreter is running.
For example, :const:`True` and :const:`None` are immortal in CPython.

Immortal objects can be identified via :func:`sys._is_immortal`, or
via :c:func:`PyUnstable_IsImmortal` in the C API.

immutable
An object with a fixed value. Immutable objects include numbers, strings and
tuples. Such an object cannot be altered. A new object has to
Expand Down
8 changes: 6 additions & 2 deletions Doc/library/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,13 @@ The following exceptions are the exceptions that are usually raised.

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

You should report this to the author or maintainer of your Python interpreter.
If you're confident that this exception wasn't your fault, or the fault of
a package you're using, you should report this to the author or maintainer
of your Python interpreter.
Be sure to report the version of the Python interpreter (``sys.version``; it is
also printed at the start of an interactive Python session), the exact error
message (the exception's associated value) and if possible the source of the
Expand Down
8 changes: 7 additions & 1 deletion Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,9 @@ the use of userspace buffers in Python as in "``outfd.write(infd.read())``".

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

On Linux and Solaris :func:`os.sendfile` is used.
On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used.

On Solaris :func:`os.sendfile` is used.

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

.. versionchanged:: next
Copy-on-write or server-side copy may be used internally via
:func:`os.copy_file_range` on supported Linux filesystems.

.. _shutil-copytree-example:

copytree example
Expand Down
23 changes: 23 additions & 0 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,11 @@ always available. Unless explicitly noted otherwise, all variables are read-only
reflect the actual number of references. Consequently, do not rely
on the returned value to be accurate, other than a value of 0 or 1.

.. impl-detail::

:term:`Immortal <immortal>` objects with a large reference count can be
identified via :func:`_is_immortal`.

.. versionchanged:: 3.12
Immortal objects have very large refcounts that do not match
the actual number of references to the object.
Expand Down Expand Up @@ -1264,6 +1269,24 @@ always available. Unless explicitly noted otherwise, all variables are read-only

.. versionadded:: 3.12

.. function:: _is_immortal(op)

Return :const:`True` if the given object is :term:`immortal`, :const:`False`
otherwise.

.. note::

Objects that are immortal (and thus return ``True`` upon being passed
to this function) are not guaranteed to be immortal in future versions,
and vice versa for mortal objects.

.. versionadded:: next

.. impl-detail::

This function should be used for specialized purposes only.
It is not guaranteed to exist in all implementations of Python.

.. function:: _is_interned(string)

Return :const:`True` if the given string is "interned", :const:`False`
Expand Down
10 changes: 5 additions & 5 deletions Doc/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ Project, https://www.wide.ad.jp/. ::
may be used to endorse or promote products derived from this software
without specific prior written permission.

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

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

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

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

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
Expand Down
10 changes: 4 additions & 6 deletions Doc/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,14 @@ goto end
:build
if not exist "%BUILDDIR%" mkdir "%BUILDDIR%"

rem PY_MISC_NEWS_DIR is also used by our Sphinx extension in tools/extensions/pyspecific.py
if not defined PY_MISC_NEWS_DIR set PY_MISC_NEWS_DIR=%BUILDDIR%\%1
if not exist "%PY_MISC_NEWS_DIR%" mkdir "%PY_MISC_NEWS_DIR%"
if not exist build mkdir build
if exist ..\Misc\NEWS (
echo.Copying Misc\NEWS to %PY_MISC_NEWS_DIR%\NEWS
copy ..\Misc\NEWS "%PY_MISC_NEWS_DIR%\NEWS" > nul
echo.Copying existing Misc\NEWS file to Doc\build\NEWS
copy ..\Misc\NEWS build\NEWS > nul
) else if exist ..\Misc\NEWS.D (
if defined BLURB (
echo.Merging Misc/NEWS with %BLURB%
%BLURB% merge -f "%PY_MISC_NEWS_DIR%\NEWS"
%BLURB% merge -f build\NEWS
) else (
echo.No Misc/NEWS file and Blurb is not available.
exit /B 1
Expand Down
3 changes: 2 additions & 1 deletion Doc/tools/extensions/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from docutils import nodes
from sphinx import addnodes
from sphinx.locale import _ as sphinx_gettext
from sphinx.util import logging
from sphinx.util.docutils import SphinxDirective

Expand Down Expand Up @@ -55,7 +56,7 @@ class Availability(SphinxDirective):
final_argument_whitespace = True

def run(self) -> list[nodes.container]:
title = "Availability"
title = sphinx_gettext("Availability")
refnode = addnodes.pending_xref(
title,
nodes.inline(title, title, classes=["xref", "std", "std-ref"]),
Expand Down
Loading

0 comments on commit 015d000

Please sign in to comment.