Skip to content
This repository has been archived by the owner on Nov 25, 2023. It is now read-only.

bpo-28603 Fix tracebacks for unhashable exceptions #11

Merged
merged 1 commit into from Mar 23, 2018

Conversation

zaneb
Copy link
Contributor

@zaneb zaneb commented Nov 7, 2017

TracebackException checks for loops between exceptions to prevent an
infinite traceback. It does this by putting the already-seen exception
into a set. This means that unhashable exception objects will cause an
error - an error that itself can likely not be printed because of the
presence of the unhashable exception in the chain.

In this case, we don't actually care about equality of the objects as
defined by the class designer; we want to check that we don't encounter
the self-same exception object, from a chain that is necessarily all in
memory at the same time. We can trivially do so by comparing identities
instead of equality.

An equivalent patch was merged in the CPython standard library.

TracebackException checks for loops between exceptions to prevent an
infinite traceback. It does this by putting the already-seen exception
into a set. This means that unhashable exception objects will cause an
error - an error that itself can likely not be printed because of the
presence of the unhashable exception in the chain.

In this case, we don't actually care about equality of the objects as
defined by the class designer; we want to check that we don't encounter
the self-same exception object, from a chain that is necessarily all in
memory at the same time. We can trivially do so by comparing identities
instead of equality.
@zaneb
Copy link
Contributor Author

zaneb commented Nov 21, 2017

The build error was from trying to pip install requests on Python 3.2, and isn't related.

@berkerpeksag berkerpeksag merged commit 2e212de into testing-cabal:master Mar 23, 2018
@berkerpeksag
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants