File tree 2 files changed +3
-4
lines changed
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ assert toml_dict["precision-matters"] == Decimal("0.982492")
95
95
Note that ` decimal.Decimal ` can be replaced with another callable that converts a TOML float from string to a Python type.
96
96
The ` decimal.Decimal ` is, however, a practical choice for use cases where float inaccuracies can not be tolerated.
97
97
98
- Illegal types include ` dict ` , ` list ` , and anything that has the ` append ` attribute .
98
+ Illegal types are ` dict ` and ` list ` , and their subtypes .
99
99
Parsing floats into an illegal type results in undefined behavior.
100
100
101
101
## FAQ<a name =" faq " ></a >
Original file line number Diff line number Diff line change @@ -216,10 +216,9 @@ def append_nest_to_list(self, key: Key) -> None:
216
216
last_key = key [- 1 ]
217
217
if last_key in cont :
218
218
list_ = cont [last_key ]
219
- try :
220
- list_ .append ({})
221
- except AttributeError :
219
+ if not isinstance (list_ , list ):
222
220
raise KeyError ("An object other than list found behind this key" )
221
+ list_ .append ({})
223
222
else :
224
223
cont [last_key ] = [{}]
225
224
You can’t perform that action at this time.
0 commit comments