Skip to content

Commit d01aa34

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pythongh-86179
2 parents 01b1f82 + 81a15ea commit d01aa34

File tree

89 files changed

+6099
-2590
lines changed

Some content is hidden

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

89 files changed

+6099
-2590
lines changed

.github/CODEOWNERS

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ Python/traceback.c @iritkatriel
7878
**/*importlib/resources/* @jaraco @warsaw @FFY00
7979
**/importlib/metadata/* @jaraco @warsaw
8080

81+
# Subinterpreters
82+
Lib/test/support/interpreters/** @ericsnowcurrently
83+
Modules/_xx*interp*module.c @ericsnowcurrently
84+
Lib/test/test_interpreters/** @ericsnowcurrently
85+
8186
# Dates and times
8287
**/*datetime* @pganssle @abalkin
8388
**/*str*time* @pganssle @abalkin
@@ -148,7 +153,15 @@ Doc/c-api/stable.rst @encukou
148153
**/*itertools* @rhettinger
149154
**/*collections* @rhettinger
150155
**/*random* @rhettinger
151-
**/*queue* @rhettinger
156+
Doc/**/*queue* @rhettinger
157+
PCbuild/**/*queue* @rhettinger
158+
Modules/_queuemodule.c @rhettinger
159+
Lib/*queue*.py @rhettinger
160+
Lib/asyncio/*queue*.py @rhettinger
161+
Lib/multiprocessing/*queue*.py @rhettinger
162+
Lib/test/*queue*.py @rhettinger
163+
Lib/test_asyncio/*queue*.py @rhettinger
164+
Lib/test_multiprocessing/*queue*.py @rhettinger
152165
**/*bisect* @rhettinger
153166
**/*heapq* @rhettinger
154167
**/*functools* @rhettinger

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.2
3+
rev: v0.1.7
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/
@@ -24,7 +24,7 @@ repos:
2424
types_or: [c, inc, python, rst]
2525

2626
- repo: https://github.com/sphinx-contrib/sphinx-lint
27-
rev: v0.8.1
27+
rev: v0.9.1
2828
hooks:
2929
- id: sphinx-lint
3030
args: [--enable=default-role]

Doc/c-api/function.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ There are a few functions specific to Python functions.
3535
must be a dictionary with the global variables accessible to the function.
3636
3737
The function's docstring and name are retrieved from the code object.
38-
:func:`~function.__module__`
38+
:attr:`~function.__module__`
3939
is retrieved from *globals*. The argument defaults, annotations and closure are
4040
set to ``NULL``. :attr:`~function.__qualname__` is set to the same value as
4141
the code object's :attr:`~codeobject.co_qualname` field.

Doc/library/hmac.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
This module implements the HMAC algorithm as described by :rfc:`2104`.
1515

1616

17-
.. function:: new(key, msg=None, digestmod='')
17+
.. function:: new(key, msg=None, digestmod)
1818

1919
Return a new hmac object. *key* is a bytes or bytearray object giving the
2020
secret key. If *msg* is present, the method call ``update(msg)`` is made.
@@ -27,10 +27,9 @@ This module implements the HMAC algorithm as described by :rfc:`2104`.
2727
Parameter *msg* can be of any type supported by :mod:`hashlib`.
2828
Parameter *digestmod* can be the name of a hash algorithm.
2929

30-
.. deprecated-removed:: 3.4 3.8
31-
MD5 as implicit default digest for *digestmod* is deprecated.
32-
The digestmod parameter is now required. Pass it as a keyword
33-
argument to avoid awkwardness when you do not have an initial msg.
30+
.. versionchanged:: 3.8
31+
The *digestmod* argument is now required. Pass it as a keyword
32+
argument to avoid awkwardness when you do not have an initial *msg*.
3433

3534

3635
.. function:: digest(key, msg, digest)
@@ -114,11 +113,9 @@ A hash object has the following attributes:
114113
.. versionadded:: 3.4
115114

116115

