Skip to content

Catch exceptions thrown by repr() when called by the dispatcher #1911

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

Closed
wants to merge 1 commit into from

Conversation

hawkinsp
Copy link
Contributor

@hawkinsp hawkinsp commented Sep 5, 2019

The dispatcher calls repr() if no overload matches, but repr() may throw causing the process to terminate with an uncaught exception. Handle that case more gracefully by catching the exception and instead using a string that simply says that repr threw.

With more work we could describe the exception but that seems unnecessary given the caller can just call repr() on the argument themselves if they want.

Fixes jax-ml/jax#1257

…e arguments" error.

The dispatcher currently calls repr() if no overload matches, but repr() may throw causing the process to terminate with an uncaught exception. Handle that case more gracefully by falling back to a string that says that repr threw. With more work we could describe the error but that seems unnecessary, given the caller can just call repr() on the argument themselves if they want.
@hawkinsp
Copy link
Contributor Author

hawkinsp commented Dec 3, 2020

It looks like #2389 made a similar fix. Closing this PR.

@hawkinsp hawkinsp closed this Dec 3, 2020
@YannickJadoul
Copy link
Collaborator

Whoops, sorry! No one noticed, when #2389 was getting reviewed :-/

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.

Bug in C++ pytree implementation
2 participants