Skip to content

Commit 1fbbdb1

Browse files
committed
Merge branch 'main' into escaping-decref-1
2 parents c05c547 + 39fc7ef commit 1fbbdb1

File tree

83 files changed

+1267
-729
lines changed

Some content is hidden

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

83 files changed

+1267
-729
lines changed

Doc/c-api/init.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,17 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
14921492
14931493
.. versionadded:: 3.8
14941494
1495+
1496+
.. c:function:: PyObject* PyUnstable_InterpreterState_GetMainModule(PyInterpreterState *interp)
1497+
1498+
Return a :term:`strong reference` to the ``__main__`` `module object <moduleobjects>`_
1499+
for the given interpreter.
1500+
1501+
The caller must hold the GIL.
1502+
1503+
.. versionadded:: 3.13
1504+
1505+
14951506
.. c:type:: PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
14961507
14971508
Type of a frame evaluation function.

Doc/library/asyncio-queue.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ Queue
115115

116116
.. method:: task_done()
117117

118-
Indicate that a formerly enqueued task is complete.
118+
Indicate that a formerly enqueued work item is complete.
119119

120120
Used by queue consumers. For each :meth:`~Queue.get` used to
121-
fetch a task, a subsequent call to :meth:`task_done` tells the
122-
queue that the processing on the task is complete.
121+
fetch a work item, a subsequent call to :meth:`task_done` tells the
122+
queue that the processing on the work item is complete.
123123

124124
If a :meth:`join` is currently blocking, it will resume when all
125125
items have been processed (meaning that a :meth:`task_done`

Doc/library/fnmatch.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses
4646
a period are not special for this module, and are matched by the ``*`` and ``?``
4747
patterns.
4848

49-
Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is used to
50-
cache the compiled regex patterns in the following functions: :func:`fnmatch`,
51-
:func:`fnmatchcase`, :func:`.filter`.
49+
Unless stated otherwise, "filename string" and "pattern string" either refer to
50+
:class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note that the
51+
functions documented below do not allow to mix a :class:`!bytes` pattern with
52+
a :class:`!str` filename, and vice-versa.
53+
54+
Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768
55+
is used to cache the (typed) compiled regex patterns in the following
56+
functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
57+
5258

5359
.. function:: fnmatch(name, pat)
5460

@@ -78,16 +84,16 @@ cache the compiled regex patterns in the following functions: :func:`fnmatch`,
7884

7985
.. function:: filter(names, pat)
8086

81-
Construct a list from those elements of the :term:`iterable` *names*
82-
that match pattern *pat*.
87+
Construct a list from those elements of the :term:`iterable` of filename
88+
strings *names* that match the pattern string *pat*.
8389
It is the same as ``[n for n in names if fnmatch(n, pat)]``,
8490
but implemented more efficiently.
8591

8692

8793
.. function:: translate(pat)
8894

8995
Return the shell-style pattern *pat* converted to a regular expression for
90-
using with :func:`re.match`.
96+
using with :func:`re.match`. The pattern is expected to be a :class:`str`.
9197

9298
Example:
9399

Doc/library/functools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ The :mod:`functools` module defines the following functions:
368368

369369
If :data:`Placeholder` sentinels are present in *args*, they will be filled first
370370
when :func:`!partial` is called. This makes it possible to pre-fill any positional
371-
argument with a call to :func:`!partial`; without :data:`!Placeholder`, only the
372-
first positional argument can be pre-filled.
371+
argument with a call to :func:`!partial`; without :data:`!Placeholder`,
372+
only the chosen number of leading positional arguments can be pre-filled.
373373

374374
If any :data:`!Placeholder` sentinels are present, all must be filled at call time:
375375

Doc/library/pdb.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,15 @@ slightly different way:
179179
.. versionadded:: 3.14
180180
The *commands* argument.
181181

182-
.. function:: post_mortem(traceback=None)
182+
.. function:: post_mortem(t=None)
183183

184-
Enter post-mortem debugging of the given *traceback* object. If no
185-
*traceback* is given, it uses the one of the exception that is currently
186-
being handled (an exception must be being handled if the default is to be
187-
used).
184+
Enter post-mortem debugging of the given exception or
185+
:ref:`traceback object <traceback-objects>`. If no value is given, it uses
186+
the exception that is currently being handled, or raises ``ValueError`` if
187+
there isn’t one.
188188

189+
.. versionchanged:: 3.13
190+
Support for exception objects was added.
189191

190192
.. function:: pm()
191193

Doc/library/sysconfig.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ Other functions
388388

389389
Windows will return one of:
390390

391-
- win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
391+
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
392+
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
392393
- win32 (all others - specifically, sys.platform is returned)
393394

394395
macOS can return:

Include/internal/pycore_emscripten_trampoline.h

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,14 @@
2727

2828
#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
2929

30-
void _Py_EmscriptenTrampoline_Init(_PyRuntimeState *runtime);
30+
void
31+
_Py_EmscriptenTrampoline_Init(_PyRuntimeState *runtime);
3132

3233
PyObject*
33-
_PyEM_TrampolineCall_JavaScript(PyCFunctionWithKeywords func,
34-
PyObject* self,
35-
PyObject* args,
36-
PyObject* kw);
37-
38-
PyObject*
39-
_PyEM_TrampolineCall_Reflection(PyCFunctionWithKeywords func,
40-
PyObject* self,
41-
PyObject* args,
42-
PyObject* kw);
43-
44-
#define _PyEM_TrampolineCall(meth, self, args, kw) \
45-
((_PyRuntime.wasm_type_reflection_available) ? \
46-
(_PyEM_TrampolineCall_Reflection((PyCFunctionWithKeywords)(meth), (self), (args), (kw))) : \
47-
(_PyEM_TrampolineCall_JavaScript((PyCFunctionWithKeywords)(meth), (self), (args), (kw))))
34+
_PyEM_TrampolineCall(PyCFunctionWithKeywords func,
35+
PyObject* self,
36+
PyObject* args,
37+
PyObject* kw);
4838

4939
#define _PyCFunction_TrampolineCall(meth, self, args) \
5040
_PyEM_TrampolineCall( \
@@ -62,8 +52,6 @@ _PyEM_TrampolineCall_Reflection(PyCFunctionWithKeywords func,
6252

6353
#else // defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
6454

65-
#define _Py_EmscriptenTrampoline_Init(runtime)
66-
6755
#define _PyCFunction_TrampolineCall(meth, self, args) \
6856
(meth)((self), (args))
6957

Include/internal/pycore_freelist_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern "C" {
2222
# define Py_futureiters_MAXFREELIST 255
2323
# define Py_object_stack_chunks_MAXFREELIST 4
2424
# define Py_unicode_writers_MAXFREELIST 1
25+
# define Py_pymethodobjects_MAXFREELIST 20
2526

2627
// A generic freelist of either PyObjects or other data structures.
2728
struct _Py_freelist {
@@ -48,6 +49,7 @@ struct _Py_freelists {
4849
struct _Py_freelist futureiters;
4950
struct _Py_freelist object_stack_chunks;
5051
struct _Py_freelist unicode_writers;
52+
struct _Py_freelist pymethodobjects;
5153
};
5254

5355
#ifdef __cplusplus

Include/internal/pycore_magic_number.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Known values:
265265
Python 3.14a4 3610 (Add VALUE_WITH_FAKE_GLOBALS format to annotationlib)
266266
Python 3.14a4 3611 (Add NOT_TAKEN instruction)
267267
Python 3.14a4 3612 (Add POP_ITER and INSTRUMENTED_POP_ITER)
268+
Python 3.14a4 3613 (Add LOAD_CONST_MORTAL instruction)
268269
269270
Python 3.15 will start with 3650
270271
@@ -277,7 +278,7 @@ PC/launcher.c must also be updated.
277278
278279
*/
279280

280-
#define PYC_MAGIC_NUMBER 3612
281+
#define PYC_MAGIC_NUMBER 3613
281282
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
282283
(little-endian) and then appending b'\r\n'. */
283284
#define PYC_MAGIC_NUMBER_TOKEN \

Include/internal/pycore_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc(
120120
PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
121121

122122
extern void _Py_AddRefTotal(PyThreadState *, Py_ssize_t);
123-
extern void _Py_IncRefTotal(PyThreadState *);
123+
extern PyAPI_FUNC(void) _Py_IncRefTotal(PyThreadState *);
124124
extern void _Py_DecRefTotal(PyThreadState *);
125125

126126
# define _Py_DEC_REFTOTAL(interp) \

0 commit comments

Comments
 (0)