FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`set_lazy_imports_filter`'s first arg (`importing_module`) can be `None` by Avasam · Pull Request #15901 · python/typeshed · GitHub

set_lazy_imports_filter's first arg (importing_module) can be None - #15901

Merged
srittau merged 1 commit into
mainfrom
Avasam-patch-1
Jun 12, 2026
Merged

set_lazy_imports_filter's first arg (importing_module) can be None#15901
srittau merged 1 commit into
mainfrom
Avasam-patch-1

Conversation

Avasam commented Jun 12, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

In real world scenario (see Toufool/AutoSplit@ba2e3d4#diff-37d213d547553f3e9f803b055881175eebb3b15caf26baec90775d81be0389f0 where I was playing around with the new lazy import filtering API) I've hit the first arg being None. I think from exec'd/embedded code (e.g. shiboken6's signature bootstrap)

Weirdly, this is not documented: https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
I've considered | MaybeNone, but this is already advanced usage, may as well be correct and let advanced users account for this edge case.

Avasam requested a review from JelleZijlstra June 12, 2026 18:04

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It's definitely safer if user code handles this edge case.

srittau merged commit d25e1e7 into main Jun 12, 2026
58 checks passed
srittau deleted the Avasam-patch-1 branch June 12, 2026 19:16
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL