Skip to content

Commit

Permalink
Merge branch 'main' into zipimport-namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Jul 4, 2024
2 parents 07a3594 + 19d1e43 commit a7488b6
Show file tree
Hide file tree
Showing 111 changed files with 2,039 additions and 1,000 deletions.
4 changes: 2 additions & 2 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Dictionary Objects
.. c:function:: int PyDict_GetItemStringRef(PyObject *p, const char *key, PyObject **result)
Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a
Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
:c:expr:`PyObject*`.
Expand Down Expand Up @@ -206,7 +206,7 @@ Dictionary Objects
``NULL``, and return ``0``.
- On error, raise an exception and return ``-1``.
This is similar to :meth:`dict.pop`, but without the default value and
Similar to :meth:`dict.pop`, but without the default value and
not raising :exc:`KeyError` if the key missing.
.. versionadded:: 3.13
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
weak references to the type object itself.

It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit and
:c:member:`~PyTypeObject.tp_weaklist`.
:c:member:`~PyTypeObject.tp_weaklistoffset`.

**Inheritance:**

Expand All @@ -1604,7 +1604,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
**Default:**

If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the
:c:member:`~PyTypeObject.tp_dict` field, then
:c:member:`~PyTypeObject.tp_flags` field, then
:c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative value,
to indicate that it is unsafe to use this field.

Expand Down
40 changes: 40 additions & 0 deletions Doc/howto/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,46 @@ following diagram.
.. raw:: html
:file: logging_flow.svg

.. raw:: html

<script>
/*
* This snippet is needed to handle the case where a light or dark theme is
* chosen via the theme is selected in the page. We call the existing handler
* and then add a dark-theme class to the body when the dark theme is selected.
* The SVG styling (above) then does the rest.
*
* If the pydoc theme is updated to set the dark-theme class, this snippet
* won't be needed any more.
*/
(function() {
var oldActivateTheme = activateTheme;
function updateBody(theme) {
let elem = document.body;
elem.classList.remove('dark-theme');
elem.classList.remove('light-theme');
if (theme === 'dark') {
elem.classList.add('dark-theme');
}
else if (theme === 'light') {
elem.classList.add('light-theme');
}
}
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed, make sure we update the body - the overriding
* of activateTheme won't have taken effect yet.
*/
updateBody(localStorage.getItem('currentTheme') || 'auto');
})();
</script>

Loggers
^^^^^^^

Expand Down
Binary file modified Doc/howto/logging_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 34 additions & 11 deletions Doc/howto/logging_flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,12 @@ complex types are available:
+----------------------------------+---------------------------------+-----------------+
| ctypes type | C type | Python type |
+==================================+=================================+=================+
| :class:`c_float_complex` | :c:expr:`float complex` | complex |
+----------------------------------+---------------------------------+-----------------+
| :class:`c_double_complex` | :c:expr:`double complex` | complex |
+----------------------------------+---------------------------------+-----------------+
| :class:`c_longdouble_complex` | :c:expr:`long double complex` | complex |
+----------------------------------+---------------------------------+-----------------+


All these types can be created by calling them with an optional initializer of
Expand Down Expand Up @@ -2302,6 +2306,22 @@ These are the fundamental ctypes data types:
.. versionadded:: 3.14


.. class:: c_float_complex

Represents the C :c:expr:`float complex` datatype, if available. The
constructor accepts an optional :class:`complex` initializer.

.. versionadded:: 3.14


.. class:: c_longdouble_complex

Represents the C :c:expr:`long double complex` datatype, if available. The
constructor accepts an optional :class:`complex` initializer.

.. versionadded:: 3.14


.. class:: c_int

Represents the C :c:expr:`signed int` datatype. The constructor accepts an
Expand Down
31 changes: 29 additions & 2 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1724,10 +1724,27 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
Added support for pipes on Windows.


.. function:: splice(src, dst, count, offset_src=None, offset_dst=None)
.. function:: splice(src, dst, count, offset_src=None, offset_dst=None, flags=0)

Transfer *count* bytes from file descriptor *src*, starting from offset
*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.

The splicing behaviour can be modified by specifying a *flags* value.
Any of the following variables may used, combined using bitwise OR
(the ``|`` operator):

* If :const:`SPLICE_F_MOVE` is specified,
the kernel is asked to move pages instead of copying,
but pages may still be copied if the kernel cannot move the pages from the pipe.

* If :const:`SPLICE_F_NONBLOCK` is specified,
the kernel is asked to not block on I/O.
This makes the splice pipe operations nonblocking,
but splice may nevertheless block because the spliced file descriptors may block.

* If :const:`SPLICE_F_MORE` is specified,
it hints to the kernel that more data will be coming in a subsequent splice.

At least one of the file descriptors must refer to a pipe. If *offset_src*
is ``None``, then *src* is read from the current position; respectively for
*offset_dst*. The offset associated to the file descriptor that refers to a
Expand All @@ -1746,6 +1763,8 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
make sense to block because there are no writers connected to the write end
of the pipe.

.. seealso:: The :manpage:`splice(2)` man page.

