[Python-checkins] cpython: Issue #23492: Argument Clinic now generates argument parsing code with

serhiy.storchaka python-checkins at python.org
Fri Apr 3 23:12:32 CEST 2015


https://hg.python.org/cpython/rev/e10ad4d4d490
changeset:   95424:e10ad4d4d490
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Apr 04 00:12:11 2015 +0300
summary:
  Issue #23492: Argument Clinic now generates argument parsing code with
PyArg_Parse instead of PyArg_ParseTuple if possible.

files:
  Misc/NEWS                          |   14 +-
  Modules/clinic/_bz2module.c.h      |    8 +-
  Modules/clinic/_codecsmodule.c.h   |    8 +-
  Modules/clinic/_lzmamodule.c.h     |   20 +-
  Modules/clinic/arraymodule.c.h     |   20 +-
  Modules/clinic/binascii.c.h        |   74 +++---
  Modules/clinic/cmathmodule.c.h     |  122 +++++-----
  Modules/clinic/posixmodule.c.h     |  176 ++++++++--------
  Modules/clinic/pwdmodule.c.h       |    8 +-
  Modules/clinic/pyexpat.c.h         |   20 +-
  Modules/clinic/spwdmodule.c.h      |    8 +-
  Modules/clinic/zlibmodule.c.h      |    8 +-
  Objects/clinic/bytearrayobject.c.h |   20 +-
  Objects/clinic/bytesobject.c.h     |   20 +-
  Python/clinic/bltinmodule.c.h      |    8 +-
  Python/clinic/import.c.h           |   38 +-
  Tools/clinic/clinic.py             |   52 +++-
  17 files changed, 321 insertions(+), 303 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -63,7 +63,7 @@
 Build
 -----
 
-- Issue #23501: Argumen Clinic now generates code into separate files by default.
+- Issue #23501: Argument Clinic now generates code into separate files by default.
 
 Tests
 -----
@@ -71,6 +71,13 @@
 Tools/Demos
 -----------
 
+- Issue #23492: Argument Clinic now generates argument parsing code with
+  PyArg_Parse instead of PyArg_ParseTuple if possible.
+
+- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
+  (empty) definition of the methoddef macro: it's only generated once, even
+  if Argument Clinic processes the same symbol multiple times, and it's emitted
+  at the end of all processing rather than immediately after the first use.
 
 
 What's New in Python 3.5.0 alpha 3?
@@ -270,11 +277,6 @@
 Tools/Demos
 -----------
 
-- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
-  (empty) definition of the methoddef macro: it's only generated once, even
-  if Argument Clinic processes the same symbol multiple times, and it's emitted
-  at the end of all processing rather than immediately after the first use.
-
 - Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
   compatible with regular files (in particular it now supports the context
   management protocol).
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -14,18 +14,18 @@
 "flush() method to finish the compression process.");
 
 #define _BZ2_BZ2COMPRESSOR_COMPRESS_METHODDEF    \
-    {"compress", (PyCFunction)_bz2_BZ2Compressor_compress, METH_VARARGS, _bz2_BZ2Compressor_compress__doc__},
+    {"compress", (PyCFunction)_bz2_BZ2Compressor_compress, METH_O, _bz2_BZ2Compressor_compress__doc__},
 
 static PyObject *
 _bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data);
 
 static PyObject *
-_bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *args)
+_bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:compress",
         &data))
         goto exit;
@@ -168,4 +168,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=8e65e3953430bc3d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3565d163a360af01 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -9,18 +9,18 @@
 "Purge the named codec from the internal codec lookup cache");
 
 #define _CODECS__FORGET_CODEC_METHODDEF    \
-    {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_VARARGS, _codecs__forget_codec__doc__},
+    {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__},
 
 static PyObject *
 _codecs__forget_codec_impl(PyModuleDef *module, const char *encoding);
 
 static PyObject *
-_codecs__forget_codec(PyModuleDef *module, PyObject *args)
+_codecs__forget_codec(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     const char *encoding;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "s:_forget_codec",
         &encoding))
         goto exit;
@@ -29,4 +29,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=cdea83e21d76a900 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fc5ce4d3166f7d96 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -14,18 +14,18 @@
 "flush() method to finish the compression process.");
 
 #define _LZMA_LZMACOMPRESSOR_COMPRESS_METHODDEF    \
-    {"compress", (PyCFunction)_lzma_LZMACompressor_compress, METH_VARARGS, _lzma_LZMACompressor_compress__doc__},
+    {"compress", (PyCFunction)_lzma_LZMACompressor_compress, METH_O, _lzma_LZMACompressor_compress__doc__},
 
 static PyObject *
 _lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data);
 
 static PyObject *
-_lzma_LZMACompressor_compress(Compressor *self, PyObject *args)
+_lzma_LZMACompressor_compress(Compressor *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:compress",
         &data))
         goto exit;
@@ -162,18 +162,18 @@
 "Always returns True for CHECK_NONE and CHECK_CRC32.");
 
 #define _LZMA_IS_CHECK_SUPPORTED_METHODDEF    \
-    {"is_check_supported", (PyCFunction)_lzma_is_check_supported, METH_VARARGS, _lzma_is_check_supported__doc__},
+    {"is_check_supported", (PyCFunction)_lzma_is_check_supported, METH_O, _lzma_is_check_supported__doc__},
 
 static PyObject *
 _lzma_is_check_supported_impl(PyModuleDef *module, int check_id);
 
 static PyObject *
-_lzma_is_check_supported(PyModuleDef *module, PyObject *args)
+_lzma_is_check_supported(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int check_id;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:is_check_supported",
         &check_id))
         goto exit;
@@ -192,18 +192,18 @@
 "The result does not include the filter ID itself, only the options.");
 
 #define _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF    \
-    {"_encode_filter_properties", (PyCFunction)_lzma__encode_filter_properties, METH_VARARGS, _lzma__encode_filter_properties__doc__},
+    {"_encode_filter_properties", (PyCFunction)_lzma__encode_filter_properties, METH_O, _lzma__encode_filter_properties__doc__},
 
 static PyObject *
 _lzma__encode_filter_properties_impl(PyModuleDef *module, lzma_filter filter);
 
 static PyObject *
-_lzma__encode_filter_properties(PyModuleDef *module, PyObject *args)
+_lzma__encode_filter_properties(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:_encode_filter_properties",
         lzma_filter_converter, &filter))
         goto exit;
@@ -251,4 +251,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=dc42b73890609369 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ea7f2b2c4019fe86 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -267,18 +267,18 @@
 "This method is deprecated. Use frombytes instead.");
 
 #define ARRAY_ARRAY_FROMSTRING_METHODDEF    \
-    {"fromstring", (PyCFunction)array_array_fromstring, METH_VARARGS, array_array_fromstring__doc__},
+    {"fromstring", (PyCFunction)array_array_fromstring, METH_O, array_array_fromstring__doc__},
 
 static PyObject *
 array_array_fromstring_impl(arrayobject *self, Py_buffer *buffer);
 
 static PyObject *
-array_array_fromstring(arrayobject *self, PyObject *args)
+array_array_fromstring(arrayobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer buffer = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "s*:fromstring",
         &buffer))
         goto exit;
@@ -299,18 +299,18 @@
 "Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).");
 
 #define ARRAY_ARRAY_FROMBYTES_METHODDEF    \
-    {"frombytes", (PyCFunction)array_array_frombytes, METH_VARARGS, array_array_frombytes__doc__},
+    {"frombytes", (PyCFunction)array_array_frombytes, METH_O, array_array_frombytes__doc__},
 
 static PyObject *
 array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer);
 
 static PyObject *
-array_array_frombytes(arrayobject *self, PyObject *args)
+array_array_frombytes(arrayobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer buffer = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:frombytes",
         &buffer))
         goto exit;
@@ -373,19 +373,19 @@
 "some other type.");
 
 #define ARRAY_ARRAY_FROMUNICODE_METHODDEF    \
-    {"fromunicode", (PyCFunction)array_array_fromunicode, METH_VARARGS, array_array_fromunicode__doc__},
+    {"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__},
 
 static PyObject *
 array_array_fromunicode_impl(arrayobject *self, Py_UNICODE *ustr, Py_ssize_clean_t ustr_length);
 
 static PyObject *
-array_array_fromunicode(arrayobject *self, PyObject *args)
+array_array_fromunicode(arrayobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_UNICODE *ustr;
     Py_ssize_clean_t ustr_length;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "u#:fromunicode",
         &ustr, &ustr_length))
         goto exit;
@@ -502,4 +502,4 @@
 
 #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=e1deb61c6a3bc8c8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a8fbe83c2026fa83 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -9,18 +9,18 @@
 "Decode a line of uuencoded data.");
 
 #define BINASCII_A2B_UU_METHODDEF    \
-    {"a2b_uu", (PyCFunction)binascii_a2b_uu, METH_VARARGS, binascii_a2b_uu__doc__},
+    {"a2b_uu", (PyCFunction)binascii_a2b_uu, METH_O, binascii_a2b_uu__doc__},
 
 static PyObject *
 binascii_a2b_uu_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_a2b_uu(PyModuleDef *module, PyObject *args)
+binascii_a2b_uu(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:a2b_uu",
         ascii_buffer_converter, &data))
         goto exit;
@@ -41,18 +41,18 @@
 "Uuencode line of data.");
 
 #define BINASCII_B2A_UU_METHODDEF    \
-    {"b2a_uu", (PyCFunction)binascii_b2a_uu, METH_VARARGS, binascii_b2a_uu__doc__},
+    {"b2a_uu", (PyCFunction)binascii_b2a_uu, METH_O, binascii_b2a_uu__doc__},
 
 static PyObject *
 binascii_b2a_uu_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_b2a_uu(PyModuleDef *module, PyObject *args)
+binascii_b2a_uu(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:b2a_uu",
         &data))
         goto exit;
@@ -73,18 +73,18 @@
 "Decode a line of base64 data.");
 
 #define BINASCII_A2B_BASE64_METHODDEF    \
-    {"a2b_base64", (PyCFunction)binascii_a2b_base64, METH_VARARGS, binascii_a2b_base64__doc__},
+    {"a2b_base64", (PyCFunction)binascii_a2b_base64, METH_O, binascii_a2b_base64__doc__},
 
 static PyObject *
 binascii_a2b_base64_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_a2b_base64(PyModuleDef *module, PyObject *args)
+binascii_a2b_base64(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:a2b_base64",
         ascii_buffer_converter, &data))
         goto exit;
@@ -105,18 +105,18 @@
 "Base64-code line of data.");
 
 #define BINASCII_B2A_BASE64_METHODDEF    \
-    {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_VARARGS, binascii_b2a_base64__doc__},
+    {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_O, binascii_b2a_base64__doc__},
 
 static PyObject *
 binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_b2a_base64(PyModuleDef *module, PyObject *args)
+binascii_b2a_base64(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:b2a_base64",
         &data))
         goto exit;
@@ -137,18 +137,18 @@
 "Decode .hqx coding.");
 
 #define BINASCII_A2B_HQX_METHODDEF    \
-    {"a2b_hqx", (PyCFunction)binascii_a2b_hqx, METH_VARARGS, binascii_a2b_hqx__doc__},
+    {"a2b_hqx", (PyCFunction)binascii_a2b_hqx, METH_O, binascii_a2b_hqx__doc__},
 
 static PyObject *
 binascii_a2b_hqx_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_a2b_hqx(PyModuleDef *module, PyObject *args)
+binascii_a2b_hqx(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:a2b_hqx",
         ascii_buffer_converter, &data))
         goto exit;
@@ -169,18 +169,18 @@
 "Binhex RLE-code binary data.");
 
 #define BINASCII_RLECODE_HQX_METHODDEF    \
-    {"rlecode_hqx", (PyCFunction)binascii_rlecode_hqx, METH_VARARGS, binascii_rlecode_hqx__doc__},
+    {"rlecode_hqx", (PyCFunction)binascii_rlecode_hqx, METH_O, binascii_rlecode_hqx__doc__},
 
 static PyObject *
 binascii_rlecode_hqx_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_rlecode_hqx(PyModuleDef *module, PyObject *args)
+binascii_rlecode_hqx(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:rlecode_hqx",
         &data))
         goto exit;
@@ -201,18 +201,18 @@
 "Encode .hqx data.");
 
 #define BINASCII_B2A_HQX_METHODDEF    \
-    {"b2a_hqx", (PyCFunction)binascii_b2a_hqx, METH_VARARGS, binascii_b2a_hqx__doc__},
+    {"b2a_hqx", (PyCFunction)binascii_b2a_hqx, METH_O, binascii_b2a_hqx__doc__},
 
 static PyObject *
 binascii_b2a_hqx_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_b2a_hqx(PyModuleDef *module, PyObject *args)
+binascii_b2a_hqx(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:b2a_hqx",
         &data))
         goto exit;
@@ -233,18 +233,18 @@
 "Decode hexbin RLE-coded string.");
 
 #define BINASCII_RLEDECODE_HQX_METHODDEF    \
-    {"rledecode_hqx", (PyCFunction)binascii_rledecode_hqx, METH_VARARGS, binascii_rledecode_hqx__doc__},
+    {"rledecode_hqx", (PyCFunction)binascii_rledecode_hqx, METH_O, binascii_rledecode_hqx__doc__},
 
 static PyObject *
 binascii_rledecode_hqx_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_rledecode_hqx(PyModuleDef *module, PyObject *args)
+binascii_rledecode_hqx(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:rledecode_hqx",
         &data))
         goto exit;
@@ -342,18 +342,18 @@
 "available as \"hexlify()\".");
 
 #define BINASCII_B2A_HEX_METHODDEF    \
-    {"b2a_hex", (PyCFunction)binascii_b2a_hex, METH_VARARGS, binascii_b2a_hex__doc__},
+    {"b2a_hex", (PyCFunction)binascii_b2a_hex, METH_O, binascii_b2a_hex__doc__},
 
 static PyObject *
 binascii_b2a_hex_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_b2a_hex(PyModuleDef *module, PyObject *args)
+binascii_b2a_hex(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:b2a_hex",
         &data))
         goto exit;
@@ -376,18 +376,18 @@
 "The return value is a bytes object.");
 
 #define BINASCII_HEXLIFY_METHODDEF    \
-    {"hexlify", (PyCFunction)binascii_hexlify, METH_VARARGS, binascii_hexlify__doc__},
+    {"hexlify", (PyCFunction)binascii_hexlify, METH_O, binascii_hexlify__doc__},
 
 static PyObject *
 binascii_hexlify_impl(PyModuleDef *module, Py_buffer *data);
 
 static PyObject *
-binascii_hexlify(PyModuleDef *module, PyObject *args)
+binascii_hexlify(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:hexlify",
         &data))
         goto exit;
@@ -411,18 +411,18 @@
 "This function is also available as \"unhexlify()\".");
 
 #define BINASCII_A2B_HEX_METHODDEF    \
-    {"a2b_hex", (PyCFunction)binascii_a2b_hex, METH_VARARGS, binascii_a2b_hex__doc__},
+    {"a2b_hex", (PyCFunction)binascii_a2b_hex, METH_O, binascii_a2b_hex__doc__},
 
 static PyObject *
 binascii_a2b_hex_impl(PyModuleDef *module, Py_buffer *hexstr);
 
 static PyObject *
-binascii_a2b_hex(PyModuleDef *module, PyObject *args)
+binascii_a2b_hex(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer hexstr = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:a2b_hex",
         ascii_buffer_converter, &hexstr))
         goto exit;
@@ -445,18 +445,18 @@
 "hexstr must contain an even number of hex digits (upper or lower case).");
 
 #define BINASCII_UNHEXLIFY_METHODDEF    \
-    {"unhexlify", (PyCFunction)binascii_unhexlify, METH_VARARGS, binascii_unhexlify__doc__},
+    {"unhexlify", (PyCFunction)binascii_unhexlify, METH_O, binascii_unhexlify__doc__},
 
 static PyObject *
 binascii_unhexlify_impl(PyModuleDef *module, Py_buffer *hexstr);
 
 static PyObject *
-binascii_unhexlify(PyModuleDef *module, PyObject *args)
+binascii_unhexlify(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer hexstr = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:unhexlify",
         ascii_buffer_converter, &hexstr))
         goto exit;
@@ -543,4 +543,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=771126f8f53e84e7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=31ccbd5fddc8fd75 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h
--- a/Modules/clinic/cmathmodule.c.h
+++ b/Modules/clinic/cmathmodule.c.h
@@ -9,19 +9,19 @@
 "Return the arc cosine of z.");
 
 #define CMATH_ACOS_METHODDEF    \
-    {"acos", (PyCFunction)cmath_acos, METH_VARARGS, cmath_acos__doc__},
+    {"acos", (PyCFunction)cmath_acos, METH_O, cmath_acos__doc__},
 
 static Py_complex
 cmath_acos_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_acos(PyModuleDef *module, PyObject *args)
+cmath_acos(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:acos",
         &z))
         goto exit;
@@ -52,19 +52,19 @@
 "Return the inverse hyperbolic cosine of z.");
 
 #define CMATH_ACOSH_METHODDEF    \
-    {"acosh", (PyCFunction)cmath_acosh, METH_VARARGS, cmath_acosh__doc__},
+    {"acosh", (PyCFunction)cmath_acosh, METH_O, cmath_acosh__doc__},
 
 static Py_complex
 cmath_acosh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_acosh(PyModuleDef *module, PyObject *args)
+cmath_acosh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:acosh",
         &z))
         goto exit;
@@ -95,19 +95,19 @@
 "Return the arc sine of z.");
 
 #define CMATH_ASIN_METHODDEF    \
-    {"asin", (PyCFunction)cmath_asin, METH_VARARGS, cmath_asin__doc__},
+    {"asin", (PyCFunction)cmath_asin, METH_O, cmath_asin__doc__},
 
 static Py_complex
 cmath_asin_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_asin(PyModuleDef *module, PyObject *args)
+cmath_asin(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:asin",
         &z))
         goto exit;
@@ -138,19 +138,19 @@
 "Return the inverse hyperbolic sine of z.");
 
 #define CMATH_ASINH_METHODDEF    \
-    {"asinh", (PyCFunction)cmath_asinh, METH_VARARGS, cmath_asinh__doc__},
+    {"asinh", (PyCFunction)cmath_asinh, METH_O, cmath_asinh__doc__},
 
 static Py_complex
 cmath_asinh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_asinh(PyModuleDef *module, PyObject *args)
+cmath_asinh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:asinh",
         &z))
         goto exit;
@@ -181,19 +181,19 @@
 "Return the arc tangent of z.");
 
 #define CMATH_ATAN_METHODDEF    \
-    {"atan", (PyCFunction)cmath_atan, METH_VARARGS, cmath_atan__doc__},
+    {"atan", (PyCFunction)cmath_atan, METH_O, cmath_atan__doc__},
 
 static Py_complex
 cmath_atan_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_atan(PyModuleDef *module, PyObject *args)
+cmath_atan(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:atan",
         &z))
         goto exit;
@@ -224,19 +224,19 @@
 "Return the inverse hyperbolic tangent of z.");
 
 #define CMATH_ATANH_METHODDEF    \
-    {"atanh", (PyCFunction)cmath_atanh, METH_VARARGS, cmath_atanh__doc__},
+    {"atanh", (PyCFunction)cmath_atanh, METH_O, cmath_atanh__doc__},
 
 static Py_complex
 cmath_atanh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_atanh(PyModuleDef *module, PyObject *args)
+cmath_atanh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:atanh",
         &z))
         goto exit;
@@ -267,19 +267,19 @@
 "Return the cosine of z.");
 
 #define CMATH_COS_METHODDEF    \
-    {"cos", (PyCFunction)cmath_cos, METH_VARARGS, cmath_cos__doc__},
+    {"cos", (PyCFunction)cmath_cos, METH_O, cmath_cos__doc__},
 
 static Py_complex
 cmath_cos_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_cos(PyModuleDef *module, PyObject *args)
+cmath_cos(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:cos",
         &z))
         goto exit;
@@ -310,19 +310,19 @@
 "Return the hyperbolic cosine of z.");
 
 #define CMATH_COSH_METHODDEF    \
-    {"cosh", (PyCFunction)cmath_cosh, METH_VARARGS, cmath_cosh__doc__},
+    {"cosh", (PyCFunction)cmath_cosh, METH_O, cmath_cosh__doc__},
 
 static Py_complex
 cmath_cosh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_cosh(PyModuleDef *module, PyObject *args)
+cmath_cosh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:cosh",
         &z))
         goto exit;
@@ -353,19 +353,19 @@
 "Return the exponential value e**z.");
 
 #define CMATH_EXP_METHODDEF    \
-    {"exp", (PyCFunction)cmath_exp, METH_VARARGS, cmath_exp__doc__},
+    {"exp", (PyCFunction)cmath_exp, METH_O, cmath_exp__doc__},
 
 static Py_complex
 cmath_exp_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_exp(PyModuleDef *module, PyObject *args)
+cmath_exp(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:exp",
         &z))
         goto exit;
@@ -396,19 +396,19 @@
 "Return the base-10 logarithm of z.");
 
 #define CMATH_LOG10_METHODDEF    \
-    {"log10", (PyCFunction)cmath_log10, METH_VARARGS, cmath_log10__doc__},
+    {"log10", (PyCFunction)cmath_log10, METH_O, cmath_log10__doc__},
 
 static Py_complex
 cmath_log10_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_log10(PyModuleDef *module, PyObject *args)
+cmath_log10(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:log10",
         &z))
         goto exit;
@@ -439,19 +439,19 @@
 "Return the sine of z.");
 
 #define CMATH_SIN_METHODDEF    \
-    {"sin", (PyCFunction)cmath_sin, METH_VARARGS, cmath_sin__doc__},
+    {"sin", (PyCFunction)cmath_sin, METH_O, cmath_sin__doc__},
 
 static Py_complex
 cmath_sin_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_sin(PyModuleDef *module, PyObject *args)
+cmath_sin(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:sin",
         &z))
         goto exit;
@@ -482,19 +482,19 @@
 "Return the hyperbolic sine of z.");
 
 #define CMATH_SINH_METHODDEF    \
-    {"sinh", (PyCFunction)cmath_sinh, METH_VARARGS, cmath_sinh__doc__},
+    {"sinh", (PyCFunction)cmath_sinh, METH_O, cmath_sinh__doc__},
 
 static Py_complex
 cmath_sinh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_sinh(PyModuleDef *module, PyObject *args)
+cmath_sinh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:sinh",
         &z))
         goto exit;
@@ -525,19 +525,19 @@
 "Return the square root of z.");
 
 #define CMATH_SQRT_METHODDEF    \
-    {"sqrt", (PyCFunction)cmath_sqrt, METH_VARARGS, cmath_sqrt__doc__},
+    {"sqrt", (PyCFunction)cmath_sqrt, METH_O, cmath_sqrt__doc__},
 
 static Py_complex
 cmath_sqrt_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_sqrt(PyModuleDef *module, PyObject *args)
+cmath_sqrt(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:sqrt",
         &z))
         goto exit;
@@ -568,19 +568,19 @@
 "Return the tangent of z.");
 
 #define CMATH_TAN_METHODDEF    \
-    {"tan", (PyCFunction)cmath_tan, METH_VARARGS, cmath_tan__doc__},
+    {"tan", (PyCFunction)cmath_tan, METH_O, cmath_tan__doc__},
 
 static Py_complex
 cmath_tan_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_tan(PyModuleDef *module, PyObject *args)
+cmath_tan(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:tan",
         &z))
         goto exit;
@@ -611,19 +611,19 @@
 "Return the hyperbolic tangent of z.");
 
 #define CMATH_TANH_METHODDEF    \
-    {"tanh", (PyCFunction)cmath_tanh, METH_VARARGS, cmath_tanh__doc__},
+    {"tanh", (PyCFunction)cmath_tanh, METH_O, cmath_tanh__doc__},
 
 static Py_complex
 cmath_tanh_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_tanh(PyModuleDef *module, PyObject *args)
+cmath_tanh(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
     Py_complex _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:tanh",
         &z))
         goto exit;
@@ -685,18 +685,18 @@
 "Return argument, also known as the phase angle, of a complex.");
 
 #define CMATH_PHASE_METHODDEF    \
-    {"phase", (PyCFunction)cmath_phase, METH_VARARGS, cmath_phase__doc__},
+    {"phase", (PyCFunction)cmath_phase, METH_O, cmath_phase__doc__},
 
 static PyObject *
 cmath_phase_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_phase(PyModuleDef *module, PyObject *args)
+cmath_phase(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:phase",
         &z))
         goto exit;
@@ -715,18 +715,18 @@
 "r is the distance from 0 and phi the phase angle.");
 
 #define CMATH_POLAR_METHODDEF    \
-    {"polar", (PyCFunction)cmath_polar, METH_VARARGS, cmath_polar__doc__},
+    {"polar", (PyCFunction)cmath_polar, METH_O, cmath_polar__doc__},
 
 static PyObject *
 cmath_polar_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_polar(PyModuleDef *module, PyObject *args)
+cmath_polar(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:polar",
         &z))
         goto exit;
@@ -772,18 +772,18 @@
 "Return True if both the real and imaginary parts of z are finite, else False.");
 
 #define CMATH_ISFINITE_METHODDEF    \
-    {"isfinite", (PyCFunction)cmath_isfinite, METH_VARARGS, cmath_isfinite__doc__},
+    {"isfinite", (PyCFunction)cmath_isfinite, METH_O, cmath_isfinite__doc__},
 
 static PyObject *
 cmath_isfinite_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_isfinite(PyModuleDef *module, PyObject *args)
+cmath_isfinite(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:isfinite",
         &z))
         goto exit;
@@ -800,18 +800,18 @@
 "Checks if the real or imaginary part of z not a number (NaN).");
 
 #define CMATH_ISNAN_METHODDEF    \
-    {"isnan", (PyCFunction)cmath_isnan, METH_VARARGS, cmath_isnan__doc__},
+    {"isnan", (PyCFunction)cmath_isnan, METH_O, cmath_isnan__doc__},
 
 static PyObject *
 cmath_isnan_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_isnan(PyModuleDef *module, PyObject *args)
+cmath_isnan(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:isnan",
         &z))
         goto exit;
@@ -828,18 +828,18 @@
 "Checks if the real or imaginary part of z is infinite.");
 
 #define CMATH_ISINF_METHODDEF    \
-    {"isinf", (PyCFunction)cmath_isinf, METH_VARARGS, cmath_isinf__doc__},
+    {"isinf", (PyCFunction)cmath_isinf, METH_O, cmath_isinf__doc__},
 
 static PyObject *
 cmath_isinf_impl(PyModuleDef *module, Py_complex z);
 
 static PyObject *
-cmath_isinf(PyModuleDef *module, PyObject *args)
+cmath_isinf(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_complex z;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "D:isinf",
         &z))
         goto exit;
@@ -848,4 +848,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=9b6d81711e4e3c4b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9143b8dcc8069024 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -168,19 +168,19 @@
 "    Integer file descriptor handle.");
 
 #define OS_TTYNAME_METHODDEF    \
-    {"ttyname", (PyCFunction)os_ttyname, METH_VARARGS, os_ttyname__doc__},
+    {"ttyname", (PyCFunction)os_ttyname, METH_O, os_ttyname__doc__},
 
 static char *
 os_ttyname_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_ttyname(PyModuleDef *module, PyObject *args)
+os_ttyname(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
     char *_return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:ttyname",
         &fd))
         goto exit;
@@ -911,18 +911,18 @@
 "A helper function for samepath on windows.");
 
 #define OS__GETFINALPATHNAME_METHODDEF    \
-    {"_getfinalpathname", (PyCFunction)os__getfinalpathname, METH_VARARGS, os__getfinalpathname__doc__},
+    {"_getfinalpathname", (PyCFunction)os__getfinalpathname, METH_O, os__getfinalpathname__doc__},
 
 static PyObject *
 os__getfinalpathname_impl(PyModuleDef *module, PyObject *path);
 
 static PyObject *
-os__getfinalpathname(PyModuleDef *module, PyObject *args)
+os__getfinalpathname(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *path;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:_getfinalpathname",
         &path))
         goto exit;
@@ -1017,18 +1017,18 @@
 "Add increment to the priority of process and return the new priority.");
 
 #define OS_NICE_METHODDEF    \
-    {"nice", (PyCFunction)os_nice, METH_VARARGS, os_nice__doc__},
+    {"nice", (PyCFunction)os_nice, METH_O, os_nice__doc__},
 
 static PyObject *
 os_nice_impl(PyModuleDef *module, int increment);
 
 static PyObject *
-os_nice(PyModuleDef *module, PyObject *args)
+os_nice(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int increment;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:nice",
         &increment))
         goto exit;
@@ -1317,18 +1317,18 @@
 "Set the current numeric umask and return the previous umask.");
 
 #define OS_UMASK_METHODDEF    \
-    {"umask", (PyCFunction)os_umask, METH_VARARGS, os_umask__doc__},
+    {"umask", (PyCFunction)os_umask, METH_O, os_umask__doc__},
 
 static PyObject *
 os_umask_impl(PyModuleDef *module, int mask);
 
 static PyObject *
-os_umask(PyModuleDef *module, PyObject *args)
+os_umask(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int mask;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:umask",
         &mask))
         goto exit;
@@ -1829,18 +1829,18 @@
 "Passing 0 for pid returns the scheduling policy for the calling process.");
 
 #define OS_SCHED_GETSCHEDULER_METHODDEF    \
-    {"sched_getscheduler", (PyCFunction)os_sched_getscheduler, METH_VARARGS, os_sched_getscheduler__doc__},
+    {"sched_getscheduler", (PyCFunction)os_sched_getscheduler, METH_O, os_sched_getscheduler__doc__},
 
 static PyObject *
 os_sched_getscheduler_impl(PyModuleDef *module, pid_t pid);
 
 static PyObject *
-os_sched_getscheduler(PyModuleDef *module, PyObject *args)
+os_sched_getscheduler(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     pid_t pid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_PID ":sched_getscheduler",
         &pid))
         goto exit;
@@ -1934,18 +1934,18 @@
 "Return value is an instance of sched_param.");
 
 #define OS_SCHED_GETPARAM_METHODDEF    \
-    {"sched_getparam", (PyCFunction)os_sched_getparam, METH_VARARGS, os_sched_getparam__doc__},
+    {"sched_getparam", (PyCFunction)os_sched_getparam, METH_O, os_sched_getparam__doc__},
 
 static PyObject *
 os_sched_getparam_impl(PyModuleDef *module, pid_t pid);
 
 static PyObject *
-os_sched_getparam(PyModuleDef *module, PyObject *args)
+os_sched_getparam(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     pid_t pid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_PID ":sched_getparam",
         &pid))
         goto exit;
@@ -2004,19 +2004,19 @@
 "Value returned is a float.");
 
 #define OS_SCHED_RR_GET_INTERVAL_METHODDEF    \
-    {"sched_rr_get_interval", (PyCFunction)os_sched_rr_get_interval, METH_VARARGS, os_sched_rr_get_interval__doc__},
+    {"sched_rr_get_interval", (PyCFunction)os_sched_rr_get_interval, METH_O, os_sched_rr_get_interval__doc__},
 
 static double
 os_sched_rr_get_interval_impl(PyModuleDef *module, pid_t pid);
 
 static PyObject *
-os_sched_rr_get_interval(PyModuleDef *module, PyObject *args)
+os_sched_rr_get_interval(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     pid_t pid;
     double _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_PID ":sched_rr_get_interval",
         &pid))
         goto exit;
@@ -2099,18 +2099,18 @@
 "The affinity is returned as a set of CPU identifiers.");
 
 #define OS_SCHED_GETAFFINITY_METHODDEF    \
-    {"sched_getaffinity", (PyCFunction)os_sched_getaffinity, METH_VARARGS, os_sched_getaffinity__doc__},
+    {"sched_getaffinity", (PyCFunction)os_sched_getaffinity, METH_O, os_sched_getaffinity__doc__},
 
 static PyObject *
 os_sched_getaffinity_impl(PyModuleDef *module, pid_t pid);
 
 static PyObject *
-os_sched_getaffinity(PyModuleDef *module, PyObject *args)
+os_sched_getaffinity(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     pid_t pid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_PID ":sched_getaffinity",
         &pid))
         goto exit;
@@ -2501,18 +2501,18 @@
 "Lock program segments into memory.\");");
 
 #define OS_PLOCK_METHODDEF    \
-    {"plock", (PyCFunction)os_plock, METH_VARARGS, os_plock__doc__},
+    {"plock", (PyCFunction)os_plock, METH_O, os_plock__doc__},
 
 static PyObject *
 os_plock_impl(PyModuleDef *module, int op);
 
 static PyObject *
-os_plock(PyModuleDef *module, PyObject *args)
+os_plock(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int op;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:plock",
         &op))
         goto exit;
@@ -2533,18 +2533,18 @@
 "Set the current process\'s user id.");
 
 #define OS_SETUID_METHODDEF    \
-    {"setuid", (PyCFunction)os_setuid, METH_VARARGS, os_setuid__doc__},
+    {"setuid", (PyCFunction)os_setuid, METH_O, os_setuid__doc__},
 
 static PyObject *
 os_setuid_impl(PyModuleDef *module, uid_t uid);
 
 static PyObject *
-os_setuid(PyModuleDef *module, PyObject *args)
+os_setuid(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     uid_t uid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:setuid",
         _Py_Uid_Converter, &uid))
         goto exit;
@@ -2565,18 +2565,18 @@
 "Set the current process\'s effective user id.");
 
 #define OS_SETEUID_METHODDEF    \
-    {"seteuid", (PyCFunction)os_seteuid, METH_VARARGS, os_seteuid__doc__},
+    {"seteuid", (PyCFunction)os_seteuid, METH_O, os_seteuid__doc__},
 
 static PyObject *
 os_seteuid_impl(PyModuleDef *module, uid_t euid);
 
 static PyObject *
-os_seteuid(PyModuleDef *module, PyObject *args)
+os_seteuid(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     uid_t euid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:seteuid",
         _Py_Uid_Converter, &euid))
         goto exit;
@@ -2597,18 +2597,18 @@
 "Set the current process\'s effective group id.");
 
 #define OS_SETEGID_METHODDEF    \
-    {"setegid", (PyCFunction)os_setegid, METH_VARARGS, os_setegid__doc__},
+    {"setegid", (PyCFunction)os_setegid, METH_O, os_setegid__doc__},
 
 static PyObject *
 os_setegid_impl(PyModuleDef *module, gid_t egid);
 
 static PyObject *
-os_setegid(PyModuleDef *module, PyObject *args)
+os_setegid(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     gid_t egid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:setegid",
         _Py_Gid_Converter, &egid))
         goto exit;
@@ -2695,18 +2695,18 @@
 "Set the current process\'s group id.");
 
 #define OS_SETGID_METHODDEF    \
-    {"setgid", (PyCFunction)os_setgid, METH_VARARGS, os_setgid__doc__},
+    {"setgid", (PyCFunction)os_setgid, METH_O, os_setgid__doc__},
 
 static PyObject *
 os_setgid_impl(PyModuleDef *module, gid_t gid);
 
 static PyObject *
-os_setgid(PyModuleDef *module, PyObject *args)
+os_setgid(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     gid_t gid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:setgid",
         _Py_Gid_Converter, &gid))
         goto exit;
@@ -3036,18 +3036,18 @@
 "Call the system call getsid(pid) and return the result.");
 
 #define OS_GETSID_METHODDEF    \
-    {"getsid", (PyCFunction)os_getsid, METH_VARARGS, os_getsid__doc__},
+    {"getsid", (PyCFunction)os_getsid, METH_O, os_getsid__doc__},
 
 static PyObject *
 os_getsid_impl(PyModuleDef *module, pid_t pid);
 
 static PyObject *
-os_getsid(PyModuleDef *module, PyObject *args)
+os_getsid(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     pid_t pid;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_PID ":getsid",
         &pid))
         goto exit;
@@ -3123,18 +3123,18 @@
 "Return the process group associated with the terminal specified by fd.");
 
 #define OS_TCGETPGRP_METHODDEF    \
-    {"tcgetpgrp", (PyCFunction)os_tcgetpgrp, METH_VARARGS, os_tcgetpgrp__doc__},
+    {"tcgetpgrp", (PyCFunction)os_tcgetpgrp, METH_O, os_tcgetpgrp__doc__},
 
 static PyObject *
 os_tcgetpgrp_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_tcgetpgrp(PyModuleDef *module, PyObject *args)
+os_tcgetpgrp(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:tcgetpgrp",
         &fd))
         goto exit;
@@ -3288,19 +3288,19 @@
 "Return a duplicate of a file descriptor.");
 
 #define OS_DUP_METHODDEF    \
-    {"dup", (PyCFunction)os_dup, METH_VARARGS, os_dup__doc__},
+    {"dup", (PyCFunction)os_dup, METH_O, os_dup__doc__},
 
 static int
 os_dup_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_dup(PyModuleDef *module, PyObject *args)
+os_dup(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
     int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:dup",
         &fd))
         goto exit;
@@ -3612,19 +3612,19 @@
 "connected to the slave end of a terminal.");
 
 #define OS_ISATTY_METHODDEF    \
-    {"isatty", (PyCFunction)os_isatty, METH_VARARGS, os_isatty__doc__},
+    {"isatty", (PyCFunction)os_isatty, METH_O, os_isatty__doc__},
 
 static int
 os_isatty_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_isatty(PyModuleDef *module, PyObject *args)
+os_isatty(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
     int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:isatty",
         &fd))
         goto exit;
@@ -3677,18 +3677,18 @@
 "O_NONBLOCK, O_CLOEXEC.");
 
 #define OS_PIPE2_METHODDEF    \
-    {"pipe2", (PyCFunction)os_pipe2, METH_VARARGS, os_pipe2__doc__},
+    {"pipe2", (PyCFunction)os_pipe2, METH_O, os_pipe2__doc__},
 
 static PyObject *
 os_pipe2_impl(PyModuleDef *module, int flags);
 
 static PyObject *
-os_pipe2(PyModuleDef *module, PyObject *args)
+os_pipe2(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int flags;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:pipe2",
         &flags))
         goto exit;
@@ -3889,19 +3889,19 @@
 "Extracts a device major number from a raw device number.");
 
 #define OS_MAJOR_METHODDEF    \
-    {"major", (PyCFunction)os_major, METH_VARARGS, os_major__doc__},
+    {"major", (PyCFunction)os_major, METH_O, os_major__doc__},
 
 static unsigned int
 os_major_impl(PyModuleDef *module, dev_t device);
 
 static PyObject *
-os_major(PyModuleDef *module, PyObject *args)
+os_major(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     dev_t device;
     unsigned int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:major",
         _Py_Dev_Converter, &device))
         goto exit;
@@ -3925,19 +3925,19 @@
 "Extracts a device minor number from a raw device number.");
 
 #define OS_MINOR_METHODDEF    \
-    {"minor", (PyCFunction)os_minor, METH_VARARGS, os_minor__doc__},
+    {"minor", (PyCFunction)os_minor, METH_O, os_minor__doc__},
 
 static unsigned int
 os_minor_impl(PyModuleDef *module, dev_t device);
 
 static PyObject *
-os_minor(PyModuleDef *module, PyObject *args)
+os_minor(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     dev_t device;
     unsigned int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:minor",
         _Py_Dev_Converter, &device))
         goto exit;
@@ -4222,18 +4222,18 @@
 "Delete an environment variable.");
 
 #define OS_UNSETENV_METHODDEF    \
-    {"unsetenv", (PyCFunction)os_unsetenv, METH_VARARGS, os_unsetenv__doc__},
+    {"unsetenv", (PyCFunction)os_unsetenv, METH_O, os_unsetenv__doc__},
 
 static PyObject *
 os_unsetenv_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-os_unsetenv(PyModuleDef *module, PyObject *args)
+os_unsetenv(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name = NULL;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:unsetenv",
         PyUnicode_FSConverter, &name))
         goto exit;
@@ -4255,18 +4255,18 @@
 "Translate an error code to a message string.");
 
 #define OS_STRERROR_METHODDEF    \
-    {"strerror", (PyCFunction)os_strerror, METH_VARARGS, os_strerror__doc__},
+    {"strerror", (PyCFunction)os_strerror, METH_O, os_strerror__doc__},
 
 static PyObject *
 os_strerror_impl(PyModuleDef *module, int code);
 
 static PyObject *
-os_strerror(PyModuleDef *module, PyObject *args)
+os_strerror(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int code;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:strerror",
         &code))
         goto exit;
@@ -4285,19 +4285,19 @@
 "Return True if the process returning status was dumped to a core file.");
 
 #define OS_WCOREDUMP_METHODDEF    \
-    {"WCOREDUMP", (PyCFunction)os_WCOREDUMP, METH_VARARGS, os_WCOREDUMP__doc__},
+    {"WCOREDUMP", (PyCFunction)os_WCOREDUMP, METH_O, os_WCOREDUMP__doc__},
 
 static int
 os_WCOREDUMP_impl(PyModuleDef *module, int status);
 
 static PyObject *
-os_WCOREDUMP(PyModuleDef *module, PyObject *args)
+os_WCOREDUMP(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int status;
     int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:WCOREDUMP",
         &status))
         goto exit;
@@ -4585,18 +4585,18 @@
 "Equivalent to statvfs(fd).");
 
 #define OS_FSTATVFS_METHODDEF    \
-    {"fstatvfs", (PyCFunction)os_fstatvfs, METH_VARARGS, os_fstatvfs__doc__},
+    {"fstatvfs", (PyCFunction)os_fstatvfs, METH_O, os_fstatvfs__doc__},
 
 static PyObject *
 os_fstatvfs_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_fstatvfs(PyModuleDef *module, PyObject *args)
+os_fstatvfs(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:fstatvfs",
         &fd))
         goto exit;
@@ -4774,18 +4774,18 @@
 "Return a string-valued system configuration variable.");
 
 #define OS_CONFSTR_METHODDEF    \
-    {"confstr", (PyCFunction)os_confstr, METH_VARARGS, os_confstr__doc__},
+    {"confstr", (PyCFunction)os_confstr, METH_O, os_confstr__doc__},
 
 static PyObject *
 os_confstr_impl(PyModuleDef *module, int name);
 
 static PyObject *
-os_confstr(PyModuleDef *module, PyObject *args)
+os_confstr(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:confstr",
         conv_confstr_confname, &name))
         goto exit;
@@ -4806,19 +4806,19 @@
 "Return an integer-valued system configuration variable.");
 
 #define OS_SYSCONF_METHODDEF    \
-    {"sysconf", (PyCFunction)os_sysconf, METH_VARARGS, os_sysconf__doc__},
+    {"sysconf", (PyCFunction)os_sysconf, METH_O, os_sysconf__doc__},
 
 static long
 os_sysconf_impl(PyModuleDef *module, int name);
 
 static PyObject *
-os_sysconf(PyModuleDef *module, PyObject *args)
+os_sysconf(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int name;
     long _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:sysconf",
         conv_sysconf_confname, &name))
         goto exit;
@@ -5215,18 +5215,18 @@
 "Return a bytes object containing random bytes suitable for cryptographic use.");
 
 #define OS_URANDOM_METHODDEF    \
-    {"urandom", (PyCFunction)os_urandom, METH_VARARGS, os_urandom__doc__},
+    {"urandom", (PyCFunction)os_urandom, METH_O, os_urandom__doc__},
 
 static PyObject *
 os_urandom_impl(PyModuleDef *module, Py_ssize_t size);
 
 static PyObject *
-os_urandom(PyModuleDef *module, PyObject *args)
+os_urandom(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_ssize_t size;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "n:urandom",
         &size))
         goto exit;
@@ -5261,19 +5261,19 @@
 "Get the close-on-exe flag of the specified file descriptor.");
 
 #define OS_GET_INHERITABLE_METHODDEF    \
-    {"get_inheritable", (PyCFunction)os_get_inheritable, METH_VARARGS, os_get_inheritable__doc__},
+    {"get_inheritable", (PyCFunction)os_get_inheritable, METH_O, os_get_inheritable__doc__},
 
 static int
 os_get_inheritable_impl(PyModuleDef *module, int fd);
 
 static PyObject *
-os_get_inheritable(PyModuleDef *module, PyObject *args)
+os_get_inheritable(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int fd;
     int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:get_inheritable",
         &fd))
         goto exit;
@@ -5324,19 +5324,19 @@
 "Get the close-on-exe flag of the specified file descriptor.");
 
 #define OS_GET_HANDLE_INHERITABLE_METHODDEF    \
-    {"get_handle_inheritable", (PyCFunction)os_get_handle_inheritable, METH_VARARGS, os_get_handle_inheritable__doc__},
+    {"get_handle_inheritable", (PyCFunction)os_get_handle_inheritable, METH_O, os_get_handle_inheritable__doc__},
 
 static int
 os_get_handle_inheritable_impl(PyModuleDef *module, Py_intptr_t handle);
 
 static PyObject *
-os_get_handle_inheritable(PyModuleDef *module, PyObject *args)
+os_get_handle_inheritable(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_intptr_t handle;
     int _return_value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "" _Py_PARSE_INTPTR ":get_handle_inheritable",
         &handle))
         goto exit;
@@ -5847,4 +5847,4 @@
 #ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
     #define OS_SET_HANDLE_INHERITABLE_METHODDEF
 #endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
-/*[clinic end generated code: output=d17c625afa72886b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b15ceac3a8ff0eae input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h
--- a/Modules/clinic/pwdmodule.c.h
+++ b/Modules/clinic/pwdmodule.c.h
@@ -22,18 +22,18 @@
 "See `help(pwd)` for more on password database entries.");
 
 #define PWD_GETPWNAM_METHODDEF    \
-    {"getpwnam", (PyCFunction)pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__},
+    {"getpwnam", (PyCFunction)pwd_getpwnam, METH_O, pwd_getpwnam__doc__},
 
 static PyObject *
 pwd_getpwnam_impl(PyModuleDef *module, PyObject *arg);
 
 static PyObject *
-pwd_getpwnam(PyModuleDef *module, PyObject *args)
+pwd_getpwnam(PyModuleDef *module, PyObject *arg_)
 {
     PyObject *return_value = NULL;
     PyObject *arg;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg_,
         "U:getpwnam",
         &arg))
         goto exit;
@@ -70,4 +70,4 @@
 #ifndef PWD_GETPWALL_METHODDEF
     #define PWD_GETPWALL_METHODDEF
 #endif /* !defined(PWD_GETPWALL_METHODDEF) */
-/*[clinic end generated code: output=2e23f920020a750a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e7d5ac24b20e91ae input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -49,18 +49,18 @@
 "Set the base URL for the parser.");
 
 #define PYEXPAT_XMLPARSER_SETBASE_METHODDEF    \
-    {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_VARARGS, pyexpat_xmlparser_SetBase__doc__},
+    {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_O, pyexpat_xmlparser_SetBase__doc__},
 
 static PyObject *
 pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
 
 static PyObject *
-pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *args)
+pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     const char *base;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "s:SetBase",
         &base))
         goto exit;
@@ -150,18 +150,18 @@
 "was successful.");
 
 #define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF    \
-    {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_VARARGS, pyexpat_xmlparser_SetParamEntityParsing__doc__},
+    {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_O, pyexpat_xmlparser_SetParamEntityParsing__doc__},
 
 static PyObject *
 pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
 
 static PyObject *
-pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *args)
+pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int flag;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:SetParamEntityParsing",
         &flag))
         goto exit;
@@ -262,18 +262,18 @@
 "Returns string error for given number.");
 
 #define PYEXPAT_ERRORSTRING_METHODDEF    \
-    {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_VARARGS, pyexpat_ErrorString__doc__},
+    {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_O, pyexpat_ErrorString__doc__},
 
 static PyObject *
 pyexpat_ErrorString_impl(PyModuleDef *module, long code);
 
 static PyObject *
-pyexpat_ErrorString(PyModuleDef *module, PyObject *args)
+pyexpat_ErrorString(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     long code;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "l:ErrorString",
         &code))
         goto exit;
@@ -286,4 +286,4 @@
 #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
     #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
 #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=0198390005e40e1c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9715b916f2d618fa input=a9049054013a1b77]*/
diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h
--- a/Modules/clinic/spwdmodule.c.h
+++ b/Modules/clinic/spwdmodule.c.h
@@ -13,18 +13,18 @@
 "See `help(spwd)` for more on shadow password database entries.");
 
 #define SPWD_GETSPNAM_METHODDEF    \
-    {"getspnam", (PyCFunction)spwd_getspnam, METH_VARARGS, spwd_getspnam__doc__},
+    {"getspnam", (PyCFunction)spwd_getspnam, METH_O, spwd_getspnam__doc__},
 
 static PyObject *
 spwd_getspnam_impl(PyModuleDef *module, PyObject *arg);
 
 static PyObject *
-spwd_getspnam(PyModuleDef *module, PyObject *args)
+spwd_getspnam(PyModuleDef *module, PyObject *arg_)
 {
     PyObject *return_value = NULL;
     PyObject *arg;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg_,
         "U:getspnam",
         &arg))
         goto exit;
@@ -67,4 +67,4 @@
 #ifndef SPWD_GETSPALL_METHODDEF
     #define SPWD_GETSPALL_METHODDEF
 #endif /* !defined(SPWD_GETSPALL_METHODDEF) */
-/*[clinic end generated code: output=ab16125c5e5f2b1b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=67a4f8c47008f28f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -189,18 +189,18 @@
 "Call the flush() method to clear these buffers.");
 
 #define ZLIB_COMPRESS_COMPRESS_METHODDEF    \
-    {"compress", (PyCFunction)zlib_Compress_compress, METH_VARARGS, zlib_Compress_compress__doc__},
+    {"compress", (PyCFunction)zlib_Compress_compress, METH_O, zlib_Compress_compress__doc__},
 
 static PyObject *
 zlib_Compress_compress_impl(compobject *self, Py_buffer *data);
 
 static PyObject *
-zlib_Compress_compress(compobject *self, PyObject *args)
+zlib_Compress_compress(compobject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:compress",
         &data))
         goto exit;
@@ -446,4 +446,4 @@
 #ifndef ZLIB_COMPRESS_COPY_METHODDEF
     #define ZLIB_COMPRESS_COPY_METHODDEF
 #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
-/*[clinic end generated code: output=901c18189767dc08 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0743b1aa908f0b68 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -339,18 +339,18 @@
 "    The item to be appended.");
 
 #define BYTEARRAY_APPEND_METHODDEF    \
-    {"append", (PyCFunction)bytearray_append, METH_VARARGS, bytearray_append__doc__},
+    {"append", (PyCFunction)bytearray_append, METH_O, bytearray_append__doc__},
 
 static PyObject *
 bytearray_append_impl(PyByteArrayObject *self, int item);
 
 static PyObject *
-bytearray_append(PyByteArrayObject *self, PyObject *args)
+bytearray_append(PyByteArrayObject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int item;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:append",
         _getbytevalue, &item))
         goto exit;
@@ -416,18 +416,18 @@
 "    The value to remove.");
 
 #define BYTEARRAY_REMOVE_METHODDEF    \
-    {"remove", (PyCFunction)bytearray_remove, METH_VARARGS, bytearray_remove__doc__},
+    {"remove", (PyCFunction)bytearray_remove, METH_O, bytearray_remove__doc__},
 
 static PyObject *
 bytearray_remove_impl(PyByteArrayObject *self, int value);
 
 static PyObject *
-bytearray_remove(PyByteArrayObject *self, PyObject *args)
+bytearray_remove(PyByteArrayObject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int value;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "O&:remove",
         _getbytevalue, &value))
         goto exit;
@@ -621,18 +621,18 @@
 "Example: bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')");
 
 #define BYTEARRAY_FROMHEX_METHODDEF    \
-    {"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS, bytearray_fromhex__doc__},
+    {"fromhex", (PyCFunction)bytearray_fromhex, METH_O|METH_CLASS, bytearray_fromhex__doc__},
 
 static PyObject *
 bytearray_fromhex_impl(PyObject*cls, PyObject *string);
 
 static PyObject *
-bytearray_fromhex(PyTypeObject *cls, PyObject *args)
+bytearray_fromhex(PyTypeObject *cls, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *string;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:fromhex",
         &string))
         goto exit;
@@ -705,4 +705,4 @@
 {
     return bytearray_sizeof_impl(self);
 }
-/*[clinic end generated code: output=70ea384faeca8d16 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d763876718a66fc3 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -54,18 +54,18 @@
 "object and two empty bytes objects.");
 
 #define BYTES_PARTITION_METHODDEF    \
-    {"partition", (PyCFunction)bytes_partition, METH_VARARGS, bytes_partition__doc__},
+    {"partition", (PyCFunction)bytes_partition, METH_O, bytes_partition__doc__},
 
 static PyObject *
 bytes_partition_impl(PyBytesObject *self, Py_buffer *sep);
 
 static PyObject *
-bytes_partition(PyBytesObject *self, PyObject *args)
+bytes_partition(PyBytesObject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer sep = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:partition",
         &sep))
         goto exit;
@@ -93,18 +93,18 @@
 "objects and the original bytes object.");
 
 #define BYTES_RPARTITION_METHODDEF    \
-    {"rpartition", (PyCFunction)bytes_rpartition, METH_VARARGS, bytes_rpartition__doc__},
+    {"rpartition", (PyCFunction)bytes_rpartition, METH_O, bytes_rpartition__doc__},
 
 static PyObject *
 bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep);
 
 static PyObject *
-bytes_rpartition(PyBytesObject *self, PyObject *args)
+bytes_rpartition(PyBytesObject *self, PyObject *arg)
 {
     PyObject *return_value = NULL;
     Py_buffer sep = {NULL, NULL};
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "y*:rpartition",
         &sep))
         goto exit;
@@ -473,18 +473,18 @@
 "Example: bytes.fromhex(\'B9 01EF\') -> b\'\\\\xb9\\\\x01\\\\xef\'.");
 
 #define BYTES_FROMHEX_METHODDEF    \
-    {"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS, bytes_fromhex__doc__},
+    {"fromhex", (PyCFunction)bytes_fromhex, METH_O|METH_CLASS, bytes_fromhex__doc__},
 
 static PyObject *
 bytes_fromhex_impl(PyTypeObject *type, PyObject *string);
 
 static PyObject *
-bytes_fromhex(PyTypeObject *type, PyObject *args)
+bytes_fromhex(PyTypeObject *type, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *string;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:fromhex",
         &string))
         goto exit;
@@ -493,4 +493,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=dfe5c9a317b99f49 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b9e69e1f7c8ccd14 input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -109,18 +109,18 @@
 "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
 
 #define BUILTIN_CHR_METHODDEF    \
-    {"chr", (PyCFunction)builtin_chr, METH_VARARGS, builtin_chr__doc__},
+    {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__},
 
 static PyObject *
 builtin_chr_impl(PyModuleDef *module, int i);
 
 static PyObject *
-builtin_chr(PyModuleDef *module, PyObject *args)
+builtin_chr(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     int i;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "i:chr",
         &i))
         goto exit;
@@ -656,4 +656,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=2da46de189e48d26 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=12db4cde92eb11b3 input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -122,18 +122,18 @@
 "Initializes a built-in module.");
 
 #define _IMP_INIT_BUILTIN_METHODDEF    \
-    {"init_builtin", (PyCFunction)_imp_init_builtin, METH_VARARGS, _imp_init_builtin__doc__},
+    {"init_builtin", (PyCFunction)_imp_init_builtin, METH_O, _imp_init_builtin__doc__},
 
 static PyObject *
 _imp_init_builtin_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_init_builtin(PyModuleDef *module, PyObject *args)
+_imp_init_builtin(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:init_builtin",
         &name))
         goto exit;
@@ -150,18 +150,18 @@
 "Initializes a frozen module.");
 
 #define _IMP_INIT_FROZEN_METHODDEF    \
-    {"init_frozen", (PyCFunction)_imp_init_frozen, METH_VARARGS, _imp_init_frozen__doc__},
+    {"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__},
 
 static PyObject *
 _imp_init_frozen_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_init_frozen(PyModuleDef *module, PyObject *args)
+_imp_init_frozen(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:init_frozen",
         &name))
         goto exit;
@@ -178,18 +178,18 @@
 "Create a code object for a frozen module.");
 
 #define _IMP_GET_FROZEN_OBJECT_METHODDEF    \
-    {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_VARARGS, _imp_get_frozen_object__doc__},
+    {"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__},
 
 static PyObject *
 _imp_get_frozen_object_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_get_frozen_object(PyModuleDef *module, PyObject *args)
+_imp_get_frozen_object(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:get_frozen_object",
         &name))
         goto exit;
@@ -206,18 +206,18 @@
 "Returns True if the module name is of a frozen package.");
 
 #define _IMP_IS_FROZEN_PACKAGE_METHODDEF    \
-    {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_VARARGS, _imp_is_frozen_package__doc__},
+    {"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__},
 
 static PyObject *
 _imp_is_frozen_package_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_is_frozen_package(PyModuleDef *module, PyObject *args)
+_imp_is_frozen_package(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:is_frozen_package",
         &name))
         goto exit;
@@ -234,18 +234,18 @@
 "Returns True if the module name corresponds to a built-in module.");
 
 #define _IMP_IS_BUILTIN_METHODDEF    \
-    {"is_builtin", (PyCFunction)_imp_is_builtin, METH_VARARGS, _imp_is_builtin__doc__},
+    {"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__},
 
 static PyObject *
 _imp_is_builtin_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_is_builtin(PyModuleDef *module, PyObject *args)
+_imp_is_builtin(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:is_builtin",
         &name))
         goto exit;
@@ -262,18 +262,18 @@
 "Returns True if the module name corresponds to a frozen module.");
 
 #define _IMP_IS_FROZEN_METHODDEF    \
-    {"is_frozen", (PyCFunction)_imp_is_frozen, METH_VARARGS, _imp_is_frozen__doc__},
+    {"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__},
 
 static PyObject *
 _imp_is_frozen_impl(PyModuleDef *module, PyObject *name);
 
 static PyObject *
-_imp_is_frozen(PyModuleDef *module, PyObject *args)
+_imp_is_frozen(PyModuleDef *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
     PyObject *name;
 
-    if (!PyArg_ParseTuple(args,
+    if (!PyArg_Parse(arg,
         "U:is_frozen",
         &name))
         goto exit;
@@ -320,4 +320,4 @@
 #ifndef _IMP_LOAD_DYNAMIC_METHODDEF
     #define _IMP_LOAD_DYNAMIC_METHODDEF
 #endif /* !defined(_IMP_LOAD_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=087a1f22e9febcc7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d41c392510815c5b input=a9049054013a1b77]*/
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -593,8 +593,6 @@
         meth_o = (len(parameters) == 1 and
               parameters[0].kind == inspect.Parameter.POSITIONAL_ONLY and
               not converters[0].is_optional() and
-              isinstance(converters[0], object_converter) and
-              converters[0].format_unit == 'O' and
               not new_or_init)
 
         # we have to set these things before we're done:
@@ -700,22 +698,40 @@
         elif meth_o:
             flags = "METH_O"
 
-            meth_o_prototype = normalize_snippet("""
-                static PyObject *
-                {c_basename}({impl_parameters})
-                """)
-
-            if default_return_converter:
-                # maps perfectly to METH_O, doesn't need a return converter.
-                # so we skip making a parse function
-                # and call directly into the impl function.
-                impl_prototype = parser_prototype = parser_definition = ''
-                impl_definition = meth_o_prototype
+            if (isinstance(converters[0], object_converter) and
+                converters[0].format_unit == 'O'):
+                meth_o_prototype = normalize_snippet("""
+                    static PyObject *
+                    {c_basename}({impl_parameters})
+                    """)
+
+                if default_return_converter:
+                    # maps perfectly to METH_O, doesn't need a return converter.
+                    # so we skip making a parse function
+                    # and call directly into the impl function.
+                    impl_prototype = parser_prototype = parser_definition = ''
+                    impl_definition = meth_o_prototype
+                else:
+                    # SLIGHT HACK
+                    # use impl_parameters for the parser here!
+                    parser_prototype = meth_o_prototype
+                    parser_definition = parser_body(parser_prototype)
+
             else:
-                # SLIGHT HACK
-                # use impl_parameters for the parser here!
-                parser_prototype = meth_o_prototype
-                parser_definition = parser_body(parser_prototype)
+                argname = 'arg'
+                if parameters[0].name == argname:
+                    argname += '_'
+                parser_prototype = normalize_snippet("""
+                    static PyObject *
+                    {c_basename}({self_type}{self_name}, PyObject *%s)
+                    """ % argname)
+
+                parser_definition = parser_body(parser_prototype, normalize_snippet("""
+                    if (!PyArg_Parse(%s,
+                        "{format_units}:{name}",
+                        {parse_arguments}))
+                        goto exit;
+                    """ % argname, indent=4))
 
         elif has_option_groups:
             # positional parameters with option groups
@@ -1025,7 +1041,7 @@
         # METH_O, we have exactly one anyway, so we know exactly
         # where it is.
         if ("METH_O" in templates['methoddef_define'] and
-            not default_return_converter):
+            '{impl_parameters}' in templates['parser_prototype']):
             data.declarations.pop(0)
 
         template_dict = {}

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list