|
248 | 248 |
|
249 | 249 | # Missing commas in literals collections should not |
250 | 250 | # produce special error messages regarding missing |
251 | | -# parentheses |
| 251 | +# parentheses, but about missing commas instead |
252 | 252 |
|
253 | 253 | >>> [1, 2 3] |
254 | 254 | Traceback (most recent call last): |
255 | | -SyntaxError: invalid syntax |
| 255 | +SyntaxError: invalid syntax. Perhaps you forgot a comma? |
256 | 256 |
|
257 | 257 | >>> {1, 2 3} |
258 | 258 | Traceback (most recent call last): |
259 | | -SyntaxError: invalid syntax |
| 259 | +SyntaxError: invalid syntax. Perhaps you forgot a comma? |
260 | 260 |
|
261 | 261 | >>> {1:2, 2:5 3:12} |
262 | 262 | Traceback (most recent call last): |
263 | | -SyntaxError: invalid syntax |
| 263 | +SyntaxError: invalid syntax. Perhaps you forgot a comma? |
264 | 264 |
|
265 | 265 | >>> (1, 2 3) |
266 | 266 | Traceback (most recent call last): |
| 267 | +SyntaxError: invalid syntax. Perhaps you forgot a comma? |
| 268 | +
|
| 269 | +# Make sure soft keywords constructs don't raise specialized |
| 270 | +# errors regarding missing commas |
| 271 | +
|
| 272 | +>>> match x: |
| 273 | +... y = 3 |
| 274 | +Traceback (most recent call last): |
| 275 | +SyntaxError: invalid syntax |
| 276 | +
|
| 277 | +>>> match x: |
| 278 | +... case y: |
| 279 | +... 3 $ 3 |
| 280 | +Traceback (most recent call last): |
267 | 281 | SyntaxError: invalid syntax |
268 | 282 |
|
269 | 283 | From compiler_complex_args(): |
|
864 | 878 | SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='? |
865 | 879 |
|
866 | 880 | Ensure that early = are not matched by the parser as invalid comparisons |
867 | | - >>> f(2, 4, x=34); {1,2 a} |
| 881 | + >>> f(2, 4, x=34); 1 $ 2 |
868 | 882 | Traceback (most recent call last): |
869 | 883 | SyntaxError: invalid syntax |
870 | 884 |
|
|
0 commit comments