Skip to content

Differentiate sys.implementation.version from sys.version_info #7770

@TwelveBaud

Description

@TwelveBaud

Feature

I'm writing an application that runs a third-party script, which operates on pickles generated by another application. There are different versions of the script for Python 2 and Python 3, and the Python version must match the Python version used by that other application, but the actual implementation doesn't matter -- CPy, RustPy, Jython, IronPy, and PyPy all work properly.

My application allows the user to choose their Python executable of choice. It needs to check whether it implements Python 2 or Python 3 and also collect and show a proof-of-life (i.e. "RustPython 0.5.0 (64bit, for Python 3.14)"). Usually I'd get that from PEP514 registrations, but I also need to generate it if someone browses to an unregistered interpreter like RustPython. I'm getting incorrect output from RustPython when I try to obtain that information.

There are two version numbers in sys, and RustPython incorrectly uses the same version information in both:

  • sys.version_info -- This is the version of CPython that RustPython is trying to copy, and is correctly set to (essentially) 3.14.0alpha.
  • sys.implementation.version -- This is the version of RustPython itself. It should be set to (essentially) 0.5.0, but instead is set to the same version as above.

Python Documentation or reference to CPython source code

https://docs.python.org/3/library/sys.html#sys.implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type
    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