def _get_session_python_version_info(session):
    try:
        version_info = session._runner._real_python_version_info
    except AttributeError:
        old_install_only_value = session._runner.global_config.install_only
        try:
            session._runner.global_config.install_only = False
            session_py_version = session.run('python', '-c', 'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))', silent=True, log=False)
            version_info = tuple((int(part) for part in session_py_version.split('.') if part.isdigit()))
            session._runner._real_python_version_info = version_info
        finally:
            session._runner.global_config.install_only = old_install_only_value
    return version_info
def _get_session_python_version_info(session):
    try:
        version_info = session._runner._real_python_version_info
    except AttributeError:
        old_install_only_value = session._runner.global_config.install_only
        try:
            session._runner.global_config.install_only = False
            session_py_version = session.run('python', '-c', 'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))', silent=True, log=False)
            version_info = tuple((int(part) for part in session_py_version.split('.') if part.isdigit()))
            session._runner._real_python_version_info = version_info
        finally:
            session._runner.global_config.install_only = old_install_only_value
    return version_info