diff --git a/0001-patch-8.2.2970-Python-configure-check-uses-deprecate.patch b/0001-patch-8.2.2970-Python-configure-check-uses-deprecate.patch
new file mode 100644
index 0000000..ba6afa8
--- /dev/null
+++ b/0001-patch-8.2.2970-Python-configure-check-uses-deprecate.patch
@@ -0,0 +1,63 @@
+From 31e299c08f250b126b2c2c0ecce12ee563b70fdc Mon Sep 17 00:00:00 2001
+From: Zdenek Dohnal <zdohnal@redhat.com>
+Date: Thu, 10 Jun 2021 18:50:55 +0200
+Subject: [PATCH] patch 8.2.2970: Python configure check uses deprecated
+ command
+
+Problem:    Python configure check uses deprecated command.
+Solution:   Use sysconfig instead of distutils if possible. (Zdenek Dohnal,
+            closes #8354)
+---
+ src/auto/configure | 5 ++++-
+ src/configure.ac   | 5 ++++-
+ src/version.c      | 2 ++
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/auto/configure b/src/auto/configure
+index 5702a2171..7ecc40ca5 100755
+--- a/src/auto/configure
++++ b/src/auto/configure
+@@ -6755,7 +6755,10 @@ else
+ 
+        vi_cv_path_python3_conf=
+        config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
+-       d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
++       d=`${vi_cv_path_python3} -c "import sysconfig; print(sysconfig.get_config_var('LIBPL'))" 2> /dev/null`
++       if test "x$d" = "x"; then
++         d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
++       fi
+        if test -d "$d" && test -f "$d/config.c"; then
+          vi_cv_path_python3_conf="$d"
+        else
+diff --git a/src/configure.ac b/src/configure.ac
+index 2db04496f..9810ea1fc 100644
+--- a/src/configure.ac
++++ b/src/configure.ac
+@@ -1487,7 +1487,10 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic";
+       [
+        vi_cv_path_python3_conf=
+        config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
+-       d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
++       d=`${vi_cv_path_python3} -c "import sysconfig; print(sysconfig.get_config_var('LIBPL'))" 2> /dev/null`
++       if test "x$d" = "x"; then
++         d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
++       fi
+        if test -d "$d" && test -f "$d/config.c"; then
+          vi_cv_path_python3_conf="$d"
+        else
+diff --git a/src/version.c b/src/version.c
+index 055179cd2..628658199 100644
+--- a/src/version.c
++++ b/src/version.c
+@@ -750,6 +750,8 @@ static char *(features[]) =
+ 
+ static int included_patches[] =
+ {   /* Add new patch number below this line */
++/**/
++    2970,
+ /**/
+     2969,
+ /**/
+-- 
+2.31.1
+
diff --git a/0001-patch-8.2.2995-linker-errors-with-dynamic-Python-3.1.patch b/0001-patch-8.2.2995-linker-errors-with-dynamic-Python-3.1.patch
new file mode 100644
index 0000000..1b00efa
--- /dev/null
+++ b/0001-patch-8.2.2995-linker-errors-with-dynamic-Python-3.1.patch
@@ -0,0 +1,79 @@
+From 90478f35a8c78e2e10a4b4a8f135998dc04c91fa Mon Sep 17 00:00:00 2001
+From: Zdenek Dohnal <zdohnal@redhat.com>
+Date: Mon, 14 Jun 2021 15:08:30 +0200
+Subject: [PATCH] patch 8.2.2995: linker errors with dynamic Python 3.10
+
+Problem:    Linker errors with dynamic Python 3.10.
+Solution:   Add a couple of library entries. (Zdenek Dohnal, closes #8381,
+            closes #8356)
+---
+ src/if_python3.c | 18 ++++++++++++++++++
+ src/version.c    |  2 ++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/src/if_python3.c b/src/if_python3.c
+index f9c8002da..c7db9d7a2 100644
+--- a/src/if_python3.c
++++ b/src/if_python3.c
+@@ -184,6 +184,9 @@ typedef PySliceObject PySliceObject_T;
+ # ifndef PyMapping_Keys
+ #  define PyMapping_Keys py3_PyMapping_Keys
+ # endif
++# if PY_VERSION_HEX >= 0x030a00b2
++#  define PyIter_Check py3_PyIter_Check
++# endif
+ # define PyIter_Next py3_PyIter_Next
+ # define PyObject_GetIter py3_PyObject_GetIter
+ # define PyObject_Repr py3_PyObject_Repr
+@@ -358,6 +361,9 @@ static PyObject* (*py3_PyDict_GetItemString)(PyObject *, const char *);
+ static int (*py3_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
+ static PyObject* (*py3_PyLong_FromLong)(long);
+ static PyObject* (*py3_PyDict_New)(void);
++# if PY_VERSION_HEX >= 0x030a00b2
++static int (*py3_PyIter_Check)(PyObject *o);
++# endif
+ static PyObject* (*py3_PyIter_Next)(PyObject *);
+ static PyObject* (*py3_PyObject_GetIter)(PyObject *);
+ static PyObject* (*py3_PyObject_Repr)(PyObject *);
+@@ -538,6 +544,9 @@ static struct
+     {"PyDict_Next", (PYTHON_PROC*)&py3_PyDict_Next},
+     {"PyMapping_Check", (PYTHON_PROC*)&py3_PyMapping_Check},
+     {"PyMapping_Keys", (PYTHON_PROC*)&py3_PyMapping_Keys},
++# if PY_VERSION_HEX >= 0x030a00b2
++    {"PyIter_Check", (PYTHON_PROC*)&py3_PyIter_Check},
++# endif
+     {"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
+     {"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
+     {"PyObject_Repr", (PYTHON_PROC*)&py3_PyObject_Repr},
+@@ -671,6 +680,15 @@ py3_PyType_HasFeature(PyTypeObject *type, unsigned long feature)
+ #  define PyType_HasFeature(t,f) py3_PyType_HasFeature(t,f)
+ # endif
+ 
++# if PY_VERSION_HEX >= 0x030a00b2
++    static inline int
++py3__PyObject_TypeCheck(PyObject *ob, PyTypeObject *type)
++{
++    return Py_IS_TYPE(ob, type) || PyType_IsSubtype(Py_TYPE(ob), type);
++}
++#  define _PyObject_TypeCheck(o,t) py3__PyObject_TypeCheck(o,t)
++# endif
++
+ # ifdef MSWIN
+ /*
+  * Look up the library "libname" using the InstallPath registry key.
+diff --git a/src/version.c b/src/version.c
+index 58bd42016..b146efb69 100644
+--- a/src/version.c
++++ b/src/version.c
+@@ -750,6 +750,8 @@ static char *(features[]) =
+ 
+ static int included_patches[] =
+ {   /* Add new patch number below this line */
++/**/
++    2995,
+ /**/
+     2994,
+ /**/
+-- 
+2.31.1
+
diff --git a/vim.spec b/vim.spec
index ba71360..4b6b900 100644
--- a/vim.spec
+++ b/vim.spec
@@ -70,6 +70,10 @@ Patch3016: vim-8.0-copy-paste.patch
 Patch3017: vim-python3-tests.patch
 # fips warning
 Patch3018: vim-crypto-warning.patch
+# distutils deprecated - use sysconfig if available
+Patch3019: 0001-patch-8.2.2970-Python-configure-check-uses-deprecate.patch
+# FTBFS with Python 3.10
+Patch3020: 0001-patch-8.2.2995-linker-errors-with-dynamic-Python-3.1.patch
 
 # gcc is no longer in buildroot by default
 BuildRequires: gcc
@@ -281,6 +285,8 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
 %patch3016 -p1 -b .copypaste
 %patch3017 -p1 -b .python-tests
 %patch3018 -p1 -b .fips-warning
+%patch3019 -p1 -b .distutils-deprecated
+%patch3020 -p1 -b .python310-ftbfs
 
 %build
 cd src