File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ Extending :class:`JSONEncoder`::
83
83
... def default(self, obj):
84
84
... if isinstance(obj, complex):
85
85
... return [obj.real, obj.imag]
86
+ ... # Let the base class default method raise the TypeError
86
87
... return json.JSONEncoder.default(self, obj)
87
88
...
88
89
>>> json.dumps(2 + 1j, cls=ComplexEncoder)
@@ -431,6 +432,7 @@ Encoders and Decoders
431
432
pass
432
433
else:
433
434
return list(iterable)
435
+ # Let the base class default method raise the TypeError
434
436
return json.JSONEncoder.default(self, o)
435
437
436
438
Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ def default(self, o):
166
166
pass
167
167
else:
168
168
return list(iterable)
169
+ # Let the base class default method raise the TypeError
169
170
return JSONEncoder.default(self, o)
170
171
171
172
"""
You can’t perform that action at this time.
0 commit comments