Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type of path parameter in pkgutil.iter_modules #13636

Closed
srittau opened this issue Mar 17, 2025 · 2 comments · Fixed by #13642
Closed

type of path parameter in pkgutil.iter_modules #13636

srittau opened this issue Mar 17, 2025 · 2 comments · Fixed by #13642
Labels
help wanted An actionable problem of low to medium complexity where a PR would be very welcome stubs: false positive Type checkers report false errors

Comments

@srittau
Copy link
Collaborator

srittau commented Mar 17, 2025

Discussed in python/typing#1946

Originally posted by maarten-vandenberg March 17, 2025
I'm not sure whether this is the right place to ask the following question. If not, I'd be happy to ask it and/or look elsewhere! I could not find an answer searching this forum or typeshed issues, however a related issue might be #6650.

The path parameter in pkgutil.iter_modules is typed as Iterable[str]. However iter_modules also accepts a pathlib.Path, which seems consistent with the call to os.fsdecode in get_importer (accepting PathLike). Am I missing something in how this is typed or is this somehow inconsistent?

@srittau srittau transferred this issue from python/typing Mar 17, 2025
@srittau
Copy link
Collaborator Author

srittau commented Mar 17, 2025

The annotations were probably never updated. Both iter_modules() and get_importer() seem to accept StrOrBytesPath since at least Python 3.8. PR welcome!

@srittau srittau added stubs: false positive Type checkers report false errors help wanted An actionable problem of low to medium complexity where a PR would be very welcome labels Mar 17, 2025
@maarten-vandenberg
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted An actionable problem of low to medium complexity where a PR would be very welcome stubs: false positive Type checkers report false errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants