Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-110722-regrtest
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed Nov 6, 2023
2 parents d4f5b6b + d4426e8 commit 84263a3
Show file tree
Hide file tree
Showing 285 changed files with 24,292 additions and 33,187 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ jobs:
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
allowed-failures: >-
build_macos,
build_macos_free_threaded,
build_ubuntu_free_threaded,
build_ubuntu_ssltests,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/new-bugs-announce-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 20
- run: npm install mailgun.js form-data
- name: Send notification
uses: actions/github-script@v6
Expand Down
2 changes: 1 addition & 1 deletion Doc/bugs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ though it may take a while to be processed.
`Helping with Documentation <https://devguide.python.org/docquality/#helping-with-documentation>`_
Comprehensive guide for individuals that are interested in contributing to Python documentation.

`Documentation Translations <https://devguide.python.org/documenting/#translating>`_
`Documentation Translations <https://devguide.python.org/documentation/translating/>`_
A list of GitHub pages for documentation translation and their primary contacts.


Expand Down
1 change: 1 addition & 0 deletions Doc/c-api/bytes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ called with a non-bytes parameter.
Return the null-terminated contents of the object *obj*
through the output variables *buffer* and *length*.
Returns ``0`` on success.
If *length* is ``NULL``, the bytes object
may not contain embedded null bytes;
Expand Down
4 changes: 4 additions & 0 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ it can be updated:
>>> Movie('Star Wars').director
'J.J. Abrams'

.. testcleanup::

conn.close()


Pure Python Equivalents
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
8 changes: 5 additions & 3 deletions Doc/library/difflib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
expressed in the ISO 8601 format. If not specified, the
strings default to blanks.

>>> import sys
>>> from difflib import *
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py', tofile='after.py'))
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py',
... tofile='after.py'))
*** before.py
--- after.py
***************
Expand Down Expand Up @@ -294,13 +297,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
For inputs that do not have trailing newlines, set the *lineterm* argument to
``""`` so that the output will be uniformly newline free.

The context diff format normally has a header for filenames and modification
The unified diff format normally has a header for filenames and modification
times. Any or all of these may be specified using strings for *fromfile*,
*tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
expressed in the ISO 8601 format. If not specified, the
strings default to blanks.


>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
>>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py'))
Expand Down
14 changes: 12 additions & 2 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ iterations of the loop.
.. versionchanged:: 3.12
oparg set to be the exception block depth, for efficient closing of generators.

.. versionchanged:: 3.13
oparg is ``1`` if this instruction is part of a yield-from or await, and ``0``
otherwise.

.. opcode:: SETUP_ANNOTATIONS

Expand Down Expand Up @@ -1625,20 +1628,27 @@ iterations of the loop.
success (``True``) or failure (``False``).


.. opcode:: RESUME (where)
.. opcode:: RESUME (context)

A no-op. Performs internal tracing, debugging and optimization checks.

The ``where`` operand marks where the ``RESUME`` occurs:
The ``context`` oparand consists of two parts. The lowest two bits
indicate where the ``RESUME`` occurs:

* ``0`` The start of a function, which is neither a generator, coroutine
nor an async generator
* ``1`` After a ``yield`` expression
* ``2`` After a ``yield from`` expression
* ``3`` After an ``await`` expression

The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0``
otherwise.

.. versionadded:: 3.11

.. versionchanged:: 3.13
The oparg value changed to include information about except-depth


.. opcode:: RETURN_GENERATOR

Expand Down
7 changes: 7 additions & 0 deletions Doc/library/ipaddress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ write code that handles both IP versions correctly. Address objects are
``True`` if the address is reserved for link-local usage. See
:RFC:`3927`.

.. attribute:: ipv6_mapped

:class:`IPv4Address` object representing the IPv4-mapped IPv6 address. See :RFC:`4291`.

.. versionadded:: 3.13


.. _iana-ipv4-special-registry: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
.. _iana-ipv6-special-registry: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml

