Repository navigation
Commit 7720273
committed
Fix ParseError when a sub-table extends the last array-of-tables element after an unrelated table
When a sub-table header such as [fruit.apple.texture] follows the array
[[fruit]] with an unrelated table in between, the parser rebuilds it as a
fresh super table named "fruit" and tries to append it to the document,
colliding with the existing array of tables and raising
ParseError: Key "fruit" already exists.
even though the document is valid TOML 1.0.0. The contiguous form (no
intervening table) already worked because the sub-table is consumed while
the array element is still being parsed.
A sub-table header that refers to an existing array of tables extends the
array's last element, regardless of any tables defined in between, so merge
its contents into that element instead of treating it as a redefinition.
Defining a non-super table with the same name as an array (e.g. [fruit]
after [[fruit]]) is still a genuine conflict and continues to raise.
Fixes python-poetry#2611 parent 8571bcd commit 7720273
3 files changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
241 | 260 | | |
242 | 261 | | |
243 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
| |||
0 commit comments