Repository navigation
Commit 23c08dc
Remove LoaderProtocol.load_module on Python 3.15+
importlib.abc.Loader.load_module was removed in Python 3.15, and
importlib/_abc.pyi already gates it with `sys.version_info < (3, 15)`
(done in #16285). That change did not touch `_typeshed/importlib.pyi`, so
LoaderProtocol still required `load_module` unconditionally. On 3.15 a plain
`importlib.abc.Loader` subclass is therefore rejected by
importlib.util.spec_from_loader, importlib.machinery.ModuleSpec, and other
users of the protocol:
error: Argument 2 to "spec_from_loader" has incompatible type "MyLoader";
expected "LoaderProtocol | None"
Gate `load_module` the same way.
The comment at the top of importlib.pyi say that deprecated and optinal
method, technically I suppose load_module has been deprecated since
3.10, so the verision gate could be 3.10+ ?
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>1 parent 9741952 commit 23c08dc
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
0 commit comments