8000 Merge branch 'main' into long-rearrange-size-bits · python/cpython@b06bb6f · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b06bb6f

Browse files
committed
Merge branch 'main' into long-rearrange-size-bits
2 parents 7f5acc0 + 5c75b7a commit b06bb6f

File tree

438 files changed

+11807
-4469
lines changed

Some content is hidden

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

438 files changed

+11807
-4469
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ jobs:
111111
run: make smelly
112112
- name: Check limited ABI symbols
113113
run: make check-limited-abi
114+
- name: Check for unsupported C global variables
115+
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
116+
run: make check-c-globals
114117

115118
build_win32:
116119
name: 'Windows (x86)'

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
- name: Send notification
2020
uses: actions/github-script@v6
2121
env:
22-
MAILGUN_API_KEY: ${{ secrets.PSF_MAILGUN_KEY }}
22+
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
2323
with:
2424
script: |
2525
const Mailgun = require("mailgun.js");
2626
const formData = require('form-data');
2727
const mailgun = new Mailgun(formData);
28-
const DOMAIN = "mg.python.org";
28+
const DOMAIN = "mailgun.python.org";
2929
const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY});
3030
github.rest.issues.get({
3131
issue_number: context.issue.number,
@@ -44,7 +44,7 @@ jobs:
4444
};
4545
4646
const data = {
47-
from: "CPython Issues <github@mg.python.org>",
47+
from: "CPython Issues <github@mailgun.python.org>",
4848
to: "new-bugs-announce@python.org",
4949
subject: `[Issue ${issue.data.number}] ${issue.data.title}`,
5050
template: "new-github-issue",

Doc/c-api/buffer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ Buffer-related functions
499499
This function fails if *len* != *src->len*.
500500
501501
502-
.. c:function:: int PyObject_CopyData(Py_buffer *dest, Py_buffer *src)
502+
.. c:function:: int PyObject_CopyData(PyObject *dest, PyObject *src)
503503
504504
Copy data from *src* to *dest* buffer. Can convert between C-style and
505505
or Fortran-style buffers.

Doc/c-api/code.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,27 @@ bound into a function.
172172
before the destruction of *co* takes place, so the prior state of *co*
173173
can be inspected.
174174
175+
If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback
176+
to the about-to-be-destroyed code object will resurrect it and prevent it
177+
from being freed at this time. When the resurrected object is destroyed
178+
later, any watcher callbacks active at that time will be called again.
179+
175180
Users of this API should not rely on internal runtime implementation
176181
details. Such details may include, but are not limited to, the exact
177182
order and timing of creation and destruction of code objects. While
178183
changes in these details may result in differences observable by watchers
179184
(including whether a callback is invoked or not), it does not change
180185
the semantics of the Python code being executed.
181186
182-
If the callback returns with an exception set, it must return ``-1``; this
183-
exception will be printed as an unraisable exception using
184-
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
187+
If the callback sets an exception, it must return ``-1``; this exception will
188+
be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`.
189+
Otherwise it should return ``0``.
190+
191+
There may already be a pending exception set on entry to the callback. In
192+
this case, the callback should return ``0`` with the same exception still
193+
set. This means the callback may not call any other API that can set an
194+
exception unless it saves and clears the exception state first, and restores
195+
it before returning.
185196
186197
.. versionadded:: 3.12
187198

Doc/c-api/dict.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,26 @@ Dictionary Objects
298298
dictionary.
299299
300300
The callback may inspect but must not modify *dict*; doing so could have
301-
unpredictable effects, including infinite recursion.
301+
unpredictable effects, including infinite recursion. Do not trigger Python
302+
code execution in the callback, as it could modify the dict as a side effect.
303+
304+
If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the
305+
callback to the about-to-be-destroyed dictionary will resurrect it and
306+
prevent it from being freed at this time. When the resurrected object is
307+
destroyed later, any watcher callbacks active at that time will be called
308+
again.
302309
303310
Callbacks occur before the notified modification to *dict* takes place, so
304311
the prior state of *dict* can be inspected.
305312
306-
If the callback returns with an exception set, it must return ``-1``; this
307-
exception will be printed as an unraisable exception using
308-
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
313+
If the callback sets an exception, it must return ``-1``; this exception will
314+
be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`.
315+
Otherwise it should return ``0``.
316+
317+
There may already be a pending exception set on entry to the callback. In
318+
this case, the callback should return ``0`` with the same exception still
319+
set. This means the callback may not call any other API that can set an
320+
exception unless it saves and clears the exception state first, and restores
321+
it before returning.
309322
310323
.. versionadded:: 3.12

Doc/c-api/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ Printing and clearing
8686
8787
An exception must be set when calling this function.
8888
89+
.. c:function: void PyErr_DisplayException(PyObject *exc)
90+
91+
Print the standard traceback display of ``exc`` to ``sys.stderr``, including
92+
chained exceptions and notes.
93+
94+
.. versionadded:: 3.12
8995
9096
Raising exceptions
9197
==================

Doc/c-api/function.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,19 @@ There are a few functions specific to Python functions.
173173
runtime behavior depending on optimization decisions, it does not change
174174
the semantics of the Python code being executed.
175175
176-
If the callback returns with an exception set, it must return ``-1``; this
177-
exception will be printed as an unraisable exception using
178-
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
176+
If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the
177+
callback to the about-to-be-destroyed function will resurrect it, preventing
178+
it from being freed at this time. When the resurrected object is destroyed
179+
later, any watcher callbacks active at that time will be called again.
180+
181+
If the callback sets an exception, it must return ``-1``; this exception will
182+
be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`.
183+
Otherwise it should return ``0``.
184+
185+
There may already be a pending exception set on entry to the callback. In
186+
this case, the callback should return ``0`` with the same exception still
187+
set. This means the callback may not call any other API that can set an
188+
exception unless it saves and clears the exception state first, and restores
189+
it before returning.
179190
180191
.. versionadded:: 3.12

Doc/c-api/gcsupport.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,36 @@ garbage collection runs.
228228
Returns the current state, 0 for disabled and 1 for enabled.
229229
230230
.. versionadded:: 3.10
231+
232+
233+
Querying Garbage Collector State
234+
--------------------------------
235+
236+
The C-API provides the following interface for querying information about
237+
the garbage collector.
238+
239+
.. c:function:: void PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
240+
241+
Run supplied *callback* on all live GC-capable objects. *arg* is passed through to
242+
all invocations of *callback*.
243+
244+
.. warning::
245+
If new objects are (de)allocated by the callback it is undefined if they
246+
will be visited.
247+
248+
Garbage collection is disabled during operation. Explicitly running a collection
249+
in the callback may lead to undefined behaviour e.g. visiting the same objects
250+
multiple times or not at all.
251+
252+
.. versionadded:: 3.12
253+
254+
.. c:type:: int (*gcvisitobjects_t)(PyObject *object, void *arg)
255+
256+
Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`.
257+
*arg* is the same as the *arg* passed to ``PyUnstable_GC_VisitObjects``.
258+
Return ``0`` to continue iteration, return ``1`` to stop iteration. Other return
259+
values are reserved for now so behavior on returning anything else is undefined.
260+
261+
.. versionadded:: 3.12
262+
263+

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ Process-wide parameters
513513
program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The
514514
returned string points into static storage; the caller should not modify its
515515
value. This corresponds to the :makevar:`prefix` variable in the top-level
516-
:file:`Makefile` and the ``--prefix`` argument to the :program:`configure`
516+
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
517517
script at build time. The value is available to Python code as ``sys.prefix``.
518518
It is only useful on Unix. See also the next function.
519519

Doc/c-api/intro.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ used by extension writers. Structure member names do not have a reserved prefix.
7878

7979
The header files are typically installed with Python. On Unix, these are
8080
located in the directories :file:`{prefix}/include/pythonversion/` and
81-
:file:`{exec_prefix}/include/pythonversion/`, where :envvar:`prefix` and
82-
:envvar:`exec_prefix` are defined by the corresponding parameters to Python's
81+
:file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` and
82+
:option:`exec_prefix <--exec-prefix>` are defined by the corresponding parameters to Python's
8383
:program:`configure` script and *version* is
8484
``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed
85-
in :file:`{prefix}/include`, where :envvar:`prefix` is the installation
85+
in :file:`{prefix}/include`, where ``prefix`` is the installation
8686
directory specified to the installer.
8787

8888
To include the headers, place both directories (if different) on your compiler's
8989
search path for includes. Do *not* place the parent directories on the search
9090
path and then use ``#include <pythonX.Y/Python.h>``; this will break on
9191
multi-platform builds since the platform independent headers under
92-
:envvar:`prefix` include the platform specific headers from
93-
:envvar:`exec_prefix`.
92+
:option:`prefix <--prefix>` include the platform specific headers from
93+
:option:`exec_prefix <--exec-prefix>`.
9494

9595
C++ users should note that although the API is defined entirely using C, the
9696
header files properly declare the entry points to be ``extern "C"``. As a result,

Doc/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
ogp_site_name = 'Python documentation'
269269
ogp_image = '_static/og-image.png'
270270
ogp_custom_meta_tags = [
271-
'<meta property="og:image:width" content="200">',
272-
'<meta property="og:image:height" content="200">',
273-
'<meta name="theme-color" content="#3776ab">',
271+
'<meta property="og:image:width" content="200" />',
272+
'<meta property="og:image:height" content="200" />',
273+
'<meta name="theme-color" content="#3776ab" />',
274274
]

Doc/data/stable_abi.dat

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

Doc/distributing/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ Key terms
3939
developers and documentation authors responsible for the maintenance and
4040
evolution of the standard packaging tools and the associated metadata and
4141
file format standards. They maintain a variety of tools, documentation
42-
and issue trackers on both `GitHub <https://github.com/pypa>`__ and
43-
`Bitbucket <https://bitbucket.org/pypa/>`__.
42+
and issue trackers on `GitHub <https://github.com/pypa>`__.
4443
* ``distutils`` is the original build and distribution system first added
4544
to the Python standard library in 1998. While direct use of ``distutils``
4645
is being phased out, it still laid the foundation for the current packaging

Doc/installing/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ Key terms
5252
developers and documentation authors responsible for the maintenance and
5353
evolution of the standard packaging tools and the associated metadata and
5454
file format standards. They maintain a variety of tools, documentation,
55-
and issue trackers on both `GitHub <https://github.com/pypa>`__ and
56-
`Bitbucket <https://bitbucket.org/pypa/>`__.
55+
and issue trackers on `GitHub <https://github.com/pypa>`__.
5756
* ``distutils`` is the original build and distribution system first added to
5857
the Python standard library in 1998. While direct use of ``distutils`` is
5958
being phased out, it still laid the foundation for the current packaging

Doc/library/__main__.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ one mentioned below are preferred.
259259

260260
See :mod:`venv` for an example of a package with a minimal ``__main__.py``
261261
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
262-
block. You can invoke it with ``python3 -m venv [directory]``.
262+
block. You can invoke it with ``python -m venv [directory]``.
263263

264264
See :mod:`runpy` for more details on the :option:`-m` flag to the
265265
interpreter executable.

Doc/library/argparse.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ around an instance of :class:`argparse.ArgumentParser`. It is a container for
3434
argument specifications and has options that apply to the parser as whole::
3535

3636
parser = argparse.ArgumentParser(
37-
prog = 'ProgramName',
38-
description = 'What the program does',
39-
epilog = 'Text at the bottom of help')
37+
prog='ProgramName',
38+
description='What the program does',
39+
epilog='Text at the bottom of help')
4040

4141
The :meth:`ArgumentParser.add_argument` method attaches individual argument
4242
specifications to the parser. It supports positional arguments, options that

Doc/library/asyncio-task.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@ Waiting Primitives
804804
.. versionchanged:: 3.11
805805
Passing coroutine objects to ``wait()`` directly is forbidden.
806806

807+
.. versionchanged:: 3.12
808+
Added support for generators yielding tasks.
809+
810+
807811
.. function:: as_completed(aws, *, timeout=None)
808812

809813
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
@@ -814,9 +818,6 @@ Waiting Primitives
814818
Raises :exc:`TimeoutError` if the timeout occurs before
815819
all Futures are done.
816820

817-
.. versionchanged:: 3.10
818-
Removed the *loop* parameter.
819-
820821
Example::
821822

822823
for coro in as_completed(aws):

Doc/library/base64.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The modern interface provides:
5858
This allows an application to e.g. generate URL or filesystem safe Base64
5959
strings. The default is ``None``, for which the standard Base64 alphabet is used.
6060

61-
May assert or raise a a :exc:`ValueError` if the length of *altchars* is not 2. Raises a
61+
May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. Raises a
6262
:exc:`TypeError` if *altchars* is not a :term:`bytes-like object`.
6363

6464

Doc/library/concurrent.futures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ ThreadPoolExecutor Example
202202
'http://www.cnn.com/',
203203
'http://europe.wsj.com/',
204204
'http://www.bbc.co.uk/',
205-
'http://some-made-up-domain.com/']
205+
'http://nonexistant-subdomain.python.org/']
206206

207207
# Retrieve a single page and report the URL and contents
208208
def load_url(url, timeout):

Doc/library/dataclasses.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Module contents
389389
:func:`astuple` raises :exc:`TypeError` if ``obj`` is not a dataclass
390390
instance.
391391

392-
.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)
392+
.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False, module=None)
393393

394394
Creates a new dataclass with name ``cls_name``, fields as defined
395395
in ``fields``, base classes as given in ``bases``, and initialized
@@ -401,6 +401,10 @@ Module contents
401401
``match_args``, ``kw_only``, ``slots``, and ``weakref_slot`` have
402402
the same meaning as they do in :func:`dataclass`.
403403

404+
If ``module`` is defined, the ``__module__`` attribute
405+
of the dataclass is set to that value.
406+
By default, it is set to the module name of the caller.
407+
404408
This function is not strictly required, because any Python
405409
mechanism for creating a new class with ``__annotations__`` can
406410
then apply the 10000 :func:`dataclass` function to convert that class to

Doc/library/dis.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ the following command can be used to display the disassembly of
5757
2 0 RESUME 0
5858
<BLANKLINE>
5959
3 2 LOAD_GLOBAL 1 (NULL + len)
60-
14 LOAD_FAST 0 (alist)
61-
16 CALL 1
62-
26 RETURN_VALUE
60+
12 LOAD_FAST 0 (alist)
61+
14 CALL 1
62+
24 RETURN_VALUE
6363

6464
(The "2" is a line number).
6565

Doc/library/email.utils.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ module:
1313

1414
.. function:: localtime(dt=None)
1515

16-
Return local time as an aware datetime object. If called without
17-
arguments, return current time. Otherwise *dt* argument should be a
18-
:class:`~datetime.datetime` instance, and it is converted to the local time
19-
zone according to the system time zone database. If *dt* is naive (that
20-
is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time. In this
21-
case, a positive or zero value for *isdst* causes ``localtime`` to presume
22-
initially that summer time (for example, Daylight Saving Time) is or is not
23-
(respectively) in effect for the specified time. A negative value for
24-
*isdst* causes the ``localtime`` to attempt to divine whether summer time
25-
is in effect for the specified time.
26-
27-
.. versionadded:: 3.3
16+
Return local time as an aware datetime object. If called without
17+
arguments, return current time. Otherwise *dt* argument should be a
18+
:class:`~datetime.datetime` instance, and it is converted to the local time
19+
zone according to the system time zone database. If *dt* is naive (that
20+
is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time. The
21+
*isdst* parameter is ignored.
2822

23+
.. versionadded:: 3.3
24+
25+
.. deprecated-removed:: 3.12 3.14
26+
The *isdst* parameter.
2927

3028
.. function:: make_msgid(idstring=None, domain=None)
3129

Doc/library/importlib.metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ something into it:
7373

7474
.. code-block:: shell-session
7575
76-
$ python3 -m venv example
76+
$ python -m venv example
7777
$ source example/bin/activate
7878
(example) $ python -m pip install wheel
7979

0 commit comments

Comments
 (0)
0