Repository navigation
Conversation
Contributor
|
I think I have the core fix for #151208, but it does look like my changes alone may not address the issue and your changes are still needed (at least against my version of the implementation). |
Contributor
Author
|
Thanks for checking. That makes sense to me. In gh-151208 the explicit |
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.
With
-X lazy_imports=all,from .main import TestProgram, maininunittest/__init__.pybinds both names lazily. IfTestProgramgets resolved first, loading theunittest.mainsubmodule setsunittest.mainto the module, and the pending lazymainis lost.unittest.main()then fails withTypeError: 'module' object is not callable.mainis now assigned fromTestProgram(the same objectunittest.main.mainaliases), so it no longer depends on the lazy binding.test_unittestandtest_pyrepl(whose only failure was the sameunittest.maincolorizing check) pass with lazy imports now, so I removed both fromLib/test/lazy_imports_all_exclude.txt.The underlying problem is in the lazy import machinery, and any package whose
__init__doesfrom .m import T, mhits it. It is closely related to gh-151208, so this only works around it inunittestuntil the core behavior is decided there.Fixes #158086