Get the latest tech news

A Stacktrace Puzzle


Explore how Python stacktraces with chained exceptions can become confusing puzzles and solve a few puzzles of your own

Feel free to email me with the order-of-execution for this one (please understand that I didn’t actually bother to figure out the answer myself… that’s the whole point of this article). If you would have the verbose/redundant version of the stacktrace, you can do a common-prefix analysis to find the first unique frames, e.g. visually or literally by pasting both halves into vimdiff. Unfortunately, the “outermost in handler” frame, i.e. the point in the stacktrace inside the handling block, where the second exception begins, cannot be annotated in an automated way.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Stacktrace Puzzle

Stacktrace Puzzle