Expand Down
4 changes: 1 addition & 3 deletions Doc/library/logging.handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,7 @@ supports sending logging messages to a remote or local Unix syslog.
to the other end. This method is called during handler initialization,
but it's not regarded as an error if the other end isn't listening at
this point - the method will be called again when emitting an event, if
but it's not regarded as an error if the other end isn't listening yet
--- the method will be called again when emitting an event,
if there is no socket at that point.
there is no socket at that point.

.. versionadded:: 3.11

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/pdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ can be overridden by the local file.

Create an alias called *name* that executes *command*. The *command* must
*not* be enclosed in quotes. Replaceable parameters can be indicated by
``%1``, ``%2``, and so on, while ``%*`` is replaced by all the parameters.
``%1``, ``%2``, ... and ``%9``, while ``%*`` is replaced by all the parameters.
If *command* is omitted, the current alias for *name* is shown. If no
arguments are given, all aliases are listed.

Expand Down
8 changes: 4 additions & 4 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ without the dedicated syntax, as documented below.

.. doctest::

>>> from typing import ParamSpec
>>> from typing import ParamSpec, get_origin
>>> P = ParamSpec("P")
>>> get_origin(P.args) is P
True
Expand Down Expand Up @@ -3059,14 +3059,14 @@ Introspection helpers

Return the set of members defined in a :class:`Protocol`.

::
.. doctest::

>>> from typing import Protocol, get_protocol_members
>>> class P(Protocol):
... def a(self) -> str: ...
... b: int
>>> get_protocol_members(P)
frozenset({'a', 'b'})
>>> get_protocol_members(P) == frozenset({'a', 'b'})
True

Raise :exc:`TypeError` for arguments that are not Protocols.

Expand Down
4 changes: 2 additions & 2 deletions Doc/tools/templates/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ <h2>Unpacking</h2>

<p>Unix users should download the .tar.bz2 archives; these are bzipped tar
archives and can be handled in the usual way using tar and the bzip2
program. The <a href="http://www.info-zip.org">InfoZIP</a> unzip program can be
program. The <a href="https://infozip.sourceforge.net">Info-ZIP</a> unzip program can be
used to handle the ZIP archives if desired. The .tar.bz2 archives provide the
best compression and fastest download times.</p>

<p>Windows users can use the ZIP archives since those are customary on that
platform. These are created on Unix using the InfoZIP zip program.</p>
platform. These are created on Unix using the Info-ZIP zip program.</p>


<h2>Problems</h2>
Expand Down
25 changes: 20 additions & 5 deletions Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,13 @@ Miscellaneous options
location indicators when the interpreter displays tracebacks. See also
:envvar:`PYTHONNODEBUGRANGES`.
* ``-X frozen_modules`` determines whether or not frozen modules are
ignored by the import machinery. A value of "on" means they get
imported and "off" means they are ignored. The default is "on"
ignored by the import machinery. A value of ``on`` means they get
imported and ``off`` means they are ignored. The default is ``on``
if this is an installed Python (the normal case). If it's under
development (running from the source tree) then the default is "off".
Note that the "importlib_bootstrap" and "importlib_bootstrap_external"
frozen modules are always used, even if this flag is set to "off".
development (running from the source tree) then the default is ``off``.
Note that the :mod:`!importlib_bootstrap` and
:mod:`!importlib_bootstrap_external` frozen modules are always used, even
if this flag is set to ``off``. See also :envvar:`PYTHON_FROZEN_MODULES`.
* ``-X perf`` enables support for the Linux ``perf`` profiler.
When this option is provided, the ``perf`` profiler will be able to
report Python calls. This option is only available on some platforms and
Expand Down Expand Up @@ -1095,6 +1096,20 @@ conflict.

.. versionadded:: 3.13

.. envvar:: PYTHON_FROZEN_MODULES

If this variable is set to ``on`` or ``off``, it determines whether or not
frozen modules are ignored by the import machinery. A value of ``on`` means
they get imported and ``off`` means they are ignored. The default is ``on``
for non-debug builds (the normal case) and ``off`` for debug builds.
Note that the :mod:`!importlib_bootstrap` and
:mod:`!importlib_bootstrap_external` frozen modules are always used, even
if this flag is set to ``off``.

