flax
ec16e94a - Avoid inadvertent submodule setup (1/2)

Commit
2 years ago
Avoid inadvertent submodule setup (1/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. The first part adds a unit test to show this issue. PiperOrigin-RevId: 524156426
Author
Changwan Ryu
Committer
Parents
Loading