117-
.. deprecated:: 3.9
118-
119-
The undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, and
120-
``HMAC.outer`` are internal implementation details and will be removed in
121-
Python 3.10.
116+
.. versionchanged:: 3.10
117+
Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``,
118+
and ``HMAC.outer``.
122119

123120
This module also provides the following helper function:
124121

Doc/library/random.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ Functions for sequences
220220
generated. For example, a sequence of length 2080 is the largest that
221221
can fit within the period of the Mersenne Twister random number generator.
222222

223-
.. deprecated-removed:: 3.9 3.11
224-
The optional parameter *random*.
223+
.. versionchanged:: 3.11
224+
Removed the optional parameter *random*.
225225

226226

227227
.. function:: sample(population, k, *, counts=None)
@@ -407,9 +407,9 @@ Alternative Generator
407407
Class that implements the default pseudo-random number generator used by the
408408
:mod:`random` module.
409409

410-
.. deprecated-removed:: 3.9 3.11
410+
.. versionchanged:: 3.11
411411
Formerly the *seed* could be any hashable object. Now it is limited to:
412-
:class:`NoneType`, :class:`int`, :class:`float`, :class:`str`,
412+
``None``, :class:`int`, :class:`float`, :class:`str`,
413413
:class:`bytes`, or :class:`bytearray`.
414414

415415
.. class:: SystemRandom([seed])

Doc/library/syslog.rst

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ facility.
1515

1616
This module wraps the system ``syslog`` family of routines. A pure Python
1717
library that can speak to a syslog server is available in the
18-
:mod:`logging.handlers` module as :class:`SysLogHandler`.
18+
:mod:`logging.handlers` module as :class:`~logging.handlers.SysLogHandler`.
1919

2020
The module defines the following functions:
2121

@@ -107,22 +107,62 @@ The module defines the following functions:
107107

108108
The module defines the following constants:
109109

110-
Priority levels (high to low):
111-
:const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:`LOG_ERR`,
112-
:const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`,
113-
:const:`LOG_DEBUG`.
114-
115-
Facilities:
116-
:const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
117-
:const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
118-
:const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to
119-
:const:`LOG_LOCAL7`, and, if defined in ``<syslog.h>``,
120-
:const:`LOG_AUTHPRIV`.
121-
122-
Log options:
123-
:const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined
124-
in ``<syslog.h>``, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and
125-
:const:`LOG_PERROR`.
110+
111+
.. data:: LOG_EMERG
112+
LOG_ALERT
113+
LOG_CRIT
114+
LOG_ERR
115+
LOG_WARNING
116+
LOG_NOTICE
117+
LOG_INFO
118+
LOG_DEBUG
119+
120+
Priority levels (high to low).
121+
122+
123+
.. data:: LOG_AUTH
124+
LOG_AUTHPRIV
125+
LOG_CRON
126+
LOG_DAEMON
127+
LOG_FTP
128+
LOG_INSTALL
129+
LOG_KERN
130+
LOG_LAUNCHD
131+
LOG_LPR
132+
LOG_MAIL
133+
LOG_NETINFO
134+
LOG_NEWS
135+
LOG_RAS
136+
LOG_REMOTEAUTH
137+
LOG_SYSLOG
138+
LOG_USER
139+
LOG_UUCP
140+
LOG_LOCAL0
141+
LOG_LOCAL1
142+
LOG_LOCAL2
143+
LOG_LOCAL3
144+
LOG_LOCAL4
145+
LOG_LOCAL5
146+
LOG_LOCAL6
147+
LOG_LOCAL7
148+
149+
Facilities, depending on availability in ``<syslog.h>`` for :const:`LOG_AUTHPRIV`,
150+
:const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
151+
:const:`LOG_INSTALL` and :const:`LOG_RAS`.
152+
153+
.. versionchanged:: 3.13
154+
Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
155+
:const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`.
156+
157+
.. data:: LOG_PID
158+
LOG_CONS
159+
LOG_NDELAY
160+
LOG_ODELAY
161+
LOG_NOWAIT
162+
LOG_PERROR
163+
164+
Log options, depending on availability in ``<syslog.h>`` for
165+
:const:`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`.
126166

127167

128168
Examples

Doc/reference/datamodel.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ Most of these attributes check the type of the assigned value:
601601
or ``None`` if unavailable.
602602

603603
* - .. attribute:: function.__defaults__
604-
- A :class:`tuple` containing default parameter values
604+
- A :class:`tuple` containing default :term:`parameter` values
605605
for those parameters that have defaults,
606606
or ``None`` if no parameters have a default value.
607607

@@ -614,19 +614,22 @@ Most of these attributes check the type of the assigned value:
614614
See also: :attr:`__dict__ attributes <object.__dict__>`.
615615

616616
* - .. attribute:: function.__annotations__
617-
- A :class:`dictionary <dict>` containing annotations of parameters.
617+
- A :class:`dictionary <dict>` containing annotations of
618+
:term:`parameters <parameter>`.
618619
The keys of the dictionary are the parameter names,
619620
and ``'return'`` for the return annotation, if provided.
620621
See also: :ref:`annotations-howto`.
621622

622623
* - .. attribute:: function.__kwdefaults__
623624
- A :class:`dictionary <dict>` containing defaults for keyword-only
624-
parameters.
625+
:term:`parameters <parameter>`.
625626

626627
* - .. attribute:: function.__type_params__
627628
- A :class:`tuple` containing the :ref:`type parameters <type-params>` of
628629
a :ref:`generic function <generic-functions>`.
629630

631+
.. versionadded:: 3.12
632+
630633
Function objects also support getting and setting arbitrary attributes, which
631634
can be used, for example, to attach metadata to functions. Regular attribute
632635
dot-notation is used to get and set such attributes.

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Doc/library/ssl.rst
9191
Doc/library/stdtypes.rst
9292
Doc/library/string.rst
9393
Doc/library/subprocess.rst
94-
Doc/library/syslog.rst
9594
Doc/library/tarfile.rst
9695
Doc/library/termios.rst
9796
Doc/library/test.rst

Doc/using/cmdline.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,7 @@ Miscellaneous options
590590

591591
.. versionadded:: 3.10
592592
The ``-X warn_default_encoding`` option.
593-
594-
.. deprecated-removed:: 3.9 3.10
595-
The ``-X oldparser`` option.
593+
Removed the ``-X oldparser`` option.
596594

597595
.. versionadded:: 3.11
598596
The ``-X no_debug_ranges`` option.

Include/cpython/optimizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ typedef struct {
3232
typedef struct _PyExecutorObject {
3333
PyObject_VAR_HEAD
3434
/* WARNING: execute consumes a reference to self. This is necessary to allow executors to tail call into each other. */
35-
struct _PyInterpreterFrame *(*execute)(struct _PyExecutorObject *self, struct _PyInterpreterFrame *frame, PyObject **stack_pointer);
35+
_Py_CODEUNIT *(*execute)(struct _PyExecutorObject *self, struct _PyInterpreterFrame *frame, PyObject **stack_pointer);
3636
_PyVMData vm_data; /* Used by the VM, but opaque to the optimizer */
3737
/* Data needed by the executor goes here, but is opaque to the VM */
3838
} _PyExecutorObject;

Include/internal/pycore_crossinterp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ extern "C" {
1111
#include "pycore_lock.h" // PyMutex
1212
#include "pycore_pyerrors.h"
1313

14+
/**************/
15+
/* exceptions */
16+
/**************/
17+
18+
PyAPI_DATA(PyObject *) PyExc_InterpreterError;
19+
PyAPI_DATA(PyObject *) PyExc_InterpreterNotFoundError;
20+
1421

1522
/***************************/
1623
/* cross-interpreter calls */
@@ -160,6 +167,9 @@ struct _xi_state {
160167
extern PyStatus _PyXI_Init(PyInterpreterState *interp);
161168
extern void _PyXI_Fini(PyInterpreterState *interp);
162169

170+
extern PyStatus _PyXI_InitTypes(PyInterpreterState *interp);
171+
extern void _PyXI_FiniTypes(PyInterpreterState *interp);
172+
163173

164174
/***************************/
165175
/* short-term data sharing */

Include/internal/pycore_interp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ _PyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tst
250250
// Export for the _xxinterpchannels module.
251251
PyAPI_FUNC(PyInterpreterState *) _PyInterpreterState_LookUpID(int64_t);
252252

253-
extern int _PyInterpreterState_IDInitref(PyInterpreterState *);
254-
extern int _PyInterpreterState_IDIncref(PyInterpreterState *);
255-
extern void _PyInterpreterState_IDDecref(PyInterpreterState *);
253+
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
254+
PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *);
255+
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);
256256

257257
extern const PyConfig* _PyInterpreterState_GetConfig(PyInterpreterState *interp);
258258

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_pymem_init.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@ extern void * _PyMem_RawRealloc(void *, void *, size_t);
1818
extern void _PyMem_RawFree(void *, void *);
1919
#define PYRAW_ALLOC {NULL, _PyMem_RawMalloc, _PyMem_RawCalloc, _PyMem_RawRealloc, _PyMem_RawFree}
2020

21-
#if defined(WITH_PYMALLOC)
21+
#ifdef Py_GIL_DISABLED
22+
// Py_GIL_DISABLED requires mimalloc
23+
extern void* _PyObject_MiMalloc(void *, size_t);
24+
extern void* _PyObject_MiCalloc(void *, size_t, size_t);
25+
extern void _PyObject_MiFree(void *, void *);
26+
extern void* _PyObject_MiRealloc(void *, void *, size_t);
27+
# define PYOBJ_ALLOC {NULL, _PyObject_MiMalloc, _PyObject_MiCalloc, _PyObject_MiRealloc, _PyObject_MiFree}
28+
extern void* _PyMem_MiMalloc(void *, size_t);
29+
extern void* _PyMem_MiCalloc(void *, size_t, size_t);
30+
extern void _PyMem_MiFree(void *, void *);
31+
extern void* _PyMem_MiRealloc(void *, void *, size_t);
32+
# define PYMEM_ALLOC {NULL, _PyMem_MiMalloc, _PyMem_MiCalloc, _PyMem_MiRealloc, _PyMem_MiFree}
33+
#elif defined(WITH_PYMALLOC)
2234
extern void* _PyObject_Malloc(void *, size_t);
2335
extern void* _PyObject_Calloc(void *, size_t, size_t);
2436
extern void _PyObject_Free(void *, void *);

Include/internal/pycore_uop_ids.h

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

Include/internal/pycore_uops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct {
2424
_PyUOpInstruction trace[1];
2525
} _PyUOpExecutorObject;
2626

27-
_PyInterpreterFrame *_PyUOpExecute(
27+
_Py_CODEUNIT *_PyUOpExecute(
2828
_PyExecutorObject *executor,
2929
_PyInterpreterFrame *frame,
3030
PyObject **stack_pointer);

Include/opcode_ids.h

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

Lib/hmac.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, key, msg=None, digestmod=''):
5353
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
5454

5555
if not digestmod:
56-
raise TypeError("Missing required parameter 'digestmod'.")
56+
raise TypeError("Missing required argument 'digestmod'.")
5757

5858
if _hashopenssl and isinstance(digestmod, (str, _functype)):
5959
try:

Lib/idlelib/NEWS.txt renamed to Lib/idlelib/News3.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
What's New in IDLE 3.13.0
2+
(since 3.12.0)
3+
Released on 2024-10-xx
4+
=========================
5+
6+
7+
gh-112939: Fix processing unsaved files when quitting IDLE on macOS.
8+
Patch by Ronald Oussoren and Christopher Chavez.
9+
10+
gh-79871: Add docstrings to debugger.py. Fix two bugs in
11+
test_debugger and expand coverage by 47%. Patch by Anthony Shaw.
12+
13+
114
What's New in IDLE 3.12.0
215
(since 3.11.0)
316
Released on 2023-10-02
417
=========================
518

6-
719
gh-104719: Remove IDLE's modification of tokenize.tabsize and test
820
other uses of tokenize data and methods.
921

0 commit comments

Comments
 (0)