.. availability:: Linux >= 2.6.17 with glibc >= 2.5

.. versionadded:: 3.10
Expand Down Expand Up @@ -4642,6 +4661,10 @@ written in Python, such as a mail server's external command delivery program.
Use :class:`subprocess.Popen` or :func:`subprocess.run` to
control options like encodings.

.. deprecated:: 3.14
The function is :term:`soft deprecated` and should no longer be used to
write new code. The :mod:`subprocess` module is recommended instead.


.. function:: posix_spawn(path, argv, env, *, file_actions=None, \
setpgroup=None, resetids=False, setsid=False, setsigmask=(), \
Expand Down Expand Up @@ -4868,6 +4891,10 @@ written in Python, such as a mail server's external command delivery program.
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.

.. deprecated:: 3.14
These functions are :term:`soft deprecated` and should no longer be used
to write new code. The :mod:`subprocess` module is recommended instead.


.. data:: P_NOWAIT
P_NOWAITO
Expand Down Expand Up @@ -4972,7 +4999,7 @@ written in Python, such as a mail server's external command delivery program.
shell documentation.

The :mod:`subprocess` module provides more powerful facilities for spawning
new processes and retrieving their results; using that module is preferable
new processes and retrieving their results; using that module is recommended
to using this function. See the :ref:`subprocess-replacements` section in
the :mod:`subprocess` documentation for some helpful recipes.

Expand Down
5 changes: 0 additions & 5 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1554,11 +1554,6 @@ Copying, renaming and deleting
permissions. After the copy is complete, users may wish to call
:meth:`Path.chmod` to set the permissions of the target file.

.. warning::
On old builds of Windows (before Windows 10 build 19041), this method
raises :exc:`OSError` when a symlink to a directory is encountered and
*follow_symlinks* is false.

.. versionadded:: 3.14


Expand Down
6 changes: 6 additions & 0 deletions Doc/library/socketserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ server is the address family.
waits until all non-daemon threads complete, except if
:attr:`block_on_close` attribute is ``False``.

.. attribute:: max_children

Specify how many child processes will exist to handle requests at a time
for :class:`ForkingMixIn`. If the limit is reached,
new requests will wait until one child process has finished.

.. attribute:: daemon_threads

For :class:`ThreadingMixIn` use daemonic threads by setting
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4565,7 +4565,7 @@ can be used interchangeably to index the same dictionary entry.

Return a shallow copy of the dictionary.

.. classmethod:: fromkeys(iterable, value=None)
.. classmethod:: fromkeys(iterable, value=None, /)

Create a new dictionary with keys from *iterable* and values set to *value*.

Expand Down
10 changes: 6 additions & 4 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ A comprehension in an :keyword:`!async def` function may consist of either a
:keyword:`!for` or :keyword:`!async for` clause following the leading
expression, may contain additional :keyword:`!for` or :keyword:`!async for`
clauses, and may also use :keyword:`await` expressions.
If a comprehension contains either :keyword:`!async for` clauses or
:keyword:`!await` expressions or other asynchronous comprehensions it is called
an :dfn:`asynchronous comprehension`. An asynchronous comprehension may
suspend the execution of the coroutine function in which it appears.

If a comprehension contains :keyword:`!async for` clauses, or if it contains
:keyword:`!await` expressions or other asynchronous comprehensions anywhere except
the iterable expression in the leftmost :keyword:`!for` clause, it is called an
:dfn:`asynchronous comprehension`. An asynchronous comprehension may suspend the
execution of the coroutine function in which it appears.
See also :pep:`530`.

.. versionadded:: 3.6
Expand Down
19 changes: 17 additions & 2 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ Improved Modules
ast
---

Added :func:`ast.compare` for comparing two ASTs.
(Contributed by Batuhan Taskaya and Jeremy Hylton in :issue:`15987`.)
* Added :func:`ast.compare` for comparing two ASTs.
(Contributed by Batuhan Taskaya and Jeremy Hylton in :issue:`15987`.)

* Add support for :func:`copy.replace` for AST nodes.

(Contributed by Bénédikt Tran in :gh:`121141`.)

os
--
Expand Down Expand Up @@ -144,6 +148,11 @@ Deprecated
as a single positional argument.
(Contributed by Serhiy Storchaka in :gh:`109218`.)

* :term:`Soft deprecate <soft deprecated>` :func:`os.popen` and
:func:`os.spawn* <os.spawnl>` functions. They should no longer be used to
write new code. The :mod:`subprocess` module is recommended instead.
(Contributed by Victor Stinner in :gh:`120743`.)


Removed
=======
Expand Down Expand Up @@ -300,6 +309,12 @@ Porting to Python 3.14
This section lists previously described changes and other bugfixes
that may require changes to your code.

Changes in the Python API
-------------------------

* :class:`functools.partial` is now a method descriptor.
Wrap it in :func:`staticmethod` if you want to preserve the old behavior.
(Contributed by Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)

Build Changes
=============
Expand Down
Loading

0 comments on commit a7488b6

Please sign in to comment.