Skip to content

Commit 90a1c04

Browse files
committed
Catch up with main
2 parents f090ee1 + 8a00c9a commit 90a1c04

File tree

198 files changed

+3243
-1366
lines changed

Some content is hidden

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

198 files changed

+3243
-1366
lines changed

Doc/library/sys.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
12471247

12481248
.. versionadded:: 3.13
12491249

1250+
.. impl-detail::
1251+
1252+
It is not guaranteed to exist in all implementations of Python.
12501253

12511254
.. function:: is_finalizing()
12521255

Doc/library/uuid.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ The following options are accepted:
377377
The name used as part of generating the uuid. Only required for
378378
:func:`uuid3` / :func:`uuid5` functions.
379379

380+
.. option:: -C <num>
381+
--count <num>
382+
383+
Generate *num* fresh UUIDs.
384+
385+
.. versionadded:: next
386+
380387

381388
.. _uuid-example:
382389

@@ -432,16 +439,18 @@ Here are some examples of typical usage of the :mod:`uuid` module::
432439
Command-Line Example
433440
--------------------
434441

435-
Here are some examples of typical usage of the :mod:`uuid` command line interface:
442+
Here are some examples of typical usage of the :mod:`uuid` command-line interface:
436443

437444
.. code-block:: shell
438445
439-
# generate a random uuid - by default uuid4() is used
446+
# generate a random UUID - by default uuid4() is used
440447
$ python -m uuid
441448
442-
# generate a uuid using uuid1()
449+
# generate a UUID using uuid1()
443450
$ python -m uuid -u uuid1
444451
445-
# generate a uuid using uuid5
452+
# generate a UUID using uuid5
446453
$ python -m uuid -u uuid5 -n @url -N example.com
447454
455+
# generate 42 random UUIDs
456+
$ python -m uuid -C 42

