Avoid inadvertent submodule setup (2/2)#3025
Open
copybara-service[bot] wants to merge 1 commit into
Open
Conversation
d4ec475 to
bad7a86
Compare
Codecov Report
@@ Coverage Diff @@
## main #3025 +/- ##
==========================================
+ Coverage 81.97% 81.99% +0.01%
==========================================
Files 55 55
Lines 6002 6019 +17
==========================================
+ Hits 4920 4935 +15
- Misses 1082 1084 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
bad7a86 to
dc5ef3f
Compare
repr() is often used as development tool, e.g. by IntelliJ debugger window or in logging. But as it stands, repr() causes inadvertent setup() of submodules with the following code flow: repr() -> _module_repr() -> _attr_repr(submodule) -> getattr(submodule, '__name__', None). (in submodule) -> __getattr__() -> _try_setup() When using IntelliJ, repr() eventually try_setup() on a submodule but without proper context. The error is silently eaten in IntelliJ debugger but changes the internal setup state to be DONE and later setup attempt gets ignored, causing failures at a later step. This CL simply prevents __name__ to not cause try_setup. PiperOrigin-RevId: 524020065
dc5ef3f to
61f8f68
Compare
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.
Avoid inadvertent submodule setup (2/2)
repr() is often used as development tool, e.g. by IntelliJ debugger window or in logging.
But as it stands, repr() causes inadvertent setup() of submodules with the following code flow:
repr()
-> _module_repr()
-> _attr_repr(submodule)
-> getattr(submodule, 'name', None).
(in submodule)
-> getattr()
-> _try_setup()
When using IntelliJ, repr() eventually try_setup() on a submodule but without proper context. The error is silently eaten in IntelliJ debugger but changes the internal setup state to be DONE and later setup attempt gets ignored, causing failures at a later step.
This CL simply prevents name to not cause try_setup.