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

Skip to content

Commit 640992a

Browse files
Merge branch 'main' into wip-symtable
2 parents 9e575aa + f63d378 commit 640992a

Some content is hidden

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

42 files changed

+230
-180
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,6 @@ Doc/c-api/stable.rst @encukou
179179
/Tools/clinic/** @erlend-aasland @AlexWaygood
180180
/Lib/test/test_clinic.py @erlend-aasland @AlexWaygood
181181
Doc/howto/clinic.rst @erlend-aasland
182+
183+
# WebAssembly
184+
/Tools/wasm/ @brettcannon

Doc/library/ast.rst

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@ Expressions
650650

651651
.. class:: NamedExpr(target, value)
652652

653-
A named expression. This AST node is produced by the assignment expressions
654-
operator (also known as the walrus operator). As opposed to the :class:`Assign`
655-
node in which the first argument can be multiple nodes, in this case both
656-
``target`` and ``value`` must be single nodes.
653+
A named expression. This AST node is produced by the assignment expressions
654+
operator (also known as the walrus operator). As opposed to the :class:`Assign`
655+
node in which the first argument can be multiple nodes, in this case both
656+
``target`` and ``value`` must be single nodes.
657657

658658
.. doctest::
659659

@@ -663,6 +663,7 @@ Expressions
663663
target=Name(id='x', ctx=Store()),
664664
value=Constant(value=4)))
665665

666+
.. versionadded:: 3.8
666667

667668
Subscripting
668669
~~~~~~~~~~~~
@@ -1036,6 +1037,7 @@ Statements
10361037
value=Name(id='int', ctx=Load()))],
10371038
type_ignores=[])
10381039

1040+
.. versionadded:: 3.12
10391041

10401042
Other statements which are only applicable inside functions or loops are
10411043
described in other sections.
@@ -1318,6 +1320,7 @@ Control flow
13181320
finalbody=[])],
13191321
type_ignores=[])
13201322

1323+
.. versionadded:: 3.11
13211324

13221325
.. class:: ExceptHandler(type, name, body)
13231326

@@ -1407,6 +1410,8 @@ Pattern matching
14071410
that is being matched against the cases) and ``cases`` contains an iterable of
14081411
:class:`match_case` nodes with the different cases.
14091412

1413+
.. versionadded:: 3.10
1414+
14101415
.. class:: match_case(pattern, guard, body)
14111416

14121417
A single case pattern in a ``match`` statement. ``pattern`` contains the
@@ -1458,6 +1463,8 @@ Pattern matching
14581463
value=Constant(value=Ellipsis))])])],
14591464
type_ignores=[])
14601465

1466+
.. versionadded:: 3.10
1467+
14611468
.. class:: MatchValue(value)
14621469

14631470
A match literal or value pattern that compares by equality. ``value`` is
@@ -1485,6 +1492,8 @@ Pattern matching
14851492
value=Constant(value=Ellipsis))])])],
14861493
type_ignores=[])
14871494

1495+
.. versionadded:: 3.10
1496+
14881497
.. class:: MatchSingleton(value)
14891498

14901499
A match literal pattern that compares by identity. ``value`` is the
@@ -1510,6 +1519,8 @@ Pattern matching
15101519
value=Constant(value=Ellipsis))])])],
15111520
type_ignores=[])
15121521

1522+
.. versionadded:: 3.10
1523+
15131524
.. class:: MatchSequence(patterns)
15141525

15151526
A match sequence pattern. ``patterns`` contains the patterns to be matched
@@ -1541,6 +1552,8 @@ Pattern matching
15411552
value=Constant(value=Ellipsis))])])],
15421553
type_ignores=[])
15431554

1555+
.. versionadded:: 3.10
1556+
15441557
.. class:: MatchStar(name)
15451558

15461559
Matches the rest of the sequence in a variable length match sequence pattern.
@@ -1581,6 +1594,8 @@ Pattern matching
15811594
value=Constant(value=Ellipsis))])])],
15821595
type_ignores=[])
15831596

1597+
.. versionadded:: 3.10
1598+
15841599
.. class:: MatchMapping(keys, patterns, rest)
15851600

15861601
A match mapping pattern. ``keys`` is a sequence of expression nodes.
@@ -1627,6 +1642,8 @@ Pattern matching
16271642
value=Constant(value=Ellipsis))])])],
16281643
type_ignores=[])
16291644

1645+
.. versionadded:: 3.10
1646+
16301647
.. class:: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
16311648

16321649
A match class pattern. ``cls`` is an expression giving the nominal class to
@@ -1691,6 +1708,8 @@ Pattern matching
16911708
value=Constant(value=Ellipsis))])])],
16921709
type_ignores=[])
16931710

1711+
.. versionadded:: 3.10
1712+
16941713
.. class:: MatchAs(pattern, name)
16951714

16961715
A match "as-pattern", capture pattern or wildcard pattern. ``pattern``
@@ -1732,6 +1751,8 @@ Pattern matching
17321751
value=Constant(value=Ellipsis))])])],
17331752
type_ignores=[])
17341753

1754+
.. versionadded:: 3.10
1755+
17351756
.. class:: MatchOr(patterns)
17361757

17371758
A match "or-pattern". An or-pattern matches each of its subpatterns in turn
@@ -1764,6 +1785,8 @@ Pattern matching
17641785
value=Constant(value=Ellipsis))])])],
17651786
type_ignores=[])
17661787

1788+
.. versionadded:: 3.10
1789+
17671790
.. _ast-type-params:
17681791

17691792
Type parameters
@@ -1795,6 +1818,8 @@ aliases.
17951818
ctx=Load()))],
17961819
type_ignores=[])
17971820

1821+
.. versionadded:: 3.12
1822+
17981823
.. class:: ParamSpec(name)
17991824

18001825
A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification.
@@ -1818,6 +1843,8 @@ aliases.
18181843
ctx=Load()))],
18191844
type_ignores=[])
18201845

1846+
.. versionadded:: 3.12
1847+
18211848
.. class:: TypeVarTuple(name)
18221849

18231850
A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple.
@@ -1842,6 +1869,8 @@ aliases.
18421869
ctx=Load()))],
18431870
type_ignores=[])
18441871

1872+
.. versionadded:: 3.12
1873+
18451874
Function and class definitions
18461875
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18471876

@@ -1861,6 +1890,9 @@ Function and class definitions
18611890

18621891
``type_comment`` is an optional string with the type annotation as a comment.
18631892

1893+
.. versionchanged:: 3.12
1894+
Added ``type_params``.
1895+
18641896

18651897
.. class:: Lambda(args, body)
18661898

@@ -2059,6 +2091,9 @@ Function and class definitions
20592091
type_params=[])],
20602092
type_ignores=[])
20612093

2094+
.. versionchanged:: 3.12
2095+
Added ``type_params``.
2096+
20622097
Async and await
20632098
^^^^^^^^^^^^^^^
20642099

@@ -2067,6 +2102,9 @@ Async and await
20672102
An ``async def`` function definition. Has the same fields as
20682103
:class:`FunctionDef`.
20692104

2105+
.. versionchanged:: 3.12
2106+
Added ``type_params``.
2107+
20702108

20712109
.. class:: Await(value)
20722110

Include/cpython/import.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ struct _frozen {
1717
const unsigned char *code;
1818
int size;
1919
int is_package;
20-
PyObject *(*get_code)(void);
2120
};
2221

2322
/* Embedding apps may change this pointer to point to their favorite

Include/cpython/pystate.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,17 @@ struct _ts {
194194

195195
};
196196

197-
/* WASI has limited call stack. Python's recursion limit depends on code
198-
layout, optimization, and WASI runtime. Wasmtime can handle about 700
199-
recursions, sometimes less. 500 is a more conservative limit. */
200-
#ifndef C_RECURSION_LIMIT
201-
# ifdef __wasi__
202-
# define C_RECURSION_LIMIT 500
203-
# else
204-
// This value is duplicated in Lib/test/support/__init__.py
205-
# define C_RECURSION_LIMIT 1500
206-
# endif
197+
#ifdef __wasi__
198+
// WASI has limited call stack. Python's recursion limit depends on code
199+
// layout, optimization, and WASI runtime. Wasmtime can handle about 700
200+
// recursions, sometimes less. 500 is a more conservative limit.
201+
# define Py_C_RECURSION_LIMIT 500
202+
#else
203+
// This value is duplicated in Lib/test/support/__init__.py
204+
# define Py_C_RECURSION_LIMIT 1500
207205
#endif
208206

207+
209208
/* other API */
210209

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

Include/internal/pycore_code.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,6 @@ adaptive_counter_backoff(uint16_t counter) {
465465
return adaptive_counter_bits(value, backoff);
466466
}
467467

468-
extern uint32_t _Py_next_func_version;
469-
470468

471469
/* Comparison bit masks. */
472470

Include/internal/pycore_interp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ struct _is {
186186
_PyOptimizerObject *optimizer;
187187
uint16_t optimizer_resume_threshold;
188188
uint16_t optimizer_backedge_threshold;
189+
uint32_t next_func_version;
189190

190191
_Py_GlobalMonitors monitors;
191192
bool f_opcode_trace_set;

Include/internal/pycore_pystate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ _Py_ThreadCanHandleSignals(PyInterpreterState *interp)
6767
extern _Py_thread_local PyThreadState *_Py_tss_tstate;
6868
#endif
6969

70+
#ifndef NDEBUG
71+
extern int _PyThreadState_CheckConsistency(PyThreadState *tstate);
72+
#endif
73+
7074
// Export for most shared extensions, used via _PyThreadState_GET() static
7175
// inline function.
7276
PyAPI_FUNC(PyThreadState *) _PyThreadState_GetCurrent(void);

Lib/enum.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,11 @@ def __call__(cls, value, names=None, *values, module=None, qualname=None, type=N
730730
value = (value, names) + values
731731
return cls.__new__(cls, value)
732732
# otherwise, functional API: we're creating a new Enum type
733+
if names is None and type is None:
734+
# no body? no data-type? possibly wrong usage
735+
raise TypeError(
736+
f"{cls} has no members; specify `names=()` if you meant to create a new, empty, enum"
737+
)
733738
return cls._create_(
734739
class_name=value,
735740
names=names,

Lib/test/list_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from functools import cmp_to_key
77

88
from test import seq_tests
9-
from test.support import ALWAYS_EQ, NEVER_EQ, C_RECURSION_LIMIT
9+
from test.support import ALWAYS_EQ, NEVER_EQ, Py_C_RECURSION_LIMIT
1010

1111

1212
class CommonTest(seq_tests.CommonTest):
@@ -61,7 +61,7 @@ def test_repr(self):
6161

6262
def test_repr_deep(self):
6363
a = self.type2test([])
64-
for i in range(C_RECURSION_LIMIT + 1):
64+
for i in range(Py_C_RECURSION_LIMIT + 1):
6565
a = self.type2test([a])
6666
self.assertRaises(RecursionError, repr, a)
6767

Lib/test/mapping_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import unittest
33
import collections
44
import sys
5-
from test.support import C_RECURSION_LIMIT
5+
from test.support import Py_C_RECURSION_LIMIT
66

77

88
class BasicTestMappingProtocol(unittest.TestCase):
@@ -625,7 +625,7 @@ def __repr__(self):
625625

626626
def test_repr_deep(self):
627627
d = self._empty_mapping()
628-
for i in range(C_RECURSION_LIMIT + 1):
628+
for i in range(Py_C_RECURSION_LIMIT + 1):
629629
d0 = d
630630
d = self._empty_mapping()
631631
d[1] = d0

0 commit comments

Comments
 (0)