Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e45c22a

Browse files
authored
Merge branch 'main' into 3.14-zstd-c-code
2 parents cadf6e4 + 732d1b0 commit e45c22a

File tree

78 files changed

+1872
-1097
lines changed

Some content is hidden

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

78 files changed

+1872
-1097
lines changed

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ on:
88
pull_request:
99
paths:
1010
- ".github/workflows/mypy.yml"
11+
- "Lib/_colorize.py"
1112
- "Lib/_pyrepl/**"
1213
- "Lib/test/libregrtest/**"
14+
- "Misc/mypy/**"
1315
- "Tools/build/generate_sbom.py"
1416
- "Tools/cases_generator/**"
1517
- "Tools/clinic/**"

Doc/c-api/unicode.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ Python:
3333

3434
.. c:var:: PyTypeObject PyUnicode_Type
3535
36-
This instance of :c:type:`PyTypeObject` represents the Python Unicode type. It
37-
is exposed to Python code as :py:class:`str`.
36+
This instance of :c:type:`PyTypeObject` represents the Python Unicode type.
37+
It is exposed to Python code as :py:class:`str`.
38+
39+
40+
.. c:var:: PyTypeObject PyUnicodeIter_Type
41+
42+
This instance of :c:type:`PyTypeObject` represents the Python Unicode
43+
iterator type. It is used to iterate over Unicode string objects.
3844

3945

4046
.. c:type:: Py_UCS4

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ although there is currently no date scheduled for their removal.
1313
deprecated.
1414
* The :class:`argparse.FileType` type converter is deprecated.
1515

16-
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
17-
1816
* :mod:`builtins`:
1917

2018
* ``bool(NotImplemented)``.

Doc/library/pdb.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,21 @@ slightly different way:
188188
.. versionadded:: 3.14
189189
The *commands* argument.
190190

191+
192+
.. awaitablefunction:: set_trace_async(*, header=None, commands=None)
193+
194+
async version of :func:`set_trace`. This function should be used inside an
195+
async function with :keyword:`await`.
196+
197+
.. code-block:: python
198+
199+
async def f():
200+
await pdb.set_trace_async()
201+
202+
:keyword:`await` statements are supported if the debugger is invoked by this function.
203+
204+
.. versionadded:: 3.14
205+
191206
.. function:: post_mortem(t=None)
192207

193208
Enter post-mortem debugging of the given exception or

Doc/whatsnew/3.14.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,11 @@ pdb
11681168
backend by default, which is configurable.
11691169
(Contributed by Tian Gao in :gh:`124533`.)
11701170

1171+
* :func:`pdb.set_trace_async` is added to support debugging asyncio
1172+
coroutines. :keyword:`await` statements are supported with this
1173+
function.
1174+
(Contributed by Tian Gao in :gh:`132576`.)
1175+
11711176

11721177
pickle
11731178
------
@@ -1637,6 +1642,13 @@ Deprecated
16371642
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
16381643
(Contributed by Bénédikt Tran in :gh:`119698`.)
16391644

1645+
* :mod:`tkinter`:
1646+
The :class:`!tkinter.Variable` methods :meth:`!trace_variable`,
1647+
:meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now deprecated.
1648+
Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!trace_info`
1649+
instead.
1650+
(Contributed by Serhiy Storchaka in :gh:`120220`.)
1651+
16401652
* :mod:`urllib.parse`:
16411653
Accepting objects with false values (like ``0`` and ``[]``) except empty
16421654
strings, byte-like objects and ``None`` in :mod:`urllib.parse` functions
@@ -2280,3 +2292,10 @@ Removed
22802292
* Remove the private ``_Py_InitializeMain()`` function. It was a
22812293
:term:`provisional API` added to Python 3.8 by :pep:`587`.
22822294
(Contributed by Victor Stinner in :gh:`129033`.)
2295+
2296+
* The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and
2297+
:c:member:`!PyThreadState.c_recursion_remaining`, added in 3.13, are removed
2298+
without a deprecation period.
2299+
Please use :c:func:`Py_EnterRecursiveCall` to guard against runaway recursion
2300+
in C code.
2301+
(Removed in :gh:`133079`, see also :gh:`130396`.)

Include/cpython/pystate.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ struct _ts {
118118

119119
int py_recursion_remaining;
120120
int py_recursion_limit;
121-
122-
int c_recursion_remaining; /* Retained for backwards compatibility. Do not use */
123121
int recursion_headroom; /* Allow 50 more calls to handle any errors. */
124122

125123
/* 'tracing' keeps track of the execution depth when tracing/profiling.
@@ -210,8 +208,6 @@ struct _ts {
210208
_PyRemoteDebuggerSupport remote_debugger_support;
211209
};
212210

213-
# define Py_C_RECURSION_LIMIT 5000
214-
215211
/* other API */
216212

217213
/* Similar to PyThreadState_Get(), but don't issue a fatal error

Include/internal/pycore_code.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ typedef struct {
177177
*/
178178

179179
// Note that these all fit within a byte, as do combinations.
180-
// Later, we will use the smaller numbers to differentiate the different
181-
// kinds of locals (e.g. pos-only arg, varkwargs, local-only).
182-
#define CO_FAST_HIDDEN 0x10
183-
#define CO_FAST_LOCAL 0x20
184-
#define CO_FAST_CELL 0x40
185-
#define CO_FAST_FREE 0x80
180+
#define CO_FAST_ARG_POS (0x02) // pos-only, pos-or-kw, varargs
181+
#define CO_FAST_ARG_KW (0x04) // kw-only, pos-or-kw, varkwargs
182+
#define CO_FAST_ARG_VAR (0x08) // varargs, varkwargs
183+
#define CO_FAST_ARG (CO_FAST_ARG_POS | CO_FAST_ARG_KW | CO_FAST_ARG_VAR)
184+
#define CO_FAST_HIDDEN (0x10)
185+
#define CO_FAST_LOCAL (0x20)
186+
#define CO_FAST_CELL (0x40)
187+
#define CO_FAST_FREE (0x80)
186188

187189
typedef unsigned char _PyLocals_Kind;
188190

@@ -315,6 +317,7 @@ extern void _Py_Specialize_ForIter(_PyStackRef iter, _Py_CODEUNIT *instr, int op
315317
extern void _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
316318
extern void _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
317319
extern void _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
320+
extern void _Py_GatherStats_GetIter(_PyStackRef iterable);
318321

319322
// Utility functions for reading/writing 32/64-bit values in the inline caches.
320323
// Great care should be taken to ensure that these functions remain correct and
@@ -561,6 +564,10 @@ extern void _Py_ClearTLBCIndex(_PyThreadStateImpl *tstate);
561564
extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
562565
#endif
563566

567+
568+
PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);
569+
570+
564571
#ifdef __cplusplus
565572
}
566573
#endif

Include/internal/pycore_interp_structs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,11 +667,8 @@ struct _Py_interp_cached_objects {
667667

668668
/* object.__reduce__ */
669669
PyObject *objreduce;
670-
#ifndef Py_GIL_DISABLED
671-
/* resolve_slotdups() */
672670
PyObject *type_slots_pname;
673671
pytype_slotdef *type_slots_ptrs[MAX_EQUIV];
674-
#endif
675672

676673
/* TypeVar and related types */
677674
PyTypeObject *generic_type;

Include/internal/pycore_interpframe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C" {
1818
((int)((IF)->instr_ptr - _PyFrame_GetBytecode((IF))))
1919

2020
static inline PyCodeObject *_PyFrame_GetCode(_PyInterpreterFrame *f) {
21+
assert(!PyStackRef_IsNull(f->f_executable));
2122
PyObject *executable = PyStackRef_AsPyObjectBorrow(f->f_executable);
2223
assert(PyCode_Check(executable));
2324
return (PyCodeObject *)executable;

Include/internal/pycore_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ extern int _PyDict_CheckConsistency(PyObject *mp, int check_content);
313313
// Fast inlined version of PyType_HasFeature()
314314
static inline int
315315
_PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
316-
return ((type->tp_flags) & feature) != 0;
316+
return ((FT_ATOMIC_LOAD_ULONG_RELAXED(type->tp_flags) & feature) != 0);
317317
}
318318

319319
extern void _PyType_InitCache(PyInterpreterState *interp);

0 commit comments

Comments
 (0)