diff --git a/Include/cpython/modsupport.h b/Include/cpython/modsupport.h
new file mode 100644
index 000000000000000..d3b88f58c82ca3e
--- /dev/null
+++ b/Include/cpython/modsupport.h
@@ -0,0 +1,26 @@
+#ifndef Py_CPYTHON_MODSUPPORT_H
+# error "this header file must not be included directly"
+#endif
+
+// A data structure that can be used to run initialization code once in a
+// thread-safe manner. The C++11 equivalent is std::call_once.
+typedef struct {
+ uint8_t v;
+} _PyOnceFlag;
+
+typedef struct _PyArg_Parser {
+ const char *format;
+ const char * const *keywords;
+ const char *fname;
+ const char *custom_msg;
+ _PyOnceFlag once; /* atomic one-time initialization flag */
+ int is_kwtuple_owned; /* does this parser own the kwtuple object? */
+ int pos; /* number of positional-only arguments */
+ int min; /* minimal number of arguments */
+ int max; /* maximal number of positional arguments */
+ PyObject *kwtuple; /* tuple of keyword parameter names */
+ struct _PyArg_Parser *next;
+} _PyArg_Parser;
+
+PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
+ struct _PyArg_Parser *, ...);
diff --git a/Include/internal/pycore_lock.h b/Include/internal/pycore_lock.h
index 8aa73946e2c6451..3824434f3f375d3 100644
--- a/Include/internal/pycore_lock.h
+++ b/Include/internal/pycore_lock.h
@@ -128,12 +128,6 @@ _PyRawMutex_Unlock(_PyRawMutex *m)
_PyRawMutex_UnlockSlow(m);
}
-// A data structure that can be used to run initialization code once in a
-// thread-safe manner. The C++11 equivalent is std::call_once.
-typedef struct {
- uint8_t v;
-} _PyOnceFlag;
-
// Type signature for one-time initialization functions. The function should
// return 0 on success and -1 on failure.
typedef int _Py_once_fn_t(void *arg);
diff --git a/Include/internal/pycore_modsupport.h b/Include/internal/pycore_modsupport.h
index 3d3cd6722528e93..11fde814875938f 100644
--- a/Include/internal/pycore_modsupport.h
+++ b/Include/internal/pycore_modsupport.h
@@ -67,24 +67,6 @@ PyAPI_FUNC(void) _PyArg_BadArgument(
// --- _PyArg_Parser API ---------------------------------------------------
-typedef struct _PyArg_Parser {
- const char *format;
- const char * const *keywords;
- const char *fname;
- const char *custom_msg;
- _PyOnceFlag once; /* atomic one-time initialization flag */
- int is_kwtuple_owned; /* does this parser own the kwtuple object? */
- int pos; /* number of positional-only arguments */
- int min; /* minimal number of arguments */
- int max; /* maximal number of positional arguments */
- PyObject *kwtuple; /* tuple of keyword parameter names */
- struct _PyArg_Parser *next;
-} _PyArg_Parser;
-
-// Export for '_testclinic' shared extension
-PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
- struct _PyArg_Parser *, ...);
-
// Export for '_dbm' shared extension
PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
PyObject *const *args,
diff --git a/Include/modsupport.h b/Include/modsupport.h
index ea4c0fce9f4562c..af995f567b004c9 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -134,6 +134,12 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
#endif /* New in 3.5 */
+#ifndef Py_LIMITED_API
+# define Py_CPYTHON_MODSUPPORT_H
+# include "cpython/modsupport.h"
+# undef Py_CPYTHON_MODSUPPORT_H
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/Makefile.pre.in b/Makefile.pre.in
index e1c793ce629b02c..94cfb74138a3d99 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1115,6 +1115,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/cpython/longobject.h \
$(srcdir)/Include/cpython/memoryobject.h \
$(srcdir)/Include/cpython/methodobject.h \
+ $(srcdir)/Include/cpython/modsupport.h \
$(srcdir)/Include/cpython/monitoring.h \
$(srcdir)/Include/cpython/object.h \
$(srcdir)/Include/cpython/objimpl.h \
diff --git a/Misc/NEWS.d/next/C API/2024-07-02-11-03-40.gh-issue-112136.f3fiY8.rst b/Misc/NEWS.d/next/C API/2024-07-02-11-03-40.gh-issue-112136.f3fiY8.rst
new file mode 100644
index 000000000000000..27708702bb98ce1
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2024-07-02-11-03-40.gh-issue-112136.f3fiY8.rst
@@ -0,0 +1,2 @@
+Restore removed private ``_PyArg_Parser`` structure and private
+``_PyArg_ParseTupleAndKeywordsFast()`` function. Patch by Victor Stinner.
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 3378ed54203f188..f36fcb8caece330 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -163,6 +163,7 @@
+
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index 742d88d9e1fa7a5..a1b43addf9e36a6 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -432,6 +432,9 @@
Include\cpython
+
+ Include\cpython
+
Include\cpython