Commit 2f2ac18
Leifur Halldor Asgeirsson
Fix sparse fieldset RuntimeError under python3.5
With Python 3.5, using sparse fieldsets causes a `RuntimeError:
OrderedDict mutated during iteration`. This patch fixes the bug,
in `SparseFieldsetMixin`, by iterating over a copy of the `OrderedDict`,
so that the original may be modified in the loop.
The `OrderedDict` in question is the underlying `OrderedDict` of the
`BindingDict` returned by the `fields` property on `Serializer`.
If curious, see section
[4.10.1](https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects)
of the python standard library docs for more information about
why this RuntimeError was being thrown in the first place.1 parent 0959693 commit 2f2ac18
File tree
2 files changed
+16
-1
lines changed- example/tests/integration
- rest_framework_json_api
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
0 commit comments