You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
type of path parameter in pkgutil.iter_modules #13636
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?
The annotations were probably never updated. Both iter_modules() and get_importer() seem to accept StrOrBytesPath since at least Python 3.8. PR welcome!
Activity
srittau commentedon Mar 17, 2025
The annotations were probably never updated. Both
iter_modules()andget_importer()seem to acceptStrOrBytesPathsince at least Python 3.8. PR welcome!maarten-vandenberg commentedon Mar 19, 2025
Thanks!