Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stack traces to unhashable TypeErrors in the engine (#7532)
### Problem - When we provide an unhashable type such as `list` to a `datatype` field of an object that goes through the v2 engine, the engine will tell you there is a TypeError, but won't tell you which object it's from. - The unhashable type error happens late (long after the datatype is constructed) and without an appropriate stacktrace. It should be easy to declare hashable collection fields (in this case, just tuples) and have them fail early (at construction). ### Solution - Add the name of the type of the object passed to `extern_identify()` to the `TypeError` raised if one of its fields are unhashable. - Make a `HashableTypedCollection` type constructor. - Capture exceptions raised in CFFI extern methods using the `onerror` handler and re-raise those with their tracebacks so the `TypeError`s are actually catchable. ### Result Unhashable type errors for datatypes going through the engine happen less, and errors happen earlier and with more context!
- Loading branch information
1 parent
762c03a
commit fac27b8
Showing
8 changed files
with
276 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.