|
27 | 27 |
|
28 | 28 | Errors from set_context(): |
29 | 29 |
|
30 | | -TODO(jhylton): "assignment to None" is inconsistent with other messages |
31 | | -
|
32 | 30 | >>> obj.None = 1 |
33 | 31 | Traceback (most recent call last): |
34 | | -SyntaxError: assignment to None (<doctest test.test_syntax[1]>, line 1) |
| 32 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[1]>, line 1) |
35 | 33 |
|
36 | 34 | >>> None = 1 |
37 | 35 | Traceback (most recent call last): |
38 | | -SyntaxError: assignment to None (<doctest test.test_syntax[2]>, line 1) |
| 36 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[2]>, line 1) |
39 | 37 |
|
40 | 38 | It's a syntax error to assign to the empty tuple. Why isn't it an |
41 | 39 | error to assign to the empty list? It will always raise some error at |
|
95 | 93 | >>> def f(None=1): |
96 | 94 | ... pass |
97 | 95 | Traceback (most recent call last): |
98 | | -SyntaxError: assignment to None (<doctest test.test_syntax[14]>, line 1) |
| 96 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[14]>, line 1) |
99 | 97 |
|
100 | 98 |
|
101 | 99 | From ast_for_arguments(): |
|
108 | 106 | >>> def f(x, None): |
109 | 107 | ... pass |
110 | 108 | Traceback (most recent call last): |
111 | | -SyntaxError: assignment to None (<doctest test.test_syntax[16]>, line 1) |
| 109 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[16]>, line 1) |
112 | 110 |
|
113 | 111 | >>> def f(*None): |
114 | 112 | ... pass |
115 | 113 | Traceback (most recent call last): |
116 | | -SyntaxError: assignment to None (<doctest test.test_syntax[17]>, line 1) |
| 114 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[17]>, line 1) |
117 | 115 |
|
118 | 116 | >>> def f(**None): |
119 | 117 | ... pass |
120 | 118 | Traceback (most recent call last): |
121 | | -SyntaxError: assignment to None (<doctest test.test_syntax[18]>, line 1) |
| 119 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[18]>, line 1) |
122 | 120 |
|
123 | 121 |
|
124 | 122 | From ast_for_funcdef(): |
125 | 123 |
|
126 | 124 | >>> def None(x): |
127 | 125 | ... pass |
128 | 126 | Traceback (most recent call last): |
129 | | -SyntaxError: assignment to None (<doctest test.test_syntax[19]>, line 1) |
| 127 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[19]>, line 1) |
130 | 128 |
|
131 | 129 |
|
132 | 130 | From ast_for_call(): |
|
231 | 229 | SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_syntax[31]>, line 1) |
232 | 230 | >>> None += 1 |
233 | 231 | Traceback (most recent call last): |
234 | | -SyntaxError: assignment to None (<doctest test.test_syntax[32]>, line 1) |
| 232 | +SyntaxError: cannot assign to None (<doctest test.test_syntax[32]>, line 1) |
235 | 233 | >>> f() += 1 |
236 | 234 | Traceback (most recent call last): |
237 | 235 | SyntaxError: illegal expression for augmented assignment (<doctest test.test_syntax[33]>, line 1) |
|
0 commit comments