Skip to content

gh-146401: suggest a module in sys.builtin_module_names#146421

Open
Locked-chess-official wants to merge 1 commit intopython:mainfrom
Locked-chess-official:suggest_builtin_module
Open

gh-146401: suggest a module in sys.builtin_module_names#146421
Locked-chess-official wants to merge 1 commit intopython:mainfrom
Locked-chess-official:suggest_builtin_module

Conversation

@Locked-chess-official
Copy link
Contributor

@Locked-chess-official Locked-chess-official commented Mar 25, 2026

Change to use @classmethod to yield specs.

Comment on lines +941 to +946
@classmethod
def discover(cls, spec=None):
if spec is not None: # assume that built-in modules have no submodule
return
for i in sys.builtin_module_names:
yield cls.find_spec(i)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need this specific change here. It feels wrong to change importlib.

@bedevere-app
Copy link

bedevere-app bot commented Mar 25, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@picnixz
Copy link
Member

picnixz commented Mar 25, 2026

If you want to improve suggestions for built-in names, it should be at the REPL level. Not in importlib. Please update the issue about your rationale of this change first.

@picnixz picnixz closed this Mar 25, 2026
@picnixz
Copy link
Member

picnixz commented Mar 25, 2026

Re-opening as we will make the change elsewhere.

@picnixz picnixz reopened this Mar 25, 2026
@picnixz picnixz marked this pull request as draft March 25, 2026 14:51
@picnixz
Copy link
Member

picnixz commented Mar 25, 2026

@Locked-chess-official I'll make it a draft. Once you're done with your changes, ping me and I'll remove the reviewers as they won't be relevant anymore.

@picnixz picnixz marked this pull request as ready for review March 25, 2026 16:09
else:
parent = None
d = []
d = list(sys.builtin_module_names)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah now, I see what happens. I'm really sorry. Maybe the change in the finder is ok? cc @brettcannon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants