Python Forum
Stack trace shows different exception type than print
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stack trace shows different exception type than print
#4
There are two exceptions being thrown:
  1. json.loads('+Infinity') is called.
  2. ...
  3. raw_decode('+Infinity') is called.
  4. raw_decode calls PositiveInfinityJSONDecoder._scan_once.
  5. PositiveInfinityJSONDecoder._scan_once calls self.original_scan_once (a.k.a. JSONDecoder().scan_once).
  6. self.original_scan_once raises a StopIteration as expected.
  7. PositiveInfinityJSONDecoder._scan_once prints the StopIteration exception and reraises it.
  8. raw_decode excepts StopIteration and raises JSONDecodeError.
  9. JSONDecodeError is not caught, so it prints the stack trace for JSONDecodeError.
Reply


Messages In This Thread
RE: Stack trace shows different exception type than print - by sheeba_weeba - Mar-31-2019, 05:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  what type of exception to use? Skaperen 3 1,076 Sep-30-2022, 05:00 PM
Last Post: Skaperen
  ModuleNotFound but pip shows module installed biscotty666 2 1,594 Jul-14-2022, 05:17 PM
Last Post: Axel_Erfurt
  Os command output in variable shows wrong value paulo79 2 1,549 Apr-09-2022, 03:48 PM
Last Post: ndc85430
Lightbulb trace library xxxlabradorxxx 1 1,173 Oct-01-2021, 11:30 PM
Last Post: Larz60+
  Help in designing a timestamp finder for chapter-less TV shows Daring_T 1 1,878 Oct-26-2020, 09:30 PM
Last Post: Daring_T
  colorbar for scatter shows no negatives values... gil 0 1,557 Apr-15-2020, 12:45 AM
Last Post: gil
  Exception: Returned Type Mismatch Error devansing 1 5,203 Mar-06-2020, 07:26 PM
Last Post: ndc85430
  Type hinting - return type based on parameter micseydel 2 2,522 Jan-14-2020, 01:20 AM
Last Post: micseydel
  How to fix 'uncaught exception of type NSException' in Python MonsterPython 0 2,197 Jul-09-2019, 06:52 AM
Last Post: MonsterPython
  Tracing a multiplication table w/ Python trace() NationalRex22 0 1,770 Jun-11-2019, 03:31 AM
Last Post: NationalRex22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020