From 23c0192166760b0d73bd39252ca72e3cfe596f6e Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 21 May 2021 11:43:58 +0200
Subject: [PATCH] patch 8.2.2876: configure cannot detect Python 3.10

Problem:    Configure cannot detect Python 3.10.
Solution:   Use sys.version_info. (closes #8233)
---
 src/auto/configure | 2 +-
 src/configure.ac   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/auto/configure b/src/auto/configure
index 0b423a65775..5702a217188 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -6673,7 +6673,7 @@ if ${vi_cv_var_python3_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   vi_cv_var_python3_version=`
-          ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
+          ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_var_python3_version" >&5
diff --git a/src/configure.ac b/src/configure.ac
index cc8d61f7f8b..2db04496ff1 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1436,7 +1436,7 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic";
     dnl -- get its version number
     AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
     [[vi_cv_var_python3_version=`
-          ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
+          ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
     ]])
 
     dnl -- it must be at least version 3
