summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-10-17 12:30:31 (GMT)
committerGitHub <noreply@github.com>2023-10-17 12:30:31 (GMT)
commitbe5e8a010341c4d2d28ef53a1baed402ee06466e (patch)
tree6372a45676c7d5b8d07c69b67e889bbaf8f307e1 /PC
parent054f496bd45cf94eac4158fd60ac95ab5f8e45c4 (diff)
downloadcpython-be5e8a010341c4d2d28ef53a1baed402ee06466e.zip
cpython-be5e8a010341c4d2d28ef53a1baed402ee06466e.tar.gz
cpython-be5e8a010341c4d2d28ef53a1baed402ee06466e.tar.bz2
gh-110964: Remove private _PyArg functions (#110966)
Move the following private functions and structures to pycore_modsupport.h internal C API: * _PyArg_BadArgument() * _PyArg_CheckPositional() * _PyArg_NoKeywords() * _PyArg_NoPositional() * _PyArg_ParseStack() * _PyArg_ParseStackAndKeywords() * _PyArg_Parser structure * _PyArg_UnpackKeywords() * _PyArg_UnpackKeywordsWithVararg() * _PyArg_UnpackStack() * _Py_ANY_VARARGS() Changes: * Python/getargs.h now includes pycore_modsupport.h to export functions. * clinic.py now adds pycore_modsupport.h when one of these functions is used. * Add pycore_modsupport.h includes when a C extension uses one of these functions. * Define Py_BUILD_CORE_MODULE in C extensions which now include directly or indirectly (via code generated by Argument Clinic) pycore_modsupport.h: * _csv * _curses_panel * _dbm * _gdbm * _multiprocessing.posixshmem * _sqlite.row * _statistics * grp * resource * syslog * _testcapi: bad_get() no longer uses METH_FASTCALL calling convention but METH_VARARGS. Replace _PyArg_UnpackStack() with PyArg_ParseTuple(). * _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined by _testcapi sub-modules which need the internal C API (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c, watchers.c. * Remove Include/cpython/modsupport.h header file. Include/modsupport.h no longer includes the removed header file. * Fix mypy clinic.py
Diffstat (limited to 'PC')
-rw-r--r--PC/_wmimodule.cpp5
-rw-r--r--PC/clinic/_testconsole.c.h3
-rw-r--r--PC/clinic/_wmimodule.cpp.h3
-rw-r--r--PC/clinic/msvcrtmodule.c.h4
-rw-r--r--PC/clinic/winreg.c.h3
-rw-r--r--PC/clinic/winsound.c.h3
-rw-r--r--PC/winsound.c5
7 files changed, 21 insertions, 5 deletions
diff --git a/PC/_wmimodule.cpp b/PC/_wmimodule.cpp
index 310aa86..fdf09ec 100644
--- a/PC/_wmimodule.cpp
+++ b/PC/_wmimodule.cpp
@@ -8,6 +8,11 @@
// Version history
// 2022-08: Initial contribution (Steve Dower)
+// clinic/_wmimodule.cpp.h uses internal pycore_modsupport.h API
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#define _WIN32_DCOM
#include <Windows.h>
#include <comdef.h>
diff --git a/PC/clinic/_testconsole.c.h b/PC/clinic/_testconsole.c.h
index 99cd302..2c71c11 100644
--- a/PC/clinic/_testconsole.c.h
+++ b/PC/clinic/_testconsole.c.h
@@ -6,6 +6,7 @@ preserve
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
#if defined(MS_WINDOWS)
@@ -139,4 +140,4 @@ exit:
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
-/*[clinic end generated code: output=f59fe72cd4e73704 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=08a1c844b3657272 input=a9049054013a1b77]*/
diff --git a/PC/clinic/_wmimodule.cpp.h b/PC/clinic/_wmimodule.cpp.h
index 3ece5e6..fccf3d7 100644
--- a/PC/clinic/_wmimodule.cpp.h
+++ b/PC/clinic/_wmimodule.cpp.h
@@ -6,6 +6,7 @@ preserve
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(_wmi_exec_query__doc__,
"exec_query($module, /, query)\n"
@@ -68,4 +69,4 @@ _wmi_exec_query(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
exit:
return return_value;
}
-/*[clinic end generated code: output=53821e597fc2aca4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ba04920d127f3ceb input=a9049054013a1b77]*/
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h
index 54ae61b..e3f7ea4 100644
--- a/PC/clinic/msvcrtmodule.c.h
+++ b/PC/clinic/msvcrtmodule.c.h
@@ -2,6 +2,8 @@
preserve
[clinic start generated code]*/
+#include "pycore_modsupport.h" // _PyArg_CheckPositional()
+
PyDoc_STRVAR(msvcrt_heapmin__doc__,
"heapmin($module, /)\n"
"--\n"
@@ -695,4 +697,4 @@ exit:
#ifndef MSVCRT_GETERRORMODE_METHODDEF
#define MSVCRT_GETERRORMODE_METHODDEF
#endif /* !defined(MSVCRT_GETERRORMODE_METHODDEF) */
-/*[clinic end generated code: output=525ec6ac4e3cb4f2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=de9687b46212c2ed input=a9049054013a1b77]*/
diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h
index 7507c11..7e5545e 100644
--- a/PC/clinic/winreg.c.h
+++ b/PC/clinic/winreg.c.h
@@ -7,6 +7,7 @@ preserve
# include "pycore_runtime.h" // _Py_ID()
#endif
#include "pycore_long.h" // _PyLong_UnsignedLong_Converter()
+#include "pycore_modsupport.h" // _PyArg_CheckPositional()
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
@@ -1761,4 +1762,4 @@ exit:
#ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF
#define WINREG_QUERYREFLECTIONKEY_METHODDEF
#endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */
-/*[clinic end generated code: output=d7ae41899af53d7c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1ee4098b2f143b6a input=a9049054013a1b77]*/
diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h
index b8c8e7d..32a9a3d 100644
--- a/PC/clinic/winsound.c.h
+++ b/PC/clinic/winsound.c.h
@@ -6,6 +6,7 @@ preserve
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif
+#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(winsound_PlaySound__doc__,
"PlaySound($module, /, sound, flags)\n"
@@ -205,4 +206,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=21584101f656198f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=191d4fb1542c7abf input=a9049054013a1b77]*/
diff --git a/PC/winsound.c b/PC/winsound.c
index 68a9178..2881490 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -35,6 +35,11 @@
winsound.PlaySound(None, 0)
*/
+// clinic/winsound.c.h uses internal pycore_modsupport.h API
+#ifndef Py_BUILD_CORE_BUILTIN
+# define Py_BUILD_CORE_MODULE 1
+#endif
+
#include <Python.h>
#include <windows.h>
#include <mmsystem.h>