See also the :option:`-X frozen_modules <-X>` command-line option.

.. versionadded:: 3.13


Debug-mode variables
~~~~~~~~~~~~~~~~~~~~
Expand Down
21 changes: 20 additions & 1 deletion Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ Other Language Changes
is rejected when the global is used in the :keyword:`else` block.
(Contributed by Irit Katriel in :gh:`111123`.)

* Added a new environment variable :envvar:`PYTHON_FROZEN_MODULES`. It
determines whether or not frozen modules are ignored by the import machinery,
equivalent of the :option:`-X frozen_modules <-X>` command-line option.
(Contributed by Yilei Yang in :gh:`111374`.)

New Modules
===========

Expand Down Expand Up @@ -180,6 +185,12 @@ and only logged in :ref:`Python Development Mode <devmode>` or on :ref:`Python
built on debug mode <debug-build>`.
(Contributed by Victor Stinner in :gh:`62948`.)

ipaddress
---------

* Add the :attr:`ipaddress.IPv4Address.ipv6_mapped` property, which returns the IPv4-mapped IPv6 address.
(Contributed by Charles Machalow in :gh:`109466`.)

opcode
------

Expand Down Expand Up @@ -940,6 +951,15 @@ Others

* None yet

CPython bytecode changes
========================

* The oparg of ``YIELD_VALUE`` is now ``1`` if the yield is part of a
yield-from or await, and ``0`` otherwise. The oparg of ``RESUME`` was
changed to add a bit indicating whether the except-depth is 1, which
is needed to optimize closing of generators.
(Contributed by Irit Katriel in :gh:`111354`.)

Porting to Python 3.13
======================

Expand Down Expand Up @@ -1035,7 +1055,6 @@ New Features
* If Python is built in :ref:`debug mode <debug-build>` or :option:`with
assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and
:c:func:`PyList_SET_ITEM` now check the index argument with an assertion.
If the assertion fails, make sure that the size is set before.
(Contributed by Victor Stinner in :gh:`106168`.)

* Add :c:func:`PyModule_Add` function: similar to
Expand Down
1 change: 1 addition & 0 deletions Include/cpython/pthread_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ PyAPI_FUNC(int) pthread_create(pthread_t *restrict thread,
void *(*start_routine)(void *),
void *restrict arg);
PyAPI_FUNC(int) pthread_detach(pthread_t thread);
PyAPI_FUNC(int) pthread_join(pthread_t thread, void** value_ptr);
PyAPI_FUNC(pthread_t) pthread_self(void);
PyAPI_FUNC(int) pthread_exit(void *retval) __attribute__ ((__noreturn__));
PyAPI_FUNC(int) pthread_attr_init(pthread_attr_t *attr);
Expand Down
2 changes: 2 additions & 0 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ PyAPI_FUNC(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyO

extern int _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);

extern int _PyEval_SetOpcodeTrace(PyFrameObject *f, bool enable);

// Helper to look up a builtin object
// Export for 'array' shared extension
PyAPI_FUNC(PyObject*) _PyEval_GetBuiltin(PyObject *);
Expand Down
2 changes: 2 additions & 0 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ extern int _PyStaticCode_Init(PyCodeObject *co);

#ifdef Py_STATS

#include "pycore_bitutils.h" // _Py_bit_length

#define STAT_INC(opname, name) do { if (_Py_stats) _Py_stats->opcode_stats[opname].specialization.name++; } while (0)
#define STAT_DEC(opname, name) do { if (_Py_stats) _Py_stats->opcode_stats[opname].specialization.name--; } while (0)
#define OPCODE_EXE_INC(opname) do { if (_Py_stats) _Py_stats->opcode_stats[opname].execution_count++; } while (0)
Expand Down
Loading

0 comments on commit 84263a3

Please sign in to comment.