          if ffi_inc and ffi_lib:
 -            ext.include_dirs.extend(ffi_inc)
 +            ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
-+            if grep_headers_for('ffi_closure_alloc', ffi_headers):
-+                try:
-+                    sources.remove('_ctypes/malloc_closure.c')
-+                except ValueError:
-+                    pass
 +            if grep_headers_for('ffi_prep_cif_var', ffi_headers):
 +                ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
++            if grep_headers_for('ffi_prep_closure_loc', ffi_headers):
++                ext.extra_compile_args.append("-DHAVE_FFI_PREP_CLOSURE_LOC=1")
++            if grep_headers_for('ffi_closure_alloc', ffi_headers):
++                ext.extra_compile_args.append("-DHAVE_FFI_CLOSURE_ALLOC=1")
++
 +            ext.include_dirs.append(ffi_inc)
              ext.libraries.append(ffi_lib)
              self.use_system_libffi = True
  
--- 
-2.21.1 (Apple Git-122.3)
-
-
-From 6717b8cb761ad60d243247c22d2136d1bb6cf6ed Mon Sep 17 00:00:00 2001
-From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com>
-Date: Wed, 1 Jul 2020 01:30:05 +0000
-Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?=
- =?UTF-8?q?rb=5Fit.?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-Comment: Patches 1/9 and 3/9 have been slightly modified in order to
-Comment: backport this patchset to Python 3.8.3.
-
----
- .../Core and Builtins/2020-07-01-01-30-04.bpo-41100.hCrjJJ.rst   | 1 +
- 1 file changed, 1 insertion(+)
- create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-07-01-01-30-04.bpo-41100.hCrjJJ.rst
-
-diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-07-01-01-30-04.bpo-41100.hCrjJJ.rst b/Misc/NEWS.d/next/Core and Builtins/2020-07-01-01-30-04.bpo-41100.hCrjJJ.rst
-new file mode 100644
-index 0000000..769eb89
---- /dev/null
-+++ b/Misc/NEWS.d/next/Core and Builtins/2020-07-01-01-30-04.bpo-41100.hCrjJJ.rst	
-@@ -0,0 +1 @@
-+setup.py: probe libffi for ffi_closure_alloc and ffi_prep_cif_var
-\ No newline at end of file
--- 
-2.21.1 (Apple Git-122.3)
-
-
-From 25b80eaea24be19a201e02629844b486b20d4acb Mon Sep 17 00:00:00 2001
-From: Lawrence D'Anna <64555057+lawrence-danna-apple@users.noreply.github.com>
-Date: Mon, 13 Jul 2020 16:21:28 -0700
-Subject: [PATCH 7/9] fix spelling in Doc/library/ctypes.rst
-Comment: Patches 1/9 and 3/9 have been slightly modified in order to
-Comment: backport this patchset to Python 3.8.3.
-
-Co-authored-by: Arch Oversight <archoversight@gmail.com>
----
- Doc/library/ctypes.rst | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
-index caed17a..8a82dd5 100644
---- a/Doc/library/ctypes.rst
-+++ b/Doc/library/ctypes.rst
-@@ -1581,7 +1581,7 @@ They are instances of a private class:
- 
-    .. attribute:: variadic
- 
--      Assign a boolean to specify that the function takes a variable nubmer of
-+      Assign a boolean to specify that the function takes a variable number of
-       arguments.   This does not matter on most platforms, but for Apple arm64
-       platforms variadic functions have a different calling convention than
-       normal functions.
-@@ -2552,4 +2552,3 @@ Arrays and pointers
- 
-         Returns the object to which to pointer points.  Assigning to this
-         attribute changes the pointer to point to the assigned object.
--
--- 
-2.21.1 (Apple Git-122.3)
-
-
-From 31a6fc56a69b85423971247c95f003387924e3d9 Mon Sep 17 00:00:00 2001
-From: Lawrence D'Anna <lawrence_danna@apple.com>
-Date: Mon, 29 Jun 2020 14:03:15 -0700
-Subject: [PATCH 8/9] allow python to build for macosx-11.0-arm64
-Comment: Patches 1/9 and 3/9 have been slightly modified in order to
-Comment: backport this patchset to Python 3.8.3.
-
----
- configure    | 3 +++
- configure.ac | 3 +++
- 2 files changed, 6 insertions(+)
-
-diff --git a/configure b/configure
-index 96dcd0d..b009927 100755
---- a/configure
-+++ b/configure
-@@ -9264,6 +9264,9 @@ fi
-     	ppc)
-     		MACOSX_DEFAULT_ARCH="ppc64"
-     		;;
-+      arm64)
-+    		MACOSX_DEFAULT_ARCH="arm64"
-+    		;;
-     	*)
-     		as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
-     		;;
-diff --git a/configure.ac b/configure.ac
-index 18a0446..3083e1e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -2442,6 +2442,9 @@ case $ac_sys_system/$ac_sys_release in
-     	ppc)
-     		MACOSX_DEFAULT_ARCH="ppc64"
-     		;;
-+      arm64)
-+    		MACOSX_DEFAULT_ARCH="arm64"
-+    		;;
-     	*)
-     		AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
-     		;;
--- 
-2.21.1 (Apple Git-122.3)
-
-
-From 0f4840d3003c82a8a67b6f0c4f71ccbdbfa6d1c6 Mon Sep 17 00:00:00 2001
-From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com>
-Date: Tue, 30 Jun 2020 00:02:43 +0000
-Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?=
- =?UTF-8?q?rb=5Fit.?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-Comment: Patches 1/9 and 3/9 have been slightly modified in order to
-Comment: backport this patchset to Python 3.8.3.
-
----
- .../Core and Builtins/2020-06-30-00-02-42.bpo-41164.zbzWsP.rst   | 1 +
- 1 file changed, 1 insertion(+)
- create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-06-30-00-02-42.bpo-41164.zbzWsP.rst
-
-diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-30-00-02-42.bpo-41164.zbzWsP.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-00-02-42.bpo-41164.zbzWsP.rst
-new file mode 100644
-index 0000000..c431766
---- /dev/null
-+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-00-02-42.bpo-41164.zbzWsP.rst	
-@@ -0,0 +1 @@
-+Allow python to build for macosx-11.0-arm64
-\ No newline at end of file
--- 
-2.21.1 (Apple Git-122.3)
-

         name = "PyUnicode_FromFormat"
         _PyUnicode_FromFormat = getattr(pythonapi, name)
