Skip to content

Commit 0156624

Browse files
authored
Merge branch 'main' into gh-140443-fused-multiply
2 parents f05b4b2 + bd2c7e8 commit 0156624

File tree

9 files changed

+748
-517
lines changed

9 files changed

+748
-517
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"image": "ghcr.io/python/wasicontainer:latest",
3+
"onCreateCommand": [
4+
// Install common tooling.
5+
"dnf",
6+
"install",
7+
"-y",
8+
// For umask fix below.
9+
"/usr/bin/setfacl"
10+
],
11+
"updateContentCommand": {
12+
// Using the shell for `nproc` usage.
13+
"python": "python3 Tools/wasm/wasi build --quiet -- --with-pydebug -C"
14+
},
15+
"postCreateCommand": {
16+
// https://github.com/orgs/community/discussions/26026
17+
"umask fix: workspace": ["sudo", "setfacl", "-bnR", "."],
18+
"umask fix: /tmp": ["sudo", "setfacl", "-bnR", "/tmp"]
19+
},
20+
"customizations": {
21+
"vscode": {
22+
"extensions": [
23+
// Highlighting for Parser/Python.asdl.
24+
"brettcannon.zephyr-asdl",
25+
// Highlighting for configure.ac.
26+
"maelvalais.autoconf",
27+
// C auto-complete.
28+
"ms-vscode.cpptools",
29+
// Python auto-complete.
30+
"ms-python.python"
31+
],
32+
"settings": {
33+
"C_Cpp.default.compilerPath": "/usr/bin/clang",
34+
"C_Cpp.default.cStandard": "c11",
35+
"C_Cpp.default.defines": [
36+
"CONFIG_64",
37+
"Py_BUILD_CORE"
38+
],
39+
"C_Cpp.default.includePath": [
40+
"${workspaceFolder}/*",
41+
"${workspaceFolder}/Include/**"
42+
],
43+
// https://github.com/microsoft/vscode-cpptools/issues/10732
44+
"C_Cpp.errorSquiggles": "disabled",
45+
"editor.insertSpaces": true,
46+
"editor.rulers": [
47+
80
48+
],
49+
"editor.tabSize": 4,
50+
"editor.trimAutoWhitespace": true,
51+
"files.associations": {
52+
"*.h": "c"
53+
},
54+
"files.encoding": "utf8",
55+
"files.eol": "\n",
56+
"files.insertFinalNewline": true,
57+
"files.trimTrailingWhitespace": true,
58+
"python.analysis.diagnosticSeverityOverrides": {
59+
// Complains about shadowing the stdlib w/ the stdlib.
60+
"reportShadowedImports": "none",
61+
// Doesn't like _frozen_importlib.
62+
"reportMissingImports": "none"
63+
},
64+
"python.analysis.extraPaths": [
65+
"Lib"
66+
],
67+
"[restructuredtext]": {
68+
"editor.tabSize": 3
69+
}
70+
}
71+
}
72+
}
73+
}

.github/workflows/reusable-wasi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
timeout-minutes: 60
1818
env:
19-
WASMTIME_VERSION: 22.0.0
20-
WASI_SDK_VERSION: 24
19+
WASMTIME_VERSION: 38.0.2
20+
WASI_SDK_VERSION: 25
2121
WASI_SDK_PATH: /opt/wasi-sdk
2222
CROSS_BUILD_PYTHON: cross-build/build
2323
CROSS_BUILD_WASI: cross-build/wasm32-wasip1

Grammar/python.gram

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ mapping_pattern[pattern_ty]:
626626
CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
627627
NULL,
628628
EXTRA) }
629+
| invalid_mapping_pattern
629630

630631
items_pattern[asdl_seq*]:
631632
| ','.key_value_pattern+
@@ -1490,6 +1491,10 @@ invalid_class_pattern:
14901491
PyPegen_first_item(a, pattern_ty),
14911492
PyPegen_last_item(a, pattern_ty),
14921493
"positional patterns follow keyword patterns") }
1494+
invalid_mapping_pattern:
1495+
| '{' (items_pattern ',')? rest=double_star_pattern ',' items_pattern ','? '}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
1496+
rest,
1497+
"double star pattern must be the last (right-most) subpattern in the mapping pattern") }
14931498
invalid_class_argument_pattern[asdl_pattern_seq*]:
14941499
| [positional_patterns ','] keyword_patterns ',' a=positional_patterns { a }
14951500
invalid_if_stmt:

Lib/test/test_exceptions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,16 @@ def testSyntaxErrorOffset(self):
252252
check('[\nfile\nfor str(file)\nin\n[]\n]', 3, 5)
253253
check('[file for\n str(file) in []]', 2, 2)
254254
check("ages = {'Alice'=22, 'Bob'=23}", 1, 9)
255-
check('match ...:\n case {**rest, "key": value}:\n ...', 2, 19)
255+
check(dedent("""\
256+
match ...:
257+
case {**rest1, "after": after}:
258+
...
259+
"""), 2, 11)
260+
check(dedent("""\
261+
match ...:
262+
case {"before": before, **rest2, "after": after}:
263+
...
264+
"""), 2, 29)
256265
check("[a b c d e f]", 1, 2)
257266
check("for x yfff:", 1, 7)
258267
check("f(a for a in b, c)", 1, 3, 1, 15)

Lib/test/test_syntax.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@
370370
Traceback (most recent call last):
371371
SyntaxError: invalid syntax
372372
373-
>>> match ...:
374-
... case {**rest, "key": value}:
375-
... ...
376-
Traceback (most recent call last):
377-
SyntaxError: invalid syntax
378-
379373
>>> match ...:
380374
... case {**_}:
381375
... ...
@@ -2240,7 +2234,7 @@
22402234
Traceback (most recent call last):
22412235
SyntaxError: invalid character '£' (U+00A3)
22422236
2243-
Invalid pattern matching constructs:
2237+
Invalid pattern matching constructs:
22442238
22452239
>>> match ...:
22462240
... case 42 as _:
@@ -2302,6 +2296,24 @@
23022296
Traceback (most recent call last):
23032297
SyntaxError: positional patterns follow keyword patterns
23042298
2299+
>>> match ...:
2300+
... case {**double_star, "spam": "eggs"}:
2301+
... ...
2302+
Traceback (most recent call last):
2303+
SyntaxError: double star pattern must be the last (right-most) subpattern in the mapping pattern
2304+
2305+
>>> match ...:
2306+
... case {"foo": 1, **double_star, "spam": "eggs"}:
2307+
... ...
2308+
Traceback (most recent call last):
2309+
SyntaxError: double star pattern must be the last (right-most) subpattern in the mapping pattern
2310+
2311+
>>> match ...:
2312+
... case {"spam": "eggs", "b": {**d, "ham": "bacon"}}:
2313+
... ...
2314+
Traceback (most recent call last):
2315+
SyntaxError: double star pattern must be the last (right-most) subpattern in the mapping pattern
2316+
23052317
Uses of the star operator which should fail:
23062318
23072319
A[:*b]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support WASI SDK 25.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Wrong placement of a double-star pattern inside a mapping pattern now throws a specialized syntax error.
2+
Contributed by Bartosz Sławecki in :gh:`140253`.

0 commit comments

Comments
 (0)