aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/arg.rst6
-rw-r--r--Doc/c-api/function.rst20
-rw-r--r--Doc/data/refcounts.dat24
-rw-r--r--Doc/library/argparse.rst2
-rw-r--r--Doc/library/functions.rst10
-rw-r--r--Doc/library/shutil.rst7
-rw-r--r--Doc/reference/expressions.rst2
-rw-r--r--Doc/using/cmdline.rst17
-rw-r--r--Doc/whatsnew/3.14.rst37
9 files changed, 116 insertions, 9 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 49dbc8d71cc..ab9f9c4539a 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -686,6 +686,12 @@ Building values
``p`` (:class:`bool`) [int]
Convert a C :c:expr:`int` to a Python :class:`bool` object.
+ Be aware that this format requires an ``int`` argument.
+ Unlike most other contexts in C, variadic arguments are not coerced to
+ a suitable type automatically.
+ You can convert another type (for example, a pointer or a float) to a
+ suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
+
.. versionadded:: 3.14
``c`` (:class:`bytes` of length 1) [char]
diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst
index 63b78f67767..5fb8567ef8c 100644
--- a/Doc/c-api/function.rst
+++ b/Doc/c-api/function.rst
@@ -95,6 +95,13 @@ There are a few functions specific to Python functions.
.. versionadded:: 3.12
+
+.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
+
+ Return the keyword-only argument default values of the function object *op*. This can be a
+ dictionary of arguments or ``NULL``.
+
+
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
Return the closure associated with the function object *op*. This can be ``NULL``
@@ -123,6 +130,19 @@ There are a few functions specific to Python functions.
Raises :exc:`SystemError` and returns ``-1`` on failure.
+.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
+ PyObject *PyFunction_GET_GLOBALS(PyObject *op)
+ PyObject *PyFunction_GET_MODULE(PyObject *op)
+ PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
+ PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
+ PyObject *PyFunction_GET_CLOSURE(PyObject *op)
+ PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
+
+ These functions are similar to their ``PyFunction_Get*`` counterparts, but
+ do not do type checking. Passing anything other than an instance of
+ :c:data:`PyFunction_Type` is undefined behavior.
+
+
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
Register *callback* as a function watcher for the current interpreter.
diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat
index 99cc823c0c3..144c5608e07 100644
--- a/Doc/data/refcounts.dat
+++ b/Doc/data/refcounts.dat
@@ -963,21 +963,45 @@ PyFunction_Check:PyObject*:o:0:
PyFunction_GetAnnotations:PyObject*::0:
PyFunction_GetAnnotations:PyObject*:op:0:
+PyFunction_GET_ANNOTATIONS:PyObject*::0:
+PyFunction_GET_ANNOTATIONS:PyObject*:op:0:
+
PyFunction_GetClosure:PyObject*::0:
PyFunction_GetClosure:PyObject*:op:0:
+PyFunction_GET_CLOSURE:PyObject*::0:
+PyFunction_GET_CLOSURE:PyObject*:op:0:
+
PyFunction_GetCode:PyObject*::0:
PyFunction_GetCode:PyObject*:op:0:
+PyFunction_GET_CODE:PyObject*::0:
+PyFunction_GET_CODE:PyObject*:op:0:
+
PyFunction_GetDefaults:PyObject*::0:
PyFunction_GetDefaults:PyObject*:op:0:
+PyFunction_GET_DEFAULTS:PyObject*::0:
+PyFunction_GET_DEFAULTS:PyObject*:op:0:
+
+PyFunction_GetKwDefaults:PyObject*::0:
+PyFunction_GetKwDefaults:PyObject*:op:0:
+
+PyFunction_GET_KW_DEFAULTS:PyObject*::0:
+PyFunction_GET_KW_DEFAULTS:PyObject*:op:0:
+
PyFunction_GetGlobals:PyObject*::0:
PyFunction_GetGlobals:PyObject*:op:0:
+PyFunction_GET_GLOBALS:PyObject*::0:
+PyFunction_GET_GLOBALS:PyObject*:op:0:
+
PyFunction_GetModule:PyObject*::0:
PyFunction_GetModule:PyObject*:op:0:
+PyFunction_GET_MODULE:PyObject*::0:
+PyFunction_GET_MODULE:PyObject*:op:0:
+
PyFunction_New:PyObject*::+1:
PyFunction_New:PyObject*:code:+1:
PyFunction_New:PyObject*:globals:+1:
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 17f126cc065..a03d88092db 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -955,7 +955,7 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are:
.. index:: single: + (plus); in argparse module
-* ``'+'``. Just like ``'*'``, all command-line args present are gathered into a
+* ``'+'``. Just like ``'*'``, all command-line arguments present are gathered into a
list. Additionally, an error message will be generated if there wasn't at
least one command-line argument present. For example::
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 2ecce3dba5a..80bd1275973 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1839,15 +1839,15 @@ are always available. They are listed here in alphabetical order.
``range(start, stop, step)``. The *start* and *step* arguments default to
``None``.
+ Slice objects have read-only data attributes :attr:`!start`,
+ :attr:`!stop`, and :attr:`!step` which merely return the argument
+ values (or their default). They have no other explicit functionality;
+ however, they are used by NumPy and other third-party packages.
+
.. attribute:: slice.start
.. attribute:: slice.stop
.. attribute:: slice.step
- Slice objects have read-only data attributes :attr:`!start`,
- :attr:`!stop`, and :attr:`!step` which merely return the argument
- values (or their default). They have no other explicit functionality;
- however, they are used by NumPy and other third-party packages.
-
Slice objects are also generated when extended indexing syntax is used. For
example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See
:func:`itertools.islice` for an alternate version that returns an
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index e7c4c4f46bd..2dde40c9d92 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -47,6 +47,13 @@ Directory and files operations
0, only the contents from the current file position to the end of the file will
be copied.
+ :func:`copyfileobj` will *not* guarantee that the destination stream has
+ been flushed on completion of the copy. If you want to read from the
+ destination at the completion of the copy operation (for example, reading
+ the contents of a temporary file that has been copied from a HTTP stream),
+ you must ensure that you have called :func:`~io.IOBase.flush` or
+ :func:`~io.IOBase.close` on the file-like object before attempting to read
+ the destination file.
.. function:: copyfile(src, dst, *, follow_symlinks=True)
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 429b3cd1f00..17f39aaf5f5 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1023,7 +1023,7 @@ series of :term:`arguments <argument>`:
: ["," `keywords_arguments`]
: | `starred_and_keywords` ["," `keywords_arguments`]
: | `keywords_arguments`
- positional_arguments: positional_item ("," positional_item)*
+ positional_arguments: `positional_item` ("," `positional_item`)*
positional_item: `assignment_expression` | "*" `expression`
starred_and_keywords: ("*" `expression` | `keyword_item`)
: ("," "*" `expression` | "," `keyword_item`)*
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index 40a46a62031..a5867b489e0 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -669,6 +669,13 @@ Miscellaneous options
.. versionadded:: 3.14
+ * :samp:`-X tlbc={0,1}` enables (1, the default) or disables (0) thread-local
+ bytecode in builds configured with :option:`--disable-gil`. When disabled,
+ this also disables the specializing interpreter. See also
+ :envvar:`PYTHON_TLBC`.
+
+ .. versionadded:: 3.14
+
It also allows passing arbitrary values and retrieving them through the
:data:`sys._xoptions` dictionary.
@@ -1302,6 +1309,16 @@ conflict.
.. versionadded:: 3.13
+.. envvar:: PYTHON_TLBC
+
+ If set to ``1`` enables thread-local bytecode. If set to ``0`` thread-local
+ bytecode and the specializing interpreter are disabled. Only applies to
+ builds configured with :option:`--disable-gil`.
+
+ See also the :option:`-X tlbc <-X>` command-line option.
+
+ .. versionadded:: 3.14
+
Debug-mode variables
~~~~~~~~~~~~~~~~~~~~
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index f0a87a9ada7..cbca720b75e 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -278,7 +278,7 @@ As another example, generating HTML attributes from data:
attributes = {"src": "shrubbery.jpg", "alt": "looks nice"}
template = t"<img {attributes}>"
- assert html(template) == '<img src="shrubbery.jpg" alt="looks nice" class="looks-nice">'
+ assert html(template) == '<img src="shrubbery.jpg" alt="looks nice" />'
Compared to using an f-string, the ``html`` function has access to template attributes
containing the original information: static strings, interpolations, and values
@@ -1757,6 +1757,16 @@ os
(Contributed by Cody Maloney in :gh:`129205`.)
+os.path
+-------
+
+* The *strict* parameter to :func:`os.path.realpath` accepts a new value,
+ :data:`os.path.ALLOW_MISSING`.
+ If used, errors other than :exc:`FileNotFoundError` will be re-raised;
+ the resulting path can be missing but it will be free of symlinks.
+ (Contributed by Petr Viktorin for :cve:`2025-4517`.)
+
+
pathlib
-------
@@ -1945,6 +1955,28 @@ sysconfig
(Contributed by Xuehai Pan in :gh:`131799`.)
+tarfile
+-------
+
+* :func:`~tarfile.data_filter` now normalizes symbolic link targets in order to
+ avoid path traversal attacks.
+ (Contributed by Petr Viktorin in :gh:`127987` and :cve:`2025-4138`.)
+* :func:`~tarfile.TarFile.extractall` now skips fixing up directory attributes
+ when a directory was removed or replaced by another kind of file.
+ (Contributed by Petr Viktorin in :gh:`127987` and :cve:`2024-12718`.)
+* :func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall`
+ now (re-)apply the extraction filter when substituting a link (hard or
+ symbolic) with a copy of another archive member, and when fixing up
+ directory attributes.
+ The former raises a new exception, :exc:`~tarfile.LinkFallbackError`.
+ (Contributed by Petr Viktorin for :cve:`2025-4330` and :cve:`2024-12718`.)
+* :func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall`
+ no longer extract rejected members when
+ :func:`~tarfile.TarFile.errorlevel` is zero.
+ (Contributed by Matt Prodani and Petr Viktorin in :gh:`112887`
+ and :cve:`2025-4435`.)
+
+
threading
---------
@@ -2700,6 +2732,7 @@ New features
* :c:func:`PyUnicodeWriter_Discard`
* :c:func:`PyUnicodeWriter_Finish`
* :c:func:`PyUnicodeWriter_Format`
+ * :c:func:`PyUnicodeWriter_WriteASCII`
* :c:func:`PyUnicodeWriter_WriteChar`
* :c:func:`PyUnicodeWriter_WriteRepr`
* :c:func:`PyUnicodeWriter_WriteStr`
@@ -2976,7 +3009,7 @@ Deprecated
:c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) <PyUnicodeWriter_WriteSubstring>`.
* :c:func:`!_PyUnicodeWriter_WriteASCIIString`:
replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with
- :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
+ :c:func:`PyUnicodeWriter_WriteASCII(writer, str) <PyUnicodeWriter_WriteASCII>`.
* :c:func:`!_PyUnicodeWriter_WriteLatin1String`:
replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.