Skip to content

typing: "util" is not a known attribute of module "importlib" #15831

@lucascolley

Description

@lucascolley

Bug report

Bug description:

This works as documented at runtime:

import importlib

assert importlib.util.find_spec("importlib") is not None

but type checkers are not happy, e.g.

https://basedpyright.com/?typeCheckingMode=all&code=JYWwDg9gTgLgBKSsA2wBGAoDBDAzrgU1gXGhlTQDoBXGYZSgM2ADsATAfVzAIGMAKAESIyFQQEoEuOCwjwAchBYEgA

same with https://mypy-play.net/?mypy=latest&python=3.14

CPython versions tested on:

3.14

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions