|
93 | 93 | >>> g(*Nothing()) |
94 | 94 | Traceback (most recent call last): |
95 | 95 | ... |
96 | | - TypeError: g() argument after * must be a sequence, not instance |
| 96 | + TypeError: g() argument after * must be an iterable, not instance |
97 | 97 |
|
98 | 98 | >>> class Nothing: |
99 | 99 | ... def __len__(self): return 5 |
|
102 | 102 | >>> g(*Nothing()) |
103 | 103 | Traceback (most recent call last): |
104 | 104 | ... |
105 | | - TypeError: g() argument after * must be a sequence, not instance |
| 105 | + TypeError: g() argument after * must be an iterable, not instance |
106 | 106 |
|
107 | 107 | >>> class Nothing(): |
108 | 108 | ... def __len__(self): return 5 |
|
128 | 128 | >>> g(*Nothing()) |
129 | 129 | 0 (1, 2, 3) {} |
130 | 130 |
|
| 131 | +Check for issue #4806: Does a TypeError in a generator get propagated with the |
| 132 | +right error message? |
| 133 | +
|
| 134 | + >>> def broken(): raise TypeError("myerror") |
| 135 | + ... |
| 136 | +
|
| 137 | + >>> g(*(broken() for i in range(1))) |
| 138 | + Traceback (most recent call last): |
| 139 | + ... |
| 140 | + TypeError: myerror |
| 141 | +
|
131 | 142 | Make sure that the function doesn't stomp the dictionary |
132 | 143 |
|
133 | 144 | >>> d = {'a': 1, 'b': 2, 'c': 3} |
|
167 | 178 | >>> h(*h) |
168 | 179 | Traceback (most recent call last): |
169 | 180 | ... |
170 | | - TypeError: h() argument after * must be a sequence, not function |
| 181 | + TypeError: h() argument after * must be an iterable, not function |
171 | 182 |
|
172 | 183 | >>> dir(*h) |
173 | 184 | Traceback (most recent call last): |
174 | 185 | ... |
175 | | - TypeError: dir() argument after * must be a sequence, not function |
| 186 | + TypeError: dir() argument after * must be an iterable, not function |
176 | 187 |
|
177 | 188 | >>> None(*h) |
178 | 189 | Traceback (most recent call last): |
179 | 190 | ... |
180 | | - TypeError: NoneType object argument after * must be a sequence, \ |
| 191 | + TypeError: NoneType object argument after * must be an iterable, \ |
181 | 192 | not function |
182 | 193 |
|
183 | 194 | >>> h(**h) |
|
0 commit comments