+        _PyUnicode_FromFormat.argtypes = (c_char_p,)
+        _PyUnicode_FromFormat.variadic = True
         _PyUnicode_FromFormat.restype = py_object
 
         def PyUnicode_FromFormat(format, *args):
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index b10b867..65d0374 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3320,6 +3320,35 @@ PyCFuncPtr_get_restype(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
     }
 }
 
+static int
+PyCFuncPtr_set_variadic(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
+{
+    StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+    assert(dict);
+    int r = PyObject_IsTrue(ob);
+    if (r == 1) {
+        dict->flags |= FUNCFLAG_VARIADIC;
+        return 0;
+    } else if (r == 0) {
+        dict->flags &= ~FUNCFLAG_VARIADIC;
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+static PyObject *
+PyCFuncPtr_get_variadic(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
+{
+    StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+    assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
+    if (dict->flags & FUNCFLAG_VARIADIC)
+        Py_RETURN_TRUE;
+    else
+        Py_RETURN_FALSE;
+}
+
+
 static int
 PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
 {
@@ -3365,6 +3394,8 @@ static PyGetSetDef PyCFuncPtr_getsets[] = {
     { "argtypes", (getter)PyCFuncPtr_get_argtypes,
       (setter)PyCFuncPtr_set_argtypes,
       "specify the argument types", NULL },
+    { "variadic", (getter)PyCFuncPtr_get_variadic, (setter)PyCFuncPtr_set_variadic,
+      "specify if function takes variable number of arguments", NULL },
     { NULL, NULL }
 };
 
@@ -5833,6 +5864,7 @@ PyInit__ctypes(void)
     PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
     PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
     PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
+    PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyLong_FromLong(FUNCFLAG_VARIADIC));
     PyModule_AddStringConstant(m, "__version__", "1.1.0");
 
     PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 4027bdb..9b0ab9d 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -86,6 +86,10 @@
 #define DONT_USE_SEH
 #endif
 
+#if defined(__APPLE__) && __arm64__
+#define HAVE_FFI_PREP_CIF_VAR 1
+#endif
+
 #define CTYPES_CAPSULE_NAME_PYMEM "_ctypes pymem"
 
 static void pymem_destructor(PyObject *ptr)
@@ -813,7 +817,8 @@ static int _call_function_pointer(int flags,
                                   ffi_type **atypes,
                                   ffi_type *restype,
                                   void *resmem,

 {
     PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
     PyObject *error_object = NULL;
@@ -835,14 +842,70 @@ static int _call_function_pointer(int fl
     if ((flags & FUNCFLAG_CDECL) == 0)
         cc = FFI_STDCALL;
 #endif
