Exception formatting: handle case where module is None#2011
Merged
Jasha10 merged 1 commit intofacebookresearch:mainfrom Oct 10, 2022
Merged
Exception formatting: handle case where module is None#2011Jasha10 merged 1 commit intofacebookresearch:mainfrom
module is None#2011Jasha10 merged 1 commit intofacebookresearch:mainfrom
Conversation
Contributor
|
could you paste an example before and after? :) |
Collaborator
Author
|
I'm closing this PR for now as I'm no longer able to reproduce the original issue. Edit: see #2342 for a way to reproduce the bug. |
YouJiacheng
reviewed
Aug 16, 2022
Collaborator
Author
YouJiacheng
reviewed
Aug 16, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix an issue where Hydra's exception-handling logic could raise an
AssertionErrorif the module from which in the exception's originates cannot be determined.Closes #2010. Closes #2342.
See #2342 for a way to reproduce the bug.
Details:
Hydra's exception-handling logic automatically removes omegaconf-related stack frames before printing the handled traceback. This requires inspecting the stack frames (when an exception arises) to determine which stack frames belong to OmegaConf. Hydra uses the function
inspect.getmoduleto determine the module to which a given stack frame belongs.In the case where the module from which a stack frame originated cannot be determined,
inspect.getmodulereturnsNone. Previously, this would cause Hydra to throw anAssertionError. This PR adds logic to handle the case where the module cannot be determined, avoiding theAssertionError.