-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Type annotations in _colorize module are unresolvable at runtime #150994
Copy link
Copy link
Open
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
Bug report
Bug description:
See the above reproducer and beartype/beartype#656 for more context. The issue here is that the
_colorizemodule (which is imported by other public modules/packages in the stdlib) guards itstypingimports (which are used in dataclass field annotations) in anif False:block. This breaks runtime type checkers like beartype that introspect type annotations at runtime.CPython versions tested on:
3.15
Operating systems tested on:
Linux