Doc/whatsnew/3.12.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,14 @@ pathlib
811811
:meth:`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching
812812
the path's case sensitivity, allowing for more precise control over the matching process.
813813

814+
platform
815+
--------
816+
817+
* Add support for detecting Windows 11 and Windows Server releases past 2012.
818+
Previously, lookups on Windows Server platforms newer than Windows Server 2012
819+
and on Windows 11 would return ``Windows-10``.
820+
(Contributed by Steve Dower in :gh:`89545`.)
821+
814822
pdb
815823
---
816824

Doc/whatsnew/3.14.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,9 @@ uuid
10171017
Nil and Max UUID formats as defined by :rfc:`9562`.
10181018
(Contributed by Nick Pope in :gh:`128427`.)
10191019

1020+
* Allow to generate multiple UUIDs at once via :option:`python -m uuid --count <uuid --count>`.
1021+
(Contributed by Simon Legner in :gh:`131236`.)
1022+
10201023

10211024
zipinfo
10221025
-------

Include/cpython/tupleobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
typedef struct {
66
PyObject_VAR_HEAD
7+
/* Cached hash. Initially set to -1. */
8+
Py_hash_t ob_hash;
79
/* ob_item contains space for 'ob_size' elements.
810
Items must normally not be NULL, except during construction when
911
the tuple is not yet visible outside the function that builds it. */

Include/internal/pycore_cell.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define Py_INTERNAL_CELL_H
33

44
#include "pycore_critical_section.h"
5+
#include "pycore_object.h"
6+
#include "pycore_stackref.h"
57

68
#ifdef __cplusplus
79
extern "C" {
@@ -19,7 +21,7 @@ PyCell_SwapTakeRef(PyCellObject *cell, PyObject *value)
1921
PyObject *old_value;
2022
Py_BEGIN_CRITICAL_SECTION(cell);
2123
old_value = cell->ob_ref;
22-
cell->ob_ref = value;
24+
FT_ATOMIC_STORE_PTR_RELEASE(cell->ob_ref, value);
2325
Py_END_CRITICAL_SECTION();
2426
return old_value;
2527
}
@@ -37,11 +39,36 @@ PyCell_GetRef(PyCellObject *cell)
3739
{
3840
PyObject *res;
3941
Py_BEGIN_CRITICAL_SECTION(cell);
42+
#ifdef Py_GIL_DISABLED
43+
res = _Py_XNewRefWithLock(cell->ob_ref);
44+
#else
4045
res = Py_XNewRef(cell->ob_ref);
46+
#endif
4147
Py_END_CRITICAL_SECTION();
4248
return res;
4349
}
4450

51+
static inline _PyStackRef
52+
_PyCell_GetStackRef(PyCellObject *cell)
53+
{
54+
PyObject *value;
55+
#ifdef Py_GIL_DISABLED
56+
value = _Py_atomic_load_ptr(&cell->ob_ref);
57+
if (value == NULL) {
58+
return PyStackRef_NULL;
59+
}
60+
_PyStackRef ref;
61+
if (_Py_TryIncrefCompareStackRef(&cell->ob_ref, value, &ref)) {
62+
return ref;
63+
}
64+
#endif
65+
value = PyCell_GetRef(cell);
66+
if (value == NULL) {
67+
return PyStackRef_NULL;
68+
}
69+
return PyStackRef_FromPyObjectSteal(value);
70+
}
71+
4572
#ifdef __cplusplus
4673
}
4774
#endif

Include/internal/pycore_compile.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ void _PyCompile_ExitScope(struct _PyCompiler *c);
134134
Py_ssize_t _PyCompile_AddConst(struct _PyCompiler *c, PyObject *o);
135135
_PyInstructionSequence *_PyCompile_InstrSequence(struct _PyCompiler *c);
136136
int _PyCompile_FutureFeatures(struct _PyCompiler *c);
137-
PyObject *_PyCompile_DeferredAnnotations(struct _PyCompiler *c);
137+
void _PyCompile_DeferredAnnotations(
138+
struct _PyCompiler *c, PyObject **deferred_annotations,
139+
PyObject **conditional_annotation_indices);
138140
PyObject *_PyCompile_Mangle(struct _PyCompiler *c, PyObject *name);
139141
PyObject *_PyCompile_MaybeMangle(struct _PyCompiler *c, PyObject *name);
140142
int _PyCompile_MaybeAddStaticAttributeToClass(struct _PyCompiler *c, expr_ty e);
@@ -178,13 +180,16 @@ int _PyCompile_TweakInlinedComprehensionScopes(struct _PyCompiler *c, _Py_Source
178180
_PyCompile_InlinedComprehensionState *state);
179181
int _PyCompile_RevertInlinedComprehensionScopes(struct _PyCompiler *c, _Py_SourceLocation loc,
180182
_PyCompile_InlinedComprehensionState *state);
181-
int _PyCompile_AddDeferredAnnotaion(struct _PyCompiler *c, stmt_ty s);
183+
int _PyCompile_AddDeferredAnnotation(struct _PyCompiler *c, stmt_ty s,
184+
PyObject **conditional_annotation_index);
185+
void _PyCompile_EnterConditionalBlock(struct _PyCompiler *c);
186+
void _PyCompile_LeaveConditionalBlock(struct _PyCompiler *c);
182187

183188
int _PyCodegen_AddReturnAtEnd(struct _PyCompiler *c, int addNone);
184189
int _PyCodegen_EnterAnonymousScope(struct _PyCompiler* c, mod_ty mod);
185190
int _PyCodegen_Expression(struct _PyCompiler *c, expr_ty e);
186-
int _PyCodegen_Body(struct _PyCompiler *c, _Py_SourceLocation loc, asdl_stmt_seq *stmts,
187-
bool is_interactive);
191+
int _PyCodegen_Module(struct _PyCompiler *c, _Py_SourceLocation loc, asdl_stmt_seq *stmts,
192+
bool is_interactive);
188193

189194
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);
190195

Include/internal/pycore_global_objects_fini_generated.h

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

Include/internal/pycore_global_strings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ struct _Py_global_strings {
8989
STRUCT_FOR_ID(__bytes__)
9090
STRUCT_FOR_ID(__call__)
9191
STRUCT_FOR_ID(__cantrace__)
92+
STRUCT_FOR_ID(__ceil__)
9293
STRUCT_FOR_ID(__class__)
9394
STRUCT_FOR_ID(__class_getitem__)
9495
STRUCT_FOR_ID(__classcell__)
9596
STRUCT_FOR_ID(__classdict__)
9697
STRUCT_FOR_ID(__classdictcell__)
9798
STRUCT_FOR_ID(__complex__)
99+
STRUCT_FOR_ID(__conditional_annotations__)
98100
STRUCT_FOR_ID(__contains__)
99101
STRUCT_FOR_ID(__ctypes_from_outparam__)
100102
STRUCT_FOR_ID(__del__)
@@ -112,6 +114,7 @@ struct _Py_global_strings {
112114
STRUCT_FOR_ID(__file__)
113115
STRUCT_FOR_ID(__firstlineno__)
114116
STRUCT_FOR_ID(__float__)
117+
STRUCT_FOR_ID(__floor__)
115118
STRUCT_FOR_ID(__floordiv__)
116119
STRUCT_FOR_ID(__format__)
117120
STRUCT_FOR_ID(__fspath__)
@@ -217,6 +220,7 @@ struct _Py_global_strings {
217220
STRUCT_FOR_ID(__subclasscheck__)
218221
STRUCT_FOR_ID(__subclasshook__)
219222
STRUCT_FOR_ID(__truediv__)
223+
STRUCT_FOR_ID(__trunc__)
220224
STRUCT_FOR_ID(__type_params__)
221225
STRUCT_FOR_ID(__typing_is_unpacked_typevartuple__)
222226
STRUCT_FOR_ID(__typing_prepare_subst__)

Include/internal/pycore_interpframe.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,17 @@ _PyFrame_GetLocalsArray(_PyInterpreterFrame *frame)
163163
return frame->localsplus;
164164
}
165165

166-
/* Fetches the stack pointer, and sets stackpointer to NULL.
167-
Having stackpointer == NULL ensures that invalid
168-
values are not visible to the cycle GC. */
166+
// Fetches the stack pointer, and (on debug builds) sets stackpointer to NULL.
167+
// Having stackpointer == NULL makes it easier to catch missing stack pointer
168+
// spills/restores (which could expose invalid values to the GC) using asserts.
169169
static inline _PyStackRef*
170170
_PyFrame_GetStackPointer(_PyInterpreterFrame *frame)
171171
{
172172
assert(frame->stackpointer != NULL);
173173
_PyStackRef *sp = frame->stackpointer;
174+
#ifndef NDEBUG
174175
frame->stackpointer = NULL;
176+
#endif
175177
return sp;
176178
}
177179

0 commit comments

Comments
 (0)