Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-hashable types in printing/formatting #12324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jluttine
Copy link

Fix #12320

For more information, see: #12320

Comment on lines -425 to +429
if cls in self.type_printers or self._in_deferred_types(cls):
try:
return self.type_printers[cls]

except (KeyError, TypeError):
pass

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about this change. In the original code, the if-clause was True even if cls is not in self.type_printers, but self._in_deferred_types(cls) evaluates to True. Doesn't self.type_printers[cls] raise KeyError in that case? So, that was a bit unclear to me, maybe there's some hidden magic happening and this change isn't correct. I wasn't able to run the tests for this module because I just got a huge bunch of failures on master.

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

Successfully merging this pull request may close these issues.

Pretty-printing fails for instances of non-hashable types
1 participant