Mar-31-2019, 05:25 PM
There are two exceptions being thrown:
- json.loads('+Infinity') is called.
- ...
- raw_decode('+Infinity') is called.
- raw_decode calls PositiveInfinityJSONDecoder._scan_once.
- PositiveInfinityJSONDecoder._scan_once calls self.original_scan_once (a.k.a. JSONDecoder().scan_once).
- self.original_scan_once raises a StopIteration as expected.
- PositiveInfinityJSONDecoder._scan_once prints the StopIteration exception and reraises it.
- raw_decode excepts StopIteration and raises JSONDecodeError.
- JSONDecodeError is not caught, so it prints the stack trace for JSONDecodeError.