Skip to content

sys.implementation.version should not be assume to match sys.version_info #3640

@jonathandung

Description

@jonathandung

Summary

ty naively assumes sys.implementation.version as equivalent to sys.version_info. This can be seen by the VS Code extension, running the language server, highlighting a branch in the following snippet as reachable when I configure the Python version to be >=3.12:

from sys import implementation as I
match I.name:
    case 'cpython':
        if I.version < (3, 12): raise ImportError('CPython 3.12 or above required') # unreachable, as expected -> darkened
    case 'graalpy':
        if I.version[0] < 25: raise ImportError('GraalPy 25 (Python 3.12) or above required') # reachable!
    case s: raise ImportError(s)

Version

ty 0.0.42 (7f8cb64 2026-06-01)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions