summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_bz2module.c.h48
-rw-r--r--Modules/clinic/_codecsmodule.c.h1396
-rw-r--r--Modules/clinic/_cryptmodule.c.h37
-rw-r--r--Modules/clinic/_cursesmodule.c.h71
-rw-r--r--Modules/clinic/_datetimemodule.c.h37
-rw-r--r--Modules/clinic/_dbmmodule.c.h141
-rw-r--r--Modules/clinic/_elementtree.c.h679
-rw-r--r--Modules/clinic/_gdbmmodule.c.h253
-rw-r--r--Modules/clinic/_lzmamodule.c.h73
-rw-r--r--Modules/clinic/_opcode.c.h36
-rw-r--r--Modules/clinic/_pickle.c.h43
-rw-r--r--Modules/clinic/_sre.c.h693
-rw-r--r--Modules/clinic/_ssl.c.h1105
-rw-r--r--Modules/clinic/_tkinter.c.h624
-rw-r--r--Modules/clinic/_weakref.c.h31
-rw-r--r--Modules/clinic/_winapi.c.h854
-rw-r--r--Modules/clinic/arraymodule.c.h499
-rw-r--r--Modules/clinic/audioop.c.h120
-rw-r--r--Modules/clinic/binascii.c.h117
-rw-r--r--Modules/clinic/cmathmodule.c.h860
-rw-r--r--Modules/clinic/fcntlmodule.c.h185
-rw-r--r--Modules/clinic/grpmodule.c.h85
-rw-r--r--Modules/clinic/md5module.c.h95
-rw-r--r--Modules/clinic/posixmodule.c.h5791
-rw-r--r--Modules/clinic/pwdmodule.c.h71
-rw-r--r--Modules/clinic/pyexpat.c.h284
-rw-r--r--Modules/clinic/sha1module.c.h95
-rw-r--r--Modules/clinic/sha256module.c.h123
-rw-r--r--Modules/clinic/sha512module.c.h171
-rw-r--r--Modules/clinic/signalmodule.c.h432
-rw-r--r--Modules/clinic/spwdmodule.c.h68
-rw-r--r--Modules/clinic/unicodedata.c.h368
-rw-r--r--Modules/clinic/zlibmodule.c.h58
33 files changed, 15294 insertions, 249 deletions
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index 8a201a0..3ed8303e 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -14,20 +14,18 @@ PyDoc_STRVAR(_bz2_BZ2Compressor_compress__doc__,
"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,
- "y*:compress",
- &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data))
goto exit;
return_value = _bz2_BZ2Compressor_compress_impl(self, &data);
@@ -84,8 +82,7 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if ((Py_TYPE(self) == &BZ2Compressor_Type) &&
!_PyArg_NoKeywords("BZ2Compressor", kwargs))
goto exit;
- if (!PyArg_ParseTuple(args,
- "|i:BZ2Compressor",
+ if (!PyArg_ParseTuple(args, "|i:BZ2Compressor",
&compresslevel))
goto exit;
return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel);
@@ -95,34 +92,43 @@ exit:
}
PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
-"decompress($self, data, /)\n"
+"decompress($self, /, data, max_length=-1)\n"
"--\n"
"\n"
-"Provide data to the decompressor object.\n"
+"Decompress *data*, returning uncompressed data as bytes.\n"
"\n"
-"Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n"
+"If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
+"decompressed data. If this limit is reached and further output can be\n"
+"produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
+"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
"\n"
-"Attempting to decompress data after the end of stream is reached\n"
-"raises an EOFError. Any data found after the end of the stream\n"
-"is ignored and saved in the unused_data attribute.");
+"If all of the input data was decompressed and returned (either because this\n"
+"was less than *max_length* bytes, or because *max_length* was negative),\n"
+"*self.needs_input* will be set to True.\n"
+"\n"
+"Attempting to decompress data after the end of stream is reached raises an\n"
+"EOFError. Any data found after the end of the stream is ignored and saved in\n"
+"the unused_data attribute.");
#define _BZ2_BZ2DECOMPRESSOR_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_VARARGS, _bz2_BZ2Decompressor_decompress__doc__},
+ {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_VARARGS|METH_KEYWORDS, _bz2_BZ2Decompressor_decompress__doc__},
static PyObject *
-_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data);
+_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
+ Py_ssize_t max_length);
static PyObject *
-_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args)
+_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
+ static char *_keywords[] = {"data", "max_length", NULL};
Py_buffer data = {NULL, NULL};
+ Py_ssize_t max_length = -1;
- if (!PyArg_ParseTuple(args,
- "y*:decompress",
- &data))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords,
+ &data, &max_length))
goto exit;
- return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data);
+ return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length);
exit:
/* Cleanup for data */
@@ -159,4 +165,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=21ca4405519a0931 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fef29b76b3314fc7 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
new file mode 100644
index 0000000..e94be11
--- /dev/null
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -0,0 +1,1396 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_codecs_register__doc__,
+"register($module, search_function, /)\n"
+"--\n"
+"\n"
+"Register a codec search function.\n"
+"\n"
+"Search functions are expected to take one argument, the encoding name in\n"
+"all lower case letters, and either return None, or a tuple of functions\n"
+"(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).");
+
+#define _CODECS_REGISTER_METHODDEF \
+ {"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
+
+PyDoc_STRVAR(_codecs_lookup__doc__,
+"lookup($module, encoding, /)\n"
+"--\n"
+"\n"
+"Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.");
+
+#define _CODECS_LOOKUP_METHODDEF \
+ {"lookup", (PyCFunction)_codecs_lookup, METH_O, _codecs_lookup__doc__},
+
+static PyObject *
+_codecs_lookup_impl(PyModuleDef *module, const char *encoding);
+
+static PyObject *
+_codecs_lookup(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *encoding;
+
+ if (!PyArg_Parse(arg, "s:lookup", &encoding))
+ goto exit;
+ return_value = _codecs_lookup_impl(module, encoding);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_encode__doc__,
+"encode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
+"--\n"
+"\n"
+"Encodes obj using the codec registered for encoding.\n"
+"\n"
+"The default encoding is \'utf-8\'. errors may be given to set a\n"
+"different error handling scheme. Default is \'strict\' meaning that encoding\n"
+"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
+"and \'backslashreplace\' as well as any other name registered with\n"
+"codecs.register_error that can handle ValueErrors.");
+
+#define _CODECS_ENCODE_METHODDEF \
+ {"encode", (PyCFunction)_codecs_encode, METH_VARARGS|METH_KEYWORDS, _codecs_encode__doc__},
+
+static PyObject *
+_codecs_encode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
+ const char *errors);
+
+static PyObject *
+_codecs_encode(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"obj", "encoding", "errors", NULL};
+ PyObject *obj;
+ const char *encoding = NULL;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:encode", _keywords,
+ &obj, &encoding, &errors))
+ goto exit;
+ return_value = _codecs_encode_impl(module, obj, encoding, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_decode__doc__,
+"decode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
+"--\n"
+"\n"
+"Decodes obj using the codec registered for encoding.\n"
+"\n"
+"Default encoding is \'utf-8\'. errors may be given to set a\n"
+"different error handling scheme. Default is \'strict\' meaning that encoding\n"
+"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
+"and \'backslashreplace\' as well as any other name registered with\n"
+"codecs.register_error that can handle ValueErrors.");
+
+#define _CODECS_DECODE_METHODDEF \
+ {"decode", (PyCFunction)_codecs_decode, METH_VARARGS|METH_KEYWORDS, _codecs_decode__doc__},
+
+static PyObject *
+_codecs_decode_impl(PyModuleDef *module, PyObject *obj, const char *encoding,
+ const char *errors);
+
+static PyObject *
+_codecs_decode(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"obj", "encoding", "errors", NULL};
+ PyObject *obj;
+ const char *encoding = NULL;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:decode", _keywords,
+ &obj, &encoding, &errors))
+ goto exit;
+ return_value = _codecs_decode_impl(module, obj, encoding, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs__forget_codec__doc__,
+"_forget_codec($module, encoding, /)\n"
+"--\n"
+"\n"
+"Purge the named codec from the internal codec lookup cache");
+
+#define _CODECS__FORGET_CODEC_METHODDEF \
+ {"_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 *arg)
+{
+ PyObject *return_value = NULL;
+ const char *encoding;
+
+ if (!PyArg_Parse(arg, "s:_forget_codec", &encoding))
+ goto exit;
+ return_value = _codecs__forget_codec_impl(module, encoding);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_escape_decode__doc__,
+"escape_decode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_ESCAPE_DECODE_METHODDEF \
+ {"escape_decode", (PyCFunction)_codecs_escape_decode, METH_VARARGS, _codecs_escape_decode__doc__},
+
+static PyObject *
+_codecs_escape_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_escape_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "s*|z:escape_decode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_escape_decode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_escape_encode__doc__,
+"escape_encode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_ESCAPE_ENCODE_METHODDEF \
+ {"escape_encode", (PyCFunction)_codecs_escape_encode, METH_VARARGS, _codecs_escape_encode__doc__},
+
+static PyObject *
+_codecs_escape_encode_impl(PyModuleDef *module, PyObject *data,
+ const char *errors);
+
+static PyObject *
+_codecs_escape_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *data;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O!|z:escape_encode",
+ &PyBytes_Type, &data, &errors))
+ goto exit;
+ return_value = _codecs_escape_encode_impl(module, data, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_unicode_internal_decode__doc__,
+"unicode_internal_decode($module, obj, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF \
+ {"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_VARARGS, _codecs_unicode_internal_decode__doc__},
+
+static PyObject *
+_codecs_unicode_internal_decode_impl(PyModuleDef *module, PyObject *obj,
+ const char *errors);
+
+static PyObject *
+_codecs_unicode_internal_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *obj;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode",
+ &obj, &errors))
+ goto exit;
+ return_value = _codecs_unicode_internal_decode_impl(module, obj, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_7_decode__doc__,
+"utf_7_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_7_DECODE_METHODDEF \
+ {"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_VARARGS, _codecs_utf_7_decode__doc__},
+
+static PyObject *
+_codecs_utf_7_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_7_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_7_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_8_decode__doc__,
+"utf_8_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_8_DECODE_METHODDEF \
+ {"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_VARARGS, _codecs_utf_8_decode__doc__},
+
+static PyObject *
+_codecs_utf_8_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_8_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_8_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_decode__doc__,
+"utf_16_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_DECODE_METHODDEF \
+ {"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_VARARGS, _codecs_utf_16_decode__doc__},
+
+static PyObject *
+_codecs_utf_16_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_16_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_16_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__,
+"utf_16_le_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_LE_DECODE_METHODDEF \
+ {"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_VARARGS, _codecs_utf_16_le_decode__doc__},
+
+static PyObject *
+_codecs_utf_16_le_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_16_le_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__,
+"utf_16_be_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_BE_DECODE_METHODDEF \
+ {"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_VARARGS, _codecs_utf_16_be_decode__doc__},
+
+static PyObject *
+_codecs_utf_16_be_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_16_be_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__,
+"utf_16_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
+" /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_EX_DECODE_METHODDEF \
+ {"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_VARARGS, _codecs_utf_16_ex_decode__doc__},
+
+static PyObject *
+_codecs_utf_16_ex_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int byteorder, int final);
+
+static PyObject *
+_codecs_utf_16_ex_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int byteorder = 0;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode",
+ &data, &errors, &byteorder, &final))
+ goto exit;
+ return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_decode__doc__,
+"utf_32_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_DECODE_METHODDEF \
+ {"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_VARARGS, _codecs_utf_32_decode__doc__},
+
+static PyObject *
+_codecs_utf_32_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_32_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_32_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__,
+"utf_32_le_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_LE_DECODE_METHODDEF \
+ {"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_VARARGS, _codecs_utf_32_le_decode__doc__},
+
+static PyObject *
+_codecs_utf_32_le_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_32_le_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__,
+"utf_32_be_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_BE_DECODE_METHODDEF \
+ {"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_VARARGS, _codecs_utf_32_be_decode__doc__},
+
+static PyObject *
+_codecs_utf_32_be_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_utf_32_be_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__,
+"utf_32_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
+" /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_EX_DECODE_METHODDEF \
+ {"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_VARARGS, _codecs_utf_32_ex_decode__doc__},
+
+static PyObject *
+_codecs_utf_32_ex_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int byteorder, int final);
+
+static PyObject *
+_codecs_utf_32_ex_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int byteorder = 0;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode",
+ &data, &errors, &byteorder, &final))
+ goto exit;
+ return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__,
+"unicode_escape_decode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF \
+ {"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_VARARGS, _codecs_unicode_escape_decode__doc__},
+
+static PyObject *
+_codecs_unicode_escape_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_unicode_escape_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__,
+"raw_unicode_escape_decode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF \
+ {"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_VARARGS, _codecs_raw_unicode_escape_decode__doc__},
+
+static PyObject *
+_codecs_raw_unicode_escape_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_raw_unicode_escape_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_latin_1_decode__doc__,
+"latin_1_decode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_LATIN_1_DECODE_METHODDEF \
+ {"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_VARARGS, _codecs_latin_1_decode__doc__},
+
+static PyObject *
+_codecs_latin_1_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_latin_1_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_latin_1_decode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_ascii_decode__doc__,
+"ascii_decode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_ASCII_DECODE_METHODDEF \
+ {"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_VARARGS, _codecs_ascii_decode__doc__},
+
+static PyObject *
+_codecs_ascii_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_ascii_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "y*|z:ascii_decode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_ascii_decode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_charmap_decode__doc__,
+"charmap_decode($module, data, errors=None, mapping=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_CHARMAP_DECODE_METHODDEF \
+ {"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_VARARGS, _codecs_charmap_decode__doc__},
+
+static PyObject *
+_codecs_charmap_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, PyObject *mapping);
+
+static PyObject *
+_codecs_charmap_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ PyObject *mapping = NULL;
+
+ if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode",
+ &data, &errors, &mapping))
+ goto exit;
+ return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+#if defined(HAVE_MBCS)
+
+PyDoc_STRVAR(_codecs_mbcs_decode__doc__,
+"mbcs_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_MBCS_DECODE_METHODDEF \
+ {"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_VARARGS, _codecs_mbcs_decode__doc__},
+
+static PyObject *
+_codecs_mbcs_decode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_mbcs_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode",
+ &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_mbcs_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_MBCS) */
+
+#if defined(HAVE_MBCS)
+
+PyDoc_STRVAR(_codecs_code_page_decode__doc__,
+"code_page_decode($module, codepage, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_CODE_PAGE_DECODE_METHODDEF \
+ {"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_VARARGS, _codecs_code_page_decode__doc__},
+
+static PyObject *
+_codecs_code_page_decode_impl(PyModuleDef *module, int codepage,
+ Py_buffer *data, const char *errors, int final);
+
+static PyObject *
+_codecs_code_page_decode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int codepage;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+ int final = 0;
+
+ if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode",
+ &codepage, &data, &errors, &final))
+ goto exit;
+ return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_MBCS) */
+
+PyDoc_STRVAR(_codecs_readbuffer_encode__doc__,
+"readbuffer_encode($module, data, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_READBUFFER_ENCODE_METHODDEF \
+ {"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_VARARGS, _codecs_readbuffer_encode__doc__},
+
+static PyObject *
+_codecs_readbuffer_encode_impl(PyModuleDef *module, Py_buffer *data,
+ const char *errors);
+
+static PyObject *
+_codecs_readbuffer_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode",
+ &data, &errors))
+ goto exit;
+ return_value = _codecs_readbuffer_encode_impl(module, &data, errors);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_unicode_internal_encode__doc__,
+"unicode_internal_encode($module, obj, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF \
+ {"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_VARARGS, _codecs_unicode_internal_encode__doc__},
+
+static PyObject *
+_codecs_unicode_internal_encode_impl(PyModuleDef *module, PyObject *obj,
+ const char *errors);
+
+static PyObject *
+_codecs_unicode_internal_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *obj;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode",
+ &obj, &errors))
+ goto exit;
+ return_value = _codecs_unicode_internal_encode_impl(module, obj, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_7_encode__doc__,
+"utf_7_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_7_ENCODE_METHODDEF \
+ {"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_VARARGS, _codecs_utf_7_encode__doc__},
+
+static PyObject *
+_codecs_utf_7_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_7_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_7_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_7_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_8_encode__doc__,
+"utf_8_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_8_ENCODE_METHODDEF \
+ {"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_VARARGS, _codecs_utf_8_encode__doc__},
+
+static PyObject *
+_codecs_utf_8_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_8_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_8_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_8_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_encode__doc__,
+"utf_16_encode($module, str, errors=None, byteorder=0, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_ENCODE_METHODDEF \
+ {"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_VARARGS, _codecs_utf_16_encode__doc__},
+
+static PyObject *
+_codecs_utf_16_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors, int byteorder);
+
+static PyObject *
+_codecs_utf_16_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+ int byteorder = 0;
+
+ if (!PyArg_ParseTuple(args, "O|zi:utf_16_encode",
+ &str, &errors, &byteorder))
+ goto exit;
+ return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_le_encode__doc__,
+"utf_16_le_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_LE_ENCODE_METHODDEF \
+ {"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_VARARGS, _codecs_utf_16_le_encode__doc__},
+
+static PyObject *
+_codecs_utf_16_le_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_16_le_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_16_le_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_16_le_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_16_be_encode__doc__,
+"utf_16_be_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_16_BE_ENCODE_METHODDEF \
+ {"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_VARARGS, _codecs_utf_16_be_encode__doc__},
+
+static PyObject *
+_codecs_utf_16_be_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_16_be_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_16_be_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_16_be_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_encode__doc__,
+"utf_32_encode($module, str, errors=None, byteorder=0, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_ENCODE_METHODDEF \
+ {"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_VARARGS, _codecs_utf_32_encode__doc__},
+
+static PyObject *
+_codecs_utf_32_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors, int byteorder);
+
+static PyObject *
+_codecs_utf_32_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+ int byteorder = 0;
+
+ if (!PyArg_ParseTuple(args, "O|zi:utf_32_encode",
+ &str, &errors, &byteorder))
+ goto exit;
+ return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_le_encode__doc__,
+"utf_32_le_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_LE_ENCODE_METHODDEF \
+ {"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_VARARGS, _codecs_utf_32_le_encode__doc__},
+
+static PyObject *
+_codecs_utf_32_le_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_32_le_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_32_le_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_32_le_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_utf_32_be_encode__doc__,
+"utf_32_be_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UTF_32_BE_ENCODE_METHODDEF \
+ {"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_VARARGS, _codecs_utf_32_be_encode__doc__},
+
+static PyObject *
+_codecs_utf_32_be_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_utf_32_be_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:utf_32_be_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_utf_32_be_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_unicode_escape_encode__doc__,
+"unicode_escape_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF \
+ {"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_VARARGS, _codecs_unicode_escape_encode__doc__},
+
+static PyObject *
+_codecs_unicode_escape_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_unicode_escape_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:unicode_escape_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_unicode_escape_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_raw_unicode_escape_encode__doc__,
+"raw_unicode_escape_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF \
+ {"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_VARARGS, _codecs_raw_unicode_escape_encode__doc__},
+
+static PyObject *
+_codecs_raw_unicode_escape_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_raw_unicode_escape_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:raw_unicode_escape_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_latin_1_encode__doc__,
+"latin_1_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_LATIN_1_ENCODE_METHODDEF \
+ {"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_VARARGS, _codecs_latin_1_encode__doc__},
+
+static PyObject *
+_codecs_latin_1_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_latin_1_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:latin_1_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_latin_1_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_ascii_encode__doc__,
+"ascii_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_ASCII_ENCODE_METHODDEF \
+ {"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_VARARGS, _codecs_ascii_encode__doc__},
+
+static PyObject *
+_codecs_ascii_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_ascii_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:ascii_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_ascii_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_charmap_encode__doc__,
+"charmap_encode($module, str, errors=None, mapping=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_CHARMAP_ENCODE_METHODDEF \
+ {"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_VARARGS, _codecs_charmap_encode__doc__},
+
+static PyObject *
+_codecs_charmap_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors, PyObject *mapping);
+
+static PyObject *
+_codecs_charmap_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+ PyObject *mapping = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|zO:charmap_encode",
+ &str, &errors, &mapping))
+ goto exit;
+ return_value = _codecs_charmap_encode_impl(module, str, errors, mapping);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_charmap_build__doc__,
+"charmap_build($module, map, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_CHARMAP_BUILD_METHODDEF \
+ {"charmap_build", (PyCFunction)_codecs_charmap_build, METH_O, _codecs_charmap_build__doc__},
+
+static PyObject *
+_codecs_charmap_build_impl(PyModuleDef *module, PyObject *map);
+
+static PyObject *
+_codecs_charmap_build(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *map;
+
+ if (!PyArg_Parse(arg, "U:charmap_build", &map))
+ goto exit;
+ return_value = _codecs_charmap_build_impl(module, map);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_MBCS)
+
+PyDoc_STRVAR(_codecs_mbcs_encode__doc__,
+"mbcs_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_MBCS_ENCODE_METHODDEF \
+ {"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_VARARGS, _codecs_mbcs_encode__doc__},
+
+static PyObject *
+_codecs_mbcs_encode_impl(PyModuleDef *module, PyObject *str,
+ const char *errors);
+
+static PyObject *
+_codecs_mbcs_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "O|z:mbcs_encode",
+ &str, &errors))
+ goto exit;
+ return_value = _codecs_mbcs_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_MBCS) */
+
+#if defined(HAVE_MBCS)
+
+PyDoc_STRVAR(_codecs_code_page_encode__doc__,
+"code_page_encode($module, code_page, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_CODE_PAGE_ENCODE_METHODDEF \
+ {"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_VARARGS, _codecs_code_page_encode__doc__},
+
+static PyObject *
+_codecs_code_page_encode_impl(PyModuleDef *module, int code_page,
+ PyObject *str, const char *errors);
+
+static PyObject *
+_codecs_code_page_encode(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int code_page;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "iO|z:code_page_encode",
+ &code_page, &str, &errors))
+ goto exit;
+ return_value = _codecs_code_page_encode_impl(module, code_page, str, errors);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_MBCS) */
+
+PyDoc_STRVAR(_codecs_register_error__doc__,
+"register_error($module, errors, handler, /)\n"
+"--\n"
+"\n"
+"Register the specified error handler under the name errors.\n"
+"\n"
+"handler must be a callable object, that will be called with an exception\n"
+"instance containing information about the location of the encoding/decoding\n"
+"error and must return a (replacement, new position) tuple.");
+
+#define _CODECS_REGISTER_ERROR_METHODDEF \
+ {"register_error", (PyCFunction)_codecs_register_error, METH_VARARGS, _codecs_register_error__doc__},
+
+static PyObject *
+_codecs_register_error_impl(PyModuleDef *module, const char *errors,
+ PyObject *handler);
+
+static PyObject *
+_codecs_register_error(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *errors;
+ PyObject *handler;
+
+ if (!PyArg_ParseTuple(args, "sO:register_error",
+ &errors, &handler))
+ goto exit;
+ return_value = _codecs_register_error_impl(module, errors, handler);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_codecs_lookup_error__doc__,
+"lookup_error($module, name, /)\n"
+"--\n"
+"\n"
+"lookup_error(errors) -> handler\n"
+"\n"
+"Return the error handler for the specified error handling name or raise a\n"
+"LookupError, if no handler exists under this name.");
+
+#define _CODECS_LOOKUP_ERROR_METHODDEF \
+ {"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__},
+
+static PyObject *
+_codecs_lookup_error_impl(PyModuleDef *module, const char *name);
+
+static PyObject *
+_codecs_lookup_error(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *name;
+
+ if (!PyArg_Parse(arg, "s:lookup_error", &name))
+ goto exit;
+ return_value = _codecs_lookup_error_impl(module, name);
+
+exit:
+ return return_value;
+}
+
+#ifndef _CODECS_MBCS_DECODE_METHODDEF
+ #define _CODECS_MBCS_DECODE_METHODDEF
+#endif /* !defined(_CODECS_MBCS_DECODE_METHODDEF) */
+
+#ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF
+ #define _CODECS_CODE_PAGE_DECODE_METHODDEF
+#endif /* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */
+
+#ifndef _CODECS_MBCS_ENCODE_METHODDEF
+ #define _CODECS_MBCS_ENCODE_METHODDEF
+#endif /* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */
+
+#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
+ #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
+#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
+/*[clinic end generated code: output=9c9967048027c1c7 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h
new file mode 100644
index 0000000..b8ec31e
--- /dev/null
+++ b/Modules/clinic/_cryptmodule.c.h
@@ -0,0 +1,37 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(crypt_crypt__doc__,
+"crypt($module, word, salt, /)\n"
+"--\n"
+"\n"
+"Hash a *word* with the given *salt* and return the hashed password.\n"
+"\n"
+"*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n"
+"character string, possibly prefixed with $digit$ to indicate the method)\n"
+"will be used to perturb the encryption algorithm and produce distinct\n"
+"results for a given *word*.");
+
+#define CRYPT_CRYPT_METHODDEF \
+ {"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
+
+static PyObject *
+crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt);
+
+static PyObject *
+crypt_crypt(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *word;
+ const char *salt;
+
+ if (!PyArg_ParseTuple(args, "ss:crypt",
+ &word, &salt))
+ goto exit;
+ return_value = crypt_crypt_impl(module, word, salt);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=22c295c9bce018c4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
new file mode 100644
index 0000000..5e11742
--- /dev/null
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -0,0 +1,71 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(curses_window_addch__doc__,
+"addch([y, x,] ch, [attr])\n"
+"Paint character ch at (y, x) with attributes attr.\n"
+"\n"
+" y\n"
+" Y-coordinate.\n"
+" x\n"
+" X-coordinate.\n"
+" ch\n"
+" Character to add.\n"
+" attr\n"
+" Attributes for the character.\n"
+"\n"
+"Paint character ch at (y, x) with attributes attr,\n"
+"overwriting any character previously painted at that location.\n"
+"By default, the character position and attributes are the\n"
+"current settings for the window object.");
+
+#define CURSES_WINDOW_ADDCH_METHODDEF \
+ {"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
+
+static PyObject *
+curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y,
+ int x, PyObject *ch, int group_right_1, long attr);
+
+static PyObject *
+curses_window_addch(PyCursesWindowObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int group_left_1 = 0;
+ int y = 0;
+ int x = 0;
+ PyObject *ch;
+ int group_right_1 = 0;
+ long attr = 0;
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "O:addch", &ch))
+ goto exit;
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
+ goto exit;
+ group_right_1 = 1;
+ break;
+ case 3:
+ if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch))
+ goto exit;
+ group_left_1 = 1;
+ break;
+ case 4:
+ if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr))
+ goto exit;
+ group_right_1 = 1;
+ group_left_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
+ goto exit;
+ }
+ return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=982b1e709577f3ec input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h
new file mode 100644
index 0000000..688c903
--- /dev/null
+++ b/Modules/clinic/_datetimemodule.c.h
@@ -0,0 +1,37 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(datetime_datetime_now__doc__,
+"now($type, /, tz=None)\n"
+"--\n"
+"\n"
+"Returns new datetime object representing current time local to tz.\n"
+"\n"
+" tz\n"
+" Timezone object.\n"
+"\n"
+"If no tz is specified, uses local timezone.");
+
+#define DATETIME_DATETIME_NOW_METHODDEF \
+ {"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
+
+static PyObject *
+datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
+
+static PyObject *
+datetime_datetime_now(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"tz", NULL};
+ PyObject *tz = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:now", _keywords,
+ &tz))
+ goto exit;
+ return_value = datetime_datetime_now_impl(type, tz);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=7f45c670d6e4953a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
new file mode 100644
index 0000000..8474e02
--- /dev/null
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -0,0 +1,141 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_dbm_dbm_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n"
+"Close the database.");
+
+#define _DBM_DBM_CLOSE_METHODDEF \
+ {"close", (PyCFunction)_dbm_dbm_close, METH_NOARGS, _dbm_dbm_close__doc__},
+
+static PyObject *
+_dbm_dbm_close_impl(dbmobject *self);
+
+static PyObject *
+_dbm_dbm_close(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _dbm_dbm_close_impl(self);
+}
+
+PyDoc_STRVAR(_dbm_dbm_keys__doc__,
+"keys($self, /)\n"
+"--\n"
+"\n"
+"Return a list of all keys in the database.");
+
+#define _DBM_DBM_KEYS_METHODDEF \
+ {"keys", (PyCFunction)_dbm_dbm_keys, METH_NOARGS, _dbm_dbm_keys__doc__},
+
+static PyObject *
+_dbm_dbm_keys_impl(dbmobject *self);
+
+static PyObject *
+_dbm_dbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _dbm_dbm_keys_impl(self);
+}
+
+PyDoc_STRVAR(_dbm_dbm_get__doc__,
+"get($self, key, default=b\'\', /)\n"
+"--\n"
+"\n"
+"Return the value for key if present, otherwise default.");
+
+#define _DBM_DBM_GET_METHODDEF \
+ {"get", (PyCFunction)_dbm_dbm_get, METH_VARARGS, _dbm_dbm_get__doc__},
+
+static PyObject *
+_dbm_dbm_get_impl(dbmobject *self, const char *key,
+ Py_ssize_clean_t key_length, PyObject *default_value);
+
+static PyObject *
+_dbm_dbm_get(dbmobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *key;
+ Py_ssize_clean_t key_length;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "s#|O:get",
+ &key, &key_length, &default_value))
+ goto exit;
+ return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_dbm_dbm_setdefault__doc__,
+"setdefault($self, key, default=b\'\', /)\n"
+"--\n"
+"\n"
+"Return the value for key if present, otherwise default.\n"
+"\n"
+"If key is not in the database, it is inserted with default as the value.");
+
+#define _DBM_DBM_SETDEFAULT_METHODDEF \
+ {"setdefault", (PyCFunction)_dbm_dbm_setdefault, METH_VARARGS, _dbm_dbm_setdefault__doc__},
+
+static PyObject *
+_dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
+ Py_ssize_clean_t key_length,
+ PyObject *default_value);
+
+static PyObject *
+_dbm_dbm_setdefault(dbmobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *key;
+ Py_ssize_clean_t key_length;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "s#|O:setdefault",
+ &key, &key_length, &default_value))
+ goto exit;
+ return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(dbmopen__doc__,
+"open($module, filename, flags=\'r\', mode=0o666, /)\n"
+"--\n"
+"\n"
+"Return a database object.\n"
+"\n"
+" filename\n"
+" The filename to open.\n"
+" flags\n"
+" How to open the file. \"r\" for reading, \"w\" for writing, etc.\n"
+" mode\n"
+" If creating a new file, the mode bits for the new file\n"
+" (e.g. os.O_RDWR).");
+
+#define DBMOPEN_METHODDEF \
+ {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
+
+static PyObject *
+dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags,
+ int mode);
+
+static PyObject *
+dbmopen(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *filename;
+ const char *flags = "r";
+ int mode = 438;
+
+ if (!PyArg_ParseTuple(args, "s|si:open",
+ &filename, &flags, &mode))
+ goto exit;
+ return_value = dbmopen_impl(module, filename, flags, mode);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=1d92e81b28c558d0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
new file mode 100644
index 0000000..86b4c4c
--- /dev/null
+++ b/Modules/clinic/_elementtree.c.h
@@ -0,0 +1,679 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_elementtree_Element_append__doc__,
+"append($self, subelement, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_APPEND_METHODDEF \
+ {"append", (PyCFunction)_elementtree_Element_append, METH_O, _elementtree_Element_append__doc__},
+
+static PyObject *
+_elementtree_Element_append_impl(ElementObject *self, PyObject *subelement);
+
+static PyObject *
+_elementtree_Element_append(ElementObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *subelement;
+
+ if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement))
+ goto exit;
+ return_value = _elementtree_Element_append_impl(self, subelement);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_clear__doc__,
+"clear($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_CLEAR_METHODDEF \
+ {"clear", (PyCFunction)_elementtree_Element_clear, METH_NOARGS, _elementtree_Element_clear__doc__},
+
+static PyObject *
+_elementtree_Element_clear_impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element_clear(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element_clear_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element___copy____doc__,
+"__copy__($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT___COPY___METHODDEF \
+ {"__copy__", (PyCFunction)_elementtree_Element___copy__, METH_NOARGS, _elementtree_Element___copy____doc__},
+
+static PyObject *
+_elementtree_Element___copy___impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element___copy__(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element___copy___impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element___deepcopy____doc__,
+"__deepcopy__($self, memo, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT___DEEPCOPY___METHODDEF \
+ {"__deepcopy__", (PyCFunction)_elementtree_Element___deepcopy__, METH_O, _elementtree_Element___deepcopy____doc__},
+
+PyDoc_STRVAR(_elementtree_Element___sizeof____doc__,
+"__sizeof__($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT___SIZEOF___METHODDEF \
+ {"__sizeof__", (PyCFunction)_elementtree_Element___sizeof__, METH_NOARGS, _elementtree_Element___sizeof____doc__},
+
+static Py_ssize_t
+_elementtree_Element___sizeof___impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element___sizeof__(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t _return_value;
+
+ _return_value = _elementtree_Element___sizeof___impl(self);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element___getstate____doc__,
+"__getstate__($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT___GETSTATE___METHODDEF \
+ {"__getstate__", (PyCFunction)_elementtree_Element___getstate__, METH_NOARGS, _elementtree_Element___getstate____doc__},
+
+static PyObject *
+_elementtree_Element___getstate___impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element___getstate__(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element___getstate___impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element___setstate____doc__,
+"__setstate__($self, state, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT___SETSTATE___METHODDEF \
+ {"__setstate__", (PyCFunction)_elementtree_Element___setstate__, METH_O, _elementtree_Element___setstate____doc__},
+
+PyDoc_STRVAR(_elementtree_Element_extend__doc__,
+"extend($self, elements, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_EXTEND_METHODDEF \
+ {"extend", (PyCFunction)_elementtree_Element_extend, METH_O, _elementtree_Element_extend__doc__},
+
+PyDoc_STRVAR(_elementtree_Element_find__doc__,
+"find($self, /, path, namespaces=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_FIND_METHODDEF \
+ {"find", (PyCFunction)_elementtree_Element_find, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_find__doc__},
+
+static PyObject *
+_elementtree_Element_find_impl(ElementObject *self, PyObject *path,
+ PyObject *namespaces);
+
+static PyObject *
+_elementtree_Element_find(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "namespaces", NULL};
+ PyObject *path;
+ PyObject *namespaces = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:find", _keywords,
+ &path, &namespaces))
+ goto exit;
+ return_value = _elementtree_Element_find_impl(self, path, namespaces);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_findtext__doc__,
+"findtext($self, /, path, default=None, namespaces=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_FINDTEXT_METHODDEF \
+ {"findtext", (PyCFunction)_elementtree_Element_findtext, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_findtext__doc__},
+
+static PyObject *
+_elementtree_Element_findtext_impl(ElementObject *self, PyObject *path,
+ PyObject *default_value,
+ PyObject *namespaces);
+
+static PyObject *
+_elementtree_Element_findtext(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "default", "namespaces", NULL};
+ PyObject *path;
+ PyObject *default_value = Py_None;
+ PyObject *namespaces = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:findtext", _keywords,
+ &path, &default_value, &namespaces))
+ goto exit;
+ return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_findall__doc__,
+"findall($self, /, path, namespaces=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_FINDALL_METHODDEF \
+ {"findall", (PyCFunction)_elementtree_Element_findall, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_findall__doc__},
+
+static PyObject *
+_elementtree_Element_findall_impl(ElementObject *self, PyObject *path,
+ PyObject *namespaces);
+
+static PyObject *
+_elementtree_Element_findall(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "namespaces", NULL};
+ PyObject *path;
+ PyObject *namespaces = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:findall", _keywords,
+ &path, &namespaces))
+ goto exit;
+ return_value = _elementtree_Element_findall_impl(self, path, namespaces);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_iterfind__doc__,
+"iterfind($self, /, path, namespaces=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF \
+ {"iterfind", (PyCFunction)_elementtree_Element_iterfind, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_iterfind__doc__},
+
+static PyObject *
+_elementtree_Element_iterfind_impl(ElementObject *self, PyObject *path,
+ PyObject *namespaces);
+
+static PyObject *
+_elementtree_Element_iterfind(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "namespaces", NULL};
+ PyObject *path;
+ PyObject *namespaces = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:iterfind", _keywords,
+ &path, &namespaces))
+ goto exit;
+ return_value = _elementtree_Element_iterfind_impl(self, path, namespaces);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_get__doc__,
+"get($self, /, key, default=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_GET_METHODDEF \
+ {"get", (PyCFunction)_elementtree_Element_get, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_get__doc__},
+
+static PyObject *
+_elementtree_Element_get_impl(ElementObject *self, PyObject *key,
+ PyObject *default_value);
+
+static PyObject *
+_elementtree_Element_get(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"key", "default", NULL};
+ PyObject *key;
+ PyObject *default_value = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get", _keywords,
+ &key, &default_value))
+ goto exit;
+ return_value = _elementtree_Element_get_impl(self, key, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_getchildren__doc__,
+"getchildren($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF \
+ {"getchildren", (PyCFunction)_elementtree_Element_getchildren, METH_NOARGS, _elementtree_Element_getchildren__doc__},
+
+static PyObject *
+_elementtree_Element_getchildren_impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element_getchildren(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element_getchildren_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element_iter__doc__,
+"iter($self, /, tag=None)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_ITER_METHODDEF \
+ {"iter", (PyCFunction)_elementtree_Element_iter, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_iter__doc__},
+
+static PyObject *
+_elementtree_Element_iter_impl(ElementObject *self, PyObject *tag);
+
+static PyObject *
+_elementtree_Element_iter(ElementObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"tag", NULL};
+ PyObject *tag = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:iter", _keywords,
+ &tag))
+ goto exit;
+ return_value = _elementtree_Element_iter_impl(self, tag);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_itertext__doc__,
+"itertext($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_ITERTEXT_METHODDEF \
+ {"itertext", (PyCFunction)_elementtree_Element_itertext, METH_NOARGS, _elementtree_Element_itertext__doc__},
+
+static PyObject *
+_elementtree_Element_itertext_impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element_itertext(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element_itertext_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element_insert__doc__,
+"insert($self, index, subelement, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_INSERT_METHODDEF \
+ {"insert", (PyCFunction)_elementtree_Element_insert, METH_VARARGS, _elementtree_Element_insert__doc__},
+
+static PyObject *
+_elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index,
+ PyObject *subelement);
+
+static PyObject *
+_elementtree_Element_insert(ElementObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t index;
+ PyObject *subelement;
+
+ if (!PyArg_ParseTuple(args, "nO!:insert",
+ &index, &Element_Type, &subelement))
+ goto exit;
+ return_value = _elementtree_Element_insert_impl(self, index, subelement);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_items__doc__,
+"items($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_ITEMS_METHODDEF \
+ {"items", (PyCFunction)_elementtree_Element_items, METH_NOARGS, _elementtree_Element_items__doc__},
+
+static PyObject *
+_elementtree_Element_items_impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element_items(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element_items_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element_keys__doc__,
+"keys($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_KEYS_METHODDEF \
+ {"keys", (PyCFunction)_elementtree_Element_keys, METH_NOARGS, _elementtree_Element_keys__doc__},
+
+static PyObject *
+_elementtree_Element_keys_impl(ElementObject *self);
+
+static PyObject *
+_elementtree_Element_keys(ElementObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_Element_keys_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_Element_makeelement__doc__,
+"makeelement($self, tag, attrib, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF \
+ {"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_VARARGS, _elementtree_Element_makeelement__doc__},
+
+static PyObject *
+_elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag,
+ PyObject *attrib);
+
+static PyObject *
+_elementtree_Element_makeelement(ElementObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *tag;
+ PyObject *attrib;
+
+ if (!PyArg_UnpackTuple(args, "makeelement",
+ 2, 2,
+ &tag, &attrib))
+ goto exit;
+ return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_remove__doc__,
+"remove($self, subelement, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_REMOVE_METHODDEF \
+ {"remove", (PyCFunction)_elementtree_Element_remove, METH_O, _elementtree_Element_remove__doc__},
+
+static PyObject *
+_elementtree_Element_remove_impl(ElementObject *self, PyObject *subelement);
+
+static PyObject *
+_elementtree_Element_remove(ElementObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *subelement;
+
+ if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement))
+ goto exit;
+ return_value = _elementtree_Element_remove_impl(self, subelement);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_Element_set__doc__,
+"set($self, key, value, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_ELEMENT_SET_METHODDEF \
+ {"set", (PyCFunction)_elementtree_Element_set, METH_VARARGS, _elementtree_Element_set__doc__},
+
+static PyObject *
+_elementtree_Element_set_impl(ElementObject *self, PyObject *key,
+ PyObject *value);
+
+static PyObject *
+_elementtree_Element_set(ElementObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *key;
+ PyObject *value;
+
+ if (!PyArg_UnpackTuple(args, "set",
+ 2, 2,
+ &key, &value))
+ goto exit;
+ return_value = _elementtree_Element_set_impl(self, key, value);
+
+exit:
+ return return_value;
+}
+
+static int
+_elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
+ PyObject *element_factory);
+
+static int
+_elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ int return_value = -1;
+ static char *_keywords[] = {"element_factory", NULL};
+ PyObject *element_factory = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:TreeBuilder", _keywords,
+ &element_factory))
+ goto exit;
+ return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_TreeBuilder_data__doc__,
+"data($self, data, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_DATA_METHODDEF \
+ {"data", (PyCFunction)_elementtree_TreeBuilder_data, METH_O, _elementtree_TreeBuilder_data__doc__},
+
+PyDoc_STRVAR(_elementtree_TreeBuilder_end__doc__,
+"end($self, tag, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_END_METHODDEF \
+ {"end", (PyCFunction)_elementtree_TreeBuilder_end, METH_O, _elementtree_TreeBuilder_end__doc__},
+
+PyDoc_STRVAR(_elementtree_TreeBuilder_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_CLOSE_METHODDEF \
+ {"close", (PyCFunction)_elementtree_TreeBuilder_close, METH_NOARGS, _elementtree_TreeBuilder_close__doc__},
+
+static PyObject *
+_elementtree_TreeBuilder_close_impl(TreeBuilderObject *self);
+
+static PyObject *
+_elementtree_TreeBuilder_close(TreeBuilderObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_TreeBuilder_close_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_TreeBuilder_start__doc__,
+"start($self, tag, attrs=None, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_START_METHODDEF \
+ {"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_VARARGS, _elementtree_TreeBuilder_start__doc__},
+
+static PyObject *
+_elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
+ PyObject *attrs);
+
+static PyObject *
+_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *tag;
+ PyObject *attrs = Py_None;
+
+ if (!PyArg_UnpackTuple(args, "start",
+ 1, 2,
+ &tag, &attrs))
+ goto exit;
+ return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
+
+exit:
+ return return_value;
+}
+
+static int
+_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html,
+ PyObject *target, const char *encoding);
+
+static int
+_elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ int return_value = -1;
+ static char *_keywords[] = {"html", "target", "encoding", NULL};
+ PyObject *html = NULL;
+ PyObject *target = NULL;
+ const char *encoding = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOz:XMLParser", _keywords,
+ &html, &target, &encoding))
+ goto exit;
+ return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, html, target, encoding);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_XMLParser_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_XMLPARSER_CLOSE_METHODDEF \
+ {"close", (PyCFunction)_elementtree_XMLParser_close, METH_NOARGS, _elementtree_XMLParser_close__doc__},
+
+static PyObject *
+_elementtree_XMLParser_close_impl(XMLParserObject *self);
+
+static PyObject *
+_elementtree_XMLParser_close(XMLParserObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _elementtree_XMLParser_close_impl(self);
+}
+
+PyDoc_STRVAR(_elementtree_XMLParser_feed__doc__,
+"feed($self, data, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_XMLPARSER_FEED_METHODDEF \
+ {"feed", (PyCFunction)_elementtree_XMLParser_feed, METH_O, _elementtree_XMLParser_feed__doc__},
+
+PyDoc_STRVAR(_elementtree_XMLParser__parse_whole__doc__,
+"_parse_whole($self, file, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_XMLPARSER__PARSE_WHOLE_METHODDEF \
+ {"_parse_whole", (PyCFunction)_elementtree_XMLParser__parse_whole, METH_O, _elementtree_XMLParser__parse_whole__doc__},
+
+PyDoc_STRVAR(_elementtree_XMLParser_doctype__doc__,
+"doctype($self, name, pubid, system, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \
+ {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_VARARGS, _elementtree_XMLParser_doctype__doc__},
+
+static PyObject *
+_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
+ PyObject *pubid, PyObject *system);
+
+static PyObject *
+_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *name;
+ PyObject *pubid;
+ PyObject *system;
+
+ if (!PyArg_UnpackTuple(args, "doctype",
+ 3, 3,
+ &name, &pubid, &system))
+ goto exit;
+ return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__,
+"_setevents($self, events_queue, events_to_report=None, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF \
+ {"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_VARARGS, _elementtree_XMLParser__setevents__doc__},
+
+static PyObject *
+_elementtree_XMLParser__setevents_impl(XMLParserObject *self,
+ PyObject *events_queue,
+ PyObject *events_to_report);
+
+static PyObject *
+_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *events_queue;
+ PyObject *events_to_report = Py_None;
+
+ if (!PyArg_ParseTuple(args, "O!|O:_setevents",
+ &PyList_Type, &events_queue, &events_to_report))
+ goto exit;
+ return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=25b8bf7e7f2151ca input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
new file mode 100644
index 0000000..110ad9a
--- /dev/null
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -0,0 +1,253 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_gdbm_gdbm_get__doc__,
+"get($self, key, default=None, /)\n"
+"--\n"
+"\n"
+"Get the value for key, or default if not present.");
+
+#define _GDBM_GDBM_GET_METHODDEF \
+ {"get", (PyCFunction)_gdbm_gdbm_get, METH_VARARGS, _gdbm_gdbm_get__doc__},
+
+static PyObject *
+_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value);
+
+static PyObject *
+_gdbm_gdbm_get(dbmobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *key;
+ PyObject *default_value = Py_None;
+
+ if (!PyArg_UnpackTuple(args, "get",
+ 1, 2,
+ &key, &default_value))
+ goto exit;
+ return_value = _gdbm_gdbm_get_impl(self, key, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_setdefault__doc__,
+"setdefault($self, key, default=None, /)\n"
+"--\n"
+"\n"
+"Get value for key, or set it to default and return default if not present.");
+
+#define _GDBM_GDBM_SETDEFAULT_METHODDEF \
+ {"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_VARARGS, _gdbm_gdbm_setdefault__doc__},
+
+static PyObject *
+_gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
+ PyObject *default_value);
+
+static PyObject *
+_gdbm_gdbm_setdefault(dbmobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *key;
+ PyObject *default_value = Py_None;
+
+ if (!PyArg_UnpackTuple(args, "setdefault",
+ 1, 2,
+ &key, &default_value))
+ goto exit;
+ return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n"
+"Close the database.");
+
+#define _GDBM_GDBM_CLOSE_METHODDEF \
+ {"close", (PyCFunction)_gdbm_gdbm_close, METH_NOARGS, _gdbm_gdbm_close__doc__},
+
+static PyObject *
+_gdbm_gdbm_close_impl(dbmobject *self);
+
+static PyObject *
+_gdbm_gdbm_close(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _gdbm_gdbm_close_impl(self);
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_keys__doc__,
+"keys($self, /)\n"
+"--\n"
+"\n"
+"Get a list of all keys in the database.");
+
+#define _GDBM_GDBM_KEYS_METHODDEF \
+ {"keys", (PyCFunction)_gdbm_gdbm_keys, METH_NOARGS, _gdbm_gdbm_keys__doc__},
+
+static PyObject *
+_gdbm_gdbm_keys_impl(dbmobject *self);
+
+static PyObject *
+_gdbm_gdbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _gdbm_gdbm_keys_impl(self);
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_firstkey__doc__,
+"firstkey($self, /)\n"
+"--\n"
+"\n"
+"Return the starting key for the traversal.\n"
+"\n"
+"It\'s possible to loop over every key in the database using this method\n"
+"and the nextkey() method. The traversal is ordered by GDBM\'s internal\n"
+"hash values, and won\'t be sorted by the key values.");
+
+#define _GDBM_GDBM_FIRSTKEY_METHODDEF \
+ {"firstkey", (PyCFunction)_gdbm_gdbm_firstkey, METH_NOARGS, _gdbm_gdbm_firstkey__doc__},
+
+static PyObject *
+_gdbm_gdbm_firstkey_impl(dbmobject *self);
+
+static PyObject *
+_gdbm_gdbm_firstkey(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _gdbm_gdbm_firstkey_impl(self);
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_nextkey__doc__,
+"nextkey($self, key, /)\n"
+"--\n"
+"\n"
+"Returns the key that follows key in the traversal.\n"
+"\n"
+"The following code prints every key in the database db, without having\n"
+"to create a list in memory that contains them all:\n"
+"\n"
+" k = db.firstkey()\n"
+" while k != None:\n"
+" print(k)\n"
+" k = db.nextkey(k)");
+
+#define _GDBM_GDBM_NEXTKEY_METHODDEF \
+ {"nextkey", (PyCFunction)_gdbm_gdbm_nextkey, METH_O, _gdbm_gdbm_nextkey__doc__},
+
+static PyObject *
+_gdbm_gdbm_nextkey_impl(dbmobject *self, const char *key,
+ Py_ssize_clean_t key_length);
+
+static PyObject *
+_gdbm_gdbm_nextkey(dbmobject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *key;
+ Py_ssize_clean_t key_length;
+
+ if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length))
+ goto exit;
+ return_value = _gdbm_gdbm_nextkey_impl(self, key, key_length);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_reorganize__doc__,
+"reorganize($self, /)\n"
+"--\n"
+"\n"
+"Reorganize the database.\n"
+"\n"
+"If you have carried out a lot of deletions and would like to shrink\n"
+"the space used by the GDBM file, this routine will reorganize the\n"
+"database. GDBM will not shorten the length of a database file except\n"
+"by using this reorganization; otherwise, deleted file space will be\n"
+"kept and reused as new (key,value) pairs are added.");
+
+#define _GDBM_GDBM_REORGANIZE_METHODDEF \
+ {"reorganize", (PyCFunction)_gdbm_gdbm_reorganize, METH_NOARGS, _gdbm_gdbm_reorganize__doc__},
+
+static PyObject *
+_gdbm_gdbm_reorganize_impl(dbmobject *self);
+
+static PyObject *
+_gdbm_gdbm_reorganize(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _gdbm_gdbm_reorganize_impl(self);
+}
+
+PyDoc_STRVAR(_gdbm_gdbm_sync__doc__,
+"sync($self, /)\n"
+"--\n"
+"\n"
+"Flush the database to the disk file.\n"
+"\n"
+"When the database has been opened in fast mode, this method forces\n"
+"any unwritten data to be written to the disk.");
+
+#define _GDBM_GDBM_SYNC_METHODDEF \
+ {"sync", (PyCFunction)_gdbm_gdbm_sync, METH_NOARGS, _gdbm_gdbm_sync__doc__},
+
+static PyObject *
+_gdbm_gdbm_sync_impl(dbmobject *self);
+
+static PyObject *
+_gdbm_gdbm_sync(dbmobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _gdbm_gdbm_sync_impl(self);
+}
+
+PyDoc_STRVAR(dbmopen__doc__,
+"open($module, filename, flags=\'r\', mode=0o666, /)\n"
+"--\n"
+"\n"
+"Open a dbm database and return a dbm object.\n"
+"\n"
+"The filename argument is the name of the database file.\n"
+"\n"
+"The optional flags argument can be \'r\' (to open an existing database\n"
+"for reading only -- default), \'w\' (to open an existing database for\n"
+"reading and writing), \'c\' (which creates the database if it doesn\'t\n"
+"exist), or \'n\' (which always creates a new empty database).\n"
+"\n"
+"Some versions of gdbm support additional flags which must be\n"
+"appended to one of the flags described above. The module constant\n"
+"\'open_flags\' is a string of valid additional flags. The \'f\' flag\n"
+"opens the database in fast mode; altered data will not automatically\n"
+"be written to the disk after every change. This results in faster\n"
+"writes to the database, but may result in an inconsistent database\n"
+"if the program crashes while the database is still open. Use the\n"
+"sync() method to force any unwritten data to be written to the disk.\n"
+"The \'s\' flag causes all database operations to be synchronized to\n"
+"disk. The \'u\' flag disables locking of the database file.\n"
+"\n"
+"The optional mode argument is the Unix mode of the file, used only\n"
+"when the database has to be created. It defaults to octal 0o666.");
+
+#define DBMOPEN_METHODDEF \
+ {"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
+
+static PyObject *
+dbmopen_impl(PyModuleDef *module, const char *name, const char *flags,
+ int mode);
+
+static PyObject *
+dbmopen(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *name;
+ const char *flags = "r";
+ int mode = 438;
+
+ if (!PyArg_ParseTuple(args, "s|si:open",
+ &name, &flags, &mode))
+ goto exit;
+ return_value = dbmopen_impl(module, name, flags, mode);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=d3d8d871bcccb68a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index c1ad882..59d9d51 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -14,20 +14,18 @@ PyDoc_STRVAR(_lzma_LZMACompressor_compress__doc__,
"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,
- "y*:compress",
- &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data))
goto exit;
return_value = _lzma_LZMACompressor_compress_impl(self, &data);
@@ -62,34 +60,43 @@ _lzma_LZMACompressor_flush(Compressor *self, PyObject *Py_UNUSED(ignored))
}
PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__,
-"decompress($self, data, /)\n"
+"decompress($self, /, data, max_length=-1)\n"
"--\n"
"\n"
-"Provide data to the decompressor object.\n"
+"Decompress *data*, returning uncompressed data as bytes.\n"
"\n"
-"Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n"
+"If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
+"decompressed data. If this limit is reached and further output can be\n"
+"produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
+"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
"\n"
-"Attempting to decompress data after the end of stream is reached\n"
-"raises an EOFError. Any data found after the end of the stream\n"
-"is ignored and saved in the unused_data attribute.");
+"If all of the input data was decompressed and returned (either because this\n"
+"was less than *max_length* bytes, or because *max_length* was negative),\n"
+"*self.needs_input* will be set to True.\n"
+"\n"
+"Attempting to decompress data after the end of stream is reached raises an\n"
+"EOFError. Any data found after the end of the stream is ignored and saved in\n"
+"the unused_data attribute.");
#define _LZMA_LZMADECOMPRESSOR_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_VARARGS, _lzma_LZMADecompressor_decompress__doc__},
+ {"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_VARARGS|METH_KEYWORDS, _lzma_LZMADecompressor_decompress__doc__},
static PyObject *
-_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data);
+_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
+ Py_ssize_t max_length);
static PyObject *
-_lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *args)
+_lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
+ static char *_keywords[] = {"data", "max_length", NULL};
Py_buffer data = {NULL, NULL};
+ Py_ssize_t max_length = -1;
- if (!PyArg_ParseTuple(args,
- "y*:decompress",
- &data))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords,
+ &data, &max_length))
goto exit;
- return_value = _lzma_LZMADecompressor_decompress_impl(self, &data);
+ return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length);
exit:
/* Cleanup for data */
@@ -123,7 +130,8 @@ PyDoc_STRVAR(_lzma_LZMADecompressor___init____doc__,
"For one-shot decompression, use the decompress() function instead.");
static int
-_lzma_LZMADecompressor___init___impl(Decompressor *self, int format, PyObject *memlimit, PyObject *filters);
+_lzma_LZMADecompressor___init___impl(Decompressor *self, int format,
+ PyObject *memlimit, PyObject *filters);
static int
_lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
@@ -134,8 +142,7 @@ _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs
PyObject *memlimit = Py_None;
PyObject *filters = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "|iOO:LZMADecompressor", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOO:LZMADecompressor", _keywords,
&format, &memlimit, &filters))
goto exit;
return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters);
@@ -153,20 +160,18 @@ PyDoc_STRVAR(_lzma_is_check_supported__doc__,
"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,
- "i:is_check_supported",
- &check_id))
+ if (!PyArg_Parse(arg, "i:is_check_supported", &check_id))
goto exit;
return_value = _lzma_is_check_supported_impl(module, check_id);
@@ -183,20 +188,18 @@ PyDoc_STRVAR(_lzma__encode_filter_properties__doc__,
"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,
- "O&:_encode_filter_properties",
- lzma_filter_converter, &filter))
+ if (!PyArg_Parse(arg, "O&:_encode_filter_properties", lzma_filter_converter, &filter))
goto exit;
return_value = _lzma__encode_filter_properties_impl(module, filter);
@@ -220,7 +223,8 @@ PyDoc_STRVAR(_lzma__decode_filter_properties__doc__,
{"_decode_filter_properties", (PyCFunction)_lzma__decode_filter_properties, METH_VARARGS, _lzma__decode_filter_properties__doc__},
static PyObject *
-_lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id, Py_buffer *encoded_props);
+_lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id,
+ Py_buffer *encoded_props);
static PyObject *
_lzma__decode_filter_properties(PyModuleDef *module, PyObject *args)
@@ -229,8 +233,7 @@ _lzma__decode_filter_properties(PyModuleDef *module, PyObject *args)
lzma_vli filter_id;
Py_buffer encoded_props = {NULL, NULL};
- if (!PyArg_ParseTuple(args,
- "O&y*:_decode_filter_properties",
+ if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties",
lzma_vli_converter, &filter_id, &encoded_props))
goto exit;
return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
@@ -242,4 +245,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=808fec8216ac712b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2d3e0842be3d3fe1 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h
new file mode 100644
index 0000000..196a2ee
--- /dev/null
+++ b/Modules/clinic/_opcode.c.h
@@ -0,0 +1,36 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_opcode_stack_effect__doc__,
+"stack_effect($module, opcode, oparg=None, /)\n"
+"--\n"
+"\n"
+"Compute the stack effect of the opcode.");
+
+#define _OPCODE_STACK_EFFECT_METHODDEF \
+ {"stack_effect", (PyCFunction)_opcode_stack_effect, METH_VARARGS, _opcode_stack_effect__doc__},
+
+static int
+_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg);
+
+static PyObject *
+_opcode_stack_effect(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int opcode;
+ PyObject *oparg = Py_None;
+ int _return_value;
+
+ if (!PyArg_ParseTuple(args, "i|O:stack_effect",
+ &opcode, &oparg))
+ goto exit;
+ _return_value = _opcode_stack_effect_impl(module, opcode, oparg);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=8ee7cb735705e8b3 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h
index 975298c..b698ce8 100644
--- a/Modules/clinic/_pickle.c.h
+++ b/Modules/clinic/_pickle.c.h
@@ -85,7 +85,8 @@ PyDoc_STRVAR(_pickle_Pickler___init____doc__,
"2, so that the pickle data stream is readable with Python 2.");
static int
-_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, PyObject *protocol, int fix_imports);
+_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
+ PyObject *protocol, int fix_imports);
static int
_pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
@@ -96,8 +97,7 @@ _pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O|Op:Pickler", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Op:Pickler", _keywords,
&file, &protocol, &fix_imports))
goto exit;
return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports);
@@ -199,7 +199,9 @@ PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__,
{"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_VARARGS, _pickle_Unpickler_find_class__doc__},
static PyObject *
-_pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *module_name, PyObject *global_name);
+_pickle_Unpickler_find_class_impl(UnpicklerObject *self,
+ PyObject *module_name,
+ PyObject *global_name);
static PyObject *
_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args)
@@ -271,7 +273,9 @@ PyDoc_STRVAR(_pickle_Unpickler___init____doc__,
"string instances as bytes objects.");
static int
-_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file, int fix_imports, const char *encoding, const char *errors);
+_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file,
+ int fix_imports, const char *encoding,
+ const char *errors);
static int
_pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
@@ -283,8 +287,7 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O|$pss:Unpickler", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:Unpickler", _keywords,
&file, &fix_imports, &encoding, &errors))
goto exit;
return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors);
@@ -377,7 +380,8 @@ PyDoc_STRVAR(_pickle_dump__doc__,
{"dump", (PyCFunction)_pickle_dump, METH_VARARGS|METH_KEYWORDS, _pickle_dump__doc__},
static PyObject *
-_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file, PyObject *protocol, int fix_imports);
+_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file,
+ PyObject *protocol, int fix_imports);
static PyObject *
_pickle_dump(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -389,8 +393,7 @@ _pickle_dump(PyModuleDef *module, PyObject *args, PyObject *kwargs)
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "OO|O$p:dump", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O$p:dump", _keywords,
&obj, &file, &protocol, &fix_imports))
goto exit;
return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports);
@@ -421,7 +424,8 @@ PyDoc_STRVAR(_pickle_dumps__doc__,
{"dumps", (PyCFunction)_pickle_dumps, METH_VARARGS|METH_KEYWORDS, _pickle_dumps__doc__},
static PyObject *
-_pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol, int fix_imports);
+_pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol,
+ int fix_imports);
static PyObject *
_pickle_dumps(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -432,8 +436,7 @@ _pickle_dumps(PyModuleDef *module, PyObject *args, PyObject *kwargs)
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O|O$p:dumps", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O$p:dumps", _keywords,
&obj, &protocol, &fix_imports))
goto exit;
return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports);
@@ -475,7 +478,8 @@ PyDoc_STRVAR(_pickle_load__doc__,
{"load", (PyCFunction)_pickle_load, METH_VARARGS|METH_KEYWORDS, _pickle_load__doc__},
static PyObject *
-_pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports, const char *encoding, const char *errors);
+_pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports,
+ const char *encoding, const char *errors);
static PyObject *
_pickle_load(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -487,8 +491,7 @@ _pickle_load(PyModuleDef *module, PyObject *args, PyObject *kwargs)
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O|$pss:load", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:load", _keywords,
&file, &fix_imports, &encoding, &errors))
goto exit;
return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors);
@@ -521,7 +524,8 @@ PyDoc_STRVAR(_pickle_loads__doc__,
{"loads", (PyCFunction)_pickle_loads, METH_VARARGS|METH_KEYWORDS, _pickle_loads__doc__},
static PyObject *
-_pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports, const char *encoding, const char *errors);
+_pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports,
+ const char *encoding, const char *errors);
static PyObject *
_pickle_loads(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -533,8 +537,7 @@ _pickle_loads(PyModuleDef *module, PyObject *args, PyObject *kwargs)
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O|$pss:loads", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:loads", _keywords,
&data, &fix_imports, &encoding, &errors))
goto exit;
return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors);
@@ -542,4 +545,4 @@ _pickle_loads(PyModuleDef *module, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=3aba79576e240c62 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=06f3a5233298448e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
new file mode 100644
index 0000000..6de4708
--- /dev/null
+++ b/Modules/clinic/_sre.c.h
@@ -0,0 +1,693 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_sre_getcodesize__doc__,
+"getcodesize($module, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_GETCODESIZE_METHODDEF \
+ {"getcodesize", (PyCFunction)_sre_getcodesize, METH_NOARGS, _sre_getcodesize__doc__},
+
+static int
+_sre_getcodesize_impl(PyModuleDef *module);
+
+static PyObject *
+_sre_getcodesize(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = _sre_getcodesize_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_getlower__doc__,
+"getlower($module, character, flags, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_GETLOWER_METHODDEF \
+ {"getlower", (PyCFunction)_sre_getlower, METH_VARARGS, _sre_getlower__doc__},
+
+static int
+_sre_getlower_impl(PyModuleDef *module, int character, int flags);
+
+static PyObject *
+_sre_getlower(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int character;
+ int flags;
+ int _return_value;
+
+ if (!PyArg_ParseTuple(args, "ii:getlower",
+ &character, &flags))
+ goto exit;
+ _return_value = _sre_getlower_impl(module, character, flags);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
+"match($self, /, string=None, pos=0, endpos=sys.maxsize, *, pattern=None)\n"
+"--\n"
+"\n"
+"Matches zero or more characters at the beginning of the string.");
+
+#define _SRE_SRE_PATTERN_MATCH_METHODDEF \
+ {"match", (PyCFunction)_sre_SRE_Pattern_match, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos,
+ PyObject *pattern);
+
+static PyObject *
+_sre_SRE_Pattern_match(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ PyObject *string = NULL;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+ PyObject *pattern = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:match", _keywords,
+ &string, &pos, &endpos, &pattern))
+ goto exit;
+ return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
+"fullmatch($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n"
+" pattern=None)\n"
+"--\n"
+"\n"
+"Matches against all of the string");
+
+#define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF \
+ {"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos,
+ PyObject *pattern);
+
+static PyObject *
+_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ PyObject *string = NULL;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+ PyObject *pattern = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:fullmatch", _keywords,
+ &string, &pos, &endpos, &pattern))
+ goto exit;
+ return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
+"search($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n"
+" pattern=None)\n"
+"--\n"
+"\n"
+"Scan through string looking for a match, and return a corresponding match object instance.\n"
+"\n"
+"Return None if no position in the string matches.");
+
+#define _SRE_SRE_PATTERN_SEARCH_METHODDEF \
+ {"search", (PyCFunction)_sre_SRE_Pattern_search, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos,
+ PyObject *pattern);
+
+static PyObject *
+_sre_SRE_Pattern_search(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ PyObject *string = NULL;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+ PyObject *pattern = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:search", _keywords,
+ &string, &pos, &endpos, &pattern))
+ goto exit;
+ return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
+"findall($self, /, string=None, pos=0, endpos=sys.maxsize, *,\n"
+" source=None)\n"
+"--\n"
+"\n"
+"Return a list of all non-overlapping matches of pattern in string.");
+
+#define _SRE_SRE_PATTERN_FINDALL_METHODDEF \
+ {"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos,
+ PyObject *source);
+
+static PyObject *
+_sre_SRE_Pattern_findall(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", "source", NULL};
+ PyObject *string = NULL;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+ PyObject *source = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:findall", _keywords,
+ &string, &pos, &endpos, &source))
+ goto exit;
+ return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
+"finditer($self, /, string, pos=0, endpos=sys.maxsize)\n"
+"--\n"
+"\n"
+"Return an iterator over all non-overlapping matches for the RE pattern in string.\n"
+"\n"
+"For each match, the iterator returns a match object.");
+
+#define _SRE_SRE_PATTERN_FINDITER_METHODDEF \
+ {"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos);
+
+static PyObject *
+_sre_SRE_Pattern_finditer(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", NULL};
+ PyObject *string;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:finditer", _keywords,
+ &string, &pos, &endpos))
+ goto exit;
+ return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
+"scanner($self, /, string, pos=0, endpos=sys.maxsize)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_PATTERN_SCANNER_METHODDEF \
+ {"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t pos, Py_ssize_t endpos);
+
+static PyObject *
+_sre_SRE_Pattern_scanner(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "pos", "endpos", NULL};
+ PyObject *string;
+ Py_ssize_t pos = 0;
+ Py_ssize_t endpos = PY_SSIZE_T_MAX;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:scanner", _keywords,
+ &string, &pos, &endpos))
+ goto exit;
+ return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
+"split($self, /, string=None, maxsplit=0, *, source=None)\n"
+"--\n"
+"\n"
+"Split string by the occurrences of pattern.");
+
+#define _SRE_SRE_PATTERN_SPLIT_METHODDEF \
+ {"split", (PyCFunction)_sre_SRE_Pattern_split, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
+ Py_ssize_t maxsplit, PyObject *source);
+
+static PyObject *
+_sre_SRE_Pattern_split(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", "maxsplit", "source", NULL};
+ PyObject *string = NULL;
+ Py_ssize_t maxsplit = 0;
+ PyObject *source = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On$O:split", _keywords,
+ &string, &maxsplit, &source))
+ goto exit;
+ return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
+"sub($self, /, repl, string, count=0)\n"
+"--\n"
+"\n"
+"Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
+
+#define _SRE_SRE_PATTERN_SUB_METHODDEF \
+ {"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
+ PyObject *string, Py_ssize_t count);
+
+static PyObject *
+_sre_SRE_Pattern_sub(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"repl", "string", "count", NULL};
+ PyObject *repl;
+ PyObject *string;
+ Py_ssize_t count = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:sub", _keywords,
+ &repl, &string, &count))
+ goto exit;
+ return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
+"subn($self, /, repl, string, count=0)\n"
+"--\n"
+"\n"
+"Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
+
+#define _SRE_SRE_PATTERN_SUBN_METHODDEF \
+ {"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
+
+static PyObject *
+_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
+ PyObject *string, Py_ssize_t count);
+
+static PyObject *
+_sre_SRE_Pattern_subn(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"repl", "string", "count", NULL};
+ PyObject *repl;
+ PyObject *string;
+ Py_ssize_t count = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:subn", _keywords,
+ &repl, &string, &count))
+ goto exit;
+ return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern___copy____doc__,
+"__copy__($self, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_PATTERN___COPY___METHODDEF \
+ {"__copy__", (PyCFunction)_sre_SRE_Pattern___copy__, METH_NOARGS, _sre_SRE_Pattern___copy____doc__},
+
+static PyObject *
+_sre_SRE_Pattern___copy___impl(PatternObject *self);
+
+static PyObject *
+_sre_SRE_Pattern___copy__(PatternObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _sre_SRE_Pattern___copy___impl(self);
+}
+
+PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
+"__deepcopy__($self, /, memo)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF \
+ {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern___deepcopy____doc__},
+
+static PyObject *
+_sre_SRE_Pattern___deepcopy___impl(PatternObject *self, PyObject *memo);
+
+static PyObject *
+_sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"memo", NULL};
+ PyObject *memo;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords,
+ &memo))
+ goto exit;
+ return_value = _sre_SRE_Pattern___deepcopy___impl(self, memo);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_compile__doc__,
+"compile($module, /, pattern, flags, code, groups, groupindex,\n"
+" indexgroup)\n"
+"--\n"
+"\n");
+
+#define _SRE_COMPILE_METHODDEF \
+ {"compile", (PyCFunction)_sre_compile, METH_VARARGS|METH_KEYWORDS, _sre_compile__doc__},
+
+static PyObject *
+_sre_compile_impl(PyModuleDef *module, PyObject *pattern, int flags,
+ PyObject *code, Py_ssize_t groups, PyObject *groupindex,
+ PyObject *indexgroup);
+
+static PyObject *
+_sre_compile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
+ PyObject *pattern;
+ int flags;
+ PyObject *code;
+ Py_ssize_t groups;
+ PyObject *groupindex;
+ PyObject *indexgroup;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO!nOO:compile", _keywords,
+ &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup))
+ goto exit;
+ return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
+"expand($self, /, template)\n"
+"--\n"
+"\n"
+"Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
+
+#define _SRE_SRE_MATCH_EXPAND_METHODDEF \
+ {"expand", (PyCFunction)_sre_SRE_Match_expand, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
+
+static PyObject *
+_sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
+
+static PyObject *
+_sre_SRE_Match_expand(MatchObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"template", NULL};
+ PyObject *template;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:expand", _keywords,
+ &template))
+ goto exit;
+ return_value = _sre_SRE_Match_expand_impl(self, template);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
+"groups($self, /, default=None)\n"
+"--\n"
+"\n"
+"Return a tuple containing all the subgroups of the match, from 1.\n"
+"\n"
+" default\n"
+" Is used for groups that did not participate in the match.");
+
+#define _SRE_SRE_MATCH_GROUPS_METHODDEF \
+ {"groups", (PyCFunction)_sre_SRE_Match_groups, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
+
+static PyObject *
+_sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
+
+static PyObject *
+_sre_SRE_Match_groups(MatchObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"default", NULL};
+ PyObject *default_value = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groups", _keywords,
+ &default_value))
+ goto exit;
+ return_value = _sre_SRE_Match_groups_impl(self, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
+"groupdict($self, /, default=None)\n"
+"--\n"
+"\n"
+"Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.\n"
+"\n"
+" default\n"
+" Is used for groups that did not participate in the match.");
+
+#define _SRE_SRE_MATCH_GROUPDICT_METHODDEF \
+ {"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
+
+static PyObject *
+_sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
+
+static PyObject *
+_sre_SRE_Match_groupdict(MatchObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"default", NULL};
+ PyObject *default_value = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groupdict", _keywords,
+ &default_value))
+ goto exit;
+ return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
+"start($self, group=0, /)\n"
+"--\n"
+"\n"
+"Return index of the start of the substring matched by group.");
+
+#define _SRE_SRE_MATCH_START_METHODDEF \
+ {"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__},
+
+static Py_ssize_t
+_sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
+
+static PyObject *
+_sre_SRE_Match_start(MatchObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *group = NULL;
+ Py_ssize_t _return_value;
+
+ if (!PyArg_UnpackTuple(args, "start",
+ 0, 1,
+ &group))
+ goto exit;
+ _return_value = _sre_SRE_Match_start_impl(self, group);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
+"end($self, group=0, /)\n"
+"--\n"
+"\n"
+"Return index of the end of the substring matched by group.");
+
+#define _SRE_SRE_MATCH_END_METHODDEF \
+ {"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__},
+
+static Py_ssize_t
+_sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
+
+static PyObject *
+_sre_SRE_Match_end(MatchObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *group = NULL;
+ Py_ssize_t _return_value;
+
+ if (!PyArg_UnpackTuple(args, "end",
+ 0, 1,
+ &group))
+ goto exit;
+ _return_value = _sre_SRE_Match_end_impl(self, group);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
+"span($self, group=0, /)\n"
+"--\n"
+"\n"
+"For MatchObject m, return the 2-tuple (m.start(group), m.end(group)).");
+
+#define _SRE_SRE_MATCH_SPAN_METHODDEF \
+ {"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__},
+
+static PyObject *
+_sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
+
+static PyObject *
+_sre_SRE_Match_span(MatchObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *group = NULL;
+
+ if (!PyArg_UnpackTuple(args, "span",
+ 0, 1,
+ &group))
+ goto exit;
+ return_value = _sre_SRE_Match_span_impl(self, group);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Match___copy____doc__,
+"__copy__($self, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_MATCH___COPY___METHODDEF \
+ {"__copy__", (PyCFunction)_sre_SRE_Match___copy__, METH_NOARGS, _sre_SRE_Match___copy____doc__},
+
+static PyObject *
+_sre_SRE_Match___copy___impl(MatchObject *self);
+
+static PyObject *
+_sre_SRE_Match___copy__(MatchObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _sre_SRE_Match___copy___impl(self);
+}
+
+PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
+"__deepcopy__($self, /, memo)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF \
+ {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match___deepcopy____doc__},
+
+static PyObject *
+_sre_SRE_Match___deepcopy___impl(MatchObject *self, PyObject *memo);
+
+static PyObject *
+_sre_SRE_Match___deepcopy__(MatchObject *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"memo", NULL};
+ PyObject *memo;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords,
+ &memo))
+ goto exit;
+ return_value = _sre_SRE_Match___deepcopy___impl(self, memo);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sre_SRE_Scanner_match__doc__,
+"match($self, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_SCANNER_MATCH_METHODDEF \
+ {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__},
+
+static PyObject *
+_sre_SRE_Scanner_match_impl(ScannerObject *self);
+
+static PyObject *
+_sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _sre_SRE_Scanner_match_impl(self);
+}
+
+PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
+"search($self, /)\n"
+"--\n"
+"\n");
+
+#define _SRE_SRE_SCANNER_SEARCH_METHODDEF \
+ {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__},
+
+static PyObject *
+_sre_SRE_Scanner_search_impl(ScannerObject *self);
+
+static PyObject *
+_sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _sre_SRE_Scanner_search_impl(self);
+}
+/*[clinic end generated code: output=d1d73ab2c5008bd4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
new file mode 100644
index 0000000..4dbc5d0
--- /dev/null
+++ b/Modules/clinic/_ssl.c.h
@@ -0,0 +1,1105 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_ssl__SSLSocket_do_handshake__doc__,
+"do_handshake($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_DO_HANDSHAKE_METHODDEF \
+ {"do_handshake", (PyCFunction)_ssl__SSLSocket_do_handshake, METH_NOARGS, _ssl__SSLSocket_do_handshake__doc__},
+
+static PyObject *
+_ssl__SSLSocket_do_handshake_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_do_handshake(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_do_handshake_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__test_decode_cert__doc__,
+"_test_decode_cert($module, path, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__TEST_DECODE_CERT_METHODDEF \
+ {"_test_decode_cert", (PyCFunction)_ssl__test_decode_cert, METH_O, _ssl__test_decode_cert__doc__},
+
+static PyObject *
+_ssl__test_decode_cert_impl(PyModuleDef *module, PyObject *path);
+
+static PyObject *
+_ssl__test_decode_cert(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *path;
+
+ if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path))
+ goto exit;
+ return_value = _ssl__test_decode_cert_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_peer_certificate__doc__,
+"peer_certificate($self, der=False, /)\n"
+"--\n"
+"\n"
+"Returns the certificate for the peer.\n"
+"\n"
+"If no certificate was provided, returns None. If a certificate was\n"
+"provided, but not validated, returns an empty dictionary. Otherwise\n"
+"returns a dict containing information about the peer certificate.\n"
+"\n"
+"If the optional argument is True, returns a DER-encoded copy of the\n"
+"peer certificate, or None if no certificate was provided. This will\n"
+"return the certificate even if it wasn\'t validated.");
+
+#define _SSL__SSLSOCKET_PEER_CERTIFICATE_METHODDEF \
+ {"peer_certificate", (PyCFunction)_ssl__SSLSocket_peer_certificate, METH_VARARGS, _ssl__SSLSocket_peer_certificate__doc__},
+
+static PyObject *
+_ssl__SSLSocket_peer_certificate_impl(PySSLSocket *self, int binary_mode);
+
+static PyObject *
+_ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int binary_mode = 0;
+
+ if (!PyArg_ParseTuple(args, "|p:peer_certificate",
+ &binary_mode))
+ goto exit;
+ return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_shared_ciphers__doc__,
+"shared_ciphers($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_SHARED_CIPHERS_METHODDEF \
+ {"shared_ciphers", (PyCFunction)_ssl__SSLSocket_shared_ciphers, METH_NOARGS, _ssl__SSLSocket_shared_ciphers__doc__},
+
+static PyObject *
+_ssl__SSLSocket_shared_ciphers_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_shared_ciphers(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_shared_ciphers_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_cipher__doc__,
+"cipher($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_CIPHER_METHODDEF \
+ {"cipher", (PyCFunction)_ssl__SSLSocket_cipher, METH_NOARGS, _ssl__SSLSocket_cipher__doc__},
+
+static PyObject *
+_ssl__SSLSocket_cipher_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_cipher(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_cipher_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_version__doc__,
+"version($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_VERSION_METHODDEF \
+ {"version", (PyCFunction)_ssl__SSLSocket_version, METH_NOARGS, _ssl__SSLSocket_version__doc__},
+
+static PyObject *
+_ssl__SSLSocket_version_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_version_impl(self);
+}
+
+#if defined(OPENSSL_NPN_NEGOTIATED)
+
+PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__,
+"selected_npn_protocol($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF \
+ {"selected_npn_protocol", (PyCFunction)_ssl__SSLSocket_selected_npn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_npn_protocol__doc__},
+
+static PyObject *
+_ssl__SSLSocket_selected_npn_protocol_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_selected_npn_protocol_impl(self);
+}
+
+#endif /* defined(OPENSSL_NPN_NEGOTIATED) */
+
+#if defined(HAVE_ALPN)
+
+PyDoc_STRVAR(_ssl__SSLSocket_selected_alpn_protocol__doc__,
+"selected_alpn_protocol($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF \
+ {"selected_alpn_protocol", (PyCFunction)_ssl__SSLSocket_selected_alpn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_alpn_protocol__doc__},
+
+static PyObject *
+_ssl__SSLSocket_selected_alpn_protocol_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_selected_alpn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_selected_alpn_protocol_impl(self);
+}
+
+#endif /* defined(HAVE_ALPN) */
+
+PyDoc_STRVAR(_ssl__SSLSocket_compression__doc__,
+"compression($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_COMPRESSION_METHODDEF \
+ {"compression", (PyCFunction)_ssl__SSLSocket_compression, METH_NOARGS, _ssl__SSLSocket_compression__doc__},
+
+static PyObject *
+_ssl__SSLSocket_compression_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_compression(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_compression_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_write__doc__,
+"write($self, b, /)\n"
+"--\n"
+"\n"
+"Writes the bytes-like object b into the SSL object.\n"
+"\n"
+"Returns the number of bytes written.");
+
+#define _SSL__SSLSOCKET_WRITE_METHODDEF \
+ {"write", (PyCFunction)_ssl__SSLSocket_write, METH_O, _ssl__SSLSocket_write__doc__},
+
+static PyObject *
+_ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b);
+
+static PyObject *
+_ssl__SSLSocket_write(PySSLSocket *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer b = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "y*:write", &b))
+ goto exit;
+ return_value = _ssl__SSLSocket_write_impl(self, &b);
+
+exit:
+ /* Cleanup for b */
+ if (b.obj)
+ PyBuffer_Release(&b);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_pending__doc__,
+"pending($self, /)\n"
+"--\n"
+"\n"
+"Returns the number of already decrypted bytes available for read, pending on the connection.");
+
+#define _SSL__SSLSOCKET_PENDING_METHODDEF \
+ {"pending", (PyCFunction)_ssl__SSLSocket_pending, METH_NOARGS, _ssl__SSLSocket_pending__doc__},
+
+static PyObject *
+_ssl__SSLSocket_pending_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_pending(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_pending_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_read__doc__,
+"read(size, [buffer])\n"
+"Read up to size bytes from the SSL socket.");
+
+#define _SSL__SSLSOCKET_READ_METHODDEF \
+ {"read", (PyCFunction)_ssl__SSLSocket_read, METH_VARARGS, _ssl__SSLSocket_read__doc__},
+
+static PyObject *
+_ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
+ Py_buffer *buffer);
+
+static PyObject *
+_ssl__SSLSocket_read(PySSLSocket *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int len;
+ int group_right_1 = 0;
+ Py_buffer buffer = {NULL, NULL};
+
+ switch (PyTuple_GET_SIZE(args)) {
+ case 1:
+ if (!PyArg_ParseTuple(args, "i:read", &len))
+ goto exit;
+ break;
+ case 2:
+ if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer))
+ goto exit;
+ group_right_1 = 1;
+ break;
+ default:
+ PyErr_SetString(PyExc_TypeError, "_ssl._SSLSocket.read requires 1 to 2 arguments");
+ goto exit;
+ }
+ return_value = _ssl__SSLSocket_read_impl(self, len, group_right_1, &buffer);
+
+exit:
+ /* Cleanup for buffer */
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_shutdown__doc__,
+"shutdown($self, /)\n"
+"--\n"
+"\n"
+"Does the SSL shutdown handshake with the remote end.\n"
+"\n"
+"Returns the underlying socket object.");
+
+#define _SSL__SSLSOCKET_SHUTDOWN_METHODDEF \
+ {"shutdown", (PyCFunction)_ssl__SSLSocket_shutdown, METH_NOARGS, _ssl__SSLSocket_shutdown__doc__},
+
+static PyObject *
+_ssl__SSLSocket_shutdown_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_shutdown(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_shutdown_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_tls_unique_cb__doc__,
+"tls_unique_cb($self, /)\n"
+"--\n"
+"\n"
+"Returns the \'tls-unique\' channel binding data, as defined by RFC 5929.\n"
+"\n"
+"If the TLS handshake is not yet complete, None is returned.");
+
+#define _SSL__SSLSOCKET_TLS_UNIQUE_CB_METHODDEF \
+ {"tls_unique_cb", (PyCFunction)_ssl__SSLSocket_tls_unique_cb, METH_NOARGS, _ssl__SSLSocket_tls_unique_cb__doc__},
+
+static PyObject *
+_ssl__SSLSocket_tls_unique_cb_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_tls_unique_cb(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLSocket_tls_unique_cb_impl(self);
+}
+
+static PyObject *
+_ssl__SSLContext_impl(PyTypeObject *type, int proto_version);
+
+static PyObject *
+_ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ int proto_version;
+
+ if ((type == &PySSLContext_Type) &&
+ !_PyArg_NoKeywords("_SSLContext", kwargs))
+ goto exit;
+ if (!PyArg_ParseTuple(args, "i:_SSLContext",
+ &proto_version))
+ goto exit;
+ return_value = _ssl__SSLContext_impl(type, proto_version);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_set_ciphers__doc__,
+"set_ciphers($self, cipherlist, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_SET_CIPHERS_METHODDEF \
+ {"set_ciphers", (PyCFunction)_ssl__SSLContext_set_ciphers, METH_O, _ssl__SSLContext_set_ciphers__doc__},
+
+static PyObject *
+_ssl__SSLContext_set_ciphers_impl(PySSLContext *self, const char *cipherlist);
+
+static PyObject *
+_ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *cipherlist;
+
+ if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist))
+ goto exit;
+ return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext__set_npn_protocols__doc__,
+"_set_npn_protocols($self, protos, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT__SET_NPN_PROTOCOLS_METHODDEF \
+ {"_set_npn_protocols", (PyCFunction)_ssl__SSLContext__set_npn_protocols, METH_O, _ssl__SSLContext__set_npn_protocols__doc__},
+
+static PyObject *
+_ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self,
+ Py_buffer *protos);
+
+static PyObject *
+_ssl__SSLContext__set_npn_protocols(PySSLContext *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer protos = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos))
+ goto exit;
+ return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos);
+
+exit:
+ /* Cleanup for protos */
+ if (protos.obj)
+ PyBuffer_Release(&protos);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext__set_alpn_protocols__doc__,
+"_set_alpn_protocols($self, protos, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT__SET_ALPN_PROTOCOLS_METHODDEF \
+ {"_set_alpn_protocols", (PyCFunction)_ssl__SSLContext__set_alpn_protocols, METH_O, _ssl__SSLContext__set_alpn_protocols__doc__},
+
+static PyObject *
+_ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self,
+ Py_buffer *protos);
+
+static PyObject *
+_ssl__SSLContext__set_alpn_protocols(PySSLContext *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer protos = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos))
+ goto exit;
+ return_value = _ssl__SSLContext__set_alpn_protocols_impl(self, &protos);
+
+exit:
+ /* Cleanup for protos */
+ if (protos.obj)
+ PyBuffer_Release(&protos);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_load_cert_chain__doc__,
+"load_cert_chain($self, /, certfile, keyfile=None, password=None)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_LOAD_CERT_CHAIN_METHODDEF \
+ {"load_cert_chain", (PyCFunction)_ssl__SSLContext_load_cert_chain, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext_load_cert_chain__doc__},
+
+static PyObject *
+_ssl__SSLContext_load_cert_chain_impl(PySSLContext *self, PyObject *certfile,
+ PyObject *keyfile, PyObject *password);
+
+static PyObject *
+_ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"certfile", "keyfile", "password", NULL};
+ PyObject *certfile;
+ PyObject *keyfile = NULL;
+ PyObject *password = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:load_cert_chain", _keywords,
+ &certfile, &keyfile, &password))
+ goto exit;
+ return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_load_verify_locations__doc__,
+"load_verify_locations($self, /, cafile=None, capath=None, cadata=None)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_LOAD_VERIFY_LOCATIONS_METHODDEF \
+ {"load_verify_locations", (PyCFunction)_ssl__SSLContext_load_verify_locations, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext_load_verify_locations__doc__},
+
+static PyObject *
+_ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
+ PyObject *cafile,
+ PyObject *capath,
+ PyObject *cadata);
+
+static PyObject *
+_ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"cafile", "capath", "cadata", NULL};
+ PyObject *cafile = NULL;
+ PyObject *capath = NULL;
+ PyObject *cadata = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:load_verify_locations", _keywords,
+ &cafile, &capath, &cadata))
+ goto exit;
+ return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_load_dh_params__doc__,
+"load_dh_params($self, path, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_LOAD_DH_PARAMS_METHODDEF \
+ {"load_dh_params", (PyCFunction)_ssl__SSLContext_load_dh_params, METH_O, _ssl__SSLContext_load_dh_params__doc__},
+
+PyDoc_STRVAR(_ssl__SSLContext__wrap_socket__doc__,
+"_wrap_socket($self, /, sock, server_side, server_hostname=None)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT__WRAP_SOCKET_METHODDEF \
+ {"_wrap_socket", (PyCFunction)_ssl__SSLContext__wrap_socket, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext__wrap_socket__doc__},
+
+static PyObject *
+_ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock,
+ int server_side, PyObject *hostname_obj);
+
+static PyObject *
+_ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"sock", "server_side", "server_hostname", NULL};
+ PyObject *sock;
+ int server_side;
+ PyObject *hostname_obj = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!i|O:_wrap_socket", _keywords,
+ PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj))
+ goto exit;
+ return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext__wrap_bio__doc__,
+"_wrap_bio($self, /, incoming, outgoing, server_side,\n"
+" server_hostname=None)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT__WRAP_BIO_METHODDEF \
+ {"_wrap_bio", (PyCFunction)_ssl__SSLContext__wrap_bio, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext__wrap_bio__doc__},
+
+static PyObject *
+_ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming,
+ PySSLMemoryBIO *outgoing, int server_side,
+ PyObject *hostname_obj);
+
+static PyObject *
+_ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", NULL};
+ PySSLMemoryBIO *incoming;
+ PySSLMemoryBIO *outgoing;
+ int server_side;
+ PyObject *hostname_obj = Py_None;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!i|O:_wrap_bio", _keywords,
+ &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj))
+ goto exit;
+ return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_session_stats__doc__,
+"session_stats($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_SESSION_STATS_METHODDEF \
+ {"session_stats", (PyCFunction)_ssl__SSLContext_session_stats, METH_NOARGS, _ssl__SSLContext_session_stats__doc__},
+
+static PyObject *
+_ssl__SSLContext_session_stats_impl(PySSLContext *self);
+
+static PyObject *
+_ssl__SSLContext_session_stats(PySSLContext *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLContext_session_stats_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_set_default_verify_paths__doc__,
+"set_default_verify_paths($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_SET_DEFAULT_VERIFY_PATHS_METHODDEF \
+ {"set_default_verify_paths", (PyCFunction)_ssl__SSLContext_set_default_verify_paths, METH_NOARGS, _ssl__SSLContext_set_default_verify_paths__doc__},
+
+static PyObject *
+_ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self);
+
+static PyObject *
+_ssl__SSLContext_set_default_verify_paths(PySSLContext *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLContext_set_default_verify_paths_impl(self);
+}
+
+#if !defined(OPENSSL_NO_ECDH)
+
+PyDoc_STRVAR(_ssl__SSLContext_set_ecdh_curve__doc__,
+"set_ecdh_curve($self, name, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF \
+ {"set_ecdh_curve", (PyCFunction)_ssl__SSLContext_set_ecdh_curve, METH_O, _ssl__SSLContext_set_ecdh_curve__doc__},
+
+#endif /* !defined(OPENSSL_NO_ECDH) */
+
+PyDoc_STRVAR(_ssl__SSLContext_set_servername_callback__doc__,
+"set_servername_callback($self, method, /)\n"
+"--\n"
+"\n"
+"Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.\n"
+"\n"
+"If the argument is None then the callback is disabled. The method is called\n"
+"with the SSLSocket, the server name as a string, and the SSLContext object.\n"
+"See RFC 6066 for details of the SNI extension.");
+
+#define _SSL__SSLCONTEXT_SET_SERVERNAME_CALLBACK_METHODDEF \
+ {"set_servername_callback", (PyCFunction)_ssl__SSLContext_set_servername_callback, METH_O, _ssl__SSLContext_set_servername_callback__doc__},
+
+PyDoc_STRVAR(_ssl__SSLContext_cert_store_stats__doc__,
+"cert_store_stats($self, /)\n"
+"--\n"
+"\n"
+"Returns quantities of loaded X.509 certificates.\n"
+"\n"
+"X.509 certificates with a CA extension and certificate revocation lists\n"
+"inside the context\'s cert store.\n"
+"\n"
+"NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
+"been used at least once.");
+
+#define _SSL__SSLCONTEXT_CERT_STORE_STATS_METHODDEF \
+ {"cert_store_stats", (PyCFunction)_ssl__SSLContext_cert_store_stats, METH_NOARGS, _ssl__SSLContext_cert_store_stats__doc__},
+
+static PyObject *
+_ssl__SSLContext_cert_store_stats_impl(PySSLContext *self);
+
+static PyObject *
+_ssl__SSLContext_cert_store_stats(PySSLContext *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLContext_cert_store_stats_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLContext_get_ca_certs__doc__,
+"get_ca_certs($self, /, binary_form=False)\n"
+"--\n"
+"\n"
+"Returns a list of dicts with information of loaded CA certs.\n"
+"\n"
+"If the optional argument is True, returns a DER-encoded copy of the CA\n"
+"certificate.\n"
+"\n"
+"NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
+"been used at least once.");
+
+#define _SSL__SSLCONTEXT_GET_CA_CERTS_METHODDEF \
+ {"get_ca_certs", (PyCFunction)_ssl__SSLContext_get_ca_certs, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext_get_ca_certs__doc__},
+
+static PyObject *
+_ssl__SSLContext_get_ca_certs_impl(PySSLContext *self, int binary_form);
+
+static PyObject *
+_ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"binary_form", NULL};
+ int binary_form = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:get_ca_certs", _keywords,
+ &binary_form))
+ goto exit;
+ return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
+
+exit:
+ return return_value;
+}
+
+static PyObject *
+_ssl_MemoryBIO_impl(PyTypeObject *type);
+
+static PyObject *
+_ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+
+ if ((type == &PySSLMemoryBIO_Type) &&
+ !_PyArg_NoPositional("MemoryBIO", args))
+ goto exit;
+ if ((type == &PySSLMemoryBIO_Type) &&
+ !_PyArg_NoKeywords("MemoryBIO", kwargs))
+ goto exit;
+ return_value = _ssl_MemoryBIO_impl(type);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_MemoryBIO_read__doc__,
+"read($self, size=-1, /)\n"
+"--\n"
+"\n"
+"Read up to size bytes from the memory BIO.\n"
+"\n"
+"If size is not specified, read the entire buffer.\n"
+"If the return value is an empty bytes instance, this means either\n"
+"EOF or that no data is available. Use the \"eof\" property to\n"
+"distinguish between the two.");
+
+#define _SSL_MEMORYBIO_READ_METHODDEF \
+ {"read", (PyCFunction)_ssl_MemoryBIO_read, METH_VARARGS, _ssl_MemoryBIO_read__doc__},
+
+static PyObject *
+_ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len);
+
+static PyObject *
+_ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int len = -1;
+
+ if (!PyArg_ParseTuple(args, "|i:read",
+ &len))
+ goto exit;
+ return_value = _ssl_MemoryBIO_read_impl(self, len);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_MemoryBIO_write__doc__,
+"write($self, b, /)\n"
+"--\n"
+"\n"
+"Writes the bytes b into the memory BIO.\n"
+"\n"
+"Returns the number of bytes written.");
+
+#define _SSL_MEMORYBIO_WRITE_METHODDEF \
+ {"write", (PyCFunction)_ssl_MemoryBIO_write, METH_O, _ssl_MemoryBIO_write__doc__},
+
+static PyObject *
+_ssl_MemoryBIO_write_impl(PySSLMemoryBIO *self, Py_buffer *b);
+
+static PyObject *
+_ssl_MemoryBIO_write(PySSLMemoryBIO *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer b = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "y*:write", &b))
+ goto exit;
+ return_value = _ssl_MemoryBIO_write_impl(self, &b);
+
+exit:
+ /* Cleanup for b */
+ if (b.obj)
+ PyBuffer_Release(&b);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_MemoryBIO_write_eof__doc__,
+"write_eof($self, /)\n"
+"--\n"
+"\n"
+"Write an EOF marker to the memory BIO.\n"
+"\n"
+"When all data has been read, the \"eof\" property will be True.");
+
+#define _SSL_MEMORYBIO_WRITE_EOF_METHODDEF \
+ {"write_eof", (PyCFunction)_ssl_MemoryBIO_write_eof, METH_NOARGS, _ssl_MemoryBIO_write_eof__doc__},
+
+static PyObject *
+_ssl_MemoryBIO_write_eof_impl(PySSLMemoryBIO *self);
+
+static PyObject *
+_ssl_MemoryBIO_write_eof(PySSLMemoryBIO *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl_MemoryBIO_write_eof_impl(self);
+}
+
+PyDoc_STRVAR(_ssl_RAND_add__doc__,
+"RAND_add($module, string, entropy, /)\n"
+"--\n"
+"\n"
+"Mix string into the OpenSSL PRNG state.\n"
+"\n"
+"entropy (a float) is a lower bound on the entropy contained in\n"
+"string. See RFC 1750.");
+
+#define _SSL_RAND_ADD_METHODDEF \
+ {"RAND_add", (PyCFunction)_ssl_RAND_add, METH_VARARGS, _ssl_RAND_add__doc__},
+
+static PyObject *
+_ssl_RAND_add_impl(PyModuleDef *module, Py_buffer *view, double entropy);
+
+static PyObject *
+_ssl_RAND_add(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer view = {NULL, NULL};
+ double entropy;
+
+ if (!PyArg_ParseTuple(args, "s*d:RAND_add",
+ &view, &entropy))
+ goto exit;
+ return_value = _ssl_RAND_add_impl(module, &view, entropy);
+
+exit:
+ /* Cleanup for view */
+ if (view.obj)
+ PyBuffer_Release(&view);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_RAND_bytes__doc__,
+"RAND_bytes($module, n, /)\n"
+"--\n"
+"\n"
+"Generate n cryptographically strong pseudo-random bytes.");
+
+#define _SSL_RAND_BYTES_METHODDEF \
+ {"RAND_bytes", (PyCFunction)_ssl_RAND_bytes, METH_O, _ssl_RAND_bytes__doc__},
+
+static PyObject *
+_ssl_RAND_bytes_impl(PyModuleDef *module, int n);
+
+static PyObject *
+_ssl_RAND_bytes(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int n;
+
+ if (!PyArg_Parse(arg, "i:RAND_bytes", &n))
+ goto exit;
+ return_value = _ssl_RAND_bytes_impl(module, n);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_RAND_pseudo_bytes__doc__,
+"RAND_pseudo_bytes($module, n, /)\n"
+"--\n"
+"\n"
+"Generate n pseudo-random bytes.\n"
+"\n"
+"Return a pair (bytes, is_cryptographic). is_cryptographic is True\n"
+"if the bytes generated are cryptographically strong.");
+
+#define _SSL_RAND_PSEUDO_BYTES_METHODDEF \
+ {"RAND_pseudo_bytes", (PyCFunction)_ssl_RAND_pseudo_bytes, METH_O, _ssl_RAND_pseudo_bytes__doc__},
+
+static PyObject *
+_ssl_RAND_pseudo_bytes_impl(PyModuleDef *module, int n);
+
+static PyObject *
+_ssl_RAND_pseudo_bytes(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int n;
+
+ if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n))
+ goto exit;
+ return_value = _ssl_RAND_pseudo_bytes_impl(module, n);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_RAND_status__doc__,
+"RAND_status($module, /)\n"
+"--\n"
+"\n"
+"Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n"
+"\n"
+"It is necessary to seed the PRNG with RAND_add() on some platforms before\n"
+"using the ssl() function.");
+
+#define _SSL_RAND_STATUS_METHODDEF \
+ {"RAND_status", (PyCFunction)_ssl_RAND_status, METH_NOARGS, _ssl_RAND_status__doc__},
+
+static PyObject *
+_ssl_RAND_status_impl(PyModuleDef *module);
+
+static PyObject *
+_ssl_RAND_status(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl_RAND_status_impl(module);
+}
+
+#if defined(HAVE_RAND_EGD)
+
+PyDoc_STRVAR(_ssl_RAND_egd__doc__,
+"RAND_egd($module, path, /)\n"
+"--\n"
+"\n"
+"Queries the entropy gather daemon (EGD) on the socket named by \'path\'.\n"
+"\n"
+"Returns number of bytes read. Raises SSLError if connection to EGD\n"
+"fails or if it does not provide enough data to seed PRNG.");
+
+#define _SSL_RAND_EGD_METHODDEF \
+ {"RAND_egd", (PyCFunction)_ssl_RAND_egd, METH_O, _ssl_RAND_egd__doc__},
+
+static PyObject *
+_ssl_RAND_egd_impl(PyModuleDef *module, PyObject *path);
+
+static PyObject *
+_ssl_RAND_egd(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *path;
+
+ if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path))
+ goto exit;
+ return_value = _ssl_RAND_egd_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_RAND_EGD) */
+
+PyDoc_STRVAR(_ssl_get_default_verify_paths__doc__,
+"get_default_verify_paths($module, /)\n"
+"--\n"
+"\n"
+"Return search paths and environment vars that are used by SSLContext\'s set_default_verify_paths() to load default CAs.\n"
+"\n"
+"The values are \'cert_file_env\', \'cert_file\', \'cert_dir_env\', \'cert_dir\'.");
+
+#define _SSL_GET_DEFAULT_VERIFY_PATHS_METHODDEF \
+ {"get_default_verify_paths", (PyCFunction)_ssl_get_default_verify_paths, METH_NOARGS, _ssl_get_default_verify_paths__doc__},
+
+static PyObject *
+_ssl_get_default_verify_paths_impl(PyModuleDef *module);
+
+static PyObject *
+_ssl_get_default_verify_paths(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl_get_default_verify_paths_impl(module);
+}
+
+PyDoc_STRVAR(_ssl_txt2obj__doc__,
+"txt2obj($module, /, txt, name=False)\n"
+"--\n"
+"\n"
+"Lookup NID, short name, long name and OID of an ASN1_OBJECT.\n"
+"\n"
+"By default objects are looked up by OID. With name=True short and\n"
+"long name are also matched.");
+
+#define _SSL_TXT2OBJ_METHODDEF \
+ {"txt2obj", (PyCFunction)_ssl_txt2obj, METH_VARARGS|METH_KEYWORDS, _ssl_txt2obj__doc__},
+
+static PyObject *
+_ssl_txt2obj_impl(PyModuleDef *module, const char *txt, int name);
+
+static PyObject *
+_ssl_txt2obj(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"txt", "name", NULL};
+ const char *txt;
+ int name = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|p:txt2obj", _keywords,
+ &txt, &name))
+ goto exit;
+ return_value = _ssl_txt2obj_impl(module, txt, name);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_ssl_nid2obj__doc__,
+"nid2obj($module, nid, /)\n"
+"--\n"
+"\n"
+"Lookup NID, short name, long name and OID of an ASN1_OBJECT by NID.");
+
+#define _SSL_NID2OBJ_METHODDEF \
+ {"nid2obj", (PyCFunction)_ssl_nid2obj, METH_O, _ssl_nid2obj__doc__},
+
+static PyObject *
+_ssl_nid2obj_impl(PyModuleDef *module, int nid);
+
+static PyObject *
+_ssl_nid2obj(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int nid;
+
+ if (!PyArg_Parse(arg, "i:nid2obj", &nid))
+ goto exit;
+ return_value = _ssl_nid2obj_impl(module, nid);
+
+exit:
+ return return_value;
+}
+
+#if defined(_MSC_VER)
+
+PyDoc_STRVAR(_ssl_enum_certificates__doc__,
+"enum_certificates($module, /, store_name)\n"
+"--\n"
+"\n"
+"Retrieve certificates from Windows\' cert store.\n"
+"\n"
+"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may provide\n"
+"more cert storages, too. The function returns a list of (bytes,\n"
+"encoding_type, trust) tuples. The encoding_type flag can be interpreted\n"
+"with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either\n"
+"a set of OIDs or the boolean True.");
+
+#define _SSL_ENUM_CERTIFICATES_METHODDEF \
+ {"enum_certificates", (PyCFunction)_ssl_enum_certificates, METH_VARARGS|METH_KEYWORDS, _ssl_enum_certificates__doc__},
+
+static PyObject *
+_ssl_enum_certificates_impl(PyModuleDef *module, const char *store_name);
+
+static PyObject *
+_ssl_enum_certificates(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"store_name", NULL};
+ const char *store_name;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_certificates", _keywords,
+ &store_name))
+ goto exit;
+ return_value = _ssl_enum_certificates_impl(module, store_name);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(_MSC_VER) */
+
+#if defined(_MSC_VER)
+
+PyDoc_STRVAR(_ssl_enum_crls__doc__,
+"enum_crls($module, /, store_name)\n"
+"--\n"
+"\n"
+"Retrieve CRLs from Windows\' cert store.\n"
+"\n"
+"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may provide\n"
+"more cert storages, too. The function returns a list of (bytes,\n"
+"encoding_type) tuples. The encoding_type flag can be interpreted with\n"
+"X509_ASN_ENCODING or PKCS_7_ASN_ENCODING.");
+
+#define _SSL_ENUM_CRLS_METHODDEF \
+ {"enum_crls", (PyCFunction)_ssl_enum_crls, METH_VARARGS|METH_KEYWORDS, _ssl_enum_crls__doc__},
+
+static PyObject *
+_ssl_enum_crls_impl(PyModuleDef *module, const char *store_name);
+
+static PyObject *
+_ssl_enum_crls(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"store_name", NULL};
+ const char *store_name;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_crls", _keywords,
+ &store_name))
+ goto exit;
+ return_value = _ssl_enum_crls_impl(module, store_name);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(_MSC_VER) */
+
+#ifndef _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
+ #define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
+#endif /* !defined(_SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF) */
+
+#ifndef _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
+ #define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
+#endif /* !defined(_SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF) */
+
+#ifndef _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
+ #define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
+#endif /* !defined(_SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF) */
+
+#ifndef _SSL_RAND_EGD_METHODDEF
+ #define _SSL_RAND_EGD_METHODDEF
+#endif /* !defined(_SSL_RAND_EGD_METHODDEF) */
+
+#ifndef _SSL_ENUM_CERTIFICATES_METHODDEF
+ #define _SSL_ENUM_CERTIFICATES_METHODDEF
+#endif /* !defined(_SSL_ENUM_CERTIFICATES_METHODDEF) */
+
+#ifndef _SSL_ENUM_CRLS_METHODDEF
+ #define _SSL_ENUM_CRLS_METHODDEF
+#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
+/*[clinic end generated code: output=a14999cb565a69a2 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h
new file mode 100644
index 0000000..7917dec
--- /dev/null
+++ b/Modules/clinic/_tkinter.c.h
@@ -0,0 +1,624 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_tkinter_tkapp_eval__doc__,
+"eval($self, script, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EVAL_METHODDEF \
+ {"eval", (PyCFunction)_tkinter_tkapp_eval, METH_O, _tkinter_tkapp_eval__doc__},
+
+static PyObject *
+_tkinter_tkapp_eval_impl(TkappObject *self, const char *script);
+
+static PyObject *
+_tkinter_tkapp_eval(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *script;
+
+ if (!PyArg_Parse(arg, "s:eval", &script))
+ goto exit;
+ return_value = _tkinter_tkapp_eval_impl(self, script);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_evalfile__doc__,
+"evalfile($self, fileName, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EVALFILE_METHODDEF \
+ {"evalfile", (PyCFunction)_tkinter_tkapp_evalfile, METH_O, _tkinter_tkapp_evalfile__doc__},
+
+static PyObject *
+_tkinter_tkapp_evalfile_impl(TkappObject *self, const char *fileName);
+
+static PyObject *
+_tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *fileName;
+
+ if (!PyArg_Parse(arg, "s:evalfile", &fileName))
+ goto exit;
+ return_value = _tkinter_tkapp_evalfile_impl(self, fileName);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_record__doc__,
+"record($self, script, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_RECORD_METHODDEF \
+ {"record", (PyCFunction)_tkinter_tkapp_record, METH_O, _tkinter_tkapp_record__doc__},
+
+static PyObject *
+_tkinter_tkapp_record_impl(TkappObject *self, const char *script);
+
+static PyObject *
+_tkinter_tkapp_record(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *script;
+
+ if (!PyArg_Parse(arg, "s:record", &script))
+ goto exit;
+ return_value = _tkinter_tkapp_record_impl(self, script);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_adderrinfo__doc__,
+"adderrinfo($self, msg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_ADDERRINFO_METHODDEF \
+ {"adderrinfo", (PyCFunction)_tkinter_tkapp_adderrinfo, METH_O, _tkinter_tkapp_adderrinfo__doc__},
+
+static PyObject *
+_tkinter_tkapp_adderrinfo_impl(TkappObject *self, const char *msg);
+
+static PyObject *
+_tkinter_tkapp_adderrinfo(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *msg;
+
+ if (!PyArg_Parse(arg, "s:adderrinfo", &msg))
+ goto exit;
+ return_value = _tkinter_tkapp_adderrinfo_impl(self, msg);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_getint__doc__,
+"getint($self, arg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_GETINT_METHODDEF \
+ {"getint", (PyCFunction)_tkinter_tkapp_getint, METH_O, _tkinter_tkapp_getint__doc__},
+
+PyDoc_STRVAR(_tkinter_tkapp_getdouble__doc__,
+"getdouble($self, arg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_GETDOUBLE_METHODDEF \
+ {"getdouble", (PyCFunction)_tkinter_tkapp_getdouble, METH_O, _tkinter_tkapp_getdouble__doc__},
+
+PyDoc_STRVAR(_tkinter_tkapp_getboolean__doc__,
+"getboolean($self, arg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_GETBOOLEAN_METHODDEF \
+ {"getboolean", (PyCFunction)_tkinter_tkapp_getboolean, METH_O, _tkinter_tkapp_getboolean__doc__},
+
+PyDoc_STRVAR(_tkinter_tkapp_exprstring__doc__,
+"exprstring($self, s, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EXPRSTRING_METHODDEF \
+ {"exprstring", (PyCFunction)_tkinter_tkapp_exprstring, METH_O, _tkinter_tkapp_exprstring__doc__},
+
+static PyObject *
+_tkinter_tkapp_exprstring_impl(TkappObject *self, const char *s);
+
+static PyObject *
+_tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *s;
+
+ if (!PyArg_Parse(arg, "s:exprstring", &s))
+ goto exit;
+ return_value = _tkinter_tkapp_exprstring_impl(self, s);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_exprlong__doc__,
+"exprlong($self, s, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EXPRLONG_METHODDEF \
+ {"exprlong", (PyCFunction)_tkinter_tkapp_exprlong, METH_O, _tkinter_tkapp_exprlong__doc__},
+
+static PyObject *
+_tkinter_tkapp_exprlong_impl(TkappObject *self, const char *s);
+
+static PyObject *
+_tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *s;
+
+ if (!PyArg_Parse(arg, "s:exprlong", &s))
+ goto exit;
+ return_value = _tkinter_tkapp_exprlong_impl(self, s);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_exprdouble__doc__,
+"exprdouble($self, s, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EXPRDOUBLE_METHODDEF \
+ {"exprdouble", (PyCFunction)_tkinter_tkapp_exprdouble, METH_O, _tkinter_tkapp_exprdouble__doc__},
+
+static PyObject *
+_tkinter_tkapp_exprdouble_impl(TkappObject *self, const char *s);
+
+static PyObject *
+_tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *s;
+
+ if (!PyArg_Parse(arg, "s:exprdouble", &s))
+ goto exit;
+ return_value = _tkinter_tkapp_exprdouble_impl(self, s);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_exprboolean__doc__,
+"exprboolean($self, s, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_EXPRBOOLEAN_METHODDEF \
+ {"exprboolean", (PyCFunction)_tkinter_tkapp_exprboolean, METH_O, _tkinter_tkapp_exprboolean__doc__},
+
+static PyObject *
+_tkinter_tkapp_exprboolean_impl(TkappObject *self, const char *s);
+
+static PyObject *
+_tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *s;
+
+ if (!PyArg_Parse(arg, "s:exprboolean", &s))
+ goto exit;
+ return_value = _tkinter_tkapp_exprboolean_impl(self, s);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_splitlist__doc__,
+"splitlist($self, arg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_SPLITLIST_METHODDEF \
+ {"splitlist", (PyCFunction)_tkinter_tkapp_splitlist, METH_O, _tkinter_tkapp_splitlist__doc__},
+
+PyDoc_STRVAR(_tkinter_tkapp_split__doc__,
+"split($self, arg, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_SPLIT_METHODDEF \
+ {"split", (PyCFunction)_tkinter_tkapp_split, METH_O, _tkinter_tkapp_split__doc__},
+
+PyDoc_STRVAR(_tkinter_tkapp_createcommand__doc__,
+"createcommand($self, name, func, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_CREATECOMMAND_METHODDEF \
+ {"createcommand", (PyCFunction)_tkinter_tkapp_createcommand, METH_VARARGS, _tkinter_tkapp_createcommand__doc__},
+
+static PyObject *
+_tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name,
+ PyObject *func);
+
+static PyObject *
+_tkinter_tkapp_createcommand(TkappObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *name;
+ PyObject *func;
+
+ if (!PyArg_ParseTuple(args, "sO:createcommand",
+ &name, &func))
+ goto exit;
+ return_value = _tkinter_tkapp_createcommand_impl(self, name, func);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_deletecommand__doc__,
+"deletecommand($self, name, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_DELETECOMMAND_METHODDEF \
+ {"deletecommand", (PyCFunction)_tkinter_tkapp_deletecommand, METH_O, _tkinter_tkapp_deletecommand__doc__},
+
+static PyObject *
+_tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name);
+
+static PyObject *
+_tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *name;
+
+ if (!PyArg_Parse(arg, "s:deletecommand", &name))
+ goto exit;
+ return_value = _tkinter_tkapp_deletecommand_impl(self, name);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_CREATEFILEHANDLER)
+
+PyDoc_STRVAR(_tkinter_tkapp_createfilehandler__doc__,
+"createfilehandler($self, file, mask, func, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF \
+ {"createfilehandler", (PyCFunction)_tkinter_tkapp_createfilehandler, METH_VARARGS, _tkinter_tkapp_createfilehandler__doc__},
+
+static PyObject *
+_tkinter_tkapp_createfilehandler_impl(TkappObject *self, PyObject *file,
+ int mask, PyObject *func);
+
+static PyObject *
+_tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *file;
+ int mask;
+ PyObject *func;
+
+ if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
+ &file, &mask, &func))
+ goto exit;
+ return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CREATEFILEHANDLER) */
+
+#if defined(HAVE_CREATEFILEHANDLER)
+
+PyDoc_STRVAR(_tkinter_tkapp_deletefilehandler__doc__,
+"deletefilehandler($self, file, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF \
+ {"deletefilehandler", (PyCFunction)_tkinter_tkapp_deletefilehandler, METH_O, _tkinter_tkapp_deletefilehandler__doc__},
+
+#endif /* defined(HAVE_CREATEFILEHANDLER) */
+
+PyDoc_STRVAR(_tkinter_tktimertoken_deletetimerhandler__doc__,
+"deletetimerhandler($self, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKTIMERTOKEN_DELETETIMERHANDLER_METHODDEF \
+ {"deletetimerhandler", (PyCFunction)_tkinter_tktimertoken_deletetimerhandler, METH_NOARGS, _tkinter_tktimertoken_deletetimerhandler__doc__},
+
+static PyObject *
+_tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self);
+
+static PyObject *
+_tkinter_tktimertoken_deletetimerhandler(TkttObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _tkinter_tktimertoken_deletetimerhandler_impl(self);
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_createtimerhandler__doc__,
+"createtimerhandler($self, milliseconds, func, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_CREATETIMERHANDLER_METHODDEF \
+ {"createtimerhandler", (PyCFunction)_tkinter_tkapp_createtimerhandler, METH_VARARGS, _tkinter_tkapp_createtimerhandler__doc__},
+
+static PyObject *
+_tkinter_tkapp_createtimerhandler_impl(TkappObject *self, int milliseconds,
+ PyObject *func);
+
+static PyObject *
+_tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int milliseconds;
+ PyObject *func;
+
+ if (!PyArg_ParseTuple(args, "iO:createtimerhandler",
+ &milliseconds, &func))
+ goto exit;
+ return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_mainloop__doc__,
+"mainloop($self, threshold=0, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_MAINLOOP_METHODDEF \
+ {"mainloop", (PyCFunction)_tkinter_tkapp_mainloop, METH_VARARGS, _tkinter_tkapp_mainloop__doc__},
+
+static PyObject *
+_tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold);
+
+static PyObject *
+_tkinter_tkapp_mainloop(TkappObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int threshold = 0;
+
+ if (!PyArg_ParseTuple(args, "|i:mainloop",
+ &threshold))
+ goto exit;
+ return_value = _tkinter_tkapp_mainloop_impl(self, threshold);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_dooneevent__doc__,
+"dooneevent($self, flags=0, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_DOONEEVENT_METHODDEF \
+ {"dooneevent", (PyCFunction)_tkinter_tkapp_dooneevent, METH_VARARGS, _tkinter_tkapp_dooneevent__doc__},
+
+static PyObject *
+_tkinter_tkapp_dooneevent_impl(TkappObject *self, int flags);
+
+static PyObject *
+_tkinter_tkapp_dooneevent(TkappObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int flags = 0;
+
+ if (!PyArg_ParseTuple(args, "|i:dooneevent",
+ &flags))
+ goto exit;
+ return_value = _tkinter_tkapp_dooneevent_impl(self, flags);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_quit__doc__,
+"quit($self, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_QUIT_METHODDEF \
+ {"quit", (PyCFunction)_tkinter_tkapp_quit, METH_NOARGS, _tkinter_tkapp_quit__doc__},
+
+static PyObject *
+_tkinter_tkapp_quit_impl(TkappObject *self);
+
+static PyObject *
+_tkinter_tkapp_quit(TkappObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _tkinter_tkapp_quit_impl(self);
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_interpaddr__doc__,
+"interpaddr($self, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_INTERPADDR_METHODDEF \
+ {"interpaddr", (PyCFunction)_tkinter_tkapp_interpaddr, METH_NOARGS, _tkinter_tkapp_interpaddr__doc__},
+
+static PyObject *
+_tkinter_tkapp_interpaddr_impl(TkappObject *self);
+
+static PyObject *
+_tkinter_tkapp_interpaddr(TkappObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _tkinter_tkapp_interpaddr_impl(self);
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_loadtk__doc__,
+"loadtk($self, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_LOADTK_METHODDEF \
+ {"loadtk", (PyCFunction)_tkinter_tkapp_loadtk, METH_NOARGS, _tkinter_tkapp_loadtk__doc__},
+
+static PyObject *
+_tkinter_tkapp_loadtk_impl(TkappObject *self);
+
+static PyObject *
+_tkinter_tkapp_loadtk(TkappObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _tkinter_tkapp_loadtk_impl(self);
+}
+
+PyDoc_STRVAR(_tkinter_tkapp_willdispatch__doc__,
+"willdispatch($self, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER_TKAPP_WILLDISPATCH_METHODDEF \
+ {"willdispatch", (PyCFunction)_tkinter_tkapp_willdispatch, METH_NOARGS, _tkinter_tkapp_willdispatch__doc__},
+
+static PyObject *
+_tkinter_tkapp_willdispatch_impl(TkappObject *self);
+
+static PyObject *
+_tkinter_tkapp_willdispatch(TkappObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _tkinter_tkapp_willdispatch_impl(self);
+}
+
+PyDoc_STRVAR(_tkinter__flatten__doc__,
+"_flatten($module, item, /)\n"
+"--\n"
+"\n");
+
+#define _TKINTER__FLATTEN_METHODDEF \
+ {"_flatten", (PyCFunction)_tkinter__flatten, METH_O, _tkinter__flatten__doc__},
+
+PyDoc_STRVAR(_tkinter_create__doc__,
+"create($module, screenName=None, baseName=None, className=\'Tk\',\n"
+" interactive=False, wantobjects=False, wantTk=True, sync=False,\n"
+" use=None, /)\n"
+"--\n"
+"\n"
+"\n"
+"\n"
+" wantTk\n"
+" if false, then Tk_Init() doesn\'t get called\n"
+" sync\n"
+" if true, then pass -sync to wish\n"
+" use\n"
+" if not None, then pass -use to wish");
+
+#define _TKINTER_CREATE_METHODDEF \
+ {"create", (PyCFunction)_tkinter_create, METH_VARARGS, _tkinter_create__doc__},
+
+static PyObject *
+_tkinter_create_impl(PyModuleDef *module, const char *screenName,
+ const char *baseName, const char *className,
+ int interactive, int wantobjects, int wantTk, int sync,
+ const char *use);
+
+static PyObject *
+_tkinter_create(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *screenName = NULL;
+ const char *baseName = NULL;
+ const char *className = "Tk";
+ int interactive = 0;
+ int wantobjects = 0;
+ int wantTk = 1;
+ int sync = 0;
+ const char *use = NULL;
+
+ if (!PyArg_ParseTuple(args, "|zssiiiiz:create",
+ &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use))
+ goto exit;
+ return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_setbusywaitinterval__doc__,
+"setbusywaitinterval($module, new_val, /)\n"
+"--\n"
+"\n"
+"Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.\n"
+"\n"
+"It should be set to a divisor of the maximum time between frames in an animation.");
+
+#define _TKINTER_SETBUSYWAITINTERVAL_METHODDEF \
+ {"setbusywaitinterval", (PyCFunction)_tkinter_setbusywaitinterval, METH_O, _tkinter_setbusywaitinterval__doc__},
+
+static PyObject *
+_tkinter_setbusywaitinterval_impl(PyModuleDef *module, int new_val);
+
+static PyObject *
+_tkinter_setbusywaitinterval(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int new_val;
+
+ if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val))
+ goto exit;
+ return_value = _tkinter_setbusywaitinterval_impl(module, new_val);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_tkinter_getbusywaitinterval__doc__,
+"getbusywaitinterval($module, /)\n"
+"--\n"
+"\n"
+"Return the current busy-wait interval between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.");
+
+#define _TKINTER_GETBUSYWAITINTERVAL_METHODDEF \
+ {"getbusywaitinterval", (PyCFunction)_tkinter_getbusywaitinterval, METH_NOARGS, _tkinter_getbusywaitinterval__doc__},
+
+static int
+_tkinter_getbusywaitinterval_impl(PyModuleDef *module);
+
+static PyObject *
+_tkinter_getbusywaitinterval(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ int _return_value;
+
+ _return_value = _tkinter_getbusywaitinterval_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#ifndef _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF
+ #define _TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF
+#endif /* !defined(_TKINTER_TKAPP_CREATEFILEHANDLER_METHODDEF) */
+
+#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
+ #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
+#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
+/*[clinic end generated code: output=6dd667b91cf8addd input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h
new file mode 100644
index 0000000..87c701c
--- /dev/null
+++ b/Modules/clinic/_weakref.c.h
@@ -0,0 +1,31 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
+"getweakrefcount($module, object, /)\n"
+"--\n"
+"\n"
+"Return the number of weak references to \'object\'.");
+
+#define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \
+ {"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
+
+static Py_ssize_t
+_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object);
+
+static PyObject *
+_weakref_getweakrefcount(PyModuleDef *module, PyObject *object)
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t _return_value;
+
+ _return_value = _weakref_getweakrefcount_impl(module, object);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=4da9aade63eed77f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h
new file mode 100644
index 0000000..34518e8
--- /dev/null
+++ b/Modules/clinic/_winapi.c.h
@@ -0,0 +1,854 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_winapi_Overlapped_GetOverlappedResult__doc__,
+"GetOverlappedResult($self, wait, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_OVERLAPPED_GETOVERLAPPEDRESULT_METHODDEF \
+ {"GetOverlappedResult", (PyCFunction)_winapi_Overlapped_GetOverlappedResult, METH_O, _winapi_Overlapped_GetOverlappedResult__doc__},
+
+static PyObject *
+_winapi_Overlapped_GetOverlappedResult_impl(OverlappedObject *self, int wait);
+
+static PyObject *
+_winapi_Overlapped_GetOverlappedResult(OverlappedObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int wait;
+
+ if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait))
+ goto exit;
+ return_value = _winapi_Overlapped_GetOverlappedResult_impl(self, wait);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_Overlapped_getbuffer__doc__,
+"getbuffer($self, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_OVERLAPPED_GETBUFFER_METHODDEF \
+ {"getbuffer", (PyCFunction)_winapi_Overlapped_getbuffer, METH_NOARGS, _winapi_Overlapped_getbuffer__doc__},
+
+static PyObject *
+_winapi_Overlapped_getbuffer_impl(OverlappedObject *self);
+
+static PyObject *
+_winapi_Overlapped_getbuffer(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _winapi_Overlapped_getbuffer_impl(self);
+}
+
+PyDoc_STRVAR(_winapi_Overlapped_cancel__doc__,
+"cancel($self, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_OVERLAPPED_CANCEL_METHODDEF \
+ {"cancel", (PyCFunction)_winapi_Overlapped_cancel, METH_NOARGS, _winapi_Overlapped_cancel__doc__},
+
+static PyObject *
+_winapi_Overlapped_cancel_impl(OverlappedObject *self);
+
+static PyObject *
+_winapi_Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
+{
+ return _winapi_Overlapped_cancel_impl(self);
+}
+
+PyDoc_STRVAR(_winapi_CloseHandle__doc__,
+"CloseHandle($module, handle, /)\n"
+"--\n"
+"\n"
+"Close handle.");
+
+#define _WINAPI_CLOSEHANDLE_METHODDEF \
+ {"CloseHandle", (PyCFunction)_winapi_CloseHandle, METH_O, _winapi_CloseHandle__doc__},
+
+static PyObject *
+_winapi_CloseHandle_impl(PyModuleDef *module, HANDLE handle);
+
+static PyObject *
+_winapi_CloseHandle(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ HANDLE handle;
+
+ if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle))
+ goto exit;
+ return_value = _winapi_CloseHandle_impl(module, handle);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_ConnectNamedPipe__doc__,
+"ConnectNamedPipe($module, /, handle, overlapped=False)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_CONNECTNAMEDPIPE_METHODDEF \
+ {"ConnectNamedPipe", (PyCFunction)_winapi_ConnectNamedPipe, METH_VARARGS|METH_KEYWORDS, _winapi_ConnectNamedPipe__doc__},
+
+static PyObject *
+_winapi_ConnectNamedPipe_impl(PyModuleDef *module, HANDLE handle,
+ int use_overlapped);
+
+static PyObject *
+_winapi_ConnectNamedPipe(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"handle", "overlapped", NULL};
+ HANDLE handle;
+ int use_overlapped = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "|i:ConnectNamedPipe", _keywords,
+ &handle, &use_overlapped))
+ goto exit;
+ return_value = _winapi_ConnectNamedPipe_impl(module, handle, use_overlapped);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_CreateFile__doc__,
+"CreateFile($module, file_name, desired_access, share_mode,\n"
+" security_attributes, creation_disposition,\n"
+" flags_and_attributes, template_file, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_CREATEFILE_METHODDEF \
+ {"CreateFile", (PyCFunction)_winapi_CreateFile, METH_VARARGS, _winapi_CreateFile__doc__},
+
+static HANDLE
+_winapi_CreateFile_impl(PyModuleDef *module, LPCTSTR file_name,
+ DWORD desired_access, DWORD share_mode,
+ LPSECURITY_ATTRIBUTES security_attributes,
+ DWORD creation_disposition,
+ DWORD flags_and_attributes, HANDLE template_file);
+
+static PyObject *
+_winapi_CreateFile(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ LPCTSTR file_name;
+ DWORD desired_access;
+ DWORD share_mode;
+ LPSECURITY_ATTRIBUTES security_attributes;
+ DWORD creation_disposition;
+ DWORD flags_and_attributes;
+ HANDLE template_file;
+ HANDLE _return_value;
+
+ if (!PyArg_ParseTuple(args, "skk" F_POINTER "kk" F_HANDLE ":CreateFile",
+ &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file))
+ goto exit;
+ _return_value = _winapi_CreateFile_impl(module, file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_CreateJunction__doc__,
+"CreateJunction($module, src_path, dst_path, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_CREATEJUNCTION_METHODDEF \
+ {"CreateJunction", (PyCFunction)_winapi_CreateJunction, METH_VARARGS, _winapi_CreateJunction__doc__},
+
+static PyObject *
+_winapi_CreateJunction_impl(PyModuleDef *module, LPWSTR src_path,
+ LPWSTR dst_path);
+
+static PyObject *
+_winapi_CreateJunction(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ LPWSTR src_path;
+ LPWSTR dst_path;
+
+ if (!PyArg_ParseTuple(args, "uu:CreateJunction",
+ &src_path, &dst_path))
+ goto exit;
+ return_value = _winapi_CreateJunction_impl(module, src_path, dst_path);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_CreateNamedPipe__doc__,
+"CreateNamedPipe($module, name, open_mode, pipe_mode, max_instances,\n"
+" out_buffer_size, in_buffer_size, default_timeout,\n"
+" security_attributes, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_CREATENAMEDPIPE_METHODDEF \
+ {"CreateNamedPipe", (PyCFunction)_winapi_CreateNamedPipe, METH_VARARGS, _winapi_CreateNamedPipe__doc__},
+
+static HANDLE
+_winapi_CreateNamedPipe_impl(PyModuleDef *module, LPCTSTR name,
+ DWORD open_mode, DWORD pipe_mode,
+ DWORD max_instances, DWORD out_buffer_size,
+ DWORD in_buffer_size, DWORD default_timeout,
+ LPSECURITY_ATTRIBUTES security_attributes);
+
+static PyObject *
+_winapi_CreateNamedPipe(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ LPCTSTR name;
+ DWORD open_mode;
+ DWORD pipe_mode;
+ DWORD max_instances;
+ DWORD out_buffer_size;
+ DWORD in_buffer_size;
+ DWORD default_timeout;
+ LPSECURITY_ATTRIBUTES security_attributes;
+ HANDLE _return_value;
+
+ if (!PyArg_ParseTuple(args, "skkkkkk" F_POINTER ":CreateNamedPipe",
+ &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes))
+ goto exit;
+ _return_value = _winapi_CreateNamedPipe_impl(module, name, open_mode, pipe_mode, max_instances, out_buffer_size, in_buffer_size, default_timeout, security_attributes);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_CreatePipe__doc__,
+"CreatePipe($module, pipe_attrs, size, /)\n"
+"--\n"
+"\n"
+"Create an anonymous pipe.\n"
+"\n"
+" pipe_attrs\n"
+" Ignored internally, can be None.\n"
+"\n"
+"Returns a 2-tuple of handles, to the read and write ends of the pipe.");
+
+#define _WINAPI_CREATEPIPE_METHODDEF \
+ {"CreatePipe", (PyCFunction)_winapi_CreatePipe, METH_VARARGS, _winapi_CreatePipe__doc__},
+
+static PyObject *
+_winapi_CreatePipe_impl(PyModuleDef *module, PyObject *pipe_attrs,
+ DWORD size);
+
+static PyObject *
+_winapi_CreatePipe(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *pipe_attrs;
+ DWORD size;
+
+ if (!PyArg_ParseTuple(args, "Ok:CreatePipe",
+ &pipe_attrs, &size))
+ goto exit;
+ return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_CreateProcess__doc__,
+"CreateProcess($module, application_name, command_line, proc_attrs,\n"
+" thread_attrs, inherit_handles, creation_flags,\n"
+" env_mapping, current_directory, startup_info, /)\n"
+"--\n"
+"\n"
+"Create a new process and its primary thread.\n"
+"\n"
+" proc_attrs\n"
+" Ignored internally, can be None.\n"
+" thread_attrs\n"
+" Ignored internally, can be None.\n"
+"\n"
+"The return value is a tuple of the process handle, thread handle,\n"
+"process ID, and thread ID.");
+
+#define _WINAPI_CREATEPROCESS_METHODDEF \
+ {"CreateProcess", (PyCFunction)_winapi_CreateProcess, METH_VARARGS, _winapi_CreateProcess__doc__},
+
+static PyObject *
+_winapi_CreateProcess_impl(PyModuleDef *module, Py_UNICODE *application_name,
+ Py_UNICODE *command_line, PyObject *proc_attrs,
+ PyObject *thread_attrs, BOOL inherit_handles,
+ DWORD creation_flags, PyObject *env_mapping,
+ Py_UNICODE *current_directory,
+ PyObject *startup_info);
+
+static PyObject *
+_winapi_CreateProcess(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_UNICODE *application_name;
+ Py_UNICODE *command_line;
+ PyObject *proc_attrs;
+ PyObject *thread_attrs;
+ BOOL inherit_handles;
+ DWORD creation_flags;
+ PyObject *env_mapping;
+ Py_UNICODE *current_directory;
+ PyObject *startup_info;
+
+ if (!PyArg_ParseTuple(args, "ZZOOikOZO:CreateProcess",
+ &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, &current_directory, &startup_info))
+ goto exit;
+ return_value = _winapi_CreateProcess_impl(module, application_name, command_line, proc_attrs, thread_attrs, inherit_handles, creation_flags, env_mapping, current_directory, startup_info);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_DuplicateHandle__doc__,
+"DuplicateHandle($module, source_process_handle, source_handle,\n"
+" target_process_handle, desired_access, inherit_handle,\n"
+" options=0, /)\n"
+"--\n"
+"\n"
+"Return a duplicate handle object.\n"
+"\n"
+"The duplicate handle refers to the same object as the original\n"
+"handle. Therefore, any changes to the object are reflected\n"
+"through both handles.");
+
+#define _WINAPI_DUPLICATEHANDLE_METHODDEF \
+ {"DuplicateHandle", (PyCFunction)_winapi_DuplicateHandle, METH_VARARGS, _winapi_DuplicateHandle__doc__},
+
+static HANDLE
+_winapi_DuplicateHandle_impl(PyModuleDef *module,
+ HANDLE source_process_handle,
+ HANDLE source_handle,
+ HANDLE target_process_handle,
+ DWORD desired_access, BOOL inherit_handle,
+ DWORD options);
+
+static PyObject *
+_winapi_DuplicateHandle(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ HANDLE source_process_handle;
+ HANDLE source_handle;
+ HANDLE target_process_handle;
+ DWORD desired_access;
+ BOOL inherit_handle;
+ DWORD options = 0;
+ HANDLE _return_value;
+
+ if (!PyArg_ParseTuple(args, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle",
+ &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options))
+ goto exit;
+ _return_value = _winapi_DuplicateHandle_impl(module, source_process_handle, source_handle, target_process_handle, desired_access, inherit_handle, options);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_ExitProcess__doc__,
+"ExitProcess($module, ExitCode, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_EXITPROCESS_METHODDEF \
+ {"ExitProcess", (PyCFunction)_winapi_ExitProcess, METH_O, _winapi_ExitProcess__doc__},
+
+static PyObject *
+_winapi_ExitProcess_impl(PyModuleDef *module, UINT ExitCode);
+
+static PyObject *
+_winapi_ExitProcess(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ UINT ExitCode;
+
+ if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode))
+ goto exit;
+ return_value = _winapi_ExitProcess_impl(module, ExitCode);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetCurrentProcess__doc__,
+"GetCurrentProcess($module, /)\n"
+"--\n"
+"\n"
+"Return a handle object for the current process.");
+
+#define _WINAPI_GETCURRENTPROCESS_METHODDEF \
+ {"GetCurrentProcess", (PyCFunction)_winapi_GetCurrentProcess, METH_NOARGS, _winapi_GetCurrentProcess__doc__},
+
+static HANDLE
+_winapi_GetCurrentProcess_impl(PyModuleDef *module);
+
+static PyObject *
+_winapi_GetCurrentProcess(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ HANDLE _return_value;
+
+ _return_value = _winapi_GetCurrentProcess_impl(module);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetExitCodeProcess__doc__,
+"GetExitCodeProcess($module, process, /)\n"
+"--\n"
+"\n"
+"Return the termination status of the specified process.");
+
+#define _WINAPI_GETEXITCODEPROCESS_METHODDEF \
+ {"GetExitCodeProcess", (PyCFunction)_winapi_GetExitCodeProcess, METH_O, _winapi_GetExitCodeProcess__doc__},
+
+static DWORD
+_winapi_GetExitCodeProcess_impl(PyModuleDef *module, HANDLE process);
+
+static PyObject *
+_winapi_GetExitCodeProcess(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ HANDLE process;
+ DWORD _return_value;
+
+ if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process))
+ goto exit;
+ _return_value = _winapi_GetExitCodeProcess_impl(module, process);
+ if ((_return_value == DWORD_MAX) && PyErr_Occurred())
+ goto exit;
+ return_value = Py_BuildValue("k", _return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetLastError__doc__,
+"GetLastError($module, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_GETLASTERROR_METHODDEF \
+ {"GetLastError", (PyCFunction)_winapi_GetLastError, METH_NOARGS, _winapi_GetLastError__doc__},
+
+static DWORD
+_winapi_GetLastError_impl(PyModuleDef *module);
+
+static PyObject *
+_winapi_GetLastError(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ DWORD _return_value;
+
+ _return_value = _winapi_GetLastError_impl(module);
+ if ((_return_value == DWORD_MAX) && PyErr_Occurred())
+ goto exit;
+ return_value = Py_BuildValue("k", _return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetModuleFileName__doc__,
+"GetModuleFileName($module, module_handle, /)\n"
+"--\n"
+"\n"
+"Return the fully-qualified path for the file that contains module.\n"
+"\n"
+"The module must have been loaded by the current process.\n"
+"\n"
+"The module parameter should be a handle to the loaded module\n"
+"whose path is being requested. If this parameter is 0,\n"
+"GetModuleFileName retrieves the path of the executable file\n"
+"of the current process.");
+
+#define _WINAPI_GETMODULEFILENAME_METHODDEF \
+ {"GetModuleFileName", (PyCFunction)_winapi_GetModuleFileName, METH_O, _winapi_GetModuleFileName__doc__},
+
+static PyObject *
+_winapi_GetModuleFileName_impl(PyModuleDef *module, HMODULE module_handle);
+
+static PyObject *
+_winapi_GetModuleFileName(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ HMODULE module_handle;
+
+ if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle))
+ goto exit;
+ return_value = _winapi_GetModuleFileName_impl(module, module_handle);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetStdHandle__doc__,
+"GetStdHandle($module, std_handle, /)\n"
+"--\n"
+"\n"
+"Return a handle to the specified standard device.\n"
+"\n"
+" std_handle\n"
+" One of STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE.\n"
+"\n"
+"The integer associated with the handle object is returned.");
+
+#define _WINAPI_GETSTDHANDLE_METHODDEF \
+ {"GetStdHandle", (PyCFunction)_winapi_GetStdHandle, METH_O, _winapi_GetStdHandle__doc__},
+
+static HANDLE
+_winapi_GetStdHandle_impl(PyModuleDef *module, DWORD std_handle);
+
+static PyObject *
+_winapi_GetStdHandle(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ DWORD std_handle;
+ HANDLE _return_value;
+
+ if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle))
+ goto exit;
+ _return_value = _winapi_GetStdHandle_impl(module, std_handle);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_GetVersion__doc__,
+"GetVersion($module, /)\n"
+"--\n"
+"\n"
+"Return the version number of the current operating system.");
+
+#define _WINAPI_GETVERSION_METHODDEF \
+ {"GetVersion", (PyCFunction)_winapi_GetVersion, METH_NOARGS, _winapi_GetVersion__doc__},
+
+static long
+_winapi_GetVersion_impl(PyModuleDef *module);
+
+static PyObject *
+_winapi_GetVersion(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ PyObject *return_value = NULL;
+ long _return_value;
+
+ _return_value = _winapi_GetVersion_impl(module);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_OpenProcess__doc__,
+"OpenProcess($module, desired_access, inherit_handle, process_id, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_OPENPROCESS_METHODDEF \
+ {"OpenProcess", (PyCFunction)_winapi_OpenProcess, METH_VARARGS, _winapi_OpenProcess__doc__},
+
+static HANDLE
+_winapi_OpenProcess_impl(PyModuleDef *module, DWORD desired_access,
+ BOOL inherit_handle, DWORD process_id);
+
+static PyObject *
+_winapi_OpenProcess(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ DWORD desired_access;
+ BOOL inherit_handle;
+ DWORD process_id;
+ HANDLE _return_value;
+
+ if (!PyArg_ParseTuple(args, "kik:OpenProcess",
+ &desired_access, &inherit_handle, &process_id))
+ goto exit;
+ _return_value = _winapi_OpenProcess_impl(module, desired_access, inherit_handle, process_id);
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ goto exit;
+ if (_return_value == NULL)
+ Py_RETURN_NONE;
+ return_value = HANDLE_TO_PYNUM(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_PeekNamedPipe__doc__,
+"PeekNamedPipe($module, handle, size=0, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_PEEKNAMEDPIPE_METHODDEF \
+ {"PeekNamedPipe", (PyCFunction)_winapi_PeekNamedPipe, METH_VARARGS, _winapi_PeekNamedPipe__doc__},
+
+static PyObject *
+_winapi_PeekNamedPipe_impl(PyModuleDef *module, HANDLE handle, int size);
+
+static PyObject *
+_winapi_PeekNamedPipe(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ HANDLE handle;
+ int size = 0;
+
+ if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe",
+ &handle, &size))
+ goto exit;
+ return_value = _winapi_PeekNamedPipe_impl(module, handle, size);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_ReadFile__doc__,
+"ReadFile($module, /, handle, size, overlapped=False)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_READFILE_METHODDEF \
+ {"ReadFile", (PyCFunction)_winapi_ReadFile, METH_VARARGS|METH_KEYWORDS, _winapi_ReadFile__doc__},
+
+static PyObject *
+_winapi_ReadFile_impl(PyModuleDef *module, HANDLE handle, int size,
+ int use_overlapped);
+
+static PyObject *
+_winapi_ReadFile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"handle", "size", "overlapped", NULL};
+ HANDLE handle;
+ int size;
+ int use_overlapped = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "i|i:ReadFile", _keywords,
+ &handle, &size, &use_overlapped))
+ goto exit;
+ return_value = _winapi_ReadFile_impl(module, handle, size, use_overlapped);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_SetNamedPipeHandleState__doc__,
+"SetNamedPipeHandleState($module, named_pipe, mode,\n"
+" max_collection_count, collect_data_timeout, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_SETNAMEDPIPEHANDLESTATE_METHODDEF \
+ {"SetNamedPipeHandleState", (PyCFunction)_winapi_SetNamedPipeHandleState, METH_VARARGS, _winapi_SetNamedPipeHandleState__doc__},
+
+static PyObject *
+_winapi_SetNamedPipeHandleState_impl(PyModuleDef *module, HANDLE named_pipe,
+ PyObject *mode,
+ PyObject *max_collection_count,
+ PyObject *collect_data_timeout);
+
+static PyObject *
+_winapi_SetNamedPipeHandleState(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ HANDLE named_pipe;
+ PyObject *mode;
+ PyObject *max_collection_count;
+ PyObject *collect_data_timeout;
+
+ if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState",
+ &named_pipe, &mode, &max_collection_count, &collect_data_timeout))
+ goto exit;
+ return_value = _winapi_SetNamedPipeHandleState_impl(module, named_pipe, mode, max_collection_count, collect_data_timeout);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_TerminateProcess__doc__,
+"TerminateProcess($module, handle, exit_code, /)\n"
+"--\n"
+"\n"
+"Terminate the specified process and all of its threads.");
+
+#define _WINAPI_TERMINATEPROCESS_METHODDEF \
+ {"TerminateProcess", (PyCFunction)_winapi_TerminateProcess, METH_VARARGS, _winapi_TerminateProcess__doc__},
+
+static PyObject *
+_winapi_TerminateProcess_impl(PyModuleDef *module, HANDLE handle,
+ UINT exit_code);
+
+static PyObject *
+_winapi_TerminateProcess(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ HANDLE handle;
+ UINT exit_code;
+
+ if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess",
+ &handle, &exit_code))
+ goto exit;
+ return_value = _winapi_TerminateProcess_impl(module, handle, exit_code);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_WaitNamedPipe__doc__,
+"WaitNamedPipe($module, name, timeout, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_WAITNAMEDPIPE_METHODDEF \
+ {"WaitNamedPipe", (PyCFunction)_winapi_WaitNamedPipe, METH_VARARGS, _winapi_WaitNamedPipe__doc__},
+
+static PyObject *
+_winapi_WaitNamedPipe_impl(PyModuleDef *module, LPCTSTR name, DWORD timeout);
+
+static PyObject *
+_winapi_WaitNamedPipe(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ LPCTSTR name;
+ DWORD timeout;
+
+ if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe",
+ &name, &timeout))
+ goto exit;
+ return_value = _winapi_WaitNamedPipe_impl(module, name, timeout);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_WaitForMultipleObjects__doc__,
+"WaitForMultipleObjects($module, handle_seq, wait_flag,\n"
+" milliseconds=_winapi.INFINITE, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_WAITFORMULTIPLEOBJECTS_METHODDEF \
+ {"WaitForMultipleObjects", (PyCFunction)_winapi_WaitForMultipleObjects, METH_VARARGS, _winapi_WaitForMultipleObjects__doc__},
+
+static PyObject *
+_winapi_WaitForMultipleObjects_impl(PyModuleDef *module,
+ PyObject *handle_seq, BOOL wait_flag,
+ DWORD milliseconds);
+
+static PyObject *
+_winapi_WaitForMultipleObjects(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *handle_seq;
+ BOOL wait_flag;
+ DWORD milliseconds = INFINITE;
+
+ if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects",
+ &handle_seq, &wait_flag, &milliseconds))
+ goto exit;
+ return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_WaitForSingleObject__doc__,
+"WaitForSingleObject($module, handle, milliseconds, /)\n"
+"--\n"
+"\n"
+"Wait for a single object.\n"
+"\n"
+"Wait until the specified object is in the signaled state or\n"
+"the time-out interval elapses. The timeout value is specified\n"
+"in milliseconds.");
+
+#define _WINAPI_WAITFORSINGLEOBJECT_METHODDEF \
+ {"WaitForSingleObject", (PyCFunction)_winapi_WaitForSingleObject, METH_VARARGS, _winapi_WaitForSingleObject__doc__},
+
+static long
+_winapi_WaitForSingleObject_impl(PyModuleDef *module, HANDLE handle,
+ DWORD milliseconds);
+
+static PyObject *
+_winapi_WaitForSingleObject(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ HANDLE handle;
+ DWORD milliseconds;
+ long _return_value;
+
+ if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject",
+ &handle, &milliseconds))
+ goto exit;
+ _return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_winapi_WriteFile__doc__,
+"WriteFile($module, /, handle, buffer, overlapped=False)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_WRITEFILE_METHODDEF \
+ {"WriteFile", (PyCFunction)_winapi_WriteFile, METH_VARARGS|METH_KEYWORDS, _winapi_WriteFile__doc__},
+
+static PyObject *
+_winapi_WriteFile_impl(PyModuleDef *module, HANDLE handle, PyObject *buffer,
+ int use_overlapped);
+
+static PyObject *
+_winapi_WriteFile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"handle", "buffer", "overlapped", NULL};
+ HANDLE handle;
+ PyObject *buffer;
+ int use_overlapped = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "O|i:WriteFile", _keywords,
+ &handle, &buffer, &use_overlapped))
+ goto exit;
+ return_value = _winapi_WriteFile_impl(module, handle, buffer, use_overlapped);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=98771c6584056d19 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
new file mode 100644
index 0000000..fdf247e
--- /dev/null
+++ b/Modules/clinic/arraymodule.c.h
@@ -0,0 +1,499 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(array_array___copy____doc__,
+"__copy__($self, /)\n"
+"--\n"
+"\n"
+"Return a copy of the array.");
+
+#define ARRAY_ARRAY___COPY___METHODDEF \
+ {"__copy__", (PyCFunction)array_array___copy__, METH_NOARGS, array_array___copy____doc__},
+
+static PyObject *
+array_array___copy___impl(arrayobject *self);
+
+static PyObject *
+array_array___copy__(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array___copy___impl(self);
+}
+
+PyDoc_STRVAR(array_array___deepcopy____doc__,
+"__deepcopy__($self, unused, /)\n"
+"--\n"
+"\n"
+"Return a copy of the array.");
+
+#define ARRAY_ARRAY___DEEPCOPY___METHODDEF \
+ {"__deepcopy__", (PyCFunction)array_array___deepcopy__, METH_O, array_array___deepcopy____doc__},
+
+PyDoc_STRVAR(array_array_count__doc__,
+"count($self, v, /)\n"
+"--\n"
+"\n"
+"Return number of occurrences of v in the array.");
+
+#define ARRAY_ARRAY_COUNT_METHODDEF \
+ {"count", (PyCFunction)array_array_count, METH_O, array_array_count__doc__},
+
+PyDoc_STRVAR(array_array_index__doc__,
+"index($self, v, /)\n"
+"--\n"
+"\n"
+"Return index of first occurrence of v in the array.");
+
+#define ARRAY_ARRAY_INDEX_METHODDEF \
+ {"index", (PyCFunction)array_array_index, METH_O, array_array_index__doc__},
+
+PyDoc_STRVAR(array_array_remove__doc__,
+"remove($self, v, /)\n"
+"--\n"
+"\n"
+"Remove the first occurrence of v in the array.");
+
+#define ARRAY_ARRAY_REMOVE_METHODDEF \
+ {"remove", (PyCFunction)array_array_remove, METH_O, array_array_remove__doc__},
+
+PyDoc_STRVAR(array_array_pop__doc__,
+"pop($self, i=-1, /)\n"
+"--\n"
+"\n"
+"Return the i-th element and delete it from the array.\n"
+"\n"
+"i defaults to -1.");
+
+#define ARRAY_ARRAY_POP_METHODDEF \
+ {"pop", (PyCFunction)array_array_pop, METH_VARARGS, array_array_pop__doc__},
+
+static PyObject *
+array_array_pop_impl(arrayobject *self, Py_ssize_t i);
+
+static PyObject *
+array_array_pop(arrayobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t i = -1;
+
+ if (!PyArg_ParseTuple(args, "|n:pop",
+ &i))
+ goto exit;
+ return_value = array_array_pop_impl(self, i);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_extend__doc__,
+"extend($self, bb, /)\n"
+"--\n"
+"\n"
+"Append items to the end of the array.");
+
+#define ARRAY_ARRAY_EXTEND_METHODDEF \
+ {"extend", (PyCFunction)array_array_extend, METH_O, array_array_extend__doc__},
+
+PyDoc_STRVAR(array_array_insert__doc__,
+"insert($self, i, v, /)\n"
+"--\n"
+"\n"
+"Insert a new item v into the array before position i.");
+
+#define ARRAY_ARRAY_INSERT_METHODDEF \
+ {"insert", (PyCFunction)array_array_insert, METH_VARARGS, array_array_insert__doc__},
+
+static PyObject *
+array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
+
+static PyObject *
+array_array_insert(arrayobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t i;
+ PyObject *v;
+
+ if (!PyArg_ParseTuple(args, "nO:insert",
+ &i, &v))
+ goto exit;
+ return_value = array_array_insert_impl(self, i, v);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_buffer_info__doc__,
+"buffer_info($self, /)\n"
+"--\n"
+"\n"
+"Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array\'s contents.\n"
+"\n"
+"The length should be multiplied by the itemsize attribute to calculate\n"
+"the buffer length in bytes.");
+
+#define ARRAY_ARRAY_BUFFER_INFO_METHODDEF \
+ {"buffer_info", (PyCFunction)array_array_buffer_info, METH_NOARGS, array_array_buffer_info__doc__},
+
+static PyObject *
+array_array_buffer_info_impl(arrayobject *self);
+
+static PyObject *
+array_array_buffer_info(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_buffer_info_impl(self);
+}
+
+PyDoc_STRVAR(array_array_append__doc__,
+"append($self, v, /)\n"
+"--\n"
+"\n"
+"Append new value v to the end of the array.");
+
+#define ARRAY_ARRAY_APPEND_METHODDEF \
+ {"append", (PyCFunction)array_array_append, METH_O, array_array_append__doc__},
+
+PyDoc_STRVAR(array_array_byteswap__doc__,
+"byteswap($self, /)\n"
+"--\n"
+"\n"
+"Byteswap all items of the array.\n"
+"\n"
+"If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n"
+"raised.");
+
+#define ARRAY_ARRAY_BYTESWAP_METHODDEF \
+ {"byteswap", (PyCFunction)array_array_byteswap, METH_NOARGS, array_array_byteswap__doc__},
+
+static PyObject *
+array_array_byteswap_impl(arrayobject *self);
+
+static PyObject *
+array_array_byteswap(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_byteswap_impl(self);
+}
+
+PyDoc_STRVAR(array_array_reverse__doc__,
+"reverse($self, /)\n"
+"--\n"
+"\n"
+"Reverse the order of the items in the array.");
+
+#define ARRAY_ARRAY_REVERSE_METHODDEF \
+ {"reverse", (PyCFunction)array_array_reverse, METH_NOARGS, array_array_reverse__doc__},
+
+static PyObject *
+array_array_reverse_impl(arrayobject *self);
+
+static PyObject *
+array_array_reverse(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_reverse_impl(self);
+}
+
+PyDoc_STRVAR(array_array_fromfile__doc__,
+"fromfile($self, f, n, /)\n"
+"--\n"
+"\n"
+"Read n objects from the file object f and append them to the end of the array.");
+
+#define ARRAY_ARRAY_FROMFILE_METHODDEF \
+ {"fromfile", (PyCFunction)array_array_fromfile, METH_VARARGS, array_array_fromfile__doc__},
+
+static PyObject *
+array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n);
+
+static PyObject *
+array_array_fromfile(arrayobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *f;
+ Py_ssize_t n;
+
+ if (!PyArg_ParseTuple(args, "On:fromfile",
+ &f, &n))
+ goto exit;
+ return_value = array_array_fromfile_impl(self, f, n);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_tofile__doc__,
+"tofile($self, f, /)\n"
+"--\n"
+"\n"
+"Write all items (as machine values) to the file object f.");
+
+#define ARRAY_ARRAY_TOFILE_METHODDEF \
+ {"tofile", (PyCFunction)array_array_tofile, METH_O, array_array_tofile__doc__},
+
+PyDoc_STRVAR(array_array_fromlist__doc__,
+"fromlist($self, list, /)\n"
+"--\n"
+"\n"
+"Append items to array from list.");
+
+#define ARRAY_ARRAY_FROMLIST_METHODDEF \
+ {"fromlist", (PyCFunction)array_array_fromlist, METH_O, array_array_fromlist__doc__},
+
+PyDoc_STRVAR(array_array_tolist__doc__,
+"tolist($self, /)\n"
+"--\n"
+"\n"
+"Convert array to an ordinary list with the same items.");
+
+#define ARRAY_ARRAY_TOLIST_METHODDEF \
+ {"tolist", (PyCFunction)array_array_tolist, METH_NOARGS, array_array_tolist__doc__},
+
+static PyObject *
+array_array_tolist_impl(arrayobject *self);
+
+static PyObject *
+array_array_tolist(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_tolist_impl(self);
+}
+
+PyDoc_STRVAR(array_array_fromstring__doc__,
+"fromstring($self, buffer, /)\n"
+"--\n"
+"\n"
+"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).\n"
+"\n"
+"This method is deprecated. Use frombytes instead.");
+
+#define ARRAY_ARRAY_FROMSTRING_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer buffer = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "s*:fromstring", &buffer))
+ goto exit;
+ return_value = array_array_fromstring_impl(self, &buffer);
+
+exit:
+ /* Cleanup for buffer */
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_frombytes__doc__,
+"frombytes($self, buffer, /)\n"
+"--\n"
+"\n"
+"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_O, array_array_frombytes__doc__},
+
+static PyObject *
+array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer);
+
+static PyObject *
+array_array_frombytes(arrayobject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ Py_buffer buffer = {NULL, NULL};
+
+ if (!PyArg_Parse(arg, "y*:frombytes", &buffer))
+ goto exit;
+ return_value = array_array_frombytes_impl(self, &buffer);
+
+exit:
+ /* Cleanup for buffer */
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_tobytes__doc__,
+"tobytes($self, /)\n"
+"--\n"
+"\n"
+"Convert the array to an array of machine values and return the bytes representation.");
+
+#define ARRAY_ARRAY_TOBYTES_METHODDEF \
+ {"tobytes", (PyCFunction)array_array_tobytes, METH_NOARGS, array_array_tobytes__doc__},
+
+static PyObject *
+array_array_tobytes_impl(arrayobject *self);
+
+static PyObject *
+array_array_tobytes(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_tobytes_impl(self);
+}
+
+PyDoc_STRVAR(array_array_tostring__doc__,
+"tostring($self, /)\n"
+"--\n"
+"\n"
+"Convert the array to an array of machine values and return the bytes representation.\n"
+"\n"
+"This method is deprecated. Use tobytes instead.");
+
+#define ARRAY_ARRAY_TOSTRING_METHODDEF \
+ {"tostring", (PyCFunction)array_array_tostring, METH_NOARGS, array_array_tostring__doc__},
+
+static PyObject *
+array_array_tostring_impl(arrayobject *self);
+
+static PyObject *
+array_array_tostring(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_tostring_impl(self);
+}
+
+PyDoc_STRVAR(array_array_fromunicode__doc__,
+"fromunicode($self, ustr, /)\n"
+"--\n"
+"\n"
+"Extends this array with data from the unicode string ustr.\n"
+"\n"
+"The array must be a unicode type array; otherwise a ValueError is raised.\n"
+"Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n"
+"some other type.");
+
+#define ARRAY_ARRAY_FROMUNICODE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_UNICODE *ustr;
+ Py_ssize_clean_t ustr_length;
+
+ if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length))
+ goto exit;
+ return_value = array_array_fromunicode_impl(self, ustr, ustr_length);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array_tounicode__doc__,
+"tounicode($self, /)\n"
+"--\n"
+"\n"
+"Extends this array with data from the unicode string ustr.\n"
+"\n"
+"Convert the array to a unicode string. The array must be a unicode type array;\n"
+"otherwise a ValueError is raised. Use array.tobytes().decode() to obtain a\n"
+"unicode string from an array of some other type.");
+
+#define ARRAY_ARRAY_TOUNICODE_METHODDEF \
+ {"tounicode", (PyCFunction)array_array_tounicode, METH_NOARGS, array_array_tounicode__doc__},
+
+static PyObject *
+array_array_tounicode_impl(arrayobject *self);
+
+static PyObject *
+array_array_tounicode(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array_tounicode_impl(self);
+}
+
+PyDoc_STRVAR(array_array___sizeof____doc__,
+"__sizeof__($self, /)\n"
+"--\n"
+"\n"
+"Size of the array in memory, in bytes.");
+
+#define ARRAY_ARRAY___SIZEOF___METHODDEF \
+ {"__sizeof__", (PyCFunction)array_array___sizeof__, METH_NOARGS, array_array___sizeof____doc__},
+
+static PyObject *
+array_array___sizeof___impl(arrayobject *self);
+
+static PyObject *
+array_array___sizeof__(arrayobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_array___sizeof___impl(self);
+}
+
+PyDoc_STRVAR(array__array_reconstructor__doc__,
+"_array_reconstructor($module, arraytype, typecode, mformat_code, items,\n"
+" /)\n"
+"--\n"
+"\n"
+"Internal. Used for pickling support.");
+
+#define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF \
+ {"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_VARARGS, array__array_reconstructor__doc__},
+
+static PyObject *
+array__array_reconstructor_impl(PyModuleDef *module, PyTypeObject *arraytype,
+ int typecode,
+ enum machine_format_code mformat_code,
+ PyObject *items);
+
+static PyObject *
+array__array_reconstructor(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyTypeObject *arraytype;
+ int typecode;
+ enum machine_format_code mformat_code;
+ PyObject *items;
+
+ if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor",
+ &arraytype, &typecode, &mformat_code, &items))
+ goto exit;
+ return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(array_array___reduce_ex____doc__,
+"__reduce_ex__($self, value, /)\n"
+"--\n"
+"\n"
+"Return state information for pickling.");
+
+#define ARRAY_ARRAY___REDUCE_EX___METHODDEF \
+ {"__reduce_ex__", (PyCFunction)array_array___reduce_ex__, METH_O, array_array___reduce_ex____doc__},
+
+PyDoc_STRVAR(array_arrayiterator___reduce____doc__,
+"__reduce__($self, /)\n"
+"--\n"
+"\n"
+"Return state information for pickling.");
+
+#define ARRAY_ARRAYITERATOR___REDUCE___METHODDEF \
+ {"__reduce__", (PyCFunction)array_arrayiterator___reduce__, METH_NOARGS, array_arrayiterator___reduce____doc__},
+
+static PyObject *
+array_arrayiterator___reduce___impl(arrayiterobject *self);
+
+static PyObject *
+array_arrayiterator___reduce__(arrayiterobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return array_arrayiterator___reduce___impl(self);
+}
+
+PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
+"__setstate__($self, state, /)\n"
+"--\n"
+"\n"
+"Set state information for unpickling.");
+
+#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
+ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
+/*[clinic end generated code: output=d2e82c65ea841cfc input=a9049054013a1b77]*/
diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h
index 40ef5e2..3ee2966 100644
--- a/Modules/clinic/audioop.c.h
+++ b/Modules/clinic/audioop.c.h
@@ -12,7 +12,8 @@ PyDoc_STRVAR(audioop_getsample__doc__,
{"getsample", (PyCFunction)audioop_getsample, METH_VARARGS, audioop_getsample__doc__},
static PyObject *
-audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width, Py_ssize_t index);
+audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ Py_ssize_t index);
static PyObject *
audioop_getsample(PyModuleDef *module, PyObject *args)
@@ -22,8 +23,7 @@ audioop_getsample(PyModuleDef *module, PyObject *args)
int width;
Py_ssize_t index;
- if (!PyArg_ParseTuple(args,
- "y*in:getsample",
+ if (!PyArg_ParseTuple(args, "y*in:getsample",
&fragment, &width, &index))
goto exit;
return_value = audioop_getsample_impl(module, &fragment, width, index);
@@ -55,8 +55,7 @@ audioop_max(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:max",
+ if (!PyArg_ParseTuple(args, "y*i:max",
&fragment, &width))
goto exit;
return_value = audioop_max_impl(module, &fragment, width);
@@ -88,8 +87,7 @@ audioop_minmax(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:minmax",
+ if (!PyArg_ParseTuple(args, "y*i:minmax",
&fragment, &width))
goto exit;
return_value = audioop_minmax_impl(module, &fragment, width);
@@ -121,8 +119,7 @@ audioop_avg(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:avg",
+ if (!PyArg_ParseTuple(args, "y*i:avg",
&fragment, &width))
goto exit;
return_value = audioop_avg_impl(module, &fragment, width);
@@ -154,8 +151,7 @@ audioop_rms(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:rms",
+ if (!PyArg_ParseTuple(args, "y*i:rms",
&fragment, &width))
goto exit;
return_value = audioop_rms_impl(module, &fragment, width);
@@ -178,7 +174,8 @@ PyDoc_STRVAR(audioop_findfit__doc__,
{"findfit", (PyCFunction)audioop_findfit, METH_VARARGS, audioop_findfit__doc__},
static PyObject *
-audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference);
+audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment,
+ Py_buffer *reference);
static PyObject *
audioop_findfit(PyModuleDef *module, PyObject *args)
@@ -187,8 +184,7 @@ audioop_findfit(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
Py_buffer reference = {NULL, NULL};
- if (!PyArg_ParseTuple(args,
- "y*y*:findfit",
+ if (!PyArg_ParseTuple(args, "y*y*:findfit",
&fragment, &reference))
goto exit;
return_value = audioop_findfit_impl(module, &fragment, &reference);
@@ -214,7 +210,8 @@ PyDoc_STRVAR(audioop_findfactor__doc__,
{"findfactor", (PyCFunction)audioop_findfactor, METH_VARARGS, audioop_findfactor__doc__},
static PyObject *
-audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference);
+audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment,
+ Py_buffer *reference);
static PyObject *
audioop_findfactor(PyModuleDef *module, PyObject *args)
@@ -223,8 +220,7 @@ audioop_findfactor(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
Py_buffer reference = {NULL, NULL};
- if (!PyArg_ParseTuple(args,
- "y*y*:findfactor",
+ if (!PyArg_ParseTuple(args, "y*y*:findfactor",
&fragment, &reference))
goto exit;
return_value = audioop_findfactor_impl(module, &fragment, &reference);
@@ -250,7 +246,8 @@ PyDoc_STRVAR(audioop_findmax__doc__,
{"findmax", (PyCFunction)audioop_findmax, METH_VARARGS, audioop_findmax__doc__},
static PyObject *
-audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment, Py_ssize_t length);
+audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment,
+ Py_ssize_t length);
static PyObject *
audioop_findmax(PyModuleDef *module, PyObject *args)
@@ -259,8 +256,7 @@ audioop_findmax(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
Py_ssize_t length;
- if (!PyArg_ParseTuple(args,
- "y*n:findmax",
+ if (!PyArg_ParseTuple(args, "y*n:findmax",
&fragment, &length))
goto exit;
return_value = audioop_findmax_impl(module, &fragment, length);
@@ -292,8 +288,7 @@ audioop_avgpp(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:avgpp",
+ if (!PyArg_ParseTuple(args, "y*i:avgpp",
&fragment, &width))
goto exit;
return_value = audioop_avgpp_impl(module, &fragment, width);
@@ -325,8 +320,7 @@ audioop_maxpp(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:maxpp",
+ if (!PyArg_ParseTuple(args, "y*i:maxpp",
&fragment, &width))
goto exit;
return_value = audioop_maxpp_impl(module, &fragment, width);
@@ -358,8 +352,7 @@ audioop_cross(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:cross",
+ if (!PyArg_ParseTuple(args, "y*i:cross",
&fragment, &width))
goto exit;
return_value = audioop_cross_impl(module, &fragment, width);
@@ -382,7 +375,8 @@ PyDoc_STRVAR(audioop_mul__doc__,
{"mul", (PyCFunction)audioop_mul, METH_VARARGS, audioop_mul__doc__},
static PyObject *
-audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width, double factor);
+audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ double factor);
static PyObject *
audioop_mul(PyModuleDef *module, PyObject *args)
@@ -392,8 +386,7 @@ audioop_mul(PyModuleDef *module, PyObject *args)
int width;
double factor;
- if (!PyArg_ParseTuple(args,
- "y*id:mul",
+ if (!PyArg_ParseTuple(args, "y*id:mul",
&fragment, &width, &factor))
goto exit;
return_value = audioop_mul_impl(module, &fragment, width, factor);
@@ -416,7 +409,8 @@ PyDoc_STRVAR(audioop_tomono__doc__,
{"tomono", (PyCFunction)audioop_tomono, METH_VARARGS, audioop_tomono__doc__},
static PyObject *
-audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor);
+audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ double lfactor, double rfactor);
static PyObject *
audioop_tomono(PyModuleDef *module, PyObject *args)
@@ -427,8 +421,7 @@ audioop_tomono(PyModuleDef *module, PyObject *args)
double lfactor;
double rfactor;
- if (!PyArg_ParseTuple(args,
- "y*idd:tomono",
+ if (!PyArg_ParseTuple(args, "y*idd:tomono",
&fragment, &width, &lfactor, &rfactor))
goto exit;
return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
@@ -451,7 +444,8 @@ PyDoc_STRVAR(audioop_tostereo__doc__,
{"tostereo", (PyCFunction)audioop_tostereo, METH_VARARGS, audioop_tostereo__doc__},
static PyObject *
-audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor);
+audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ double lfactor, double rfactor);
static PyObject *
audioop_tostereo(PyModuleDef *module, PyObject *args)
@@ -462,8 +456,7 @@ audioop_tostereo(PyModuleDef *module, PyObject *args)
double lfactor;
double rfactor;
- if (!PyArg_ParseTuple(args,
- "y*idd:tostereo",
+ if (!PyArg_ParseTuple(args, "y*idd:tostereo",
&fragment, &width, &lfactor, &rfactor))
goto exit;
return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
@@ -486,7 +479,8 @@ PyDoc_STRVAR(audioop_add__doc__,
{"add", (PyCFunction)audioop_add, METH_VARARGS, audioop_add__doc__},
static PyObject *
-audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1, Py_buffer *fragment2, int width);
+audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1,
+ Py_buffer *fragment2, int width);
static PyObject *
audioop_add(PyModuleDef *module, PyObject *args)
@@ -496,8 +490,7 @@ audioop_add(PyModuleDef *module, PyObject *args)
Py_buffer fragment2 = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*y*i:add",
+ if (!PyArg_ParseTuple(args, "y*y*i:add",
&fragment1, &fragment2, &width))
goto exit;
return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
@@ -523,7 +516,8 @@ PyDoc_STRVAR(audioop_bias__doc__,
{"bias", (PyCFunction)audioop_bias, METH_VARARGS, audioop_bias__doc__},
static PyObject *
-audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width, int bias);
+audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ int bias);
static PyObject *
audioop_bias(PyModuleDef *module, PyObject *args)
@@ -533,8 +527,7 @@ audioop_bias(PyModuleDef *module, PyObject *args)
int width;
int bias;
- if (!PyArg_ParseTuple(args,
- "y*ii:bias",
+ if (!PyArg_ParseTuple(args, "y*ii:bias",
&fragment, &width, &bias))
goto exit;
return_value = audioop_bias_impl(module, &fragment, width, bias);
@@ -566,8 +559,7 @@ audioop_reverse(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:reverse",
+ if (!PyArg_ParseTuple(args, "y*i:reverse",
&fragment, &width))
goto exit;
return_value = audioop_reverse_impl(module, &fragment, width);
@@ -599,8 +591,7 @@ audioop_byteswap(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:byteswap",
+ if (!PyArg_ParseTuple(args, "y*i:byteswap",
&fragment, &width))
goto exit;
return_value = audioop_byteswap_impl(module, &fragment, width);
@@ -623,7 +614,8 @@ PyDoc_STRVAR(audioop_lin2lin__doc__,
{"lin2lin", (PyCFunction)audioop_lin2lin, METH_VARARGS, audioop_lin2lin__doc__},
static PyObject *
-audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, int newwidth);
+audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ int newwidth);
static PyObject *
audioop_lin2lin(PyModuleDef *module, PyObject *args)
@@ -633,8 +625,7 @@ audioop_lin2lin(PyModuleDef *module, PyObject *args)
int width;
int newwidth;
- if (!PyArg_ParseTuple(args,
- "y*ii:lin2lin",
+ if (!PyArg_ParseTuple(args, "y*ii:lin2lin",
&fragment, &width, &newwidth))
goto exit;
return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
@@ -658,7 +649,9 @@ PyDoc_STRVAR(audioop_ratecv__doc__,
{"ratecv", (PyCFunction)audioop_ratecv, METH_VARARGS, audioop_ratecv__doc__},
static PyObject *
-audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width, int nchannels, int inrate, int outrate, PyObject *state, int weightA, int weightB);
+audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ int nchannels, int inrate, int outrate, PyObject *state,
+ int weightA, int weightB);
static PyObject *
audioop_ratecv(PyModuleDef *module, PyObject *args)
@@ -673,8 +666,7 @@ audioop_ratecv(PyModuleDef *module, PyObject *args)
int weightA = 1;
int weightB = 0;
- if (!PyArg_ParseTuple(args,
- "y*iiiiO|ii:ratecv",
+ if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv",
&fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB))
goto exit;
return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
@@ -706,8 +698,7 @@ audioop_lin2ulaw(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:lin2ulaw",
+ if (!PyArg_ParseTuple(args, "y*i:lin2ulaw",
&fragment, &width))
goto exit;
return_value = audioop_lin2ulaw_impl(module, &fragment, width);
@@ -739,8 +730,7 @@ audioop_ulaw2lin(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:ulaw2lin",
+ if (!PyArg_ParseTuple(args, "y*i:ulaw2lin",
&fragment, &width))
goto exit;
return_value = audioop_ulaw2lin_impl(module, &fragment, width);
@@ -772,8 +762,7 @@ audioop_lin2alaw(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:lin2alaw",
+ if (!PyArg_ParseTuple(args, "y*i:lin2alaw",
&fragment, &width))
goto exit;
return_value = audioop_lin2alaw_impl(module, &fragment, width);
@@ -805,8 +794,7 @@ audioop_alaw2lin(PyModuleDef *module, PyObject *args)
Py_buffer fragment = {NULL, NULL};
int width;
- if (!PyArg_ParseTuple(args,
- "y*i:alaw2lin",
+ if (!PyArg_ParseTuple(args, "y*i:alaw2lin",
&fragment, &width))
goto exit;
return_value = audioop_alaw2lin_impl(module, &fragment, width);
@@ -829,7 +817,8 @@ PyDoc_STRVAR(audioop_lin2adpcm__doc__,
{"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_VARARGS, audioop_lin2adpcm__doc__},
static PyObject *
-audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state);
+audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ PyObject *state);
static PyObject *
audioop_lin2adpcm(PyModuleDef *module, PyObject *args)
@@ -839,8 +828,7 @@ audioop_lin2adpcm(PyModuleDef *module, PyObject *args)
int width;
PyObject *state;
- if (!PyArg_ParseTuple(args,
- "y*iO:lin2adpcm",
+ if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm",
&fragment, &width, &state))
goto exit;
return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
@@ -863,7 +851,8 @@ PyDoc_STRVAR(audioop_adpcm2lin__doc__,
{"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_VARARGS, audioop_adpcm2lin__doc__},
static PyObject *
-audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state);
+audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width,
+ PyObject *state);
static PyObject *
audioop_adpcm2lin(PyModuleDef *module, PyObject *args)
@@ -873,8 +862,7 @@ audioop_adpcm2lin(PyModuleDef *module, PyObject *args)
int width;
PyObject *state;
- if (!PyArg_ParseTuple(args,
- "y*iO:adpcm2lin",
+ if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin",
&fragment, &width, &state))
goto exit;
return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
@@ -886,4 +874,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=be840bba5d40c2ce input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a076e1b213a8727b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index ef646dd..e348bee 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -9,20 +9,18 @@ PyDoc_STRVAR(binascii_a2b_uu__doc__,
"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,
- "O&:a2b_uu",
- ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data))
goto exit;
return_value = binascii_a2b_uu_impl(module, &data);
@@ -41,20 +39,18 @@ PyDoc_STRVAR(binascii_b2a_uu__doc__,
"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,
- "y*:b2a_uu",
- &data))
+ if (!PyArg_Parse(arg, "y*:b2a_uu", &data))
goto exit;
return_value = binascii_b2a_uu_impl(module, &data);
@@ -73,20 +69,18 @@ PyDoc_STRVAR(binascii_a2b_base64__doc__,
"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,
- "O&:a2b_base64",
- ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data))
goto exit;
return_value = binascii_a2b_base64_impl(module, &data);
@@ -105,20 +99,18 @@ PyDoc_STRVAR(binascii_b2a_base64__doc__,
"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,
- "y*:b2a_base64",
- &data))
+ if (!PyArg_Parse(arg, "y*:b2a_base64", &data))
goto exit;
return_value = binascii_b2a_base64_impl(module, &data);
@@ -137,20 +129,18 @@ PyDoc_STRVAR(binascii_a2b_hqx__doc__,
"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,
- "O&:a2b_hqx",
- ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data))
goto exit;
return_value = binascii_a2b_hqx_impl(module, &data);
@@ -169,20 +159,18 @@ PyDoc_STRVAR(binascii_rlecode_hqx__doc__,
"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,
- "y*:rlecode_hqx",
- &data))
+ if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data))
goto exit;
return_value = binascii_rlecode_hqx_impl(module, &data);
@@ -201,20 +189,18 @@ PyDoc_STRVAR(binascii_b2a_hqx__doc__,
"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,
- "y*:b2a_hqx",
- &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hqx", &data))
goto exit;
return_value = binascii_b2a_hqx_impl(module, &data);
@@ -233,20 +219,18 @@ PyDoc_STRVAR(binascii_rledecode_hqx__doc__,
"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,
- "y*:rledecode_hqx",
- &data))
+ if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data))
goto exit;
return_value = binascii_rledecode_hqx_impl(module, &data);
@@ -278,12 +262,11 @@ binascii_crc_hqx(PyModuleDef *module, PyObject *args)
unsigned int crc;
unsigned int _return_value;
- if (!PyArg_ParseTuple(args,
- "y*I:crc_hqx",
+ if (!PyArg_ParseTuple(args, "y*I:crc_hqx",
&data, &crc))
goto exit;
_return_value = binascii_crc_hqx_impl(module, &data, crc);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
@@ -315,12 +298,11 @@ binascii_crc32(PyModuleDef *module, PyObject *args)
unsigned int crc = 0;
unsigned int _return_value;
- if (!PyArg_ParseTuple(args,
- "y*|I:crc32",
+ if (!PyArg_ParseTuple(args, "y*|I:crc32",
&data, &crc))
goto exit;
_return_value = binascii_crc32_impl(module, &data, crc);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
@@ -342,20 +324,18 @@ PyDoc_STRVAR(binascii_b2a_hex__doc__,
"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,
- "y*:b2a_hex",
- &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hex", &data))
goto exit;
return_value = binascii_b2a_hex_impl(module, &data);
@@ -376,20 +356,18 @@ PyDoc_STRVAR(binascii_hexlify__doc__,
"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,
- "y*:hexlify",
- &data))
+ if (!PyArg_Parse(arg, "y*:hexlify", &data))
goto exit;
return_value = binascii_hexlify_impl(module, &data);
@@ -411,20 +389,18 @@ PyDoc_STRVAR(binascii_a2b_hex__doc__,
"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,
- "O&:a2b_hex",
- ascii_buffer_converter, &hexstr))
+ if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr))
goto exit;
return_value = binascii_a2b_hex_impl(module, &hexstr);
@@ -445,20 +421,18 @@ PyDoc_STRVAR(binascii_unhexlify__doc__,
"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,
- "O&:unhexlify",
- ascii_buffer_converter, &hexstr))
+ if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr))
goto exit;
return_value = binascii_unhexlify_impl(module, &hexstr);
@@ -490,8 +464,7 @@ binascii_a2b_qp(PyModuleDef *module, PyObject *args, PyObject *kwargs)
Py_buffer data = {NULL, NULL};
int header = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O&|i:a2b_qp", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i:a2b_qp", _keywords,
ascii_buffer_converter, &data, &header))
goto exit;
return_value = binascii_a2b_qp_impl(module, &data, header);
@@ -518,7 +491,8 @@ PyDoc_STRVAR(binascii_b2a_qp__doc__,
{"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS|METH_KEYWORDS, binascii_b2a_qp__doc__},
static PyObject *
-binascii_b2a_qp_impl(PyModuleDef *module, Py_buffer *data, int quotetabs, int istext, int header);
+binascii_b2a_qp_impl(PyModuleDef *module, Py_buffer *data, int quotetabs,
+ int istext, int header);
static PyObject *
binascii_b2a_qp(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -530,8 +504,7 @@ binascii_b2a_qp(PyModuleDef *module, PyObject *args, PyObject *kwargs)
int istext = 1;
int header = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "y*|iii:b2a_qp", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii:b2a_qp", _keywords,
&data, &quotetabs, &istext, &header))
goto exit;
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
@@ -543,4 +516,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=22761b36f4f9e5bb input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b1a3cbf7660ebaa5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h
new file mode 100644
index 0000000..7d61649
--- /dev/null
+++ b/Modules/clinic/cmathmodule.c.h
@@ -0,0 +1,860 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(cmath_acos__doc__,
+"acos($module, z, /)\n"
+"--\n"
+"\n"
+"Return the arc cosine of z.");
+
+#define CMATH_ACOS_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:acos", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_acos_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_acosh__doc__,
+"acosh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the inverse hyperbolic cosine of z.");
+
+#define CMATH_ACOSH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:acosh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_acosh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_asin__doc__,
+"asin($module, z, /)\n"
+"--\n"
+"\n"
+"Return the arc sine of z.");
+
+#define CMATH_ASIN_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:asin", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_asin_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_asinh__doc__,
+"asinh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the inverse hyperbolic sine of z.");
+
+#define CMATH_ASINH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:asinh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_asinh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_atan__doc__,
+"atan($module, z, /)\n"
+"--\n"
+"\n"
+"Return the arc tangent of z.");
+
+#define CMATH_ATAN_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:atan", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_atan_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_atanh__doc__,
+"atanh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the inverse hyperbolic tangent of z.");
+
+#define CMATH_ATANH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:atanh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_atanh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_cos__doc__,
+"cos($module, z, /)\n"
+"--\n"
+"\n"
+"Return the cosine of z.");
+
+#define CMATH_COS_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:cos", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_cos_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_cosh__doc__,
+"cosh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the hyperbolic cosine of z.");
+
+#define CMATH_COSH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:cosh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_cosh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_exp__doc__,
+"exp($module, z, /)\n"
+"--\n"
+"\n"
+"Return the exponential value e**z.");
+
+#define CMATH_EXP_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:exp", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_exp_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_log10__doc__,
+"log10($module, z, /)\n"
+"--\n"
+"\n"
+"Return the base-10 logarithm of z.");
+
+#define CMATH_LOG10_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:log10", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_log10_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_sin__doc__,
+"sin($module, z, /)\n"
+"--\n"
+"\n"
+"Return the sine of z.");
+
+#define CMATH_SIN_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:sin", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_sin_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_sinh__doc__,
+"sinh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the hyperbolic sine of z.");
+
+#define CMATH_SINH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:sinh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_sinh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_sqrt__doc__,
+"sqrt($module, z, /)\n"
+"--\n"
+"\n"
+"Return the square root of z.");
+
+#define CMATH_SQRT_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:sqrt", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_sqrt_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_tan__doc__,
+"tan($module, z, /)\n"
+"--\n"
+"\n"
+"Return the tangent of z.");
+
+#define CMATH_TAN_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:tan", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_tan_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_tanh__doc__,
+"tanh($module, z, /)\n"
+"--\n"
+"\n"
+"Return the hyperbolic tangent of z.");
+
+#define CMATH_TANH_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+ Py_complex _return_value;
+
+ if (!PyArg_Parse(arg, "D:tanh", &z))
+ goto exit;
+ /* modifications for z */
+ errno = 0; PyFPE_START_PROTECT("complex function", goto exit);
+ _return_value = cmath_tanh_impl(module, z);
+ PyFPE_END_PROTECT(_return_value);
+ if (errno == EDOM) {
+ PyErr_SetString(PyExc_ValueError, "math domain error");
+ goto exit;
+ }
+ else if (errno == ERANGE) {
+ PyErr_SetString(PyExc_OverflowError, "math range error");
+ goto exit;
+ }
+ else {
+ return_value = PyComplex_FromCComplex(_return_value);
+ }
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_log__doc__,
+"log($module, x, y_obj=None, /)\n"
+"--\n"
+"\n"
+"The logarithm of z to the given base.\n"
+"\n"
+"If the base not specified, returns the natural logarithm (base e) of z.");
+
+#define CMATH_LOG_METHODDEF \
+ {"log", (PyCFunction)cmath_log, METH_VARARGS, cmath_log__doc__},
+
+static PyObject *
+cmath_log_impl(PyModuleDef *module, Py_complex x, PyObject *y_obj);
+
+static PyObject *
+cmath_log(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_complex x;
+ PyObject *y_obj = NULL;
+
+ if (!PyArg_ParseTuple(args, "D|O:log",
+ &x, &y_obj))
+ goto exit;
+ return_value = cmath_log_impl(module, x, y_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_phase__doc__,
+"phase($module, z, /)\n"
+"--\n"
+"\n"
+"Return argument, also known as the phase angle, of a complex.");
+
+#define CMATH_PHASE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+
+ if (!PyArg_Parse(arg, "D:phase", &z))
+ goto exit;
+ return_value = cmath_phase_impl(module, z);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_polar__doc__,
+"polar($module, z, /)\n"
+"--\n"
+"\n"
+"Convert a complex from rectangular coordinates to polar coordinates.\n"
+"\n"
+"r is the distance from 0 and phi the phase angle.");
+
+#define CMATH_POLAR_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+
+ if (!PyArg_Parse(arg, "D:polar", &z))
+ goto exit;
+ return_value = cmath_polar_impl(module, z);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_rect__doc__,
+"rect($module, r, phi, /)\n"
+"--\n"
+"\n"
+"Convert from polar coordinates to rectangular coordinates.");
+
+#define CMATH_RECT_METHODDEF \
+ {"rect", (PyCFunction)cmath_rect, METH_VARARGS, cmath_rect__doc__},
+
+static PyObject *
+cmath_rect_impl(PyModuleDef *module, double r, double phi);
+
+static PyObject *
+cmath_rect(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ double r;
+ double phi;
+
+ if (!PyArg_ParseTuple(args, "dd:rect",
+ &r, &phi))
+ goto exit;
+ return_value = cmath_rect_impl(module, r, phi);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_isfinite__doc__,
+"isfinite($module, z, /)\n"
+"--\n"
+"\n"
+"Return True if both the real and imaginary parts of z are finite, else False.");
+
+#define CMATH_ISFINITE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+
+ if (!PyArg_Parse(arg, "D:isfinite", &z))
+ goto exit;
+ return_value = cmath_isfinite_impl(module, z);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_isnan__doc__,
+"isnan($module, z, /)\n"
+"--\n"
+"\n"
+"Checks if the real or imaginary part of z not a number (NaN).");
+
+#define CMATH_ISNAN_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+
+ if (!PyArg_Parse(arg, "D:isnan", &z))
+ goto exit;
+ return_value = cmath_isnan_impl(module, z);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_isinf__doc__,
+"isinf($module, z, /)\n"
+"--\n"
+"\n"
+"Checks if the real or imaginary part of z is infinite.");
+
+#define CMATH_ISINF_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_complex z;
+
+ if (!PyArg_Parse(arg, "D:isinf", &z))
+ goto exit;
+ return_value = cmath_isinf_impl(module, z);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(cmath_isclose__doc__,
+"isclose($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)\n"
+"--\n"
+"\n"
+"Determine whether two complex numbers are close in value.\n"
+"\n"
+" rel_tol\n"
+" maximum difference for being considered \"close\", relative to the\n"
+" magnitude of the input values\n"
+" abs_tol\n"
+" maximum difference for being considered \"close\", regardless of the\n"
+" magnitude of the input values\n"
+"\n"
+"Return True if a is close in value to b, and False otherwise.\n"
+"\n"
+"For the values to be considered close, the difference between them must be\n"
+"smaller than at least one of the tolerances.\n"
+"\n"
+"-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is\n"
+"not close to anything, even itself. inf and -inf are only close to themselves.");
+
+#define CMATH_ISCLOSE_METHODDEF \
+ {"isclose", (PyCFunction)cmath_isclose, METH_VARARGS|METH_KEYWORDS, cmath_isclose__doc__},
+
+static int
+cmath_isclose_impl(PyModuleDef *module, Py_complex a, Py_complex b,
+ double rel_tol, double abs_tol);
+
+static PyObject *
+cmath_isclose(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
+ Py_complex a;
+ Py_complex b;
+ double rel_tol = 1e-09;
+ double abs_tol = 0.0;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "DD|$dd:isclose", _keywords,
+ &a, &b, &rel_tol, &abs_tol))
+ goto exit;
+ _return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=229e9c48c9d27362 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h
new file mode 100644
index 0000000..5e3b1c0
--- /dev/null
+++ b/Modules/clinic/fcntlmodule.c.h
@@ -0,0 +1,185 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(fcntl_fcntl__doc__,
+"fcntl($module, fd, cmd, arg=0, /)\n"
+"--\n"
+"\n"
+"Perform the operation `cmd` on file descriptor fd.\n"
+"\n"
+"The values used for `cmd` are operating system dependent, and are available\n"
+"as constants in the fcntl module, using the same names as used in\n"
+"the relevant C header files. The argument arg is optional, and\n"
+"defaults to 0; it may be an int or a string. If arg is given as a string,\n"
+"the return value of fcntl is a string of that length, containing the\n"
+"resulting value put in the arg buffer by the operating system. The length\n"
+"of the arg string is not allowed to exceed 1024 bytes. If the arg given\n"
+"is an integer or if none is specified, the result value is an integer\n"
+"corresponding to the return value of the fcntl call in the C code.");
+
+#define FCNTL_FCNTL_METHODDEF \
+ {"fcntl", (PyCFunction)fcntl_fcntl, METH_VARARGS, fcntl_fcntl__doc__},
+
+static PyObject *
+fcntl_fcntl_impl(PyModuleDef *module, int fd, int code, PyObject *arg);
+
+static PyObject *
+fcntl_fcntl(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int code;
+ PyObject *arg = NULL;
+
+ if (!PyArg_ParseTuple(args, "O&i|O:fcntl",
+ conv_descriptor, &fd, &code, &arg))
+ goto exit;
+ return_value = fcntl_fcntl_impl(module, fd, code, arg);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(fcntl_ioctl__doc__,
+"ioctl($module, fd, request, arg=0, mutate_flag=True, /)\n"
+"--\n"
+"\n"
+"Perform the operation `request` on file descriptor `fd`.\n"
+"\n"
+"The values used for `request` are operating system dependent, and are available\n"
+"as constants in the fcntl or termios library modules, using the same names as\n"
+"used in the relevant C header files.\n"
+"\n"
+"The argument `arg` is optional, and defaults to 0; it may be an int or a\n"
+"buffer containing character data (most likely a string or an array).\n"
+"\n"
+"If the argument is a mutable buffer (such as an array) and if the\n"
+"mutate_flag argument (which is only allowed in this case) is true then the\n"
+"buffer is (in effect) passed to the operating system and changes made by\n"
+"the OS will be reflected in the contents of the buffer after the call has\n"
+"returned. The return value is the integer returned by the ioctl system\n"
+"call.\n"
+"\n"
+"If the argument is a mutable buffer and the mutable_flag argument is false,\n"
+"the behavior is as if a string had been passed.\n"
+"\n"
+"If the argument is an immutable buffer (most likely a string) then a copy\n"
+"of the buffer is passed to the operating system and the return value is a\n"
+"string of the same length containing whatever the operating system put in\n"
+"the buffer. The length of the arg buffer in this case is not allowed to\n"
+"exceed 1024 bytes.\n"
+"\n"
+"If the arg given is an integer or if none is specified, the result value is\n"
+"an integer corresponding to the return value of the ioctl call in the C\n"
+"code.");
+
+#define FCNTL_IOCTL_METHODDEF \
+ {"ioctl", (PyCFunction)fcntl_ioctl, METH_VARARGS, fcntl_ioctl__doc__},
+
+static PyObject *
+fcntl_ioctl_impl(PyModuleDef *module, int fd, unsigned int code,
+ PyObject *ob_arg, int mutate_arg);
+
+static PyObject *
+fcntl_ioctl(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ unsigned int code;
+ PyObject *ob_arg = NULL;
+ int mutate_arg = 1;
+
+ if (!PyArg_ParseTuple(args, "O&I|Op:ioctl",
+ conv_descriptor, &fd, &code, &ob_arg, &mutate_arg))
+ goto exit;
+ return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(fcntl_flock__doc__,
+"flock($module, fd, operation, /)\n"
+"--\n"
+"\n"
+"Perform the lock operation `operation` on file descriptor `fd`.\n"
+"\n"
+"See the Unix manual page for flock(2) for details (On some systems, this\n"
+"function is emulated using fcntl()).");
+
+#define FCNTL_FLOCK_METHODDEF \
+ {"flock", (PyCFunction)fcntl_flock, METH_VARARGS, fcntl_flock__doc__},
+
+static PyObject *
+fcntl_flock_impl(PyModuleDef *module, int fd, int code);
+
+static PyObject *
+fcntl_flock(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int code;
+
+ if (!PyArg_ParseTuple(args, "O&i:flock",
+ conv_descriptor, &fd, &code))
+ goto exit;
+ return_value = fcntl_flock_impl(module, fd, code);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(fcntl_lockf__doc__,
+"lockf($module, fd, cmd, len=0, start=0, whence=0, /)\n"
+"--\n"
+"\n"
+"A wrapper around the fcntl() locking calls.\n"
+"\n"
+"`fd` is the file descriptor of the file to lock or unlock, and operation is one\n"
+"of the following values:\n"
+"\n"
+" LOCK_UN - unlock\n"
+" LOCK_SH - acquire a shared lock\n"
+" LOCK_EX - acquire an exclusive lock\n"
+"\n"
+"When operation is LOCK_SH or LOCK_EX, it can also be bitwise ORed with\n"
+"LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the\n"
+"lock cannot be acquired, an IOError will be raised and the exception will\n"
+"have an errno attribute set to EACCES or EAGAIN (depending on the operating\n"
+"system -- for portability, check for either value).\n"
+"\n"
+"`len` is the number of bytes to lock, with the default meaning to lock to\n"
+"EOF. `start` is the byte offset, relative to `whence`, to that the lock\n"
+"starts. `whence` is as with fileobj.seek(), specifically:\n"
+"\n"
+" 0 - relative to the start of the file (SEEK_SET)\n"
+" 1 - relative to the current buffer position (SEEK_CUR)\n"
+" 2 - relative to the end of the file (SEEK_END)");
+
+#define FCNTL_LOCKF_METHODDEF \
+ {"lockf", (PyCFunction)fcntl_lockf, METH_VARARGS, fcntl_lockf__doc__},
+
+static PyObject *
+fcntl_lockf_impl(PyModuleDef *module, int fd, int code, PyObject *lenobj,
+ PyObject *startobj, int whence);
+
+static PyObject *
+fcntl_lockf(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int code;
+ PyObject *lenobj = NULL;
+ PyObject *startobj = NULL;
+ int whence = 0;
+
+ if (!PyArg_ParseTuple(args, "O&i|OOi:lockf",
+ conv_descriptor, &fd, &code, &lenobj, &startobj, &whence))
+ goto exit;
+ return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=92963b631d00f0fe input=a9049054013a1b77]*/
diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h
new file mode 100644
index 0000000..eb5b59d
--- /dev/null
+++ b/Modules/clinic/grpmodule.c.h
@@ -0,0 +1,85 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(grp_getgrgid__doc__,
+"getgrgid($module, /, id)\n"
+"--\n"
+"\n"
+"Return the group database entry for the given numeric group ID.\n"
+"\n"
+"If id is not valid, raise KeyError.");
+
+#define GRP_GETGRGID_METHODDEF \
+ {"getgrgid", (PyCFunction)grp_getgrgid, METH_VARARGS|METH_KEYWORDS, grp_getgrgid__doc__},
+
+static PyObject *
+grp_getgrgid_impl(PyModuleDef *module, PyObject *id);
+
+static PyObject *
+grp_getgrgid(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"id", NULL};
+ PyObject *id;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:getgrgid", _keywords,
+ &id))
+ goto exit;
+ return_value = grp_getgrgid_impl(module, id);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(grp_getgrnam__doc__,
+"getgrnam($module, /, name)\n"
+"--\n"
+"\n"
+"Return the group database entry for the given group name.\n"
+"\n"
+"If name is not valid, raise KeyError.");
+
+#define GRP_GETGRNAM_METHODDEF \
+ {"getgrnam", (PyCFunction)grp_getgrnam, METH_VARARGS|METH_KEYWORDS, grp_getgrnam__doc__},
+
+static PyObject *
+grp_getgrnam_impl(PyModuleDef *module, PyObject *name);
+
+static PyObject *
+grp_getgrnam(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"name", NULL};
+ PyObject *name;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:getgrnam", _keywords,
+ &name))
+ goto exit;
+ return_value = grp_getgrnam_impl(module, name);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(grp_getgrall__doc__,
+"getgrall($module, /)\n"
+"--\n"
+"\n"
+"Return a list of all available group entries, in arbitrary order.\n"
+"\n"
+"An entry whose name starts with \'+\' or \'-\' represents an instruction\n"
+"to use YP/NIS and may not be accessible via getgrnam or getgrgid.");
+
+#define GRP_GETGRALL_METHODDEF \
+ {"getgrall", (PyCFunction)grp_getgrall, METH_NOARGS, grp_getgrall__doc__},
+
+static PyObject *
+grp_getgrall_impl(PyModuleDef *module);
+
+static PyObject *
+grp_getgrall(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return grp_getgrall_impl(module);
+}
+/*[clinic end generated code: output=5191c25600afb1bd input=a9049054013a1b77]*/
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h
new file mode 100644
index 0000000..f5a3117
--- /dev/null
+++ b/Modules/clinic/md5module.c.h
@@ -0,0 +1,95 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(MD5Type_copy__doc__,
+"copy($self, /)\n"
+"--\n"
+"\n"
+"Return a copy of the hash object.");
+
+#define MD5TYPE_COPY_METHODDEF \
+ {"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
+
+static PyObject *
+MD5Type_copy_impl(MD5object *self);
+
+static PyObject *
+MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
+{
+ return MD5Type_copy_impl(self);
+}
+
+PyDoc_STRVAR(MD5Type_digest__doc__,
+"digest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of binary data.");
+
+#define MD5TYPE_DIGEST_METHODDEF \
+ {"digest", (PyCFunction)MD5Type_digest, METH_NOARGS, MD5Type_digest__doc__},
+
+static PyObject *
+MD5Type_digest_impl(MD5object *self);
+
+static PyObject *
+MD5Type_digest(MD5object *self, PyObject *Py_UNUSED(ignored))
+{
+ return MD5Type_digest_impl(self);
+}
+
+PyDoc_STRVAR(MD5Type_hexdigest__doc__,
+"hexdigest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of hexadecimal digits.");
+
+#define MD5TYPE_HEXDIGEST_METHODDEF \
+ {"hexdigest", (PyCFunction)MD5Type_hexdigest, METH_NOARGS, MD5Type_hexdigest__doc__},
+
+static PyObject *
+MD5Type_hexdigest_impl(MD5object *self);
+
+static PyObject *
+MD5Type_hexdigest(MD5object *self, PyObject *Py_UNUSED(ignored))
+{
+ return MD5Type_hexdigest_impl(self);
+}
+
+PyDoc_STRVAR(MD5Type_update__doc__,
+"update($self, obj, /)\n"
+"--\n"
+"\n"
+"Update this hash object\'s state with the provided string.");
+
+#define MD5TYPE_UPDATE_METHODDEF \
+ {"update", (PyCFunction)MD5Type_update, METH_O, MD5Type_update__doc__},
+
+PyDoc_STRVAR(_md5_md5__doc__,
+"md5($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new MD5 hash object; optionally initialized with a string.");
+
+#define _MD5_MD5_METHODDEF \
+ {"md5", (PyCFunction)_md5_md5, METH_VARARGS|METH_KEYWORDS, _md5_md5__doc__},
+
+static PyObject *
+_md5_md5_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_md5_md5(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:md5", _keywords,
+ &string))
+ goto exit;
+ return_value = _md5_md5_impl(module, string);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=0f803ded701aca54 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
new file mode 100644
index 0000000..98eeae4
--- /dev/null
+++ b/Modules/clinic/posixmodule.c.h
@@ -0,0 +1,5791 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(os_stat__doc__,
+"stat($module, /, path, *, dir_fd=None, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Perform a stat system call on the given path.\n"
+"\n"
+" path\n"
+" Path to be examined; can be string, bytes, or open-file-descriptor int.\n"
+" dir_fd\n"
+" If not None, it should be a file descriptor open to a directory,\n"
+" and path should be a relative string; path will then be relative to\n"
+" that directory.\n"
+" follow_symlinks\n"
+" If False, and the last element of the path is a symbolic link,\n"
+" stat will examine the symbolic link itself instead of the file\n"
+" the link points to.\n"
+"\n"
+"dir_fd and follow_symlinks may not be implemented\n"
+" on your platform. If they are unavailable, using them will raise a\n"
+" NotImplementedError.\n"
+"\n"
+"It\'s an error to use dir_fd or follow_symlinks when specifying path as\n"
+" an open file descriptor.");
+
+#define OS_STAT_METHODDEF \
+ {"stat", (PyCFunction)os_stat, METH_VARARGS|METH_KEYWORDS, os_stat__doc__},
+
+static PyObject *
+os_stat_impl(PyModuleDef *module, path_t *path, int dir_fd,
+ int follow_symlinks);
+
+static PyObject *
+os_stat(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("stat", "path", 0, 1);
+ int dir_fd = DEFAULT_DIR_FD;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&p:stat", _keywords,
+ path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ goto exit;
+ return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_lstat__doc__,
+"lstat($module, /, path, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Perform a stat system call on the given path, without following symbolic links.\n"
+"\n"
+"Like stat(), but do not follow symbolic links.\n"
+"Equivalent to stat(path, follow_symlinks=False).");
+
+#define OS_LSTAT_METHODDEF \
+ {"lstat", (PyCFunction)os_lstat, METH_VARARGS|METH_KEYWORDS, os_lstat__doc__},
+
+static PyObject *
+os_lstat_impl(PyModuleDef *module, path_t *path, int dir_fd);
+
+static PyObject *
+os_lstat(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("lstat", "path", 0, 0);
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:lstat", _keywords,
+ path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_lstat_impl(module, &path, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_access__doc__,
+"access($module, /, path, mode, *, dir_fd=None, effective_ids=False,\n"
+" follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Use the real uid/gid to test for access to a path.\n"
+"\n"
+" path\n"
+" Path to be tested; can be string, bytes, or open-file-descriptor int.\n"
+" mode\n"
+" Operating-system mode bitfield. Can be F_OK to test existence,\n"
+" or the inclusive-OR of R_OK, W_OK, and X_OK.\n"
+" dir_fd\n"
+" If not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that\n"
+" directory.\n"
+" effective_ids\n"
+" If True, access will use the effective uid/gid instead of\n"
+" the real uid/gid.\n"
+" follow_symlinks\n"
+" If False, and the last element of the path is a symbolic link,\n"
+" access will examine the symbolic link itself instead of the file\n"
+" the link points to.\n"
+"\n"
+"dir_fd, effective_ids, and follow_symlinks may not be implemented\n"
+" on your platform. If they are unavailable, using them will raise a\n"
+" NotImplementedError.\n"
+"\n"
+"Note that most operations will use the effective uid/gid, therefore this\n"
+" routine can be used in a suid/sgid environment to test if the invoking user\n"
+" has the specified access to the path.");
+
+#define OS_ACCESS_METHODDEF \
+ {"access", (PyCFunction)os_access, METH_VARARGS|METH_KEYWORDS, os_access__doc__},
+
+static int
+os_access_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd,
+ int effective_ids, int follow_symlinks);
+
+static PyObject *
+os_access(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("access", "path", 0, 1);
+ int mode;
+ int dir_fd = DEFAULT_DIR_FD;
+ int effective_ids = 0;
+ int follow_symlinks = 1;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&pp:access", _keywords,
+ path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks))
+ goto exit;
+ _return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_TTYNAME)
+
+PyDoc_STRVAR(os_ttyname__doc__,
+"ttyname($module, fd, /)\n"
+"--\n"
+"\n"
+"Return the name of the terminal device connected to \'fd\'.\n"
+"\n"
+" fd\n"
+" Integer file descriptor handle.");
+
+#define OS_TTYNAME_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ char *_return_value;
+
+ if (!PyArg_Parse(arg, "i:ttyname", &fd))
+ goto exit;
+ _return_value = os_ttyname_impl(module, fd);
+ if (_return_value == NULL)
+ goto exit;
+ return_value = PyUnicode_DecodeFSDefault(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_TTYNAME) */
+
+#if defined(HAVE_CTERMID)
+
+PyDoc_STRVAR(os_ctermid__doc__,
+"ctermid($module, /)\n"
+"--\n"
+"\n"
+"Return the name of the controlling terminal for this process.");
+
+#define OS_CTERMID_METHODDEF \
+ {"ctermid", (PyCFunction)os_ctermid, METH_NOARGS, os_ctermid__doc__},
+
+static PyObject *
+os_ctermid_impl(PyModuleDef *module);
+
+static PyObject *
+os_ctermid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_ctermid_impl(module);
+}
+
+#endif /* defined(HAVE_CTERMID) */
+
+PyDoc_STRVAR(os_chdir__doc__,
+"chdir($module, /, path)\n"
+"--\n"
+"\n"
+"Change the current working directory to the specified path.\n"
+"\n"
+"path may always be specified as a string.\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.");
+
+#define OS_CHDIR_METHODDEF \
+ {"chdir", (PyCFunction)os_chdir, METH_VARARGS|METH_KEYWORDS, os_chdir__doc__},
+
+static PyObject *
+os_chdir_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os_chdir(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chdir", _keywords,
+ path_converter, &path))
+ goto exit;
+ return_value = os_chdir_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_FCHDIR)
+
+PyDoc_STRVAR(os_fchdir__doc__,
+"fchdir($module, /, fd)\n"
+"--\n"
+"\n"
+"Change to the directory of the given file descriptor.\n"
+"\n"
+"fd must be opened on a directory, not a file.\n"
+"Equivalent to os.chdir(fd).");
+
+#define OS_FCHDIR_METHODDEF \
+ {"fchdir", (PyCFunction)os_fchdir, METH_VARARGS|METH_KEYWORDS, os_fchdir__doc__},
+
+static PyObject *
+os_fchdir_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_fchdir(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fchdir", _keywords,
+ fildes_converter, &fd))
+ goto exit;
+ return_value = os_fchdir_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FCHDIR) */
+
+PyDoc_STRVAR(os_chmod__doc__,
+"chmod($module, /, path, mode, *, dir_fd=None, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Change the access permissions of a file.\n"
+"\n"
+" path\n"
+" Path to be modified. May always be specified as a str or bytes.\n"
+" On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.\n"
+" mode\n"
+" Operating-system mode bitfield.\n"
+" dir_fd\n"
+" If not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that\n"
+" directory.\n"
+" follow_symlinks\n"
+" If False, and the last element of the path is a symbolic link,\n"
+" chmod will modify the symbolic link itself instead of the file\n"
+" the link points to.\n"
+"\n"
+"It is an error to use dir_fd or follow_symlinks when specifying path as\n"
+" an open file descriptor.\n"
+"dir_fd and follow_symlinks may not be implemented on your platform.\n"
+" If they are unavailable, using them will raise a NotImplementedError.");
+
+#define OS_CHMOD_METHODDEF \
+ {"chmod", (PyCFunction)os_chmod, METH_VARARGS|METH_KEYWORDS, os_chmod__doc__},
+
+static PyObject *
+os_chmod_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd,
+ int follow_symlinks);
+
+static PyObject *
+os_chmod(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("chmod", "path", 0, PATH_HAVE_FCHMOD);
+ int mode;
+ int dir_fd = DEFAULT_DIR_FD;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&p:chmod", _keywords,
+ path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ goto exit;
+ return_value = os_chmod_impl(module, &path, mode, dir_fd, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_FCHMOD)
+
+PyDoc_STRVAR(os_fchmod__doc__,
+"fchmod($module, /, fd, mode)\n"
+"--\n"
+"\n"
+"Change the access permissions of the file given by file descriptor fd.\n"
+"\n"
+"Equivalent to os.chmod(fd, mode).");
+
+#define OS_FCHMOD_METHODDEF \
+ {"fchmod", (PyCFunction)os_fchmod, METH_VARARGS|METH_KEYWORDS, os_fchmod__doc__},
+
+static PyObject *
+os_fchmod_impl(PyModuleDef *module, int fd, int mode);
+
+static PyObject *
+os_fchmod(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", "mode", NULL};
+ int fd;
+ int mode;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:fchmod", _keywords,
+ &fd, &mode))
+ goto exit;
+ return_value = os_fchmod_impl(module, fd, mode);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FCHMOD) */
+
+#if defined(HAVE_LCHMOD)
+
+PyDoc_STRVAR(os_lchmod__doc__,
+"lchmod($module, /, path, mode)\n"
+"--\n"
+"\n"
+"Change the access permissions of a file, without following symbolic links.\n"
+"\n"
+"If path is a symlink, this affects the link itself rather than the target.\n"
+"Equivalent to chmod(path, mode, follow_symlinks=False).\"");
+
+#define OS_LCHMOD_METHODDEF \
+ {"lchmod", (PyCFunction)os_lchmod, METH_VARARGS|METH_KEYWORDS, os_lchmod__doc__},
+
+static PyObject *
+os_lchmod_impl(PyModuleDef *module, path_t *path, int mode);
+
+static PyObject *
+os_lchmod(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", NULL};
+ path_t path = PATH_T_INITIALIZE("lchmod", "path", 0, 0);
+ int mode;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:lchmod", _keywords,
+ path_converter, &path, &mode))
+ goto exit;
+ return_value = os_lchmod_impl(module, &path, mode);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_LCHMOD) */
+
+#if defined(HAVE_CHFLAGS)
+
+PyDoc_STRVAR(os_chflags__doc__,
+"chflags($module, /, path, flags, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Set file flags.\n"
+"\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, chflags will change flags on the symbolic link itself instead of the\n"
+" file the link points to.\n"
+"follow_symlinks may not be implemented on your platform. If it is\n"
+"unavailable, using it will raise a NotImplementedError.");
+
+#define OS_CHFLAGS_METHODDEF \
+ {"chflags", (PyCFunction)os_chflags, METH_VARARGS|METH_KEYWORDS, os_chflags__doc__},
+
+static PyObject *
+os_chflags_impl(PyModuleDef *module, path_t *path, unsigned long flags,
+ int follow_symlinks);
+
+static PyObject *
+os_chflags(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "flags", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("chflags", "path", 0, 0);
+ unsigned long flags;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k|p:chflags", _keywords,
+ path_converter, &path, &flags, &follow_symlinks))
+ goto exit;
+ return_value = os_chflags_impl(module, &path, flags, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_CHFLAGS) */
+
+#if defined(HAVE_LCHFLAGS)
+
+PyDoc_STRVAR(os_lchflags__doc__,
+"lchflags($module, /, path, flags)\n"
+"--\n"
+"\n"
+"Set file flags.\n"
+"\n"
+"This function will not follow symbolic links.\n"
+"Equivalent to chflags(path, flags, follow_symlinks=False).");
+
+#define OS_LCHFLAGS_METHODDEF \
+ {"lchflags", (PyCFunction)os_lchflags, METH_VARARGS|METH_KEYWORDS, os_lchflags__doc__},
+
+static PyObject *
+os_lchflags_impl(PyModuleDef *module, path_t *path, unsigned long flags);
+
+static PyObject *
+os_lchflags(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "flags", NULL};
+ path_t path = PATH_T_INITIALIZE("lchflags", "path", 0, 0);
+ unsigned long flags;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k:lchflags", _keywords,
+ path_converter, &path, &flags))
+ goto exit;
+ return_value = os_lchflags_impl(module, &path, flags);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_LCHFLAGS) */
+
+#if defined(HAVE_CHROOT)
+
+PyDoc_STRVAR(os_chroot__doc__,
+"chroot($module, /, path)\n"
+"--\n"
+"\n"
+"Change root directory to path.");
+
+#define OS_CHROOT_METHODDEF \
+ {"chroot", (PyCFunction)os_chroot, METH_VARARGS|METH_KEYWORDS, os_chroot__doc__},
+
+static PyObject *
+os_chroot_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os_chroot(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chroot", _keywords,
+ path_converter, &path))
+ goto exit;
+ return_value = os_chroot_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_CHROOT) */
+
+#if defined(HAVE_FSYNC)
+
+PyDoc_STRVAR(os_fsync__doc__,
+"fsync($module, /, fd)\n"
+"--\n"
+"\n"
+"Force write of fd to disk.");
+
+#define OS_FSYNC_METHODDEF \
+ {"fsync", (PyCFunction)os_fsync, METH_VARARGS|METH_KEYWORDS, os_fsync__doc__},
+
+static PyObject *
+os_fsync_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_fsync(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fsync", _keywords,
+ fildes_converter, &fd))
+ goto exit;
+ return_value = os_fsync_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FSYNC) */
+
+#if defined(HAVE_SYNC)
+
+PyDoc_STRVAR(os_sync__doc__,
+"sync($module, /)\n"
+"--\n"
+"\n"
+"Force write of everything to disk.");
+
+#define OS_SYNC_METHODDEF \
+ {"sync", (PyCFunction)os_sync, METH_NOARGS, os_sync__doc__},
+
+static PyObject *
+os_sync_impl(PyModuleDef *module);
+
+static PyObject *
+os_sync(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_sync_impl(module);
+}
+
+#endif /* defined(HAVE_SYNC) */
+
+#if defined(HAVE_FDATASYNC)
+
+PyDoc_STRVAR(os_fdatasync__doc__,
+"fdatasync($module, /, fd)\n"
+"--\n"
+"\n"
+"Force write of fd to disk without forcing update of metadata.");
+
+#define OS_FDATASYNC_METHODDEF \
+ {"fdatasync", (PyCFunction)os_fdatasync, METH_VARARGS|METH_KEYWORDS, os_fdatasync__doc__},
+
+static PyObject *
+os_fdatasync_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_fdatasync(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fdatasync", _keywords,
+ fildes_converter, &fd))
+ goto exit;
+ return_value = os_fdatasync_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FDATASYNC) */
+
+#if defined(HAVE_CHOWN)
+
+PyDoc_STRVAR(os_chown__doc__,
+"chown($module, /, path, uid, gid, *, dir_fd=None, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Change the owner and group id of path to the numeric uid and gid.\\\n"
+"\n"
+" path\n"
+" Path to be examined; can be string, bytes, or open-file-descriptor int.\n"
+" dir_fd\n"
+" If not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that\n"
+" directory.\n"
+" follow_symlinks\n"
+" If False, and the last element of the path is a symbolic link,\n"
+" stat will examine the symbolic link itself instead of the file\n"
+" the link points to.\n"
+"\n"
+"path may always be specified as a string.\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, chown will modify the symbolic link itself instead of the file the\n"
+" link points to.\n"
+"It is an error to use dir_fd or follow_symlinks when specifying path as\n"
+" an open file descriptor.\n"
+"dir_fd and follow_symlinks may not be implemented on your platform.\n"
+" If they are unavailable, using them will raise a NotImplementedError.");
+
+#define OS_CHOWN_METHODDEF \
+ {"chown", (PyCFunction)os_chown, METH_VARARGS|METH_KEYWORDS, os_chown__doc__},
+
+static PyObject *
+os_chown_impl(PyModuleDef *module, path_t *path, uid_t uid, gid_t gid,
+ int dir_fd, int follow_symlinks);
+
+static PyObject *
+os_chown(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "uid", "gid", "dir_fd", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("chown", "path", 0, PATH_HAVE_FCHOWN);
+ uid_t uid;
+ gid_t gid;
+ int dir_fd = DEFAULT_DIR_FD;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", _keywords,
+ path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ goto exit;
+ return_value = os_chown_impl(module, &path, uid, gid, dir_fd, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_CHOWN) */
+
+#if defined(HAVE_FCHOWN)
+
+PyDoc_STRVAR(os_fchown__doc__,
+"fchown($module, /, fd, uid, gid)\n"
+"--\n"
+"\n"
+"Change the owner and group id of the file specified by file descriptor.\n"
+"\n"
+"Equivalent to os.chown(fd, uid, gid).");
+
+#define OS_FCHOWN_METHODDEF \
+ {"fchown", (PyCFunction)os_fchown, METH_VARARGS|METH_KEYWORDS, os_fchown__doc__},
+
+static PyObject *
+os_fchown_impl(PyModuleDef *module, int fd, uid_t uid, gid_t gid);
+
+static PyObject *
+os_fchown(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", "uid", "gid", NULL};
+ int fd;
+ uid_t uid;
+ gid_t gid;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&O&:fchown", _keywords,
+ &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid))
+ goto exit;
+ return_value = os_fchown_impl(module, fd, uid, gid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FCHOWN) */
+
+#if defined(HAVE_LCHOWN)
+
+PyDoc_STRVAR(os_lchown__doc__,
+"lchown($module, /, path, uid, gid)\n"
+"--\n"
+"\n"
+"Change the owner and group id of path to the numeric uid and gid.\n"
+"\n"
+"This function will not follow symbolic links.\n"
+"Equivalent to os.chown(path, uid, gid, follow_symlinks=False).");
+
+#define OS_LCHOWN_METHODDEF \
+ {"lchown", (PyCFunction)os_lchown, METH_VARARGS|METH_KEYWORDS, os_lchown__doc__},
+
+static PyObject *
+os_lchown_impl(PyModuleDef *module, path_t *path, uid_t uid, gid_t gid);
+
+static PyObject *
+os_lchown(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "uid", "gid", NULL};
+ path_t path = PATH_T_INITIALIZE("lchown", "path", 0, 0);
+ uid_t uid;
+ gid_t gid;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&:lchown", _keywords,
+ path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid))
+ goto exit;
+ return_value = os_lchown_impl(module, &path, uid, gid);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_LCHOWN) */
+
+PyDoc_STRVAR(os_getcwd__doc__,
+"getcwd($module, /)\n"
+"--\n"
+"\n"
+"Return a unicode string representing the current working directory.");
+
+#define OS_GETCWD_METHODDEF \
+ {"getcwd", (PyCFunction)os_getcwd, METH_NOARGS, os_getcwd__doc__},
+
+static PyObject *
+os_getcwd_impl(PyModuleDef *module);
+
+static PyObject *
+os_getcwd(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getcwd_impl(module);
+}
+
+PyDoc_STRVAR(os_getcwdb__doc__,
+"getcwdb($module, /)\n"
+"--\n"
+"\n"
+"Return a bytes string representing the current working directory.");
+
+#define OS_GETCWDB_METHODDEF \
+ {"getcwdb", (PyCFunction)os_getcwdb, METH_NOARGS, os_getcwdb__doc__},
+
+static PyObject *
+os_getcwdb_impl(PyModuleDef *module);
+
+static PyObject *
+os_getcwdb(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getcwdb_impl(module);
+}
+
+#if defined(HAVE_LINK)
+
+PyDoc_STRVAR(os_link__doc__,
+"link($module, /, src, dst, *, src_dir_fd=None, dst_dir_fd=None,\n"
+" follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Create a hard link to a file.\n"
+"\n"
+"If either src_dir_fd or dst_dir_fd is not None, it should be a file\n"
+" descriptor open to a directory, and the respective path string (src or dst)\n"
+" should be relative; the path will then be relative to that directory.\n"
+"If follow_symlinks is False, and the last element of src is a symbolic\n"
+" link, link will create a link to the symbolic link itself instead of the\n"
+" file the link points to.\n"
+"src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your\n"
+" platform. If they are unavailable, using them will raise a\n"
+" NotImplementedError.");
+
+#define OS_LINK_METHODDEF \
+ {"link", (PyCFunction)os_link, METH_VARARGS|METH_KEYWORDS, os_link__doc__},
+
+static PyObject *
+os_link_impl(PyModuleDef *module, path_t *src, path_t *dst, int src_dir_fd,
+ int dst_dir_fd, int follow_symlinks);
+
+static PyObject *
+os_link(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", "follow_symlinks", NULL};
+ path_t src = PATH_T_INITIALIZE("link", "src", 0, 0);
+ path_t dst = PATH_T_INITIALIZE("link", "dst", 0, 0);
+ int src_dir_fd = DEFAULT_DIR_FD;
+ int dst_dir_fd = DEFAULT_DIR_FD;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&p:link", _keywords,
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks))
+ goto exit;
+ return_value = os_link_impl(module, &src, &dst, src_dir_fd, dst_dir_fd, follow_symlinks);
+
+exit:
+ /* Cleanup for src */
+ path_cleanup(&src);
+ /* Cleanup for dst */
+ path_cleanup(&dst);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_LINK) */
+
+PyDoc_STRVAR(os_listdir__doc__,
+"listdir($module, /, path=None)\n"
+"--\n"
+"\n"
+"Return a list containing the names of the files in the directory.\n"
+"\n"
+"path can be specified as either str or bytes. If path is bytes,\n"
+" the filenames returned will also be bytes; in all other circumstances\n"
+" the filenames returned will be str.\n"
+"If path is None, uses the path=\'.\'.\n"
+"On some platforms, path may also be specified as an open file descriptor;\\\n"
+" the file descriptor must refer to a directory.\n"
+" If this functionality is unavailable, using it raises NotImplementedError.\n"
+"\n"
+"The list is in arbitrary order. It does not include the special\n"
+"entries \'.\' and \'..\' even if they are present in the directory.");
+
+#define OS_LISTDIR_METHODDEF \
+ {"listdir", (PyCFunction)os_listdir, METH_VARARGS|METH_KEYWORDS, os_listdir__doc__},
+
+static PyObject *
+os_listdir_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os_listdir(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", _keywords,
+ path_converter, &path))
+ goto exit;
+ return_value = os_listdir_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__getfullpathname__doc__,
+"_getfullpathname($module, path, /)\n"
+"--\n"
+"\n");
+
+#define OS__GETFULLPATHNAME_METHODDEF \
+ {"_getfullpathname", (PyCFunction)os__getfullpathname, METH_O, os__getfullpathname__doc__},
+
+static PyObject *
+os__getfullpathname_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os__getfullpathname(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ path_t path = PATH_T_INITIALIZE("_getfullpathname", "path", 0, 0);
+
+ if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path))
+ goto exit;
+ return_value = os__getfullpathname_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__getfinalpathname__doc__,
+"_getfinalpathname($module, path, /)\n"
+"--\n"
+"\n"
+"A helper function for samepath on windows.");
+
+#define OS__GETFINALPATHNAME_METHODDEF \
+ {"_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 *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *path;
+
+ if (!PyArg_Parse(arg, "U:_getfinalpathname", &path))
+ goto exit;
+ return_value = os__getfinalpathname_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__isdir__doc__,
+"_isdir($module, path, /)\n"
+"--\n"
+"\n");
+
+#define OS__ISDIR_METHODDEF \
+ {"_isdir", (PyCFunction)os__isdir, METH_O, os__isdir__doc__},
+
+static PyObject *
+os__isdir_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os__isdir(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ path_t path = PATH_T_INITIALIZE("_isdir", "path", 0, 0);
+
+ if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path))
+ goto exit;
+ return_value = os__isdir_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__getvolumepathname__doc__,
+"_getvolumepathname($module, /, path)\n"
+"--\n"
+"\n"
+"A helper function for ismount on Win32.");
+
+#define OS__GETVOLUMEPATHNAME_METHODDEF \
+ {"_getvolumepathname", (PyCFunction)os__getvolumepathname, METH_VARARGS|METH_KEYWORDS, os__getvolumepathname__doc__},
+
+static PyObject *
+os__getvolumepathname_impl(PyModuleDef *module, PyObject *path);
+
+static PyObject *
+os__getvolumepathname(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ PyObject *path;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:_getvolumepathname", _keywords,
+ &path))
+ goto exit;
+ return_value = os__getvolumepathname_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+PyDoc_STRVAR(os_mkdir__doc__,
+"mkdir($module, /, path, mode=511, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Create a directory.\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.\n"
+"\n"
+"The mode argument is ignored on Windows.");
+
+#define OS_MKDIR_METHODDEF \
+ {"mkdir", (PyCFunction)os_mkdir, METH_VARARGS|METH_KEYWORDS, os_mkdir__doc__},
+
+static PyObject *
+os_mkdir_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd);
+
+static PyObject *
+os_mkdir(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("mkdir", "path", 0, 0);
+ int mode = 511;
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkdir", _keywords,
+ path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_mkdir_impl(module, &path, mode, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_NICE)
+
+PyDoc_STRVAR(os_nice__doc__,
+"nice($module, increment, /)\n"
+"--\n"
+"\n"
+"Add increment to the priority of process and return the new priority.");
+
+#define OS_NICE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int increment;
+
+ if (!PyArg_Parse(arg, "i:nice", &increment))
+ goto exit;
+ return_value = os_nice_impl(module, increment);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_NICE) */
+
+#if defined(HAVE_GETPRIORITY)
+
+PyDoc_STRVAR(os_getpriority__doc__,
+"getpriority($module, /, which, who)\n"
+"--\n"
+"\n"
+"Return program scheduling priority.");
+
+#define OS_GETPRIORITY_METHODDEF \
+ {"getpriority", (PyCFunction)os_getpriority, METH_VARARGS|METH_KEYWORDS, os_getpriority__doc__},
+
+static PyObject *
+os_getpriority_impl(PyModuleDef *module, int which, int who);
+
+static PyObject *
+os_getpriority(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"which", "who", NULL};
+ int which;
+ int who;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:getpriority", _keywords,
+ &which, &who))
+ goto exit;
+ return_value = os_getpriority_impl(module, which, who);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETPRIORITY) */
+
+#if defined(HAVE_SETPRIORITY)
+
+PyDoc_STRVAR(os_setpriority__doc__,
+"setpriority($module, /, which, who, priority)\n"
+"--\n"
+"\n"
+"Set program scheduling priority.");
+
+#define OS_SETPRIORITY_METHODDEF \
+ {"setpriority", (PyCFunction)os_setpriority, METH_VARARGS|METH_KEYWORDS, os_setpriority__doc__},
+
+static PyObject *
+os_setpriority_impl(PyModuleDef *module, int which, int who, int priority);
+
+static PyObject *
+os_setpriority(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"which", "who", "priority", NULL};
+ int which;
+ int who;
+ int priority;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iii:setpriority", _keywords,
+ &which, &who, &priority))
+ goto exit;
+ return_value = os_setpriority_impl(module, which, who, priority);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETPRIORITY) */
+
+PyDoc_STRVAR(os_rename__doc__,
+"rename($module, /, src, dst, *, src_dir_fd=None, dst_dir_fd=None)\n"
+"--\n"
+"\n"
+"Rename a file or directory.\n"
+"\n"
+"If either src_dir_fd or dst_dir_fd is not None, it should be a file\n"
+" descriptor open to a directory, and the respective path string (src or dst)\n"
+" should be relative; the path will then be relative to that directory.\n"
+"src_dir_fd and dst_dir_fd, may not be implemented on your platform.\n"
+" If they are unavailable, using them will raise a NotImplementedError.");
+
+#define OS_RENAME_METHODDEF \
+ {"rename", (PyCFunction)os_rename, METH_VARARGS|METH_KEYWORDS, os_rename__doc__},
+
+static PyObject *
+os_rename_impl(PyModuleDef *module, path_t *src, path_t *dst, int src_dir_fd,
+ int dst_dir_fd);
+
+static PyObject *
+os_rename(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ path_t src = PATH_T_INITIALIZE("rename", "src", 0, 0);
+ path_t dst = PATH_T_INITIALIZE("rename", "dst", 0, 0);
+ int src_dir_fd = DEFAULT_DIR_FD;
+ int dst_dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:rename", _keywords,
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd))
+ goto exit;
+ return_value = os_rename_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
+
+exit:
+ /* Cleanup for src */
+ path_cleanup(&src);
+ /* Cleanup for dst */
+ path_cleanup(&dst);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_replace__doc__,
+"replace($module, /, src, dst, *, src_dir_fd=None, dst_dir_fd=None)\n"
+"--\n"
+"\n"
+"Rename a file or directory, overwriting the destination.\n"
+"\n"
+"If either src_dir_fd or dst_dir_fd is not None, it should be a file\n"
+" descriptor open to a directory, and the respective path string (src or dst)\n"
+" should be relative; the path will then be relative to that directory.\n"
+"src_dir_fd and dst_dir_fd, may not be implemented on your platform.\n"
+" If they are unavailable, using them will raise a NotImplementedError.\"");
+
+#define OS_REPLACE_METHODDEF \
+ {"replace", (PyCFunction)os_replace, METH_VARARGS|METH_KEYWORDS, os_replace__doc__},
+
+static PyObject *
+os_replace_impl(PyModuleDef *module, path_t *src, path_t *dst,
+ int src_dir_fd, int dst_dir_fd);
+
+static PyObject *
+os_replace(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ path_t src = PATH_T_INITIALIZE("replace", "src", 0, 0);
+ path_t dst = PATH_T_INITIALIZE("replace", "dst", 0, 0);
+ int src_dir_fd = DEFAULT_DIR_FD;
+ int dst_dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:replace", _keywords,
+ path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd))
+ goto exit;
+ return_value = os_replace_impl(module, &src, &dst, src_dir_fd, dst_dir_fd);
+
+exit:
+ /* Cleanup for src */
+ path_cleanup(&src);
+ /* Cleanup for dst */
+ path_cleanup(&dst);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_rmdir__doc__,
+"rmdir($module, /, path, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Remove a directory.\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_RMDIR_METHODDEF \
+ {"rmdir", (PyCFunction)os_rmdir, METH_VARARGS|METH_KEYWORDS, os_rmdir__doc__},
+
+static PyObject *
+os_rmdir_impl(PyModuleDef *module, path_t *path, int dir_fd);
+
+static PyObject *
+os_rmdir(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("rmdir", "path", 0, 0);
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:rmdir", _keywords,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_rmdir_impl(module, &path, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_SYSTEM) && defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_system__doc__,
+"system($module, /, command)\n"
+"--\n"
+"\n"
+"Execute the command in a subshell.");
+
+#define OS_SYSTEM_METHODDEF \
+ {"system", (PyCFunction)os_system, METH_VARARGS|METH_KEYWORDS, os_system__doc__},
+
+static long
+os_system_impl(PyModuleDef *module, Py_UNICODE *command);
+
+static PyObject *
+os_system(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"command", NULL};
+ Py_UNICODE *command;
+ long _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:system", _keywords,
+ &command))
+ goto exit;
+ _return_value = os_system_impl(module, command);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYSTEM) && defined(MS_WINDOWS) */
+
+#if defined(HAVE_SYSTEM) && !defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_system__doc__,
+"system($module, /, command)\n"
+"--\n"
+"\n"
+"Execute the command in a subshell.");
+
+#define OS_SYSTEM_METHODDEF \
+ {"system", (PyCFunction)os_system, METH_VARARGS|METH_KEYWORDS, os_system__doc__},
+
+static long
+os_system_impl(PyModuleDef *module, PyObject *command);
+
+static PyObject *
+os_system(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"command", NULL};
+ PyObject *command = NULL;
+ long _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:system", _keywords,
+ PyUnicode_FSConverter, &command))
+ goto exit;
+ _return_value = os_system_impl(module, command);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ /* Cleanup for command */
+ Py_XDECREF(command);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYSTEM) && !defined(MS_WINDOWS) */
+
+PyDoc_STRVAR(os_umask__doc__,
+"umask($module, mask, /)\n"
+"--\n"
+"\n"
+"Set the current numeric umask and return the previous umask.");
+
+#define OS_UMASK_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int mask;
+
+ if (!PyArg_Parse(arg, "i:umask", &mask))
+ goto exit;
+ return_value = os_umask_impl(module, mask);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_unlink__doc__,
+"unlink($module, /, path, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Remove a file (same as remove()).\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_UNLINK_METHODDEF \
+ {"unlink", (PyCFunction)os_unlink, METH_VARARGS|METH_KEYWORDS, os_unlink__doc__},
+
+static PyObject *
+os_unlink_impl(PyModuleDef *module, path_t *path, int dir_fd);
+
+static PyObject *
+os_unlink(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("unlink", "path", 0, 0);
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:unlink", _keywords,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_unlink_impl(module, &path, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_remove__doc__,
+"remove($module, /, path, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Remove a file (same as unlink()).\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_REMOVE_METHODDEF \
+ {"remove", (PyCFunction)os_remove, METH_VARARGS|METH_KEYWORDS, os_remove__doc__},
+
+static PyObject *
+os_remove_impl(PyModuleDef *module, path_t *path, int dir_fd);
+
+static PyObject *
+os_remove(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("remove", "path", 0, 0);
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:remove", _keywords,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_remove_impl(module, &path, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#if defined(HAVE_UNAME)
+
+PyDoc_STRVAR(os_uname__doc__,
+"uname($module, /)\n"
+"--\n"
+"\n"
+"Return an object identifying the current operating system.\n"
+"\n"
+"The object behaves like a named tuple with the following fields:\n"
+" (sysname, nodename, release, version, machine)");
+
+#define OS_UNAME_METHODDEF \
+ {"uname", (PyCFunction)os_uname, METH_NOARGS, os_uname__doc__},
+
+static PyObject *
+os_uname_impl(PyModuleDef *module);
+
+static PyObject *
+os_uname(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_uname_impl(module);
+}
+
+#endif /* defined(HAVE_UNAME) */
+
+PyDoc_STRVAR(os_utime__doc__,
+"utime($module, /, path, times=None, *, ns=None, dir_fd=None,\n"
+" follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Set the access and modified time of path.\n"
+"\n"
+"path may always be specified as a string.\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.\n"
+"\n"
+"If times is not None, it must be a tuple (atime, mtime);\n"
+" atime and mtime should be expressed as float seconds since the epoch.\n"
+"If ns is not None, it must be a tuple (atime_ns, mtime_ns);\n"
+" atime_ns and mtime_ns should be expressed as integer nanoseconds\n"
+" since the epoch.\n"
+"If both times and ns are None, utime uses the current time.\n"
+"Specifying tuples for both times and ns is an error.\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, utime will modify the symbolic link itself instead of the file the\n"
+" link points to.\n"
+"It is an error to use dir_fd or follow_symlinks when specifying path\n"
+" as an open file descriptor.\n"
+"dir_fd and follow_symlinks may not be available on your platform.\n"
+" If they are unavailable, using them will raise a NotImplementedError.");
+
+#define OS_UTIME_METHODDEF \
+ {"utime", (PyCFunction)os_utime, METH_VARARGS|METH_KEYWORDS, os_utime__doc__},
+
+static PyObject *
+os_utime_impl(PyModuleDef *module, path_t *path, PyObject *times,
+ PyObject *ns, int dir_fd, int follow_symlinks);
+
+static PyObject *
+os_utime(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "times", "ns", "dir_fd", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("utime", "path", 0, PATH_UTIME_HAVE_FD);
+ PyObject *times = NULL;
+ PyObject *ns = NULL;
+ int dir_fd = DEFAULT_DIR_FD;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|O$OO&p:utime", _keywords,
+ path_converter, &path, &times, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks))
+ goto exit;
+ return_value = os_utime_impl(module, &path, times, ns, dir_fd, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os__exit__doc__,
+"_exit($module, /, status)\n"
+"--\n"
+"\n"
+"Exit to the system with specified status, without normal exit processing.");
+
+#define OS__EXIT_METHODDEF \
+ {"_exit", (PyCFunction)os__exit, METH_VARARGS|METH_KEYWORDS, os__exit__doc__},
+
+static PyObject *
+os__exit_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os__exit(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:_exit", _keywords,
+ &status))
+ goto exit;
+ return_value = os__exit_impl(module, status);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_EXECV)
+
+PyDoc_STRVAR(os_execv__doc__,
+"execv($module, path, argv, /)\n"
+"--\n"
+"\n"
+"Execute an executable path with arguments, replacing current process.\n"
+"\n"
+" path\n"
+" Path of executable file.\n"
+" argv\n"
+" Tuple or list of strings.");
+
+#define OS_EXECV_METHODDEF \
+ {"execv", (PyCFunction)os_execv, METH_VARARGS, os_execv__doc__},
+
+static PyObject *
+os_execv_impl(PyModuleDef *module, PyObject *path, PyObject *argv);
+
+static PyObject *
+os_execv(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *path = NULL;
+ PyObject *argv;
+
+ if (!PyArg_ParseTuple(args, "O&O:execv",
+ PyUnicode_FSConverter, &path, &argv))
+ goto exit;
+ return_value = os_execv_impl(module, path, argv);
+
+exit:
+ /* Cleanup for path */
+ Py_XDECREF(path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_EXECV) */
+
+#if defined(HAVE_EXECV)
+
+PyDoc_STRVAR(os_execve__doc__,
+"execve($module, /, path, argv, env)\n"
+"--\n"
+"\n"
+"Execute an executable path with arguments, replacing current process.\n"
+"\n"
+" path\n"
+" Path of executable file.\n"
+" argv\n"
+" Tuple or list of strings.\n"
+" env\n"
+" Dictionary of strings mapping to strings.");
+
+#define OS_EXECVE_METHODDEF \
+ {"execve", (PyCFunction)os_execve, METH_VARARGS|METH_KEYWORDS, os_execve__doc__},
+
+static PyObject *
+os_execve_impl(PyModuleDef *module, path_t *path, PyObject *argv,
+ PyObject *env);
+
+static PyObject *
+os_execve(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "argv", "env", NULL};
+ path_t path = PATH_T_INITIALIZE("execve", "path", 0, PATH_HAVE_FEXECVE);
+ PyObject *argv;
+ PyObject *env;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&OO:execve", _keywords,
+ path_converter, &path, &argv, &env))
+ goto exit;
+ return_value = os_execve_impl(module, &path, argv, env);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_EXECV) */
+
+#if defined(HAVE_SPAWNV)
+
+PyDoc_STRVAR(os_spawnv__doc__,
+"spawnv($module, mode, path, argv, /)\n"
+"--\n"
+"\n"
+"Execute the program specified by path in a new process.\n"
+"\n"
+" mode\n"
+" Mode of process creation.\n"
+" path\n"
+" Path of executable file.\n"
+" argv\n"
+" Tuple or list of strings.");
+
+#define OS_SPAWNV_METHODDEF \
+ {"spawnv", (PyCFunction)os_spawnv, METH_VARARGS, os_spawnv__doc__},
+
+static PyObject *
+os_spawnv_impl(PyModuleDef *module, int mode, PyObject *path, PyObject *argv);
+
+static PyObject *
+os_spawnv(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int mode;
+ PyObject *path = NULL;
+ PyObject *argv;
+
+ if (!PyArg_ParseTuple(args, "iO&O:spawnv",
+ &mode, PyUnicode_FSConverter, &path, &argv))
+ goto exit;
+ return_value = os_spawnv_impl(module, mode, path, argv);
+
+exit:
+ /* Cleanup for path */
+ Py_XDECREF(path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_SPAWNV) */
+
+#if defined(HAVE_SPAWNV)
+
+PyDoc_STRVAR(os_spawnve__doc__,
+"spawnve($module, mode, path, argv, env, /)\n"
+"--\n"
+"\n"
+"Execute the program specified by path in a new process.\n"
+"\n"
+" mode\n"
+" Mode of process creation.\n"
+" path\n"
+" Path of executable file.\n"
+" argv\n"
+" Tuple or list of strings.\n"
+" env\n"
+" Dictionary of strings mapping to strings.");
+
+#define OS_SPAWNVE_METHODDEF \
+ {"spawnve", (PyCFunction)os_spawnve, METH_VARARGS, os_spawnve__doc__},
+
+static PyObject *
+os_spawnve_impl(PyModuleDef *module, int mode, PyObject *path,
+ PyObject *argv, PyObject *env);
+
+static PyObject *
+os_spawnve(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int mode;
+ PyObject *path = NULL;
+ PyObject *argv;
+ PyObject *env;
+
+ if (!PyArg_ParseTuple(args, "iO&OO:spawnve",
+ &mode, PyUnicode_FSConverter, &path, &argv, &env))
+ goto exit;
+ return_value = os_spawnve_impl(module, mode, path, argv, env);
+
+exit:
+ /* Cleanup for path */
+ Py_XDECREF(path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_SPAWNV) */
+
+#if defined(HAVE_FORK1)
+
+PyDoc_STRVAR(os_fork1__doc__,
+"fork1($module, /)\n"
+"--\n"
+"\n"
+"Fork a child process with a single multiplexed (i.e., not bound) thread.\n"
+"\n"
+"Return 0 to child process and PID of child to parent process.");
+
+#define OS_FORK1_METHODDEF \
+ {"fork1", (PyCFunction)os_fork1, METH_NOARGS, os_fork1__doc__},
+
+static PyObject *
+os_fork1_impl(PyModuleDef *module);
+
+static PyObject *
+os_fork1(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_fork1_impl(module);
+}
+
+#endif /* defined(HAVE_FORK1) */
+
+#if defined(HAVE_FORK)
+
+PyDoc_STRVAR(os_fork__doc__,
+"fork($module, /)\n"
+"--\n"
+"\n"
+"Fork a child process.\n"
+"\n"
+"Return 0 to child process and PID of child to parent process.");
+
+#define OS_FORK_METHODDEF \
+ {"fork", (PyCFunction)os_fork, METH_NOARGS, os_fork__doc__},
+
+static PyObject *
+os_fork_impl(PyModuleDef *module);
+
+static PyObject *
+os_fork(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_fork_impl(module);
+}
+
+#endif /* defined(HAVE_FORK) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
+
+PyDoc_STRVAR(os_sched_get_priority_max__doc__,
+"sched_get_priority_max($module, /, policy)\n"
+"--\n"
+"\n"
+"Get the maximum scheduling priority for policy.");
+
+#define OS_SCHED_GET_PRIORITY_MAX_METHODDEF \
+ {"sched_get_priority_max", (PyCFunction)os_sched_get_priority_max, METH_VARARGS|METH_KEYWORDS, os_sched_get_priority_max__doc__},
+
+static PyObject *
+os_sched_get_priority_max_impl(PyModuleDef *module, int policy);
+
+static PyObject *
+os_sched_get_priority_max(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"policy", NULL};
+ int policy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_max", _keywords,
+ &policy))
+ goto exit;
+ return_value = os_sched_get_priority_max_impl(module, policy);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GET_PRIORITY_MAX) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
+
+PyDoc_STRVAR(os_sched_get_priority_min__doc__,
+"sched_get_priority_min($module, /, policy)\n"
+"--\n"
+"\n"
+"Get the minimum scheduling priority for policy.");
+
+#define OS_SCHED_GET_PRIORITY_MIN_METHODDEF \
+ {"sched_get_priority_min", (PyCFunction)os_sched_get_priority_min, METH_VARARGS|METH_KEYWORDS, os_sched_get_priority_min__doc__},
+
+static PyObject *
+os_sched_get_priority_min_impl(PyModuleDef *module, int policy);
+
+static PyObject *
+os_sched_get_priority_min(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"policy", NULL};
+ int policy;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_min", _keywords,
+ &policy))
+ goto exit;
+ return_value = os_sched_get_priority_min_impl(module, policy);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GET_PRIORITY_MAX) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETSCHEDULER)
+
+PyDoc_STRVAR(os_sched_getscheduler__doc__,
+"sched_getscheduler($module, pid, /)\n"
+"--\n"
+"\n"
+"Get the scheduling policy for the process identifiedy by pid.\n"
+"\n"
+"Passing 0 for pid returns the scheduling policy for the calling process.");
+
+#define OS_SCHED_GETSCHEDULER_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid))
+ goto exit;
+ return_value = os_sched_getscheduler_impl(module, pid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETSCHEDULER) */
+
+#if defined(HAVE_SCHED_H) && (defined(HAVE_SCHED_SETSCHEDULER) || defined(HAVE_SCHED_SETPARAM))
+
+PyDoc_STRVAR(os_sched_param__doc__,
+"sched_param(sched_priority)\n"
+"--\n"
+"\n"
+"Current has only one field: sched_priority\");\n"
+"\n"
+" sched_priority\n"
+" A scheduling parameter.");
+
+static PyObject *
+os_sched_param_impl(PyTypeObject *type, PyObject *sched_priority);
+
+static PyObject *
+os_sched_param(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"sched_priority", NULL};
+ PyObject *sched_priority;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", _keywords,
+ &sched_priority))
+ goto exit;
+ return_value = os_sched_param_impl(type, sched_priority);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && (defined(HAVE_SCHED_SETSCHEDULER) || defined(HAVE_SCHED_SETPARAM)) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETSCHEDULER)
+
+PyDoc_STRVAR(os_sched_setscheduler__doc__,
+"sched_setscheduler($module, pid, policy, param, /)\n"
+"--\n"
+"\n"
+"Set the scheduling policy for the process identified by pid.\n"
+"\n"
+"If pid is 0, the calling process is changed.\n"
+"param is an instance of sched_param.");
+
+#define OS_SCHED_SETSCHEDULER_METHODDEF \
+ {"sched_setscheduler", (PyCFunction)os_sched_setscheduler, METH_VARARGS, os_sched_setscheduler__doc__},
+
+static PyObject *
+os_sched_setscheduler_impl(PyModuleDef *module, pid_t pid, int policy,
+ struct sched_param *param);
+
+static PyObject *
+os_sched_setscheduler(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ int policy;
+ struct sched_param param;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler",
+ &pid, &policy, convert_sched_param, &param))
+ goto exit;
+ return_value = os_sched_setscheduler_impl(module, pid, policy, &param);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETSCHEDULER) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETPARAM)
+
+PyDoc_STRVAR(os_sched_getparam__doc__,
+"sched_getparam($module, pid, /)\n"
+"--\n"
+"\n"
+"Returns scheduling parameters for the process identified by pid.\n"
+"\n"
+"If pid is 0, returns parameters for the calling process.\n"
+"Return value is an instance of sched_param.");
+
+#define OS_SCHED_GETPARAM_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid))
+ goto exit;
+ return_value = os_sched_getparam_impl(module, pid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETPARAM) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETPARAM)
+
+PyDoc_STRVAR(os_sched_setparam__doc__,
+"sched_setparam($module, pid, param, /)\n"
+"--\n"
+"\n"
+"Set scheduling parameters for the process identified by pid.\n"
+"\n"
+"If pid is 0, sets parameters for the calling process.\n"
+"param should be an instance of sched_param.");
+
+#define OS_SCHED_SETPARAM_METHODDEF \
+ {"sched_setparam", (PyCFunction)os_sched_setparam, METH_VARARGS, os_sched_setparam__doc__},
+
+static PyObject *
+os_sched_setparam_impl(PyModuleDef *module, pid_t pid,
+ struct sched_param *param);
+
+static PyObject *
+os_sched_setparam(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ struct sched_param param;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam",
+ &pid, convert_sched_param, &param))
+ goto exit;
+ return_value = os_sched_setparam_impl(module, pid, &param);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETPARAM) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_RR_GET_INTERVAL)
+
+PyDoc_STRVAR(os_sched_rr_get_interval__doc__,
+"sched_rr_get_interval($module, pid, /)\n"
+"--\n"
+"\n"
+"Return the round-robin quantum for the process identified by pid, in seconds.\n"
+"\n"
+"Value returned is a float.");
+
+#define OS_SCHED_RR_GET_INTERVAL_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ double _return_value;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid))
+ goto exit;
+ _return_value = os_sched_rr_get_interval_impl(module, pid);
+ if ((_return_value == -1.0) && PyErr_Occurred())
+ goto exit;
+ return_value = PyFloat_FromDouble(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_RR_GET_INTERVAL) */
+
+#if defined(HAVE_SCHED_H)
+
+PyDoc_STRVAR(os_sched_yield__doc__,
+"sched_yield($module, /)\n"
+"--\n"
+"\n"
+"Voluntarily relinquish the CPU.");
+
+#define OS_SCHED_YIELD_METHODDEF \
+ {"sched_yield", (PyCFunction)os_sched_yield, METH_NOARGS, os_sched_yield__doc__},
+
+static PyObject *
+os_sched_yield_impl(PyModuleDef *module);
+
+static PyObject *
+os_sched_yield(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_sched_yield_impl(module);
+}
+
+#endif /* defined(HAVE_SCHED_H) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETAFFINITY)
+
+PyDoc_STRVAR(os_sched_setaffinity__doc__,
+"sched_setaffinity($module, pid, mask, /)\n"
+"--\n"
+"\n"
+"Set the CPU affinity of the process identified by pid to mask.\n"
+"\n"
+"mask should be an iterable of integers identifying CPUs.");
+
+#define OS_SCHED_SETAFFINITY_METHODDEF \
+ {"sched_setaffinity", (PyCFunction)os_sched_setaffinity, METH_VARARGS, os_sched_setaffinity__doc__},
+
+static PyObject *
+os_sched_setaffinity_impl(PyModuleDef *module, pid_t pid, PyObject *mask);
+
+static PyObject *
+os_sched_setaffinity(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ PyObject *mask;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity",
+ &pid, &mask))
+ goto exit;
+ return_value = os_sched_setaffinity_impl(module, pid, mask);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETAFFINITY) */
+
+#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETAFFINITY)
+
+PyDoc_STRVAR(os_sched_getaffinity__doc__,
+"sched_getaffinity($module, pid, /)\n"
+"--\n"
+"\n"
+"Return the affinity of the process identified by pid.\n"
+"\n"
+"The affinity is returned as a set of CPU identifiers.");
+
+#define OS_SCHED_GETAFFINITY_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid))
+ goto exit;
+ return_value = os_sched_getaffinity_impl(module, pid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SCHED_H) && defined(HAVE_SCHED_SETAFFINITY) */
+
+#if (defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX))
+
+PyDoc_STRVAR(os_openpty__doc__,
+"openpty($module, /)\n"
+"--\n"
+"\n"
+"Open a pseudo-terminal.\n"
+"\n"
+"Return a tuple of (master_fd, slave_fd) containing open file descriptors\n"
+"for both the master and slave ends.");
+
+#define OS_OPENPTY_METHODDEF \
+ {"openpty", (PyCFunction)os_openpty, METH_NOARGS, os_openpty__doc__},
+
+static PyObject *
+os_openpty_impl(PyModuleDef *module);
+
+static PyObject *
+os_openpty(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_openpty_impl(module);
+}
+
+#endif /* (defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX)) */
+
+#if defined(HAVE_FORKPTY)
+
+PyDoc_STRVAR(os_forkpty__doc__,
+"forkpty($module, /)\n"
+"--\n"
+"\n"
+"Fork a new process with a new pseudo-terminal as controlling tty.\n"
+"\n"
+"Returns a tuple of (pid, master_fd).\n"
+"Like fork(), return pid of 0 to the child process,\n"
+"and pid of child to the parent process.\n"
+"To both, return fd of newly opened pseudo-terminal.");
+
+#define OS_FORKPTY_METHODDEF \
+ {"forkpty", (PyCFunction)os_forkpty, METH_NOARGS, os_forkpty__doc__},
+
+static PyObject *
+os_forkpty_impl(PyModuleDef *module);
+
+static PyObject *
+os_forkpty(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_forkpty_impl(module);
+}
+
+#endif /* defined(HAVE_FORKPTY) */
+
+#if defined(HAVE_GETEGID)
+
+PyDoc_STRVAR(os_getegid__doc__,
+"getegid($module, /)\n"
+"--\n"
+"\n"
+"Return the current process\'s effective group id.");
+
+#define OS_GETEGID_METHODDEF \
+ {"getegid", (PyCFunction)os_getegid, METH_NOARGS, os_getegid__doc__},
+
+static PyObject *
+os_getegid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getegid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getegid_impl(module);
+}
+
+#endif /* defined(HAVE_GETEGID) */
+
+#if defined(HAVE_GETEUID)
+
+PyDoc_STRVAR(os_geteuid__doc__,
+"geteuid($module, /)\n"
+"--\n"
+"\n"
+"Return the current process\'s effective user id.");
+
+#define OS_GETEUID_METHODDEF \
+ {"geteuid", (PyCFunction)os_geteuid, METH_NOARGS, os_geteuid__doc__},
+
+static PyObject *
+os_geteuid_impl(PyModuleDef *module);
+
+static PyObject *
+os_geteuid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_geteuid_impl(module);
+}
+
+#endif /* defined(HAVE_GETEUID) */
+
+#if defined(HAVE_GETGID)
+
+PyDoc_STRVAR(os_getgid__doc__,
+"getgid($module, /)\n"
+"--\n"
+"\n"
+"Return the current process\'s group id.");
+
+#define OS_GETGID_METHODDEF \
+ {"getgid", (PyCFunction)os_getgid, METH_NOARGS, os_getgid__doc__},
+
+static PyObject *
+os_getgid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getgid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getgid_impl(module);
+}
+
+#endif /* defined(HAVE_GETGID) */
+
+PyDoc_STRVAR(os_getpid__doc__,
+"getpid($module, /)\n"
+"--\n"
+"\n"
+"Return the current process id.");
+
+#define OS_GETPID_METHODDEF \
+ {"getpid", (PyCFunction)os_getpid, METH_NOARGS, os_getpid__doc__},
+
+static PyObject *
+os_getpid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getpid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getpid_impl(module);
+}
+
+#if defined(HAVE_GETGROUPS)
+
+PyDoc_STRVAR(os_getgroups__doc__,
+"getgroups($module, /)\n"
+"--\n"
+"\n"
+"Return list of supplemental group IDs for the process.");
+
+#define OS_GETGROUPS_METHODDEF \
+ {"getgroups", (PyCFunction)os_getgroups, METH_NOARGS, os_getgroups__doc__},
+
+static PyObject *
+os_getgroups_impl(PyModuleDef *module);
+
+static PyObject *
+os_getgroups(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getgroups_impl(module);
+}
+
+#endif /* defined(HAVE_GETGROUPS) */
+
+#if defined(HAVE_GETPGID)
+
+PyDoc_STRVAR(os_getpgid__doc__,
+"getpgid($module, /, pid)\n"
+"--\n"
+"\n"
+"Call the system call getpgid(), and return the result.");
+
+#define OS_GETPGID_METHODDEF \
+ {"getpgid", (PyCFunction)os_getpgid, METH_VARARGS|METH_KEYWORDS, os_getpgid__doc__},
+
+static PyObject *
+os_getpgid_impl(PyModuleDef *module, pid_t pid);
+
+static PyObject *
+os_getpgid(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"pid", NULL};
+ pid_t pid;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID ":getpgid", _keywords,
+ &pid))
+ goto exit;
+ return_value = os_getpgid_impl(module, pid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETPGID) */
+
+#if defined(HAVE_GETPGRP)
+
+PyDoc_STRVAR(os_getpgrp__doc__,
+"getpgrp($module, /)\n"
+"--\n"
+"\n"
+"Return the current process group id.");
+
+#define OS_GETPGRP_METHODDEF \
+ {"getpgrp", (PyCFunction)os_getpgrp, METH_NOARGS, os_getpgrp__doc__},
+
+static PyObject *
+os_getpgrp_impl(PyModuleDef *module);
+
+static PyObject *
+os_getpgrp(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getpgrp_impl(module);
+}
+
+#endif /* defined(HAVE_GETPGRP) */
+
+#if defined(HAVE_SETPGRP)
+
+PyDoc_STRVAR(os_setpgrp__doc__,
+"setpgrp($module, /)\n"
+"--\n"
+"\n"
+"Make the current process the leader of its process group.");
+
+#define OS_SETPGRP_METHODDEF \
+ {"setpgrp", (PyCFunction)os_setpgrp, METH_NOARGS, os_setpgrp__doc__},
+
+static PyObject *
+os_setpgrp_impl(PyModuleDef *module);
+
+static PyObject *
+os_setpgrp(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_setpgrp_impl(module);
+}
+
+#endif /* defined(HAVE_SETPGRP) */
+
+#if defined(HAVE_GETPPID)
+
+PyDoc_STRVAR(os_getppid__doc__,
+"getppid($module, /)\n"
+"--\n"
+"\n"
+"Return the parent\'s process id.\n"
+"\n"
+"If the parent process has already exited, Windows machines will still\n"
+"return its id; others systems will return the id of the \'init\' process (1).");
+
+#define OS_GETPPID_METHODDEF \
+ {"getppid", (PyCFunction)os_getppid, METH_NOARGS, os_getppid__doc__},
+
+static PyObject *
+os_getppid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getppid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getppid_impl(module);
+}
+
+#endif /* defined(HAVE_GETPPID) */
+
+#if defined(HAVE_GETLOGIN)
+
+PyDoc_STRVAR(os_getlogin__doc__,
+"getlogin($module, /)\n"
+"--\n"
+"\n"
+"Return the actual login name.");
+
+#define OS_GETLOGIN_METHODDEF \
+ {"getlogin", (PyCFunction)os_getlogin, METH_NOARGS, os_getlogin__doc__},
+
+static PyObject *
+os_getlogin_impl(PyModuleDef *module);
+
+static PyObject *
+os_getlogin(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getlogin_impl(module);
+}
+
+#endif /* defined(HAVE_GETLOGIN) */
+
+#if defined(HAVE_GETUID)
+
+PyDoc_STRVAR(os_getuid__doc__,
+"getuid($module, /)\n"
+"--\n"
+"\n"
+"Return the current process\'s user id.");
+
+#define OS_GETUID_METHODDEF \
+ {"getuid", (PyCFunction)os_getuid, METH_NOARGS, os_getuid__doc__},
+
+static PyObject *
+os_getuid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getuid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getuid_impl(module);
+}
+
+#endif /* defined(HAVE_GETUID) */
+
+#if defined(HAVE_KILL)
+
+PyDoc_STRVAR(os_kill__doc__,
+"kill($module, pid, signal, /)\n"
+"--\n"
+"\n"
+"Kill a process with a signal.");
+
+#define OS_KILL_METHODDEF \
+ {"kill", (PyCFunction)os_kill, METH_VARARGS, os_kill__doc__},
+
+static PyObject *
+os_kill_impl(PyModuleDef *module, pid_t pid, Py_ssize_t signal);
+
+static PyObject *
+os_kill(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ Py_ssize_t signal;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill",
+ &pid, &signal))
+ goto exit;
+ return_value = os_kill_impl(module, pid, signal);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_KILL) */
+
+#if defined(HAVE_KILLPG)
+
+PyDoc_STRVAR(os_killpg__doc__,
+"killpg($module, pgid, signal, /)\n"
+"--\n"
+"\n"
+"Kill a process group with a signal.");
+
+#define OS_KILLPG_METHODDEF \
+ {"killpg", (PyCFunction)os_killpg, METH_VARARGS, os_killpg__doc__},
+
+static PyObject *
+os_killpg_impl(PyModuleDef *module, pid_t pgid, int signal);
+
+static PyObject *
+os_killpg(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pgid;
+ int signal;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg",
+ &pgid, &signal))
+ goto exit;
+ return_value = os_killpg_impl(module, pgid, signal);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_KILLPG) */
+
+#if defined(HAVE_PLOCK)
+
+PyDoc_STRVAR(os_plock__doc__,
+"plock($module, op, /)\n"
+"--\n"
+"\n"
+"Lock program segments into memory.\");");
+
+#define OS_PLOCK_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int op;
+
+ if (!PyArg_Parse(arg, "i:plock", &op))
+ goto exit;
+ return_value = os_plock_impl(module, op);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_PLOCK) */
+
+#if defined(HAVE_SETUID)
+
+PyDoc_STRVAR(os_setuid__doc__,
+"setuid($module, uid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s user id.");
+
+#define OS_SETUID_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ uid_t uid;
+
+ if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid))
+ goto exit;
+ return_value = os_setuid_impl(module, uid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETUID) */
+
+#if defined(HAVE_SETEUID)
+
+PyDoc_STRVAR(os_seteuid__doc__,
+"seteuid($module, euid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s effective user id.");
+
+#define OS_SETEUID_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ uid_t euid;
+
+ if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid))
+ goto exit;
+ return_value = os_seteuid_impl(module, euid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETEUID) */
+
+#if defined(HAVE_SETEGID)
+
+PyDoc_STRVAR(os_setegid__doc__,
+"setegid($module, egid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s effective group id.");
+
+#define OS_SETEGID_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ gid_t egid;
+
+ if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid))
+ goto exit;
+ return_value = os_setegid_impl(module, egid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETEGID) */
+
+#if defined(HAVE_SETREUID)
+
+PyDoc_STRVAR(os_setreuid__doc__,
+"setreuid($module, ruid, euid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s real and effective user ids.");
+
+#define OS_SETREUID_METHODDEF \
+ {"setreuid", (PyCFunction)os_setreuid, METH_VARARGS, os_setreuid__doc__},
+
+static PyObject *
+os_setreuid_impl(PyModuleDef *module, uid_t ruid, uid_t euid);
+
+static PyObject *
+os_setreuid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ uid_t ruid;
+ uid_t euid;
+
+ if (!PyArg_ParseTuple(args, "O&O&:setreuid",
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid))
+ goto exit;
+ return_value = os_setreuid_impl(module, ruid, euid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETREUID) */
+
+#if defined(HAVE_SETREGID)
+
+PyDoc_STRVAR(os_setregid__doc__,
+"setregid($module, rgid, egid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s real and effective group ids.");
+
+#define OS_SETREGID_METHODDEF \
+ {"setregid", (PyCFunction)os_setregid, METH_VARARGS, os_setregid__doc__},
+
+static PyObject *
+os_setregid_impl(PyModuleDef *module, gid_t rgid, gid_t egid);
+
+static PyObject *
+os_setregid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ gid_t rgid;
+ gid_t egid;
+
+ if (!PyArg_ParseTuple(args, "O&O&:setregid",
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid))
+ goto exit;
+ return_value = os_setregid_impl(module, rgid, egid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETREGID) */
+
+#if defined(HAVE_SETGID)
+
+PyDoc_STRVAR(os_setgid__doc__,
+"setgid($module, gid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s group id.");
+
+#define OS_SETGID_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ gid_t gid;
+
+ if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid))
+ goto exit;
+ return_value = os_setgid_impl(module, gid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETGID) */
+
+#if defined(HAVE_SETGROUPS)
+
+PyDoc_STRVAR(os_setgroups__doc__,
+"setgroups($module, groups, /)\n"
+"--\n"
+"\n"
+"Set the groups of the current process to list.");
+
+#define OS_SETGROUPS_METHODDEF \
+ {"setgroups", (PyCFunction)os_setgroups, METH_O, os_setgroups__doc__},
+
+#endif /* defined(HAVE_SETGROUPS) */
+
+#if defined(HAVE_WAIT3)
+
+PyDoc_STRVAR(os_wait3__doc__,
+"wait3($module, /, options)\n"
+"--\n"
+"\n"
+"Wait for completion of a child process.\n"
+"\n"
+"Returns a tuple of information about the child process:\n"
+" (pid, status, rusage)");
+
+#define OS_WAIT3_METHODDEF \
+ {"wait3", (PyCFunction)os_wait3, METH_VARARGS|METH_KEYWORDS, os_wait3__doc__},
+
+static PyObject *
+os_wait3_impl(PyModuleDef *module, int options);
+
+static PyObject *
+os_wait3(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"options", NULL};
+ int options;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:wait3", _keywords,
+ &options))
+ goto exit;
+ return_value = os_wait3_impl(module, options);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_WAIT3) */
+
+#if defined(HAVE_WAIT4)
+
+PyDoc_STRVAR(os_wait4__doc__,
+"wait4($module, /, pid, options)\n"
+"--\n"
+"\n"
+"Wait for completion of a specific child process.\n"
+"\n"
+"Returns a tuple of information about the child process:\n"
+" (pid, status, rusage)");
+
+#define OS_WAIT4_METHODDEF \
+ {"wait4", (PyCFunction)os_wait4, METH_VARARGS|METH_KEYWORDS, os_wait4__doc__},
+
+static PyObject *
+os_wait4_impl(PyModuleDef *module, pid_t pid, int options);
+
+static PyObject *
+os_wait4(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"pid", "options", NULL};
+ pid_t pid;
+ int options;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID "i:wait4", _keywords,
+ &pid, &options))
+ goto exit;
+ return_value = os_wait4_impl(module, pid, options);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_WAIT4) */
+
+#if (defined(HAVE_WAITID) && !defined(__APPLE__))
+
+PyDoc_STRVAR(os_waitid__doc__,
+"waitid($module, idtype, id, options, /)\n"
+"--\n"
+"\n"
+"Returns the result of waiting for a process or processes.\n"
+"\n"
+" idtype\n"
+" Must be one of be P_PID, P_PGID or P_ALL.\n"
+" id\n"
+" The id to wait on.\n"
+" options\n"
+" Constructed from the ORing of one or more of WEXITED, WSTOPPED\n"
+" or WCONTINUED and additionally may be ORed with WNOHANG or WNOWAIT.\n"
+"\n"
+"Returns either waitid_result or None if WNOHANG is specified and there are\n"
+"no children in a waitable state.");
+
+#define OS_WAITID_METHODDEF \
+ {"waitid", (PyCFunction)os_waitid, METH_VARARGS, os_waitid__doc__},
+
+static PyObject *
+os_waitid_impl(PyModuleDef *module, idtype_t idtype, id_t id, int options);
+
+static PyObject *
+os_waitid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ idtype_t idtype;
+ id_t id;
+ int options;
+
+ if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid",
+ &idtype, &id, &options))
+ goto exit;
+ return_value = os_waitid_impl(module, idtype, id, options);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_WAITID) && !defined(__APPLE__)) */
+
+#if defined(HAVE_WAITPID)
+
+PyDoc_STRVAR(os_waitpid__doc__,
+"waitpid($module, pid, options, /)\n"
+"--\n"
+"\n"
+"Wait for completion of a given child process.\n"
+"\n"
+"Returns a tuple of information regarding the child process:\n"
+" (pid, status)\n"
+"\n"
+"The options argument is ignored on Windows.");
+
+#define OS_WAITPID_METHODDEF \
+ {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__},
+
+static PyObject *
+os_waitpid_impl(PyModuleDef *module, pid_t pid, int options);
+
+static PyObject *
+os_waitpid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ int options;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid",
+ &pid, &options))
+ goto exit;
+ return_value = os_waitpid_impl(module, pid, options);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_WAITPID) */
+
+#if defined(HAVE_CWAIT)
+
+PyDoc_STRVAR(os_waitpid__doc__,
+"waitpid($module, pid, options, /)\n"
+"--\n"
+"\n"
+"Wait for completion of a given process.\n"
+"\n"
+"Returns a tuple of information regarding the process:\n"
+" (pid, status << 8)\n"
+"\n"
+"The options argument is ignored on Windows.");
+
+#define OS_WAITPID_METHODDEF \
+ {"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__},
+
+static PyObject *
+os_waitpid_impl(PyModuleDef *module, Py_intptr_t pid, int options);
+
+static PyObject *
+os_waitpid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_intptr_t pid;
+ int options;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid",
+ &pid, &options))
+ goto exit;
+ return_value = os_waitpid_impl(module, pid, options);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CWAIT) */
+
+#if defined(HAVE_WAIT)
+
+PyDoc_STRVAR(os_wait__doc__,
+"wait($module, /)\n"
+"--\n"
+"\n"
+"Wait for completion of a child process.\n"
+"\n"
+"Returns a tuple of information about the child process:\n"
+" (pid, status)");
+
+#define OS_WAIT_METHODDEF \
+ {"wait", (PyCFunction)os_wait, METH_NOARGS, os_wait__doc__},
+
+static PyObject *
+os_wait_impl(PyModuleDef *module);
+
+static PyObject *
+os_wait(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_wait_impl(module);
+}
+
+#endif /* defined(HAVE_WAIT) */
+
+#if defined(HAVE_SYMLINK)
+
+PyDoc_STRVAR(os_symlink__doc__,
+"symlink($module, /, src, dst, target_is_directory=False, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Create a symbolic link pointing to src named dst.\n"
+"\n"
+"target_is_directory is required on Windows if the target is to be\n"
+" interpreted as a directory. (On Windows, symlink requires\n"
+" Windows 6.0 or greater, and raises a NotImplementedError otherwise.)\n"
+" target_is_directory is ignored on non-Windows platforms.\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_SYMLINK_METHODDEF \
+ {"symlink", (PyCFunction)os_symlink, METH_VARARGS|METH_KEYWORDS, os_symlink__doc__},
+
+static PyObject *
+os_symlink_impl(PyModuleDef *module, path_t *src, path_t *dst,
+ int target_is_directory, int dir_fd);
+
+static PyObject *
+os_symlink(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"src", "dst", "target_is_directory", "dir_fd", NULL};
+ path_t src = PATH_T_INITIALIZE("symlink", "src", 0, 0);
+ path_t dst = PATH_T_INITIALIZE("symlink", "dst", 0, 0);
+ int target_is_directory = 0;
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|p$O&:symlink", _keywords,
+ path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_symlink_impl(module, &src, &dst, target_is_directory, dir_fd);
+
+exit:
+ /* Cleanup for src */
+ path_cleanup(&src);
+ /* Cleanup for dst */
+ path_cleanup(&dst);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYMLINK) */
+
+#if defined(HAVE_TIMES)
+
+PyDoc_STRVAR(os_times__doc__,
+"times($module, /)\n"
+"--\n"
+"\n"
+"Return a collection containing process timing information.\n"
+"\n"
+"The object returned behaves like a named tuple with these fields:\n"
+" (utime, stime, cutime, cstime, elapsed_time)\n"
+"All fields are floating point numbers.");
+
+#define OS_TIMES_METHODDEF \
+ {"times", (PyCFunction)os_times, METH_NOARGS, os_times__doc__},
+
+static PyObject *
+os_times_impl(PyModuleDef *module);
+
+static PyObject *
+os_times(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_times_impl(module);
+}
+
+#endif /* defined(HAVE_TIMES) */
+
+#if defined(HAVE_GETSID)
+
+PyDoc_STRVAR(os_getsid__doc__,
+"getsid($module, pid, /)\n"
+"--\n"
+"\n"
+"Call the system call getsid(pid) and return the result.");
+
+#define OS_GETSID_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid))
+ goto exit;
+ return_value = os_getsid_impl(module, pid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETSID) */
+
+#if defined(HAVE_SETSID)
+
+PyDoc_STRVAR(os_setsid__doc__,
+"setsid($module, /)\n"
+"--\n"
+"\n"
+"Call the system call setsid().");
+
+#define OS_SETSID_METHODDEF \
+ {"setsid", (PyCFunction)os_setsid, METH_NOARGS, os_setsid__doc__},
+
+static PyObject *
+os_setsid_impl(PyModuleDef *module);
+
+static PyObject *
+os_setsid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_setsid_impl(module);
+}
+
+#endif /* defined(HAVE_SETSID) */
+
+#if defined(HAVE_SETPGID)
+
+PyDoc_STRVAR(os_setpgid__doc__,
+"setpgid($module, pid, pgrp, /)\n"
+"--\n"
+"\n"
+"Call the system call setpgid(pid, pgrp).");
+
+#define OS_SETPGID_METHODDEF \
+ {"setpgid", (PyCFunction)os_setpgid, METH_VARARGS, os_setpgid__doc__},
+
+static PyObject *
+os_setpgid_impl(PyModuleDef *module, pid_t pid, pid_t pgrp);
+
+static PyObject *
+os_setpgid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ pid_t pid;
+ pid_t pgrp;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid",
+ &pid, &pgrp))
+ goto exit;
+ return_value = os_setpgid_impl(module, pid, pgrp);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETPGID) */
+
+#if defined(HAVE_TCGETPGRP)
+
+PyDoc_STRVAR(os_tcgetpgrp__doc__,
+"tcgetpgrp($module, fd, /)\n"
+"--\n"
+"\n"
+"Return the process group associated with the terminal specified by fd.");
+
+#define OS_TCGETPGRP_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+
+ if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd))
+ goto exit;
+ return_value = os_tcgetpgrp_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_TCGETPGRP) */
+
+#if defined(HAVE_TCSETPGRP)
+
+PyDoc_STRVAR(os_tcsetpgrp__doc__,
+"tcsetpgrp($module, fd, pgid, /)\n"
+"--\n"
+"\n"
+"Set the process group associated with the terminal specified by fd.");
+
+#define OS_TCSETPGRP_METHODDEF \
+ {"tcsetpgrp", (PyCFunction)os_tcsetpgrp, METH_VARARGS, os_tcsetpgrp__doc__},
+
+static PyObject *
+os_tcsetpgrp_impl(PyModuleDef *module, int fd, pid_t pgid);
+
+static PyObject *
+os_tcsetpgrp(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ pid_t pgid;
+
+ if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp",
+ &fd, &pgid))
+ goto exit;
+ return_value = os_tcsetpgrp_impl(module, fd, pgid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_TCSETPGRP) */
+
+PyDoc_STRVAR(os_open__doc__,
+"open($module, /, path, flags, mode=511, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Open a file for low level IO. Returns a file descriptor (integer).\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_OPEN_METHODDEF \
+ {"open", (PyCFunction)os_open, METH_VARARGS|METH_KEYWORDS, os_open__doc__},
+
+static int
+os_open_impl(PyModuleDef *module, path_t *path, int flags, int mode,
+ int dir_fd);
+
+static PyObject *
+os_open(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "flags", "mode", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("open", "path", 0, 0);
+ int flags;
+ int mode = 511;
+ int dir_fd = DEFAULT_DIR_FD;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|i$O&:open", _keywords,
+ path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ _return_value = os_open_impl(module, &path, flags, mode, dir_fd);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_close__doc__,
+"close($module, /, fd)\n"
+"--\n"
+"\n"
+"Close a file descriptor.");
+
+#define OS_CLOSE_METHODDEF \
+ {"close", (PyCFunction)os_close, METH_VARARGS|METH_KEYWORDS, os_close__doc__},
+
+static PyObject *
+os_close_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_close(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:close", _keywords,
+ &fd))
+ goto exit;
+ return_value = os_close_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_closerange__doc__,
+"closerange($module, fd_low, fd_high, /)\n"
+"--\n"
+"\n"
+"Closes all file descriptors in [fd_low, fd_high), ignoring errors.");
+
+#define OS_CLOSERANGE_METHODDEF \
+ {"closerange", (PyCFunction)os_closerange, METH_VARARGS, os_closerange__doc__},
+
+static PyObject *
+os_closerange_impl(PyModuleDef *module, int fd_low, int fd_high);
+
+static PyObject *
+os_closerange(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd_low;
+ int fd_high;
+
+ if (!PyArg_ParseTuple(args, "ii:closerange",
+ &fd_low, &fd_high))
+ goto exit;
+ return_value = os_closerange_impl(module, fd_low, fd_high);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_dup__doc__,
+"dup($module, fd, /)\n"
+"--\n"
+"\n"
+"Return a duplicate of a file descriptor.");
+
+#define OS_DUP_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "i:dup", &fd))
+ goto exit;
+ _return_value = os_dup_impl(module, fd);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_dup2__doc__,
+"dup2($module, /, fd, fd2, inheritable=True)\n"
+"--\n"
+"\n"
+"Duplicate file descriptor.");
+
+#define OS_DUP2_METHODDEF \
+ {"dup2", (PyCFunction)os_dup2, METH_VARARGS|METH_KEYWORDS, os_dup2__doc__},
+
+static PyObject *
+os_dup2_impl(PyModuleDef *module, int fd, int fd2, int inheritable);
+
+static PyObject *
+os_dup2(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", "fd2", "inheritable", NULL};
+ int fd;
+ int fd2;
+ int inheritable = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|p:dup2", _keywords,
+ &fd, &fd2, &inheritable))
+ goto exit;
+ return_value = os_dup2_impl(module, fd, fd2, inheritable);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_LOCKF)
+
+PyDoc_STRVAR(os_lockf__doc__,
+"lockf($module, fd, command, length, /)\n"
+"--\n"
+"\n"
+"Apply, test or remove a POSIX lock on an open file descriptor.\n"
+"\n"
+" fd\n"
+" An open file descriptor.\n"
+" command\n"
+" One of F_LOCK, F_TLOCK, F_ULOCK or F_TEST.\n"
+" length\n"
+" The number of bytes to lock, starting at the current position.");
+
+#define OS_LOCKF_METHODDEF \
+ {"lockf", (PyCFunction)os_lockf, METH_VARARGS, os_lockf__doc__},
+
+static PyObject *
+os_lockf_impl(PyModuleDef *module, int fd, int command, Py_off_t length);
+
+static PyObject *
+os_lockf(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int command;
+ Py_off_t length;
+
+ if (!PyArg_ParseTuple(args, "iiO&:lockf",
+ &fd, &command, Py_off_t_converter, &length))
+ goto exit;
+ return_value = os_lockf_impl(module, fd, command, length);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_LOCKF) */
+
+PyDoc_STRVAR(os_lseek__doc__,
+"lseek($module, fd, position, how, /)\n"
+"--\n"
+"\n"
+"Set the position of a file descriptor. Return the new position.\n"
+"\n"
+"Return the new cursor position in number of bytes\n"
+"relative to the beginning of the file.");
+
+#define OS_LSEEK_METHODDEF \
+ {"lseek", (PyCFunction)os_lseek, METH_VARARGS, os_lseek__doc__},
+
+static Py_off_t
+os_lseek_impl(PyModuleDef *module, int fd, Py_off_t position, int how);
+
+static PyObject *
+os_lseek(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_off_t position;
+ int how;
+ Py_off_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "iO&i:lseek",
+ &fd, Py_off_t_converter, &position, &how))
+ goto exit;
+ _return_value = os_lseek_impl(module, fd, position, how);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromPy_off_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_read__doc__,
+"read($module, fd, length, /)\n"
+"--\n"
+"\n"
+"Read from a file descriptor. Returns a bytes object.");
+
+#define OS_READ_METHODDEF \
+ {"read", (PyCFunction)os_read, METH_VARARGS, os_read__doc__},
+
+static PyObject *
+os_read_impl(PyModuleDef *module, int fd, Py_ssize_t length);
+
+static PyObject *
+os_read(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_ssize_t length;
+
+ if (!PyArg_ParseTuple(args, "in:read",
+ &fd, &length))
+ goto exit;
+ return_value = os_read_impl(module, fd, length);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_READV)
+
+PyDoc_STRVAR(os_readv__doc__,
+"readv($module, fd, buffers, /)\n"
+"--\n"
+"\n"
+"Read from a file descriptor fd into an iterable of buffers.\n"
+"\n"
+"The buffers should be mutable buffers accepting bytes.\n"
+"readv will transfer data into each buffer until it is full\n"
+"and then move on to the next buffer in the sequence to hold\n"
+"the rest of the data.\n"
+"\n"
+"readv returns the total number of bytes read,\n"
+"which may be less than the total capacity of all the buffers.");
+
+#define OS_READV_METHODDEF \
+ {"readv", (PyCFunction)os_readv, METH_VARARGS, os_readv__doc__},
+
+static Py_ssize_t
+os_readv_impl(PyModuleDef *module, int fd, PyObject *buffers);
+
+static PyObject *
+os_readv(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ PyObject *buffers;
+ Py_ssize_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "iO:readv",
+ &fd, &buffers))
+ goto exit;
+ _return_value = os_readv_impl(module, fd, buffers);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_READV) */
+
+#if defined(HAVE_PREAD)
+
+PyDoc_STRVAR(os_pread__doc__,
+"pread($module, fd, length, offset, /)\n"
+"--\n"
+"\n"
+"Read a number of bytes from a file descriptor starting at a particular offset.\n"
+"\n"
+"Read length bytes from file descriptor fd, starting at offset bytes from\n"
+"the beginning of the file. The file offset remains unchanged.");
+
+#define OS_PREAD_METHODDEF \
+ {"pread", (PyCFunction)os_pread, METH_VARARGS, os_pread__doc__},
+
+static PyObject *
+os_pread_impl(PyModuleDef *module, int fd, int length, Py_off_t offset);
+
+static PyObject *
+os_pread(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int length;
+ Py_off_t offset;
+
+ if (!PyArg_ParseTuple(args, "iiO&:pread",
+ &fd, &length, Py_off_t_converter, &offset))
+ goto exit;
+ return_value = os_pread_impl(module, fd, length, offset);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_PREAD) */
+
+PyDoc_STRVAR(os_write__doc__,
+"write($module, fd, data, /)\n"
+"--\n"
+"\n"
+"Write a bytes object to a file descriptor.");
+
+#define OS_WRITE_METHODDEF \
+ {"write", (PyCFunction)os_write, METH_VARARGS, os_write__doc__},
+
+static Py_ssize_t
+os_write_impl(PyModuleDef *module, int fd, Py_buffer *data);
+
+static PyObject *
+os_write(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_buffer data = {NULL, NULL};
+ Py_ssize_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "iy*:write",
+ &fd, &data))
+ goto exit;
+ _return_value = os_write_impl(module, fd, &data);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
+PyDoc_STRVAR(os_fstat__doc__,
+"fstat($module, /, fd)\n"
+"--\n"
+"\n"
+"Perform a stat system call on the given file descriptor.\n"
+"\n"
+"Like stat(), but for an open file descriptor.\n"
+"Equivalent to os.stat(fd).");
+
+#define OS_FSTAT_METHODDEF \
+ {"fstat", (PyCFunction)os_fstat, METH_VARARGS|METH_KEYWORDS, os_fstat__doc__},
+
+static PyObject *
+os_fstat_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_fstat(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:fstat", _keywords,
+ &fd))
+ goto exit;
+ return_value = os_fstat_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_isatty__doc__,
+"isatty($module, fd, /)\n"
+"--\n"
+"\n"
+"Return True if the fd is connected to a terminal.\n"
+"\n"
+"Return True if the file descriptor is an open file descriptor\n"
+"connected to the slave end of a terminal.");
+
+#define OS_ISATTY_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "i:isatty", &fd))
+ goto exit;
+ _return_value = os_isatty_impl(module, fd);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_PIPE)
+
+PyDoc_STRVAR(os_pipe__doc__,
+"pipe($module, /)\n"
+"--\n"
+"\n"
+"Create a pipe.\n"
+"\n"
+"Returns a tuple of two file descriptors:\n"
+" (read_fd, write_fd)");
+
+#define OS_PIPE_METHODDEF \
+ {"pipe", (PyCFunction)os_pipe, METH_NOARGS, os_pipe__doc__},
+
+static PyObject *
+os_pipe_impl(PyModuleDef *module);
+
+static PyObject *
+os_pipe(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_pipe_impl(module);
+}
+
+#endif /* defined(HAVE_PIPE) */
+
+#if defined(HAVE_PIPE2)
+
+PyDoc_STRVAR(os_pipe2__doc__,
+"pipe2($module, flags, /)\n"
+"--\n"
+"\n"
+"Create a pipe with flags set atomically.\n"
+"\n"
+"Returns a tuple of two file descriptors:\n"
+" (read_fd, write_fd)\n"
+"\n"
+"flags can be constructed by ORing together one or more of these values:\n"
+"O_NONBLOCK, O_CLOEXEC.");
+
+#define OS_PIPE2_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int flags;
+
+ if (!PyArg_Parse(arg, "i:pipe2", &flags))
+ goto exit;
+ return_value = os_pipe2_impl(module, flags);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_PIPE2) */
+
+#if defined(HAVE_WRITEV)
+
+PyDoc_STRVAR(os_writev__doc__,
+"writev($module, fd, buffers, /)\n"
+"--\n"
+"\n"
+"Iterate over buffers, and write the contents of each to a file descriptor.\n"
+"\n"
+"Returns the total number of bytes written.\n"
+"buffers must be a sequence of bytes-like objects.");
+
+#define OS_WRITEV_METHODDEF \
+ {"writev", (PyCFunction)os_writev, METH_VARARGS, os_writev__doc__},
+
+static Py_ssize_t
+os_writev_impl(PyModuleDef *module, int fd, PyObject *buffers);
+
+static PyObject *
+os_writev(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ PyObject *buffers;
+ Py_ssize_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "iO:writev",
+ &fd, &buffers))
+ goto exit;
+ _return_value = os_writev_impl(module, fd, buffers);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_WRITEV) */
+
+#if defined(HAVE_PWRITE)
+
+PyDoc_STRVAR(os_pwrite__doc__,
+"pwrite($module, fd, buffer, offset, /)\n"
+"--\n"
+"\n"
+"Write bytes to a file descriptor starting at a particular offset.\n"
+"\n"
+"Write buffer to fd, starting at offset bytes from the beginning of\n"
+"the file. Returns the number of bytes writte. Does not change the\n"
+"current file offset.");
+
+#define OS_PWRITE_METHODDEF \
+ {"pwrite", (PyCFunction)os_pwrite, METH_VARARGS, os_pwrite__doc__},
+
+static Py_ssize_t
+os_pwrite_impl(PyModuleDef *module, int fd, Py_buffer *buffer,
+ Py_off_t offset);
+
+static PyObject *
+os_pwrite(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_buffer buffer = {NULL, NULL};
+ Py_off_t offset;
+ Py_ssize_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "iy*O&:pwrite",
+ &fd, &buffer, Py_off_t_converter, &offset))
+ goto exit;
+ _return_value = os_pwrite_impl(module, fd, &buffer, offset);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromSsize_t(_return_value);
+
+exit:
+ /* Cleanup for buffer */
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_PWRITE) */
+
+#if defined(HAVE_MKFIFO)
+
+PyDoc_STRVAR(os_mkfifo__doc__,
+"mkfifo($module, /, path, mode=438, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Create a \"fifo\" (a POSIX named pipe).\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_MKFIFO_METHODDEF \
+ {"mkfifo", (PyCFunction)os_mkfifo, METH_VARARGS|METH_KEYWORDS, os_mkfifo__doc__},
+
+static PyObject *
+os_mkfifo_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd);
+
+static PyObject *
+os_mkfifo(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("mkfifo", "path", 0, 0);
+ int mode = 438;
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkfifo", _keywords,
+ path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_mkfifo_impl(module, &path, mode, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_MKFIFO) */
+
+#if (defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV))
+
+PyDoc_STRVAR(os_mknod__doc__,
+"mknod($module, /, path, mode=384, device=0, *, dir_fd=None)\n"
+"--\n"
+"\n"
+"Create a node in the file system.\n"
+"\n"
+"Create a node in the file system (file, device special file or named pipe)\n"
+"at path. mode specifies both the permissions to use and the\n"
+"type of node to be created, being combined (bitwise OR) with one of\n"
+"S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. If S_IFCHR or S_IFBLK is set on mode,\n"
+"device defines the newly created device special file (probably using\n"
+"os.makedev()). Otherwise device is ignored.\n"
+"\n"
+"If dir_fd is not None, it should be a file descriptor open to a directory,\n"
+" and path should be relative; path will then be relative to that directory.\n"
+"dir_fd may not be implemented on your platform.\n"
+" If it is unavailable, using it will raise a NotImplementedError.");
+
+#define OS_MKNOD_METHODDEF \
+ {"mknod", (PyCFunction)os_mknod, METH_VARARGS|METH_KEYWORDS, os_mknod__doc__},
+
+static PyObject *
+os_mknod_impl(PyModuleDef *module, path_t *path, int mode, dev_t device,
+ int dir_fd);
+
+static PyObject *
+os_mknod(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "mode", "device", "dir_fd", NULL};
+ path_t path = PATH_T_INITIALIZE("mknod", "path", 0, 0);
+ int mode = 384;
+ dev_t device = 0;
+ int dir_fd = DEFAULT_DIR_FD;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|iO&$O&:mknod", _keywords,
+ path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd))
+ goto exit;
+ return_value = os_mknod_impl(module, &path, mode, device, dir_fd);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* (defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)) */
+
+#if defined(HAVE_DEVICE_MACROS)
+
+PyDoc_STRVAR(os_major__doc__,
+"major($module, device, /)\n"
+"--\n"
+"\n"
+"Extracts a device major number from a raw device number.");
+
+#define OS_MAJOR_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ dev_t device;
+ unsigned int _return_value;
+
+ if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device))
+ goto exit;
+ _return_value = os_major_impl(module, device);
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_DEVICE_MACROS) */
+
+#if defined(HAVE_DEVICE_MACROS)
+
+PyDoc_STRVAR(os_minor__doc__,
+"minor($module, device, /)\n"
+"--\n"
+"\n"
+"Extracts a device minor number from a raw device number.");
+
+#define OS_MINOR_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ dev_t device;
+ unsigned int _return_value;
+
+ if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device))
+ goto exit;
+ _return_value = os_minor_impl(module, device);
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_DEVICE_MACROS) */
+
+#if defined(HAVE_DEVICE_MACROS)
+
+PyDoc_STRVAR(os_makedev__doc__,
+"makedev($module, major, minor, /)\n"
+"--\n"
+"\n"
+"Composes a raw device number from the major and minor device numbers.");
+
+#define OS_MAKEDEV_METHODDEF \
+ {"makedev", (PyCFunction)os_makedev, METH_VARARGS, os_makedev__doc__},
+
+static dev_t
+os_makedev_impl(PyModuleDef *module, int major, int minor);
+
+static PyObject *
+os_makedev(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int major;
+ int minor;
+ dev_t _return_value;
+
+ if (!PyArg_ParseTuple(args, "ii:makedev",
+ &major, &minor))
+ goto exit;
+ _return_value = os_makedev_impl(module, major, minor);
+ if ((_return_value == (dev_t)-1) && PyErr_Occurred())
+ goto exit;
+ return_value = _PyLong_FromDev(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_DEVICE_MACROS) */
+
+#if (defined HAVE_FTRUNCATE || defined MS_WINDOWS)
+
+PyDoc_STRVAR(os_ftruncate__doc__,
+"ftruncate($module, fd, length, /)\n"
+"--\n"
+"\n"
+"Truncate a file, specified by file descriptor, to a specific length.");
+
+#define OS_FTRUNCATE_METHODDEF \
+ {"ftruncate", (PyCFunction)os_ftruncate, METH_VARARGS, os_ftruncate__doc__},
+
+static PyObject *
+os_ftruncate_impl(PyModuleDef *module, int fd, Py_off_t length);
+
+static PyObject *
+os_ftruncate(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_off_t length;
+
+ if (!PyArg_ParseTuple(args, "iO&:ftruncate",
+ &fd, Py_off_t_converter, &length))
+ goto exit;
+ return_value = os_ftruncate_impl(module, fd, length);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined HAVE_FTRUNCATE || defined MS_WINDOWS) */
+
+#if (defined HAVE_TRUNCATE || defined MS_WINDOWS)
+
+PyDoc_STRVAR(os_truncate__doc__,
+"truncate($module, /, path, length)\n"
+"--\n"
+"\n"
+"Truncate a file, specified by path, to a specific length.\n"
+"\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.");
+
+#define OS_TRUNCATE_METHODDEF \
+ {"truncate", (PyCFunction)os_truncate, METH_VARARGS|METH_KEYWORDS, os_truncate__doc__},
+
+static PyObject *
+os_truncate_impl(PyModuleDef *module, path_t *path, Py_off_t length);
+
+static PyObject *
+os_truncate(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "length", NULL};
+ path_t path = PATH_T_INITIALIZE("truncate", "path", 0, PATH_HAVE_FTRUNCATE);
+ Py_off_t length;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:truncate", _keywords,
+ path_converter, &path, Py_off_t_converter, &length))
+ goto exit;
+ return_value = os_truncate_impl(module, &path, length);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* (defined HAVE_TRUNCATE || defined MS_WINDOWS) */
+
+#if (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG))
+
+PyDoc_STRVAR(os_posix_fallocate__doc__,
+"posix_fallocate($module, fd, offset, length, /)\n"
+"--\n"
+"\n"
+"Ensure a file has allocated at least a particular number of bytes on disk.\n"
+"\n"
+"Ensure that the file specified by fd encompasses a range of bytes\n"
+"starting at offset bytes from the beginning and continuing for length bytes.");
+
+#define OS_POSIX_FALLOCATE_METHODDEF \
+ {"posix_fallocate", (PyCFunction)os_posix_fallocate, METH_VARARGS, os_posix_fallocate__doc__},
+
+static PyObject *
+os_posix_fallocate_impl(PyModuleDef *module, int fd, Py_off_t offset,
+ Py_off_t length);
+
+static PyObject *
+os_posix_fallocate(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_off_t offset;
+ Py_off_t length;
+
+ if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate",
+ &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length))
+ goto exit;
+ return_value = os_posix_fallocate_impl(module, fd, offset, length);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)) */
+
+#if (defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG))
+
+PyDoc_STRVAR(os_posix_fadvise__doc__,
+"posix_fadvise($module, fd, offset, length, advice, /)\n"
+"--\n"
+"\n"
+"Announce an intention to access data in a specific pattern.\n"
+"\n"
+"Announce an intention to access data in a specific pattern, thus allowing\n"
+"the kernel to make optimizations.\n"
+"The advice applies to the region of the file specified by fd starting at\n"
+"offset and continuing for length bytes.\n"
+"advice is one of POSIX_FADV_NORMAL, POSIX_FADV_SEQUENTIAL,\n"
+"POSIX_FADV_RANDOM, POSIX_FADV_NOREUSE, POSIX_FADV_WILLNEED, or\n"
+"POSIX_FADV_DONTNEED.");
+
+#define OS_POSIX_FADVISE_METHODDEF \
+ {"posix_fadvise", (PyCFunction)os_posix_fadvise, METH_VARARGS, os_posix_fadvise__doc__},
+
+static PyObject *
+os_posix_fadvise_impl(PyModuleDef *module, int fd, Py_off_t offset,
+ Py_off_t length, int advice);
+
+static PyObject *
+os_posix_fadvise(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ Py_off_t offset;
+ Py_off_t length;
+ int advice;
+
+ if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise",
+ &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice))
+ goto exit;
+ return_value = os_posix_fadvise_impl(module, fd, offset, length, advice);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)) */
+
+#if defined(HAVE_PUTENV) && defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_putenv__doc__,
+"putenv($module, name, value, /)\n"
+"--\n"
+"\n"
+"Change or add an environment variable.");
+
+#define OS_PUTENV_METHODDEF \
+ {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__},
+
+static PyObject *
+os_putenv_impl(PyModuleDef *module, PyObject *name, PyObject *value);
+
+static PyObject *
+os_putenv(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *name;
+ PyObject *value;
+
+ if (!PyArg_ParseTuple(args, "UU:putenv",
+ &name, &value))
+ goto exit;
+ return_value = os_putenv_impl(module, name, value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_PUTENV) && defined(MS_WINDOWS) */
+
+#if defined(HAVE_PUTENV) && !defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_putenv__doc__,
+"putenv($module, name, value, /)\n"
+"--\n"
+"\n"
+"Change or add an environment variable.");
+
+#define OS_PUTENV_METHODDEF \
+ {"putenv", (PyCFunction)os_putenv, METH_VARARGS, os_putenv__doc__},
+
+static PyObject *
+os_putenv_impl(PyModuleDef *module, PyObject *name, PyObject *value);
+
+static PyObject *
+os_putenv(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *name = NULL;
+ PyObject *value = NULL;
+
+ if (!PyArg_ParseTuple(args, "O&O&:putenv",
+ PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value))
+ goto exit;
+ return_value = os_putenv_impl(module, name, value);
+
+exit:
+ /* Cleanup for name */
+ Py_XDECREF(name);
+ /* Cleanup for value */
+ Py_XDECREF(value);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_PUTENV) && !defined(MS_WINDOWS) */
+
+#if defined(HAVE_UNSETENV)
+
+PyDoc_STRVAR(os_unsetenv__doc__,
+"unsetenv($module, name, /)\n"
+"--\n"
+"\n"
+"Delete an environment variable.");
+
+#define OS_UNSETENV_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ PyObject *name = NULL;
+
+ if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name))
+ goto exit;
+ return_value = os_unsetenv_impl(module, name);
+
+exit:
+ /* Cleanup for name */
+ Py_XDECREF(name);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_UNSETENV) */
+
+PyDoc_STRVAR(os_strerror__doc__,
+"strerror($module, code, /)\n"
+"--\n"
+"\n"
+"Translate an error code to a message string.");
+
+#define OS_STRERROR_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int code;
+
+ if (!PyArg_Parse(arg, "i:strerror", &code))
+ goto exit;
+ return_value = os_strerror_impl(module, code);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WCOREDUMP)
+
+PyDoc_STRVAR(os_WCOREDUMP__doc__,
+"WCOREDUMP($module, status, /)\n"
+"--\n"
+"\n"
+"Return True if the process returning status was dumped to a core file.");
+
+#define OS_WCOREDUMP_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int status;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "i:WCOREDUMP", &status))
+ goto exit;
+ _return_value = os_WCOREDUMP_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WCOREDUMP) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WIFCONTINUED)
+
+PyDoc_STRVAR(os_WIFCONTINUED__doc__,
+"WIFCONTINUED($module, /, status)\n"
+"--\n"
+"\n"
+"Return True if a particular process was continued from a job control stop.\n"
+"\n"
+"Return True if the process returning status was continued from a\n"
+"job control stop.");
+
+#define OS_WIFCONTINUED_METHODDEF \
+ {"WIFCONTINUED", (PyCFunction)os_WIFCONTINUED, METH_VARARGS|METH_KEYWORDS, os_WIFCONTINUED__doc__},
+
+static int
+os_WIFCONTINUED_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WIFCONTINUED(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFCONTINUED", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WIFCONTINUED_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WIFCONTINUED) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WIFSTOPPED)
+
+PyDoc_STRVAR(os_WIFSTOPPED__doc__,
+"WIFSTOPPED($module, /, status)\n"
+"--\n"
+"\n"
+"Return True if the process returning status was stopped.");
+
+#define OS_WIFSTOPPED_METHODDEF \
+ {"WIFSTOPPED", (PyCFunction)os_WIFSTOPPED, METH_VARARGS|METH_KEYWORDS, os_WIFSTOPPED__doc__},
+
+static int
+os_WIFSTOPPED_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WIFSTOPPED(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSTOPPED", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WIFSTOPPED_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WIFSTOPPED) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WIFSIGNALED)
+
+PyDoc_STRVAR(os_WIFSIGNALED__doc__,
+"WIFSIGNALED($module, /, status)\n"
+"--\n"
+"\n"
+"Return True if the process returning status was terminated by a signal.");
+
+#define OS_WIFSIGNALED_METHODDEF \
+ {"WIFSIGNALED", (PyCFunction)os_WIFSIGNALED, METH_VARARGS|METH_KEYWORDS, os_WIFSIGNALED__doc__},
+
+static int
+os_WIFSIGNALED_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WIFSIGNALED(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSIGNALED", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WIFSIGNALED_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WIFSIGNALED) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WIFEXITED)
+
+PyDoc_STRVAR(os_WIFEXITED__doc__,
+"WIFEXITED($module, /, status)\n"
+"--\n"
+"\n"
+"Return True if the process returning status exited via the exit() system call.");
+
+#define OS_WIFEXITED_METHODDEF \
+ {"WIFEXITED", (PyCFunction)os_WIFEXITED, METH_VARARGS|METH_KEYWORDS, os_WIFEXITED__doc__},
+
+static int
+os_WIFEXITED_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WIFEXITED(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFEXITED", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WIFEXITED_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WIFEXITED) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WEXITSTATUS)
+
+PyDoc_STRVAR(os_WEXITSTATUS__doc__,
+"WEXITSTATUS($module, /, status)\n"
+"--\n"
+"\n"
+"Return the process return code from status.");
+
+#define OS_WEXITSTATUS_METHODDEF \
+ {"WEXITSTATUS", (PyCFunction)os_WEXITSTATUS, METH_VARARGS|METH_KEYWORDS, os_WEXITSTATUS__doc__},
+
+static int
+os_WEXITSTATUS_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WEXITSTATUS(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WEXITSTATUS", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WEXITSTATUS_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WEXITSTATUS) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WTERMSIG)
+
+PyDoc_STRVAR(os_WTERMSIG__doc__,
+"WTERMSIG($module, /, status)\n"
+"--\n"
+"\n"
+"Return the signal that terminated the process that provided the status value.");
+
+#define OS_WTERMSIG_METHODDEF \
+ {"WTERMSIG", (PyCFunction)os_WTERMSIG, METH_VARARGS|METH_KEYWORDS, os_WTERMSIG__doc__},
+
+static int
+os_WTERMSIG_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WTERMSIG(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WTERMSIG", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WTERMSIG_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WTERMSIG) */
+
+#if defined(HAVE_SYS_WAIT_H) && defined(WSTOPSIG)
+
+PyDoc_STRVAR(os_WSTOPSIG__doc__,
+"WSTOPSIG($module, /, status)\n"
+"--\n"
+"\n"
+"Return the signal that stopped the process that provided the status value.");
+
+#define OS_WSTOPSIG_METHODDEF \
+ {"WSTOPSIG", (PyCFunction)os_WSTOPSIG, METH_VARARGS|METH_KEYWORDS, os_WSTOPSIG__doc__},
+
+static int
+os_WSTOPSIG_impl(PyModuleDef *module, int status);
+
+static PyObject *
+os_WSTOPSIG(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"status", NULL};
+ int status;
+ int _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WSTOPSIG", _keywords,
+ &status))
+ goto exit;
+ _return_value = os_WSTOPSIG_impl(module, status);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYS_WAIT_H) && defined(WSTOPSIG) */
+
+#if (defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H))
+
+PyDoc_STRVAR(os_fstatvfs__doc__,
+"fstatvfs($module, fd, /)\n"
+"--\n"
+"\n"
+"Perform an fstatvfs system call on the given fd.\n"
+"\n"
+"Equivalent to statvfs(fd).");
+
+#define OS_FSTATVFS_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+
+ if (!PyArg_Parse(arg, "i:fstatvfs", &fd))
+ goto exit;
+ return_value = os_fstatvfs_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H)) */
+
+#if (defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H))
+
+PyDoc_STRVAR(os_statvfs__doc__,
+"statvfs($module, /, path)\n"
+"--\n"
+"\n"
+"Perform a statvfs system call on the given path.\n"
+"\n"
+"path may always be specified as a string.\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.");
+
+#define OS_STATVFS_METHODDEF \
+ {"statvfs", (PyCFunction)os_statvfs, METH_VARARGS|METH_KEYWORDS, os_statvfs__doc__},
+
+static PyObject *
+os_statvfs_impl(PyModuleDef *module, path_t *path);
+
+static PyObject *
+os_statvfs(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:statvfs", _keywords,
+ path_converter, &path))
+ goto exit;
+ return_value = os_statvfs_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* (defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H)) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__getdiskusage__doc__,
+"_getdiskusage($module, /, path)\n"
+"--\n"
+"\n"
+"Return disk usage statistics about the given path as a (total, free) tuple.");
+
+#define OS__GETDISKUSAGE_METHODDEF \
+ {"_getdiskusage", (PyCFunction)os__getdiskusage, METH_VARARGS|METH_KEYWORDS, os__getdiskusage__doc__},
+
+static PyObject *
+os__getdiskusage_impl(PyModuleDef *module, Py_UNICODE *path);
+
+static PyObject *
+os__getdiskusage(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", NULL};
+ Py_UNICODE *path;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:_getdiskusage", _keywords,
+ &path))
+ goto exit;
+ return_value = os__getdiskusage_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(HAVE_FPATHCONF)
+
+PyDoc_STRVAR(os_fpathconf__doc__,
+"fpathconf($module, fd, name, /)\n"
+"--\n"
+"\n"
+"Return the configuration limit name for the file descriptor fd.\n"
+"\n"
+"If there is no limit, return -1.");
+
+#define OS_FPATHCONF_METHODDEF \
+ {"fpathconf", (PyCFunction)os_fpathconf, METH_VARARGS, os_fpathconf__doc__},
+
+static long
+os_fpathconf_impl(PyModuleDef *module, int fd, int name);
+
+static PyObject *
+os_fpathconf(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int name;
+ long _return_value;
+
+ if (!PyArg_ParseTuple(args, "iO&:fpathconf",
+ &fd, conv_path_confname, &name))
+ goto exit;
+ _return_value = os_fpathconf_impl(module, fd, name);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_FPATHCONF) */
+
+#if defined(HAVE_PATHCONF)
+
+PyDoc_STRVAR(os_pathconf__doc__,
+"pathconf($module, /, path, name)\n"
+"--\n"
+"\n"
+"Return the configuration limit name for the file or directory path.\n"
+"\n"
+"If there is no limit, return -1.\n"
+"On some platforms, path may also be specified as an open file descriptor.\n"
+" If this functionality is unavailable, using it raises an exception.");
+
+#define OS_PATHCONF_METHODDEF \
+ {"pathconf", (PyCFunction)os_pathconf, METH_VARARGS|METH_KEYWORDS, os_pathconf__doc__},
+
+static long
+os_pathconf_impl(PyModuleDef *module, path_t *path, int name);
+
+static PyObject *
+os_pathconf(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "name", NULL};
+ path_t path = PATH_T_INITIALIZE("pathconf", "path", 0, PATH_HAVE_FPATHCONF);
+ int name;
+ long _return_value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:pathconf", _keywords,
+ path_converter, &path, conv_path_confname, &name))
+ goto exit;
+ _return_value = os_pathconf_impl(module, &path, name);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(HAVE_PATHCONF) */
+
+#if defined(HAVE_CONFSTR)
+
+PyDoc_STRVAR(os_confstr__doc__,
+"confstr($module, name, /)\n"
+"--\n"
+"\n"
+"Return a string-valued system configuration variable.");
+
+#define OS_CONFSTR_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int name;
+
+ if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name))
+ goto exit;
+ return_value = os_confstr_impl(module, name);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_CONFSTR) */
+
+#if defined(HAVE_SYSCONF)
+
+PyDoc_STRVAR(os_sysconf__doc__,
+"sysconf($module, name, /)\n"
+"--\n"
+"\n"
+"Return an integer-valued system configuration variable.");
+
+#define OS_SYSCONF_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int name;
+ long _return_value;
+
+ if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name))
+ goto exit;
+ _return_value = os_sysconf_impl(module, name);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SYSCONF) */
+
+PyDoc_STRVAR(os_abort__doc__,
+"abort($module, /)\n"
+"--\n"
+"\n"
+"Abort the interpreter immediately.\n"
+"\n"
+"This function \'dumps core\' or otherwise fails in the hardest way possible\n"
+"on the hosting operating system. This function never returns.");
+
+#define OS_ABORT_METHODDEF \
+ {"abort", (PyCFunction)os_abort, METH_NOARGS, os_abort__doc__},
+
+static PyObject *
+os_abort_impl(PyModuleDef *module);
+
+static PyObject *
+os_abort(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_abort_impl(module);
+}
+
+#if defined(HAVE_GETLOADAVG)
+
+PyDoc_STRVAR(os_getloadavg__doc__,
+"getloadavg($module, /)\n"
+"--\n"
+"\n"
+"Return average recent system load information.\n"
+"\n"
+"Return the number of processes in the system run queue averaged over\n"
+"the last 1, 5, and 15 minutes as a tuple of three floats.\n"
+"Raises OSError if the load average was unobtainable.");
+
+#define OS_GETLOADAVG_METHODDEF \
+ {"getloadavg", (PyCFunction)os_getloadavg, METH_NOARGS, os_getloadavg__doc__},
+
+static PyObject *
+os_getloadavg_impl(PyModuleDef *module);
+
+static PyObject *
+os_getloadavg(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getloadavg_impl(module);
+}
+
+#endif /* defined(HAVE_GETLOADAVG) */
+
+PyDoc_STRVAR(os_device_encoding__doc__,
+"device_encoding($module, /, fd)\n"
+"--\n"
+"\n"
+"Return a string describing the encoding of a terminal\'s file descriptor.\n"
+"\n"
+"The file descriptor must be attached to a terminal.\n"
+"If the device is not a terminal, return None.");
+
+#define OS_DEVICE_ENCODING_METHODDEF \
+ {"device_encoding", (PyCFunction)os_device_encoding, METH_VARARGS|METH_KEYWORDS, os_device_encoding__doc__},
+
+static PyObject *
+os_device_encoding_impl(PyModuleDef *module, int fd);
+
+static PyObject *
+os_device_encoding(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"fd", NULL};
+ int fd;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:device_encoding", _keywords,
+ &fd))
+ goto exit;
+ return_value = os_device_encoding_impl(module, fd);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_SETRESUID)
+
+PyDoc_STRVAR(os_setresuid__doc__,
+"setresuid($module, ruid, euid, suid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s real, effective, and saved user ids.");
+
+#define OS_SETRESUID_METHODDEF \
+ {"setresuid", (PyCFunction)os_setresuid, METH_VARARGS, os_setresuid__doc__},
+
+static PyObject *
+os_setresuid_impl(PyModuleDef *module, uid_t ruid, uid_t euid, uid_t suid);
+
+static PyObject *
+os_setresuid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ uid_t ruid;
+ uid_t euid;
+ uid_t suid;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&:setresuid",
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid))
+ goto exit;
+ return_value = os_setresuid_impl(module, ruid, euid, suid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETRESUID) */
+
+#if defined(HAVE_SETRESGID)
+
+PyDoc_STRVAR(os_setresgid__doc__,
+"setresgid($module, rgid, egid, sgid, /)\n"
+"--\n"
+"\n"
+"Set the current process\'s real, effective, and saved group ids.");
+
+#define OS_SETRESGID_METHODDEF \
+ {"setresgid", (PyCFunction)os_setresgid, METH_VARARGS, os_setresgid__doc__},
+
+static PyObject *
+os_setresgid_impl(PyModuleDef *module, gid_t rgid, gid_t egid, gid_t sgid);
+
+static PyObject *
+os_setresgid(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ gid_t rgid;
+ gid_t egid;
+ gid_t sgid;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&:setresgid",
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid))
+ goto exit;
+ return_value = os_setresgid_impl(module, rgid, egid, sgid);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETRESGID) */
+
+#if defined(HAVE_GETRESUID)
+
+PyDoc_STRVAR(os_getresuid__doc__,
+"getresuid($module, /)\n"
+"--\n"
+"\n"
+"Return a tuple of the current process\'s real, effective, and saved user ids.");
+
+#define OS_GETRESUID_METHODDEF \
+ {"getresuid", (PyCFunction)os_getresuid, METH_NOARGS, os_getresuid__doc__},
+
+static PyObject *
+os_getresuid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getresuid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getresuid_impl(module);
+}
+
+#endif /* defined(HAVE_GETRESUID) */
+
+#if defined(HAVE_GETRESGID)
+
+PyDoc_STRVAR(os_getresgid__doc__,
+"getresgid($module, /)\n"
+"--\n"
+"\n"
+"Return a tuple of the current process\'s real, effective, and saved group ids.");
+
+#define OS_GETRESGID_METHODDEF \
+ {"getresgid", (PyCFunction)os_getresgid, METH_NOARGS, os_getresgid__doc__},
+
+static PyObject *
+os_getresgid_impl(PyModuleDef *module);
+
+static PyObject *
+os_getresgid(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_getresgid_impl(module);
+}
+
+#endif /* defined(HAVE_GETRESGID) */
+
+#if defined(USE_XATTRS)
+
+PyDoc_STRVAR(os_getxattr__doc__,
+"getxattr($module, /, path, attribute, *, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Return the value of extended attribute attribute on path.\n"
+"\n"
+"path may be either a string or an open file descriptor.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, getxattr will examine the symbolic link itself instead of the file\n"
+" the link points to.");
+
+#define OS_GETXATTR_METHODDEF \
+ {"getxattr", (PyCFunction)os_getxattr, METH_VARARGS|METH_KEYWORDS, os_getxattr__doc__},
+
+static PyObject *
+os_getxattr_impl(PyModuleDef *module, path_t *path, path_t *attribute,
+ int follow_symlinks);
+
+static PyObject *
+os_getxattr(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("getxattr", "path", 0, 1);
+ path_t attribute = PATH_T_INITIALIZE("getxattr", "attribute", 0, 0);
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:getxattr", _keywords,
+ path_converter, &path, path_converter, &attribute, &follow_symlinks))
+ goto exit;
+ return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+ /* Cleanup for attribute */
+ path_cleanup(&attribute);
+
+ return return_value;
+}
+
+#endif /* defined(USE_XATTRS) */
+
+#if defined(USE_XATTRS)
+
+PyDoc_STRVAR(os_setxattr__doc__,
+"setxattr($module, /, path, attribute, value, flags=0, *,\n"
+" follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Set extended attribute attribute on path to value.\n"
+"\n"
+"path may be either a string or an open file descriptor.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, setxattr will modify the symbolic link itself instead of the file\n"
+" the link points to.");
+
+#define OS_SETXATTR_METHODDEF \
+ {"setxattr", (PyCFunction)os_setxattr, METH_VARARGS|METH_KEYWORDS, os_setxattr__doc__},
+
+static PyObject *
+os_setxattr_impl(PyModuleDef *module, path_t *path, path_t *attribute,
+ Py_buffer *value, int flags, int follow_symlinks);
+
+static PyObject *
+os_setxattr(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "attribute", "value", "flags", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("setxattr", "path", 0, 1);
+ path_t attribute = PATH_T_INITIALIZE("setxattr", "attribute", 0, 0);
+ Py_buffer value = {NULL, NULL};
+ int flags = 0;
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&y*|i$p:setxattr", _keywords,
+ path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks))
+ goto exit;
+ return_value = os_setxattr_impl(module, &path, &attribute, &value, flags, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+ /* Cleanup for attribute */
+ path_cleanup(&attribute);
+ /* Cleanup for value */
+ if (value.obj)
+ PyBuffer_Release(&value);
+
+ return return_value;
+}
+
+#endif /* defined(USE_XATTRS) */
+
+#if defined(USE_XATTRS)
+
+PyDoc_STRVAR(os_removexattr__doc__,
+"removexattr($module, /, path, attribute, *, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Remove extended attribute attribute on path.\n"
+"\n"
+"path may be either a string or an open file descriptor.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, removexattr will modify the symbolic link itself instead of the file\n"
+" the link points to.");
+
+#define OS_REMOVEXATTR_METHODDEF \
+ {"removexattr", (PyCFunction)os_removexattr, METH_VARARGS|METH_KEYWORDS, os_removexattr__doc__},
+
+static PyObject *
+os_removexattr_impl(PyModuleDef *module, path_t *path, path_t *attribute,
+ int follow_symlinks);
+
+static PyObject *
+os_removexattr(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("removexattr", "path", 0, 1);
+ path_t attribute = PATH_T_INITIALIZE("removexattr", "attribute", 0, 0);
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:removexattr", _keywords,
+ path_converter, &path, path_converter, &attribute, &follow_symlinks))
+ goto exit;
+ return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+ /* Cleanup for attribute */
+ path_cleanup(&attribute);
+
+ return return_value;
+}
+
+#endif /* defined(USE_XATTRS) */
+
+#if defined(USE_XATTRS)
+
+PyDoc_STRVAR(os_listxattr__doc__,
+"listxattr($module, /, path=None, *, follow_symlinks=True)\n"
+"--\n"
+"\n"
+"Return a list of extended attributes on path.\n"
+"\n"
+"path may be either None, a string, or an open file descriptor.\n"
+"if path is None, listxattr will examine the current directory.\n"
+"If follow_symlinks is False, and the last element of the path is a symbolic\n"
+" link, listxattr will examine the symbolic link itself instead of the file\n"
+" the link points to.");
+
+#define OS_LISTXATTR_METHODDEF \
+ {"listxattr", (PyCFunction)os_listxattr, METH_VARARGS|METH_KEYWORDS, os_listxattr__doc__},
+
+static PyObject *
+os_listxattr_impl(PyModuleDef *module, path_t *path, int follow_symlinks);
+
+static PyObject *
+os_listxattr(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"path", "follow_symlinks", NULL};
+ path_t path = PATH_T_INITIALIZE("listxattr", "path", 1, 1);
+ int follow_symlinks = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&$p:listxattr", _keywords,
+ path_converter, &path, &follow_symlinks))
+ goto exit;
+ return_value = os_listxattr_impl(module, &path, follow_symlinks);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(USE_XATTRS) */
+
+PyDoc_STRVAR(os_urandom__doc__,
+"urandom($module, size, /)\n"
+"--\n"
+"\n"
+"Return a bytes object containing random bytes suitable for cryptographic use.");
+
+#define OS_URANDOM_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_ssize_t size;
+
+ if (!PyArg_Parse(arg, "n:urandom", &size))
+ goto exit;
+ return_value = os_urandom_impl(module, size);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_cpu_count__doc__,
+"cpu_count($module, /)\n"
+"--\n"
+"\n"
+"Return the number of CPUs in the system; return None if indeterminable.");
+
+#define OS_CPU_COUNT_METHODDEF \
+ {"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__},
+
+static PyObject *
+os_cpu_count_impl(PyModuleDef *module);
+
+static PyObject *
+os_cpu_count(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return os_cpu_count_impl(module);
+}
+
+PyDoc_STRVAR(os_get_inheritable__doc__,
+"get_inheritable($module, fd, /)\n"
+"--\n"
+"\n"
+"Get the close-on-exe flag of the specified file descriptor.");
+
+#define OS_GET_INHERITABLE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "i:get_inheritable", &fd))
+ goto exit;
+ _return_value = os_get_inheritable_impl(module, fd);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(os_set_inheritable__doc__,
+"set_inheritable($module, fd, inheritable, /)\n"
+"--\n"
+"\n"
+"Set the inheritable flag of the specified file descriptor.");
+
+#define OS_SET_INHERITABLE_METHODDEF \
+ {"set_inheritable", (PyCFunction)os_set_inheritable, METH_VARARGS, os_set_inheritable__doc__},
+
+static PyObject *
+os_set_inheritable_impl(PyModuleDef *module, int fd, int inheritable);
+
+static PyObject *
+os_set_inheritable(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int fd;
+ int inheritable;
+
+ if (!PyArg_ParseTuple(args, "ii:set_inheritable",
+ &fd, &inheritable))
+ goto exit;
+ return_value = os_set_inheritable_impl(module, fd, inheritable);
+
+exit:
+ return return_value;
+}
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_get_handle_inheritable__doc__,
+"get_handle_inheritable($module, handle, /)\n"
+"--\n"
+"\n"
+"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_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 *arg)
+{
+ PyObject *return_value = NULL;
+ Py_intptr_t handle;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle))
+ goto exit;
+ _return_value = os_get_handle_inheritable_impl(module, handle);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_set_handle_inheritable__doc__,
+"set_handle_inheritable($module, handle, inheritable, /)\n"
+"--\n"
+"\n"
+"Set the inheritable flag of the specified handle.");
+
+#define OS_SET_HANDLE_INHERITABLE_METHODDEF \
+ {"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_VARARGS, os_set_handle_inheritable__doc__},
+
+static PyObject *
+os_set_handle_inheritable_impl(PyModuleDef *module, Py_intptr_t handle,
+ int inheritable);
+
+static PyObject *
+os_set_handle_inheritable(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_intptr_t handle;
+ int inheritable;
+
+ if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable",
+ &handle, &inheritable))
+ goto exit;
+ return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#ifndef OS_TTYNAME_METHODDEF
+ #define OS_TTYNAME_METHODDEF
+#endif /* !defined(OS_TTYNAME_METHODDEF) */
+
+#ifndef OS_CTERMID_METHODDEF
+ #define OS_CTERMID_METHODDEF
+#endif /* !defined(OS_CTERMID_METHODDEF) */
+
+#ifndef OS_FCHDIR_METHODDEF
+ #define OS_FCHDIR_METHODDEF
+#endif /* !defined(OS_FCHDIR_METHODDEF) */
+
+#ifndef OS_FCHMOD_METHODDEF
+ #define OS_FCHMOD_METHODDEF
+#endif /* !defined(OS_FCHMOD_METHODDEF) */
+
+#ifndef OS_LCHMOD_METHODDEF
+ #define OS_LCHMOD_METHODDEF
+#endif /* !defined(OS_LCHMOD_METHODDEF) */
+
+#ifndef OS_CHFLAGS_METHODDEF
+ #define OS_CHFLAGS_METHODDEF
+#endif /* !defined(OS_CHFLAGS_METHODDEF) */
+
+#ifndef OS_LCHFLAGS_METHODDEF
+ #define OS_LCHFLAGS_METHODDEF
+#endif /* !defined(OS_LCHFLAGS_METHODDEF) */
+
+#ifndef OS_CHROOT_METHODDEF
+ #define OS_CHROOT_METHODDEF
+#endif /* !defined(OS_CHROOT_METHODDEF) */
+
+#ifndef OS_FSYNC_METHODDEF
+ #define OS_FSYNC_METHODDEF
+#endif /* !defined(OS_FSYNC_METHODDEF) */
+
+#ifndef OS_SYNC_METHODDEF
+ #define OS_SYNC_METHODDEF
+#endif /* !defined(OS_SYNC_METHODDEF) */
+
+#ifndef OS_FDATASYNC_METHODDEF
+ #define OS_FDATASYNC_METHODDEF
+#endif /* !defined(OS_FDATASYNC_METHODDEF) */
+
+#ifndef OS_CHOWN_METHODDEF
+ #define OS_CHOWN_METHODDEF
+#endif /* !defined(OS_CHOWN_METHODDEF) */
+
+#ifndef OS_FCHOWN_METHODDEF
+ #define OS_FCHOWN_METHODDEF
+#endif /* !defined(OS_FCHOWN_METHODDEF) */
+
+#ifndef OS_LCHOWN_METHODDEF
+ #define OS_LCHOWN_METHODDEF
+#endif /* !defined(OS_LCHOWN_METHODDEF) */
+
+#ifndef OS_LINK_METHODDEF
+ #define OS_LINK_METHODDEF
+#endif /* !defined(OS_LINK_METHODDEF) */
+
+#ifndef OS__GETFULLPATHNAME_METHODDEF
+ #define OS__GETFULLPATHNAME_METHODDEF
+#endif /* !defined(OS__GETFULLPATHNAME_METHODDEF) */
+
+#ifndef OS__GETFINALPATHNAME_METHODDEF
+ #define OS__GETFINALPATHNAME_METHODDEF
+#endif /* !defined(OS__GETFINALPATHNAME_METHODDEF) */
+
+#ifndef OS__ISDIR_METHODDEF
+ #define OS__ISDIR_METHODDEF
+#endif /* !defined(OS__ISDIR_METHODDEF) */
+
+#ifndef OS__GETVOLUMEPATHNAME_METHODDEF
+ #define OS__GETVOLUMEPATHNAME_METHODDEF
+#endif /* !defined(OS__GETVOLUMEPATHNAME_METHODDEF) */
+
+#ifndef OS_NICE_METHODDEF
+ #define OS_NICE_METHODDEF
+#endif /* !defined(OS_NICE_METHODDEF) */
+
+#ifndef OS_GETPRIORITY_METHODDEF
+ #define OS_GETPRIORITY_METHODDEF
+#endif /* !defined(OS_GETPRIORITY_METHODDEF) */
+
+#ifndef OS_SETPRIORITY_METHODDEF
+ #define OS_SETPRIORITY_METHODDEF
+#endif /* !defined(OS_SETPRIORITY_METHODDEF) */
+
+#ifndef OS_SYSTEM_METHODDEF
+ #define OS_SYSTEM_METHODDEF
+#endif /* !defined(OS_SYSTEM_METHODDEF) */
+
+#ifndef OS_UNAME_METHODDEF
+ #define OS_UNAME_METHODDEF
+#endif /* !defined(OS_UNAME_METHODDEF) */
+
+#ifndef OS_EXECV_METHODDEF
+ #define OS_EXECV_METHODDEF
+#endif /* !defined(OS_EXECV_METHODDEF) */
+
+#ifndef OS_EXECVE_METHODDEF
+ #define OS_EXECVE_METHODDEF
+#endif /* !defined(OS_EXECVE_METHODDEF) */
+
+#ifndef OS_SPAWNV_METHODDEF
+ #define OS_SPAWNV_METHODDEF
+#endif /* !defined(OS_SPAWNV_METHODDEF) */
+
+#ifndef OS_SPAWNVE_METHODDEF
+ #define OS_SPAWNVE_METHODDEF
+#endif /* !defined(OS_SPAWNVE_METHODDEF) */
+
+#ifndef OS_FORK1_METHODDEF
+ #define OS_FORK1_METHODDEF
+#endif /* !defined(OS_FORK1_METHODDEF) */
+
+#ifndef OS_FORK_METHODDEF
+ #define OS_FORK_METHODDEF
+#endif /* !defined(OS_FORK_METHODDEF) */
+
+#ifndef OS_SCHED_GET_PRIORITY_MAX_METHODDEF
+ #define OS_SCHED_GET_PRIORITY_MAX_METHODDEF
+#endif /* !defined(OS_SCHED_GET_PRIORITY_MAX_METHODDEF) */
+
+#ifndef OS_SCHED_GET_PRIORITY_MIN_METHODDEF
+ #define OS_SCHED_GET_PRIORITY_MIN_METHODDEF
+#endif /* !defined(OS_SCHED_GET_PRIORITY_MIN_METHODDEF) */
+
+#ifndef OS_SCHED_GETSCHEDULER_METHODDEF
+ #define OS_SCHED_GETSCHEDULER_METHODDEF
+#endif /* !defined(OS_SCHED_GETSCHEDULER_METHODDEF) */
+
+#ifndef OS_SCHED_SETSCHEDULER_METHODDEF
+ #define OS_SCHED_SETSCHEDULER_METHODDEF
+#endif /* !defined(OS_SCHED_SETSCHEDULER_METHODDEF) */
+
+#ifndef OS_SCHED_GETPARAM_METHODDEF
+ #define OS_SCHED_GETPARAM_METHODDEF
+#endif /* !defined(OS_SCHED_GETPARAM_METHODDEF) */
+
+#ifndef OS_SCHED_SETPARAM_METHODDEF
+ #define OS_SCHED_SETPARAM_METHODDEF
+#endif /* !defined(OS_SCHED_SETPARAM_METHODDEF) */
+
+#ifndef OS_SCHED_RR_GET_INTERVAL_METHODDEF
+ #define OS_SCHED_RR_GET_INTERVAL_METHODDEF
+#endif /* !defined(OS_SCHED_RR_GET_INTERVAL_METHODDEF) */
+
+#ifndef OS_SCHED_YIELD_METHODDEF
+ #define OS_SCHED_YIELD_METHODDEF
+#endif /* !defined(OS_SCHED_YIELD_METHODDEF) */
+
+#ifndef OS_SCHED_SETAFFINITY_METHODDEF
+ #define OS_SCHED_SETAFFINITY_METHODDEF
+#endif /* !defined(OS_SCHED_SETAFFINITY_METHODDEF) */
+
+#ifndef OS_SCHED_GETAFFINITY_METHODDEF
+ #define OS_SCHED_GETAFFINITY_METHODDEF
+#endif /* !defined(OS_SCHED_GETAFFINITY_METHODDEF) */
+
+#ifndef OS_OPENPTY_METHODDEF
+ #define OS_OPENPTY_METHODDEF
+#endif /* !defined(OS_OPENPTY_METHODDEF) */
+
+#ifndef OS_FORKPTY_METHODDEF
+ #define OS_FORKPTY_METHODDEF
+#endif /* !defined(OS_FORKPTY_METHODDEF) */
+
+#ifndef OS_GETEGID_METHODDEF
+ #define OS_GETEGID_METHODDEF
+#endif /* !defined(OS_GETEGID_METHODDEF) */
+
+#ifndef OS_GETEUID_METHODDEF
+ #define OS_GETEUID_METHODDEF
+#endif /* !defined(OS_GETEUID_METHODDEF) */
+
+#ifndef OS_GETGID_METHODDEF
+ #define OS_GETGID_METHODDEF
+#endif /* !defined(OS_GETGID_METHODDEF) */
+
+#ifndef OS_GETGROUPS_METHODDEF
+ #define OS_GETGROUPS_METHODDEF
+#endif /* !defined(OS_GETGROUPS_METHODDEF) */
+
+#ifndef OS_GETPGID_METHODDEF
+ #define OS_GETPGID_METHODDEF
+#endif /* !defined(OS_GETPGID_METHODDEF) */
+
+#ifndef OS_GETPGRP_METHODDEF
+ #define OS_GETPGRP_METHODDEF
+#endif /* !defined(OS_GETPGRP_METHODDEF) */
+
+#ifndef OS_SETPGRP_METHODDEF
+ #define OS_SETPGRP_METHODDEF
+#endif /* !defined(OS_SETPGRP_METHODDEF) */
+
+#ifndef OS_GETPPID_METHODDEF
+ #define OS_GETPPID_METHODDEF
+#endif /* !defined(OS_GETPPID_METHODDEF) */
+
+#ifndef OS_GETLOGIN_METHODDEF
+ #define OS_GETLOGIN_METHODDEF
+#endif /* !defined(OS_GETLOGIN_METHODDEF) */
+
+#ifndef OS_GETUID_METHODDEF
+ #define OS_GETUID_METHODDEF
+#endif /* !defined(OS_GETUID_METHODDEF) */
+
+#ifndef OS_KILL_METHODDEF
+ #define OS_KILL_METHODDEF
+#endif /* !defined(OS_KILL_METHODDEF) */
+
+#ifndef OS_KILLPG_METHODDEF
+ #define OS_KILLPG_METHODDEF
+#endif /* !defined(OS_KILLPG_METHODDEF) */
+
+#ifndef OS_PLOCK_METHODDEF
+ #define OS_PLOCK_METHODDEF
+#endif /* !defined(OS_PLOCK_METHODDEF) */
+
+#ifndef OS_SETUID_METHODDEF
+ #define OS_SETUID_METHODDEF
+#endif /* !defined(OS_SETUID_METHODDEF) */
+
+#ifndef OS_SETEUID_METHODDEF
+ #define OS_SETEUID_METHODDEF
+#endif /* !defined(OS_SETEUID_METHODDEF) */
+
+#ifndef OS_SETEGID_METHODDEF
+ #define OS_SETEGID_METHODDEF
+#endif /* !defined(OS_SETEGID_METHODDEF) */
+
+#ifndef OS_SETREUID_METHODDEF
+ #define OS_SETREUID_METHODDEF
+#endif /* !defined(OS_SETREUID_METHODDEF) */
+
+#ifndef OS_SETREGID_METHODDEF
+ #define OS_SETREGID_METHODDEF
+#endif /* !defined(OS_SETREGID_METHODDEF) */
+
+#ifndef OS_SETGID_METHODDEF
+ #define OS_SETGID_METHODDEF
+#endif /* !defined(OS_SETGID_METHODDEF) */
+
+#ifndef OS_SETGROUPS_METHODDEF
+ #define OS_SETGROUPS_METHODDEF
+#endif /* !defined(OS_SETGROUPS_METHODDEF) */
+
+#ifndef OS_WAIT3_METHODDEF
+ #define OS_WAIT3_METHODDEF
+#endif /* !defined(OS_WAIT3_METHODDEF) */
+
+#ifndef OS_WAIT4_METHODDEF
+ #define OS_WAIT4_METHODDEF
+#endif /* !defined(OS_WAIT4_METHODDEF) */
+
+#ifndef OS_WAITID_METHODDEF
+ #define OS_WAITID_METHODDEF
+#endif /* !defined(OS_WAITID_METHODDEF) */
+
+#ifndef OS_WAITPID_METHODDEF
+ #define OS_WAITPID_METHODDEF
+#endif /* !defined(OS_WAITPID_METHODDEF) */
+
+#ifndef OS_WAIT_METHODDEF
+ #define OS_WAIT_METHODDEF
+#endif /* !defined(OS_WAIT_METHODDEF) */
+
+#ifndef OS_SYMLINK_METHODDEF
+ #define OS_SYMLINK_METHODDEF
+#endif /* !defined(OS_SYMLINK_METHODDEF) */
+
+#ifndef OS_TIMES_METHODDEF
+ #define OS_TIMES_METHODDEF
+#endif /* !defined(OS_TIMES_METHODDEF) */
+
+#ifndef OS_GETSID_METHODDEF
+ #define OS_GETSID_METHODDEF
+#endif /* !defined(OS_GETSID_METHODDEF) */
+
+#ifndef OS_SETSID_METHODDEF
+ #define OS_SETSID_METHODDEF
+#endif /* !defined(OS_SETSID_METHODDEF) */
+
+#ifndef OS_SETPGID_METHODDEF
+ #define OS_SETPGID_METHODDEF
+#endif /* !defined(OS_SETPGID_METHODDEF) */
+
+#ifndef OS_TCGETPGRP_METHODDEF
+ #define OS_TCGETPGRP_METHODDEF
+#endif /* !defined(OS_TCGETPGRP_METHODDEF) */
+
+#ifndef OS_TCSETPGRP_METHODDEF
+ #define OS_TCSETPGRP_METHODDEF
+#endif /* !defined(OS_TCSETPGRP_METHODDEF) */
+
+#ifndef OS_LOCKF_METHODDEF
+ #define OS_LOCKF_METHODDEF
+#endif /* !defined(OS_LOCKF_METHODDEF) */
+
+#ifndef OS_READV_METHODDEF
+ #define OS_READV_METHODDEF
+#endif /* !defined(OS_READV_METHODDEF) */
+
+#ifndef OS_PREAD_METHODDEF
+ #define OS_PREAD_METHODDEF
+#endif /* !defined(OS_PREAD_METHODDEF) */
+
+#ifndef OS_PIPE_METHODDEF
+ #define OS_PIPE_METHODDEF
+#endif /* !defined(OS_PIPE_METHODDEF) */
+
+#ifndef OS_PIPE2_METHODDEF
+ #define OS_PIPE2_METHODDEF
+#endif /* !defined(OS_PIPE2_METHODDEF) */
+
+#ifndef OS_WRITEV_METHODDEF
+ #define OS_WRITEV_METHODDEF
+#endif /* !defined(OS_WRITEV_METHODDEF) */
+
+#ifndef OS_PWRITE_METHODDEF
+ #define OS_PWRITE_METHODDEF
+#endif /* !defined(OS_PWRITE_METHODDEF) */
+
+#ifndef OS_MKFIFO_METHODDEF
+ #define OS_MKFIFO_METHODDEF
+#endif /* !defined(OS_MKFIFO_METHODDEF) */
+
+#ifndef OS_MKNOD_METHODDEF
+ #define OS_MKNOD_METHODDEF
+#endif /* !defined(OS_MKNOD_METHODDEF) */
+
+#ifndef OS_MAJOR_METHODDEF
+ #define OS_MAJOR_METHODDEF
+#endif /* !defined(OS_MAJOR_METHODDEF) */
+
+#ifndef OS_MINOR_METHODDEF
+ #define OS_MINOR_METHODDEF
+#endif /* !defined(OS_MINOR_METHODDEF) */
+
+#ifndef OS_MAKEDEV_METHODDEF
+ #define OS_MAKEDEV_METHODDEF
+#endif /* !defined(OS_MAKEDEV_METHODDEF) */
+
+#ifndef OS_FTRUNCATE_METHODDEF
+ #define OS_FTRUNCATE_METHODDEF
+#endif /* !defined(OS_FTRUNCATE_METHODDEF) */
+
+#ifndef OS_TRUNCATE_METHODDEF
+ #define OS_TRUNCATE_METHODDEF
+#endif /* !defined(OS_TRUNCATE_METHODDEF) */
+
+#ifndef OS_POSIX_FALLOCATE_METHODDEF
+ #define OS_POSIX_FALLOCATE_METHODDEF
+#endif /* !defined(OS_POSIX_FALLOCATE_METHODDEF) */
+
+#ifndef OS_POSIX_FADVISE_METHODDEF
+ #define OS_POSIX_FADVISE_METHODDEF
+#endif /* !defined(OS_POSIX_FADVISE_METHODDEF) */
+
+#ifndef OS_PUTENV_METHODDEF
+ #define OS_PUTENV_METHODDEF
+#endif /* !defined(OS_PUTENV_METHODDEF) */
+
+#ifndef OS_UNSETENV_METHODDEF
+ #define OS_UNSETENV_METHODDEF
+#endif /* !defined(OS_UNSETENV_METHODDEF) */
+
+#ifndef OS_WCOREDUMP_METHODDEF
+ #define OS_WCOREDUMP_METHODDEF
+#endif /* !defined(OS_WCOREDUMP_METHODDEF) */
+
+#ifndef OS_WIFCONTINUED_METHODDEF
+ #define OS_WIFCONTINUED_METHODDEF
+#endif /* !defined(OS_WIFCONTINUED_METHODDEF) */
+
+#ifndef OS_WIFSTOPPED_METHODDEF
+ #define OS_WIFSTOPPED_METHODDEF
+#endif /* !defined(OS_WIFSTOPPED_METHODDEF) */
+
+#ifndef OS_WIFSIGNALED_METHODDEF
+ #define OS_WIFSIGNALED_METHODDEF
+#endif /* !defined(OS_WIFSIGNALED_METHODDEF) */
+
+#ifndef OS_WIFEXITED_METHODDEF
+ #define OS_WIFEXITED_METHODDEF
+#endif /* !defined(OS_WIFEXITED_METHODDEF) */
+
+#ifndef OS_WEXITSTATUS_METHODDEF
+ #define OS_WEXITSTATUS_METHODDEF
+#endif /* !defined(OS_WEXITSTATUS_METHODDEF) */
+
+#ifndef OS_WTERMSIG_METHODDEF
+ #define OS_WTERMSIG_METHODDEF
+#endif /* !defined(OS_WTERMSIG_METHODDEF) */
+
+#ifndef OS_WSTOPSIG_METHODDEF
+ #define OS_WSTOPSIG_METHODDEF
+#endif /* !defined(OS_WSTOPSIG_METHODDEF) */
+
+#ifndef OS_FSTATVFS_METHODDEF
+ #define OS_FSTATVFS_METHODDEF
+#endif /* !defined(OS_FSTATVFS_METHODDEF) */
+
+#ifndef OS_STATVFS_METHODDEF
+ #define OS_STATVFS_METHODDEF
+#endif /* !defined(OS_STATVFS_METHODDEF) */
+
+#ifndef OS__GETDISKUSAGE_METHODDEF
+ #define OS__GETDISKUSAGE_METHODDEF
+#endif /* !defined(OS__GETDISKUSAGE_METHODDEF) */
+
+#ifndef OS_FPATHCONF_METHODDEF
+ #define OS_FPATHCONF_METHODDEF
+#endif /* !defined(OS_FPATHCONF_METHODDEF) */
+
+#ifndef OS_PATHCONF_METHODDEF
+ #define OS_PATHCONF_METHODDEF
+#endif /* !defined(OS_PATHCONF_METHODDEF) */
+
+#ifndef OS_CONFSTR_METHODDEF
+ #define OS_CONFSTR_METHODDEF
+#endif /* !defined(OS_CONFSTR_METHODDEF) */
+
+#ifndef OS_SYSCONF_METHODDEF
+ #define OS_SYSCONF_METHODDEF
+#endif /* !defined(OS_SYSCONF_METHODDEF) */
+
+#ifndef OS_GETLOADAVG_METHODDEF
+ #define OS_GETLOADAVG_METHODDEF
+#endif /* !defined(OS_GETLOADAVG_METHODDEF) */
+
+#ifndef OS_SETRESUID_METHODDEF
+ #define OS_SETRESUID_METHODDEF
+#endif /* !defined(OS_SETRESUID_METHODDEF) */
+
+#ifndef OS_SETRESGID_METHODDEF
+ #define OS_SETRESGID_METHODDEF
+#endif /* !defined(OS_SETRESGID_METHODDEF) */
+
+#ifndef OS_GETRESUID_METHODDEF
+ #define OS_GETRESUID_METHODDEF
+#endif /* !defined(OS_GETRESUID_METHODDEF) */
+
+#ifndef OS_GETRESGID_METHODDEF
+ #define OS_GETRESGID_METHODDEF
+#endif /* !defined(OS_GETRESGID_METHODDEF) */
+
+#ifndef OS_GETXATTR_METHODDEF
+ #define OS_GETXATTR_METHODDEF
+#endif /* !defined(OS_GETXATTR_METHODDEF) */
+
+#ifndef OS_SETXATTR_METHODDEF
+ #define OS_SETXATTR_METHODDEF
+#endif /* !defined(OS_SETXATTR_METHODDEF) */
+
+#ifndef OS_REMOVEXATTR_METHODDEF
+ #define OS_REMOVEXATTR_METHODDEF
+#endif /* !defined(OS_REMOVEXATTR_METHODDEF) */
+
+#ifndef OS_LISTXATTR_METHODDEF
+ #define OS_LISTXATTR_METHODDEF
+#endif /* !defined(OS_LISTXATTR_METHODDEF) */
+
+#ifndef OS_GET_HANDLE_INHERITABLE_METHODDEF
+ #define OS_GET_HANDLE_INHERITABLE_METHODDEF
+#endif /* !defined(OS_GET_HANDLE_INHERITABLE_METHODDEF) */
+
+#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
+ #define OS_SET_HANDLE_INHERITABLE_METHODDEF
+#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
+/*[clinic end generated code: output=f3f92b2d2e2c3fe3 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h
new file mode 100644
index 0000000..9de2e4f
--- /dev/null
+++ b/Modules/clinic/pwdmodule.c.h
@@ -0,0 +1,71 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(pwd_getpwuid__doc__,
+"getpwuid($module, uidobj, /)\n"
+"--\n"
+"\n"
+"Return the password database entry for the given numeric user ID.\n"
+"\n"
+"See `help(pwd)` for more on password database entries.");
+
+#define PWD_GETPWUID_METHODDEF \
+ {"getpwuid", (PyCFunction)pwd_getpwuid, METH_O, pwd_getpwuid__doc__},
+
+PyDoc_STRVAR(pwd_getpwnam__doc__,
+"getpwnam($module, arg, /)\n"
+"--\n"
+"\n"
+"Return the password database entry for the given user name.\n"
+"\n"
+"See `help(pwd)` for more on password database entries.");
+
+#define PWD_GETPWNAM_METHODDEF \
+ {"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 *arg_)
+{
+ PyObject *return_value = NULL;
+ PyObject *arg;
+
+ if (!PyArg_Parse(arg_, "U:getpwnam", &arg))
+ goto exit;
+ return_value = pwd_getpwnam_impl(module, arg);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_GETPWENT)
+
+PyDoc_STRVAR(pwd_getpwall__doc__,
+"getpwall($module, /)\n"
+"--\n"
+"\n"
+"Return a list of all available password database entries, in arbitrary order.\n"
+"\n"
+"See help(pwd) for more on password database entries.");
+
+#define PWD_GETPWALL_METHODDEF \
+ {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__},
+
+static PyObject *
+pwd_getpwall_impl(PyModuleDef *module);
+
+static PyObject *
+pwd_getpwall(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return pwd_getpwall_impl(module);
+}
+
+#endif /* defined(HAVE_GETPWENT) */
+
+#ifndef PWD_GETPWALL_METHODDEF
+ #define PWD_GETPWALL_METHODDEF
+#endif /* !defined(PWD_GETPWALL_METHODDEF) */
+/*[clinic end generated code: output=2ed0ecf34fd3f98f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
new file mode 100644
index 0000000..379c5db
--- /dev/null
+++ b/Modules/clinic/pyexpat.c.h
@@ -0,0 +1,284 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
+"Parse($self, data, isfinal=False, /)\n"
+"--\n"
+"\n"
+"Parse XML data.\n"
+"\n"
+"`isfinal\' should be true at end of input.");
+
+#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
+ {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
+
+static PyObject *
+pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
+ int isfinal);
+
+static PyObject *
+pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *data;
+ int isfinal = 0;
+
+ if (!PyArg_ParseTuple(args, "O|i:Parse",
+ &data, &isfinal))
+ goto exit;
+ return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
+"ParseFile($self, file, /)\n"
+"--\n"
+"\n"
+"Parse XML data from file-like object.");
+
+#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
+ {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
+
+PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
+"SetBase($self, base, /)\n"
+"--\n"
+"\n"
+"Set the base URL for the parser.");
+
+#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ const char *base;
+
+ if (!PyArg_Parse(arg, "s:SetBase", &base))
+ goto exit;
+ return_value = pyexpat_xmlparser_SetBase_impl(self, base);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
+"GetBase($self, /)\n"
+"--\n"
+"\n"
+"Return base URL string for the parser.");
+
+#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
+ {"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
+
+static PyObject *
+pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
+
+static PyObject *
+pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return pyexpat_xmlparser_GetBase_impl(self);
+}
+
+PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
+"GetInputContext($self, /)\n"
+"--\n"
+"\n"
+"Return the untranslated text of the input that caused the current event.\n"
+"\n"
+"If the event was generated by a large amount of text (such as a start tag\n"
+"for an element with many attributes), not all of the text may be available.");
+
+#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
+ {"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
+
+static PyObject *
+pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
+
+static PyObject *
+pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return pyexpat_xmlparser_GetInputContext_impl(self);
+}
+
+PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
+"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
+"--\n"
+"\n"
+"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
+
+#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
+ {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
+
+static PyObject *
+pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
+ const char *context,
+ const char *encoding);
+
+static PyObject *
+pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *context;
+ const char *encoding = NULL;
+
+ if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate",
+ &context, &encoding))
+ goto exit;
+ return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
+"SetParamEntityParsing($self, flag, /)\n"
+"--\n"
+"\n"
+"Controls parsing of parameter entities (including the external DTD subset).\n"
+"\n"
+"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
+"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
+"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
+"was successful.");
+
+#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ int flag;
+
+ if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag))
+ goto exit;
+ return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
+
+exit:
+ return return_value;
+}
+
+#if (XML_COMBINED_VERSION >= 19505)
+
+PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
+"UseForeignDTD($self, flag=True, /)\n"
+"--\n"
+"\n"
+"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
+"\n"
+"This readily allows the use of a \'default\' document type controlled by the\n"
+"application, while still getting the advantage of providing document type\n"
+"information to the parser. \'flag\' defaults to True if not provided.");
+
+#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
+ {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
+
+static PyObject *
+pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
+
+static PyObject *
+pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int flag = 1;
+
+ if (!PyArg_ParseTuple(args, "|p:UseForeignDTD",
+ &flag))
+ goto exit;
+ return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
+
+exit:
+ return return_value;
+}
+
+#endif /* (XML_COMBINED_VERSION >= 19505) */
+
+PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
+"__dir__($self, /)\n"
+"--\n"
+"\n");
+
+#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
+ {"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
+
+static PyObject *
+pyexpat_xmlparser___dir___impl(xmlparseobject *self);
+
+static PyObject *
+pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return pyexpat_xmlparser___dir___impl(self);
+}
+
+PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
+"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
+" intern=None)\n"
+"--\n"
+"\n"
+"Return a new XML parser object.");
+
+#define PYEXPAT_PARSERCREATE_METHODDEF \
+ {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
+
+static PyObject *
+pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding,
+ const char *namespace_separator, PyObject *intern);
+
+static PyObject *
+pyexpat_ParserCreate(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
+ const char *encoding = NULL;
+ const char *namespace_separator = NULL;
+ PyObject *intern = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zzO:ParserCreate", _keywords,
+ &encoding, &namespace_separator, &intern))
+ goto exit;
+ return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(pyexpat_ErrorString__doc__,
+"ErrorString($module, code, /)\n"
+"--\n"
+"\n"
+"Returns string error for given number.");
+
+#define PYEXPAT_ERRORSTRING_METHODDEF \
+ {"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 *arg)
+{
+ PyObject *return_value = NULL;
+ long code;
+
+ if (!PyArg_Parse(arg, "l:ErrorString", &code))
+ goto exit;
+ return_value = pyexpat_ErrorString_impl(module, code);
+
+exit:
+ return return_value;
+}
+
+#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
+ #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
+#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
+/*[clinic end generated code: output=bf4d99c9702d8a6c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h
new file mode 100644
index 0000000..fa865ba
--- /dev/null
+++ b/Modules/clinic/sha1module.c.h
@@ -0,0 +1,95 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(SHA1Type_copy__doc__,
+"copy($self, /)\n"
+"--\n"
+"\n"
+"Return a copy of the hash object.");
+
+#define SHA1TYPE_COPY_METHODDEF \
+ {"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
+
+static PyObject *
+SHA1Type_copy_impl(SHA1object *self);
+
+static PyObject *
+SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA1Type_copy_impl(self);
+}
+
+PyDoc_STRVAR(SHA1Type_digest__doc__,
+"digest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of binary data.");
+
+#define SHA1TYPE_DIGEST_METHODDEF \
+ {"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
+
+static PyObject *
+SHA1Type_digest_impl(SHA1object *self);
+
+static PyObject *
+SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA1Type_digest_impl(self);
+}
+
+PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
+"hexdigest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of hexadecimal digits.");
+
+#define SHA1TYPE_HEXDIGEST_METHODDEF \
+ {"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
+
+static PyObject *
+SHA1Type_hexdigest_impl(SHA1object *self);
+
+static PyObject *
+SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA1Type_hexdigest_impl(self);
+}
+
+PyDoc_STRVAR(SHA1Type_update__doc__,
+"update($self, obj, /)\n"
+"--\n"
+"\n"
+"Update this hash object\'s state with the provided string.");
+
+#define SHA1TYPE_UPDATE_METHODDEF \
+ {"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
+
+PyDoc_STRVAR(_sha1_sha1__doc__,
+"sha1($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new SHA1 hash object; optionally initialized with a string.");
+
+#define _SHA1_SHA1_METHODDEF \
+ {"sha1", (PyCFunction)_sha1_sha1, METH_VARARGS|METH_KEYWORDS, _sha1_sha1__doc__},
+
+static PyObject *
+_sha1_sha1_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_sha1_sha1(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha1", _keywords,
+ &string))
+ goto exit;
+ return_value = _sha1_sha1_impl(module, string);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=be19102f3120490a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h
new file mode 100644
index 0000000..c5fe188
--- /dev/null
+++ b/Modules/clinic/sha256module.c.h
@@ -0,0 +1,123 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(SHA256Type_copy__doc__,
+"copy($self, /)\n"
+"--\n"
+"\n"
+"Return a copy of the hash object.");
+
+#define SHA256TYPE_COPY_METHODDEF \
+ {"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
+
+static PyObject *
+SHA256Type_copy_impl(SHAobject *self);
+
+static PyObject *
+SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA256Type_copy_impl(self);
+}
+
+PyDoc_STRVAR(SHA256Type_digest__doc__,
+"digest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of binary data.");
+
+#define SHA256TYPE_DIGEST_METHODDEF \
+ {"digest", (PyCFunction)SHA256Type_digest, METH_NOARGS, SHA256Type_digest__doc__},
+
+static PyObject *
+SHA256Type_digest_impl(SHAobject *self);
+
+static PyObject *
+SHA256Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA256Type_digest_impl(self);
+}
+
+PyDoc_STRVAR(SHA256Type_hexdigest__doc__,
+"hexdigest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of hexadecimal digits.");
+
+#define SHA256TYPE_HEXDIGEST_METHODDEF \
+ {"hexdigest", (PyCFunction)SHA256Type_hexdigest, METH_NOARGS, SHA256Type_hexdigest__doc__},
+
+static PyObject *
+SHA256Type_hexdigest_impl(SHAobject *self);
+
+static PyObject *
+SHA256Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA256Type_hexdigest_impl(self);
+}
+
+PyDoc_STRVAR(SHA256Type_update__doc__,
+"update($self, obj, /)\n"
+"--\n"
+"\n"
+"Update this hash object\'s state with the provided string.");
+
+#define SHA256TYPE_UPDATE_METHODDEF \
+ {"update", (PyCFunction)SHA256Type_update, METH_O, SHA256Type_update__doc__},
+
+PyDoc_STRVAR(_sha256_sha256__doc__,
+"sha256($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new SHA-256 hash object; optionally initialized with a string.");
+
+#define _SHA256_SHA256_METHODDEF \
+ {"sha256", (PyCFunction)_sha256_sha256, METH_VARARGS|METH_KEYWORDS, _sha256_sha256__doc__},
+
+static PyObject *
+_sha256_sha256_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_sha256_sha256(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha256", _keywords,
+ &string))
+ goto exit;
+ return_value = _sha256_sha256_impl(module, string);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_sha256_sha224__doc__,
+"sha224($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new SHA-224 hash object; optionally initialized with a string.");
+
+#define _SHA256_SHA224_METHODDEF \
+ {"sha224", (PyCFunction)_sha256_sha224, METH_VARARGS|METH_KEYWORDS, _sha256_sha224__doc__},
+
+static PyObject *
+_sha256_sha224_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_sha256_sha224(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha224", _keywords,
+ &string))
+ goto exit;
+ return_value = _sha256_sha224_impl(module, string);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=354cedf3b632c7b2 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h
new file mode 100644
index 0000000..c308739
--- /dev/null
+++ b/Modules/clinic/sha512module.c.h
@@ -0,0 +1,171 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(SHA512Type_copy__doc__,
+"copy($self, /)\n"
+"--\n"
+"\n"
+"Return a copy of the hash object.");
+
+#define SHA512TYPE_COPY_METHODDEF \
+ {"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
+
+static PyObject *
+SHA512Type_copy_impl(SHAobject *self);
+
+static PyObject *
+SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA512Type_copy_impl(self);
+}
+
+#endif /* defined(PY_LONG_LONG) */
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(SHA512Type_digest__doc__,
+"digest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of binary data.");
+
+#define SHA512TYPE_DIGEST_METHODDEF \
+ {"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
+
+static PyObject *
+SHA512Type_digest_impl(SHAobject *self);
+
+static PyObject *
+SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA512Type_digest_impl(self);
+}
+
+#endif /* defined(PY_LONG_LONG) */
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
+"hexdigest($self, /)\n"
+"--\n"
+"\n"
+"Return the digest value as a string of hexadecimal digits.");
+
+#define SHA512TYPE_HEXDIGEST_METHODDEF \
+ {"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
+
+static PyObject *
+SHA512Type_hexdigest_impl(SHAobject *self);
+
+static PyObject *
+SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
+{
+ return SHA512Type_hexdigest_impl(self);
+}
+
+#endif /* defined(PY_LONG_LONG) */
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(SHA512Type_update__doc__,
+"update($self, obj, /)\n"
+"--\n"
+"\n"
+"Update this hash object\'s state with the provided string.");
+
+#define SHA512TYPE_UPDATE_METHODDEF \
+ {"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
+
+#endif /* defined(PY_LONG_LONG) */
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(_sha512_sha512__doc__,
+"sha512($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new SHA-512 hash object; optionally initialized with a string.");
+
+#define _SHA512_SHA512_METHODDEF \
+ {"sha512", (PyCFunction)_sha512_sha512, METH_VARARGS|METH_KEYWORDS, _sha512_sha512__doc__},
+
+static PyObject *
+_sha512_sha512_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_sha512_sha512(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords,
+ &string))
+ goto exit;
+ return_value = _sha512_sha512_impl(module, string);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(PY_LONG_LONG) */
+
+#if defined(PY_LONG_LONG)
+
+PyDoc_STRVAR(_sha512_sha384__doc__,
+"sha384($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Return a new SHA-384 hash object; optionally initialized with a string.");
+
+#define _SHA512_SHA384_METHODDEF \
+ {"sha384", (PyCFunction)_sha512_sha384, METH_VARARGS|METH_KEYWORDS, _sha512_sha384__doc__},
+
+static PyObject *
+_sha512_sha384_impl(PyModuleDef *module, PyObject *string);
+
+static PyObject *
+_sha512_sha384(PyModuleDef *module, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static char *_keywords[] = {"string", NULL};
+ PyObject *string = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords,
+ &string))
+ goto exit;
+ return_value = _sha512_sha384_impl(module, string);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(PY_LONG_LONG) */
+
+#ifndef SHA512TYPE_COPY_METHODDEF
+ #define SHA512TYPE_COPY_METHODDEF
+#endif /* !defined(SHA512TYPE_COPY_METHODDEF) */
+
+#ifndef SHA512TYPE_DIGEST_METHODDEF
+ #define SHA512TYPE_DIGEST_METHODDEF
+#endif /* !defined(SHA512TYPE_DIGEST_METHODDEF) */
+
+#ifndef SHA512TYPE_HEXDIGEST_METHODDEF
+ #define SHA512TYPE_HEXDIGEST_METHODDEF
+#endif /* !defined(SHA512TYPE_HEXDIGEST_METHODDEF) */
+
+#ifndef SHA512TYPE_UPDATE_METHODDEF
+ #define SHA512TYPE_UPDATE_METHODDEF
+#endif /* !defined(SHA512TYPE_UPDATE_METHODDEF) */
+
+#ifndef _SHA512_SHA512_METHODDEF
+ #define _SHA512_SHA512_METHODDEF
+#endif /* !defined(_SHA512_SHA512_METHODDEF) */
+
+#ifndef _SHA512_SHA384_METHODDEF
+ #define _SHA512_SHA384_METHODDEF
+#endif /* !defined(_SHA512_SHA384_METHODDEF) */
+/*[clinic end generated code: output=1c7d385731fee7c0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h
new file mode 100644
index 0000000..ec07ef1
--- /dev/null
+++ b/Modules/clinic/signalmodule.c.h
@@ -0,0 +1,432 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if defined(HAVE_ALARM)
+
+PyDoc_STRVAR(signal_alarm__doc__,
+"alarm($module, seconds, /)\n"
+"--\n"
+"\n"
+"Arrange for SIGALRM to arrive after the given number of seconds.");
+
+#define SIGNAL_ALARM_METHODDEF \
+ {"alarm", (PyCFunction)signal_alarm, METH_O, signal_alarm__doc__},
+
+static long
+signal_alarm_impl(PyModuleDef *module, int seconds);
+
+static PyObject *
+signal_alarm(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int seconds;
+ long _return_value;
+
+ if (!PyArg_Parse(arg, "i:alarm", &seconds))
+ goto exit;
+ _return_value = signal_alarm_impl(module, seconds);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong(_return_value);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_ALARM) */
+
+#if defined(HAVE_PAUSE)
+
+PyDoc_STRVAR(signal_pause__doc__,
+"pause($module, /)\n"
+"--\n"
+"\n"
+"Wait until a signal arrives.");
+
+#define SIGNAL_PAUSE_METHODDEF \
+ {"pause", (PyCFunction)signal_pause, METH_NOARGS, signal_pause__doc__},
+
+static PyObject *
+signal_pause_impl(PyModuleDef *module);
+
+static PyObject *
+signal_pause(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return signal_pause_impl(module);
+}
+
+#endif /* defined(HAVE_PAUSE) */
+
+PyDoc_STRVAR(signal_signal__doc__,
+"signal($module, signalnum, handler, /)\n"
+"--\n"
+"\n"
+"Set the action for the given signal.\n"
+"\n"
+"The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
+"The previous action is returned. See getsignal() for possible return values.\n"
+"\n"
+"*** IMPORTANT NOTICE ***\n"
+"A signal handler function is called with two arguments:\n"
+"the first is the signal number, the second is the interrupted stack frame.");
+
+#define SIGNAL_SIGNAL_METHODDEF \
+ {"signal", (PyCFunction)signal_signal, METH_VARARGS, signal_signal__doc__},
+
+static PyObject *
+signal_signal_impl(PyModuleDef *module, int signalnum, PyObject *handler);
+
+static PyObject *
+signal_signal(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int signalnum;
+ PyObject *handler;
+
+ if (!PyArg_ParseTuple(args, "iO:signal",
+ &signalnum, &handler))
+ goto exit;
+ return_value = signal_signal_impl(module, signalnum, handler);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(signal_getsignal__doc__,
+"getsignal($module, signalnum, /)\n"
+"--\n"
+"\n"
+"Return the current action for the given signal.\n"
+"\n"
+"The return value can be:\n"
+" SIG_IGN -- if the signal is being ignored\n"
+" SIG_DFL -- if the default action for the signal is in effect\n"
+" None -- if an unknown handler is in effect\n"
+" anything else -- the callable Python object used as a handler");
+
+#define SIGNAL_GETSIGNAL_METHODDEF \
+ {"getsignal", (PyCFunction)signal_getsignal, METH_O, signal_getsignal__doc__},
+
+static PyObject *
+signal_getsignal_impl(PyModuleDef *module, int signalnum);
+
+static PyObject *
+signal_getsignal(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int signalnum;
+
+ if (!PyArg_Parse(arg, "i:getsignal", &signalnum))
+ goto exit;
+ return_value = signal_getsignal_impl(module, signalnum);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_SIGINTERRUPT)
+
+PyDoc_STRVAR(signal_siginterrupt__doc__,
+"siginterrupt($module, signalnum, flag, /)\n"
+"--\n"
+"\n"
+"Change system call restart behaviour.\n"
+"\n"
+"If flag is False, system calls will be restarted when interrupted by\n"
+"signal sig, else system calls will be interrupted.");
+
+#define SIGNAL_SIGINTERRUPT_METHODDEF \
+ {"siginterrupt", (PyCFunction)signal_siginterrupt, METH_VARARGS, signal_siginterrupt__doc__},
+
+static PyObject *
+signal_siginterrupt_impl(PyModuleDef *module, int signalnum, int flag);
+
+static PyObject *
+signal_siginterrupt(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int signalnum;
+ int flag;
+
+ if (!PyArg_ParseTuple(args, "ii:siginterrupt",
+ &signalnum, &flag))
+ goto exit;
+ return_value = signal_siginterrupt_impl(module, signalnum, flag);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SIGINTERRUPT) */
+
+#if defined(HAVE_SETITIMER)
+
+PyDoc_STRVAR(signal_setitimer__doc__,
+"setitimer($module, which, seconds, interval=0.0, /)\n"
+"--\n"
+"\n"
+"Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
+"\n"
+"The timer will fire after value seconds and after that every interval seconds.\n"
+"The itimer can be cleared by setting seconds to zero.\n"
+"\n"
+"Returns old values as a tuple: (delay, interval).");
+
+#define SIGNAL_SETITIMER_METHODDEF \
+ {"setitimer", (PyCFunction)signal_setitimer, METH_VARARGS, signal_setitimer__doc__},
+
+static PyObject *
+signal_setitimer_impl(PyModuleDef *module, int which, double seconds,
+ double interval);
+
+static PyObject *
+signal_setitimer(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int which;
+ double seconds;
+ double interval = 0.0;
+
+ if (!PyArg_ParseTuple(args, "id|d:setitimer",
+ &which, &seconds, &interval))
+ goto exit;
+ return_value = signal_setitimer_impl(module, which, seconds, interval);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SETITIMER) */
+
+#if defined(HAVE_GETITIMER)
+
+PyDoc_STRVAR(signal_getitimer__doc__,
+"getitimer($module, which, /)\n"
+"--\n"
+"\n"
+"Returns current value of given itimer.");
+
+#define SIGNAL_GETITIMER_METHODDEF \
+ {"getitimer", (PyCFunction)signal_getitimer, METH_O, signal_getitimer__doc__},
+
+static PyObject *
+signal_getitimer_impl(PyModuleDef *module, int which);
+
+static PyObject *
+signal_getitimer(PyModuleDef *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int which;
+
+ if (!PyArg_Parse(arg, "i:getitimer", &which))
+ goto exit;
+ return_value = signal_getitimer_impl(module, which);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETITIMER) */
+
+#if defined(PYPTHREAD_SIGMASK)
+
+PyDoc_STRVAR(signal_pthread_sigmask__doc__,
+"pthread_sigmask($module, how, mask, /)\n"
+"--\n"
+"\n"
+"Fetch and/or change the signal mask of the calling thread.");
+
+#define SIGNAL_PTHREAD_SIGMASK_METHODDEF \
+ {"pthread_sigmask", (PyCFunction)signal_pthread_sigmask, METH_VARARGS, signal_pthread_sigmask__doc__},
+
+static PyObject *
+signal_pthread_sigmask_impl(PyModuleDef *module, int how, PyObject *mask);
+
+static PyObject *
+signal_pthread_sigmask(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int how;
+ PyObject *mask;
+
+ if (!PyArg_ParseTuple(args, "iO:pthread_sigmask",
+ &how, &mask))
+ goto exit;
+ return_value = signal_pthread_sigmask_impl(module, how, mask);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(PYPTHREAD_SIGMASK) */
+
+#if defined(HAVE_SIGPENDING)
+
+PyDoc_STRVAR(signal_sigpending__doc__,
+"sigpending($module, /)\n"
+"--\n"
+"\n"
+"Examine pending signals.\n"
+"\n"
+"Returns a set of signal numbers that are pending for delivery to\n"
+"the calling thread.");
+
+#define SIGNAL_SIGPENDING_METHODDEF \
+ {"sigpending", (PyCFunction)signal_sigpending, METH_NOARGS, signal_sigpending__doc__},
+
+static PyObject *
+signal_sigpending_impl(PyModuleDef *module);
+
+static PyObject *
+signal_sigpending(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return signal_sigpending_impl(module);
+}
+
+#endif /* defined(HAVE_SIGPENDING) */
+
+#if defined(HAVE_SIGWAIT)
+
+PyDoc_STRVAR(signal_sigwait__doc__,
+"sigwait($module, sigset, /)\n"
+"--\n"
+"\n"
+"Wait for a signal.\n"
+"\n"
+"Suspend execution of the calling thread until the delivery of one of the\n"
+"signals specified in the signal set sigset. The function accepts the signal\n"
+"and returns the signal number.");
+
+#define SIGNAL_SIGWAIT_METHODDEF \
+ {"sigwait", (PyCFunction)signal_sigwait, METH_O, signal_sigwait__doc__},
+
+#endif /* defined(HAVE_SIGWAIT) */
+
+#if defined(HAVE_SIGWAITINFO)
+
+PyDoc_STRVAR(signal_sigwaitinfo__doc__,
+"sigwaitinfo($module, sigset, /)\n"
+"--\n"
+"\n"
+"Wait synchronously until one of the signals in *sigset* is delivered.\n"
+"\n"
+"Returns a struct_siginfo containing information about the signal.");
+
+#define SIGNAL_SIGWAITINFO_METHODDEF \
+ {"sigwaitinfo", (PyCFunction)signal_sigwaitinfo, METH_O, signal_sigwaitinfo__doc__},
+
+#endif /* defined(HAVE_SIGWAITINFO) */
+
+#if defined(HAVE_SIGTIMEDWAIT)
+
+PyDoc_STRVAR(signal_sigtimedwait__doc__,
+"sigtimedwait($module, sigset, timeout, /)\n"
+"--\n"
+"\n"
+"Like sigwaitinfo(), but with a timeout.\n"
+"\n"
+"The timeout is specified in seconds, with floating point numbers allowed.");
+
+#define SIGNAL_SIGTIMEDWAIT_METHODDEF \
+ {"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_VARARGS, signal_sigtimedwait__doc__},
+
+static PyObject *
+signal_sigtimedwait_impl(PyModuleDef *module, PyObject *sigset,
+ PyObject *timeout_obj);
+
+static PyObject *
+signal_sigtimedwait(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *sigset;
+ PyObject *timeout_obj;
+
+ if (!PyArg_UnpackTuple(args, "sigtimedwait",
+ 2, 2,
+ &sigset, &timeout_obj))
+ goto exit;
+ return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_SIGTIMEDWAIT) */
+
+#if (defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD))
+
+PyDoc_STRVAR(signal_pthread_kill__doc__,
+"pthread_kill($module, thread_id, signalnum, /)\n"
+"--\n"
+"\n"
+"Send a signal to a thread.");
+
+#define SIGNAL_PTHREAD_KILL_METHODDEF \
+ {"pthread_kill", (PyCFunction)signal_pthread_kill, METH_VARARGS, signal_pthread_kill__doc__},
+
+static PyObject *
+signal_pthread_kill_impl(PyModuleDef *module, long thread_id, int signalnum);
+
+static PyObject *
+signal_pthread_kill(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ long thread_id;
+ int signalnum;
+
+ if (!PyArg_ParseTuple(args, "li:pthread_kill",
+ &thread_id, &signalnum))
+ goto exit;
+ return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
+
+exit:
+ return return_value;
+}
+
+#endif /* (defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD)) */
+
+#ifndef SIGNAL_ALARM_METHODDEF
+ #define SIGNAL_ALARM_METHODDEF
+#endif /* !defined(SIGNAL_ALARM_METHODDEF) */
+
+#ifndef SIGNAL_PAUSE_METHODDEF
+ #define SIGNAL_PAUSE_METHODDEF
+#endif /* !defined(SIGNAL_PAUSE_METHODDEF) */
+
+#ifndef SIGNAL_SIGINTERRUPT_METHODDEF
+ #define SIGNAL_SIGINTERRUPT_METHODDEF
+#endif /* !defined(SIGNAL_SIGINTERRUPT_METHODDEF) */
+
+#ifndef SIGNAL_SETITIMER_METHODDEF
+ #define SIGNAL_SETITIMER_METHODDEF
+#endif /* !defined(SIGNAL_SETITIMER_METHODDEF) */
+
+#ifndef SIGNAL_GETITIMER_METHODDEF
+ #define SIGNAL_GETITIMER_METHODDEF
+#endif /* !defined(SIGNAL_GETITIMER_METHODDEF) */
+
+#ifndef SIGNAL_PTHREAD_SIGMASK_METHODDEF
+ #define SIGNAL_PTHREAD_SIGMASK_METHODDEF
+#endif /* !defined(SIGNAL_PTHREAD_SIGMASK_METHODDEF) */
+
+#ifndef SIGNAL_SIGPENDING_METHODDEF
+ #define SIGNAL_SIGPENDING_METHODDEF
+#endif /* !defined(SIGNAL_SIGPENDING_METHODDEF) */
+
+#ifndef SIGNAL_SIGWAIT_METHODDEF
+ #define SIGNAL_SIGWAIT_METHODDEF
+#endif /* !defined(SIGNAL_SIGWAIT_METHODDEF) */
+
+#ifndef SIGNAL_SIGWAITINFO_METHODDEF
+ #define SIGNAL_SIGWAITINFO_METHODDEF
+#endif /* !defined(SIGNAL_SIGWAITINFO_METHODDEF) */
+
+#ifndef SIGNAL_SIGTIMEDWAIT_METHODDEF
+ #define SIGNAL_SIGTIMEDWAIT_METHODDEF
+#endif /* !defined(SIGNAL_SIGTIMEDWAIT_METHODDEF) */
+
+#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
+ #define SIGNAL_PTHREAD_KILL_METHODDEF
+#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
+/*[clinic end generated code: output=b99278c16c40ea43 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h
new file mode 100644
index 0000000..c0d18db
--- /dev/null
+++ b/Modules/clinic/spwdmodule.c.h
@@ -0,0 +1,68 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if defined(HAVE_GETSPNAM)
+
+PyDoc_STRVAR(spwd_getspnam__doc__,
+"getspnam($module, arg, /)\n"
+"--\n"
+"\n"
+"Return the shadow password database entry for the given user name.\n"
+"\n"
+"See `help(spwd)` for more on shadow password database entries.");
+
+#define SPWD_GETSPNAM_METHODDEF \
+ {"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 *arg_)
+{
+ PyObject *return_value = NULL;
+ PyObject *arg;
+
+ if (!PyArg_Parse(arg_, "U:getspnam", &arg))
+ goto exit;
+ return_value = spwd_getspnam_impl(module, arg);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETSPNAM) */
+
+#if defined(HAVE_GETSPENT)
+
+PyDoc_STRVAR(spwd_getspall__doc__,
+"getspall($module, /)\n"
+"--\n"
+"\n"
+"Return a list of all available shadow password database entries, in arbitrary order.\n"
+"\n"
+"See `help(spwd)` for more on shadow password database entries.");
+
+#define SPWD_GETSPALL_METHODDEF \
+ {"getspall", (PyCFunction)spwd_getspall, METH_NOARGS, spwd_getspall__doc__},
+
+static PyObject *
+spwd_getspall_impl(PyModuleDef *module);
+
+static PyObject *
+spwd_getspall(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
+{
+ return spwd_getspall_impl(module);
+}
+
+#endif /* defined(HAVE_GETSPENT) */
+
+#ifndef SPWD_GETSPNAM_METHODDEF
+ #define SPWD_GETSPNAM_METHODDEF
+#endif /* !defined(SPWD_GETSPNAM_METHODDEF) */
+
+#ifndef SPWD_GETSPALL_METHODDEF
+ #define SPWD_GETSPALL_METHODDEF
+#endif /* !defined(SPWD_GETSPALL_METHODDEF) */
+/*[clinic end generated code: output=6c178830413f7763 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h
new file mode 100644
index 0000000..d520c1e
--- /dev/null
+++ b/Modules/clinic/unicodedata.c.h
@@ -0,0 +1,368 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
+"decimal($self, chr, default=None, /)\n"
+"--\n"
+"\n"
+"Converts a Unicode character into its equivalent decimal value.\n"
+"\n"
+"Returns the decimal value assigned to the character chr as integer.\n"
+"If no such value is defined, default is returned, or, if not given,\n"
+"ValueError is raised.");
+
+#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
+ {"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
+
+static PyObject *
+unicodedata_UCD_decimal_impl(PyObject *self, int chr,
+ PyObject *default_value);
+
+static PyObject *
+unicodedata_UCD_decimal(PyObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "C|O:decimal",
+ &chr, &default_value))
+ goto exit;
+ return_value = unicodedata_UCD_decimal_impl(self, chr, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_digit__doc__,
+"digit($self, chr, default=None, /)\n"
+"--\n"
+"\n"
+"Converts a Unicode character into its equivalent digit value.\n"
+"\n"
+"Returns the digit value assigned to the character chr as integer.\n"
+"If no such value is defined, default is returned, or, if not given,\n"
+"ValueError is raised.");
+
+#define UNICODEDATA_UCD_DIGIT_METHODDEF \
+ {"digit", (PyCFunction)unicodedata_UCD_digit, METH_VARARGS, unicodedata_UCD_digit__doc__},
+
+static PyObject *
+unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value);
+
+static PyObject *
+unicodedata_UCD_digit(PyObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "C|O:digit",
+ &chr, &default_value))
+ goto exit;
+ return_value = unicodedata_UCD_digit_impl(self, chr, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_numeric__doc__,
+"numeric($self, chr, default=None, /)\n"
+"--\n"
+"\n"
+"Converts a Unicode character into its equivalent numeric value.\n"
+"\n"
+"Returns the numeric value assigned to the character chr as float.\n"
+"If no such value is defined, default is returned, or, if not given,\n"
+"ValueError is raised.");
+
+#define UNICODEDATA_UCD_NUMERIC_METHODDEF \
+ {"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_VARARGS, unicodedata_UCD_numeric__doc__},
+
+static PyObject *
+unicodedata_UCD_numeric_impl(PyObject *self, int chr,
+ PyObject *default_value);
+
+static PyObject *
+unicodedata_UCD_numeric(PyObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "C|O:numeric",
+ &chr, &default_value))
+ goto exit;
+ return_value = unicodedata_UCD_numeric_impl(self, chr, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_category__doc__,
+"category($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the general category assigned to the character chr as string.");
+
+#define UNICODEDATA_UCD_CATEGORY_METHODDEF \
+ {"category", (PyCFunction)unicodedata_UCD_category, METH_O, unicodedata_UCD_category__doc__},
+
+static PyObject *
+unicodedata_UCD_category_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_category(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+
+ if (!PyArg_Parse(arg, "C:category", &chr))
+ goto exit;
+ return_value = unicodedata_UCD_category_impl(self, chr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_bidirectional__doc__,
+"bidirectional($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the bidirectional class assigned to the character chr as string.\n"
+"\n"
+"If no such value is defined, an empty string is returned.");
+
+#define UNICODEDATA_UCD_BIDIRECTIONAL_METHODDEF \
+ {"bidirectional", (PyCFunction)unicodedata_UCD_bidirectional, METH_O, unicodedata_UCD_bidirectional__doc__},
+
+static PyObject *
+unicodedata_UCD_bidirectional_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_bidirectional(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+
+ if (!PyArg_Parse(arg, "C:bidirectional", &chr))
+ goto exit;
+ return_value = unicodedata_UCD_bidirectional_impl(self, chr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_combining__doc__,
+"combining($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the canonical combining class assigned to the character chr as integer.\n"
+"\n"
+"Returns 0 if no combining class is defined.");
+
+#define UNICODEDATA_UCD_COMBINING_METHODDEF \
+ {"combining", (PyCFunction)unicodedata_UCD_combining, METH_O, unicodedata_UCD_combining__doc__},
+
+static int
+unicodedata_UCD_combining_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_combining(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "C:combining", &chr))
+ goto exit;
+ _return_value = unicodedata_UCD_combining_impl(self, chr);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_mirrored__doc__,
+"mirrored($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the mirrored property assigned to the character chr as integer.\n"
+"\n"
+"Returns 1 if the character has been identified as a \"mirrored\"\n"
+"character in bidirectional text, 0 otherwise.");
+
+#define UNICODEDATA_UCD_MIRRORED_METHODDEF \
+ {"mirrored", (PyCFunction)unicodedata_UCD_mirrored, METH_O, unicodedata_UCD_mirrored__doc__},
+
+static int
+unicodedata_UCD_mirrored_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_mirrored(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ int _return_value;
+
+ if (!PyArg_Parse(arg, "C:mirrored", &chr))
+ goto exit;
+ _return_value = unicodedata_UCD_mirrored_impl(self, chr);
+ if ((_return_value == -1) && PyErr_Occurred())
+ goto exit;
+ return_value = PyLong_FromLong((long)_return_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_east_asian_width__doc__,
+"east_asian_width($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the east asian width assigned to the character chr as string.");
+
+#define UNICODEDATA_UCD_EAST_ASIAN_WIDTH_METHODDEF \
+ {"east_asian_width", (PyCFunction)unicodedata_UCD_east_asian_width, METH_O, unicodedata_UCD_east_asian_width__doc__},
+
+static PyObject *
+unicodedata_UCD_east_asian_width_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_east_asian_width(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+
+ if (!PyArg_Parse(arg, "C:east_asian_width", &chr))
+ goto exit;
+ return_value = unicodedata_UCD_east_asian_width_impl(self, chr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_decomposition__doc__,
+"decomposition($self, chr, /)\n"
+"--\n"
+"\n"
+"Returns the character decomposition mapping assigned to the character chr as string.\n"
+"\n"
+"An empty string is returned in case no such mapping is defined.");
+
+#define UNICODEDATA_UCD_DECOMPOSITION_METHODDEF \
+ {"decomposition", (PyCFunction)unicodedata_UCD_decomposition, METH_O, unicodedata_UCD_decomposition__doc__},
+
+static PyObject *
+unicodedata_UCD_decomposition_impl(PyObject *self, int chr);
+
+static PyObject *
+unicodedata_UCD_decomposition(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int chr;
+
+ if (!PyArg_Parse(arg, "C:decomposition", &chr))
+ goto exit;
+ return_value = unicodedata_UCD_decomposition_impl(self, chr);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_normalize__doc__,
+"normalize($self, form, unistr, /)\n"
+"--\n"
+"\n"
+"Return the normal form \'form\' for the Unicode string unistr.\n"
+"\n"
+"Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'.");
+
+#define UNICODEDATA_UCD_NORMALIZE_METHODDEF \
+ {"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_VARARGS, unicodedata_UCD_normalize__doc__},
+
+static PyObject *
+unicodedata_UCD_normalize_impl(PyObject *self, const char *form,
+ PyObject *input);
+
+static PyObject *
+unicodedata_UCD_normalize(PyObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ const char *form;
+ PyObject *input;
+
+ if (!PyArg_ParseTuple(args, "sO!:normalize",
+ &form, &PyUnicode_Type, &input))
+ goto exit;
+ return_value = unicodedata_UCD_normalize_impl(self, form, input);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_name__doc__,
+"name($self, chr, default=None, /)\n"
+"--\n"
+"\n"
+"Returns the name assigned to the character chr as a string.\n"
+"\n"
+"If no name is defined, default is returned, or, if not given,\n"
+"ValueError is raised.");
+
+#define UNICODEDATA_UCD_NAME_METHODDEF \
+ {"name", (PyCFunction)unicodedata_UCD_name, METH_VARARGS, unicodedata_UCD_name__doc__},
+
+static PyObject *
+unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value);
+
+static PyObject *
+unicodedata_UCD_name(PyObject *self, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ int chr;
+ PyObject *default_value = NULL;
+
+ if (!PyArg_ParseTuple(args, "C|O:name",
+ &chr, &default_value))
+ goto exit;
+ return_value = unicodedata_UCD_name_impl(self, chr, default_value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(unicodedata_UCD_lookup__doc__,
+"lookup($self, name, /)\n"
+"--\n"
+"\n"
+"Look up character by name.\n"
+"\n"
+"If a character with the given name is found, return the\n"
+"corresponding character. If not found, KeyError is raised.");
+
+#define UNICODEDATA_UCD_LOOKUP_METHODDEF \
+ {"lookup", (PyCFunction)unicodedata_UCD_lookup, METH_O, unicodedata_UCD_lookup__doc__},
+
+static PyObject *
+unicodedata_UCD_lookup_impl(PyObject *self, const char *name,
+ Py_ssize_clean_t name_length);
+
+static PyObject *
+unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const char *name;
+ Py_ssize_clean_t name_length;
+
+ if (!PyArg_Parse(arg, "s#:lookup", &name, &name_length))
+ goto exit;
+ return_value = unicodedata_UCD_lookup_impl(self, name, name_length);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=4f8da33c6bc6efc9 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index f54a805..35661a5 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -26,8 +26,7 @@ zlib_compress(PyModuleDef *module, PyObject *args)
Py_buffer bytes = {NULL, NULL};
int level = Z_DEFAULT_COMPRESSION;
- if (!PyArg_ParseTuple(args,
- "y*|i:compress",
+ if (!PyArg_ParseTuple(args, "y*|i:compress",
&bytes, &level))
goto exit;
return_value = zlib_compress_impl(module, &bytes, level);
@@ -57,7 +56,8 @@ PyDoc_STRVAR(zlib_decompress__doc__,
{"decompress", (PyCFunction)zlib_decompress, METH_VARARGS, zlib_decompress__doc__},
static PyObject *
-zlib_decompress_impl(PyModuleDef *module, Py_buffer *data, int wbits, unsigned int bufsize);
+zlib_decompress_impl(PyModuleDef *module, Py_buffer *data, int wbits,
+ unsigned int bufsize);
static PyObject *
zlib_decompress(PyModuleDef *module, PyObject *args)
@@ -67,8 +67,7 @@ zlib_decompress(PyModuleDef *module, PyObject *args)
int wbits = MAX_WBITS;
unsigned int bufsize = DEF_BUF_SIZE;
- if (!PyArg_ParseTuple(args,
- "y*|iO&:decompress",
+ if (!PyArg_ParseTuple(args, "y*|iO&:decompress",
&data, &wbits, uint_converter, &bufsize))
goto exit;
return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
@@ -111,7 +110,8 @@ PyDoc_STRVAR(zlib_compressobj__doc__,
{"compressobj", (PyCFunction)zlib_compressobj, METH_VARARGS|METH_KEYWORDS, zlib_compressobj__doc__},
static PyObject *
-zlib_compressobj_impl(PyModuleDef *module, int level, int method, int wbits, int memLevel, int strategy, Py_buffer *zdict);
+zlib_compressobj_impl(PyModuleDef *module, int level, int method, int wbits,
+ int memLevel, int strategy, Py_buffer *zdict);
static PyObject *
zlib_compressobj(PyModuleDef *module, PyObject *args, PyObject *kwargs)
@@ -125,8 +125,7 @@ zlib_compressobj(PyModuleDef *module, PyObject *args, PyObject *kwargs)
int strategy = Z_DEFAULT_STRATEGY;
Py_buffer zdict = {NULL, NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "|iiiiiy*:compressobj", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iiiiiy*:compressobj", _keywords,
&level, &method, &wbits, &memLevel, &strategy, &zdict))
goto exit;
return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict);
@@ -165,8 +164,7 @@ zlib_decompressobj(PyModuleDef *module, PyObject *args, PyObject *kwargs)
int wbits = MAX_WBITS;
PyObject *zdict = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "|iO:decompressobj", _keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iO:decompressobj", _keywords,
&wbits, &zdict))
goto exit;
return_value = zlib_decompressobj_impl(module, wbits, zdict);
@@ -189,20 +187,18 @@ PyDoc_STRVAR(zlib_Compress_compress__doc__,
"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,
- "y*:compress",
- &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data))
goto exit;
return_value = zlib_Compress_compress_impl(self, &data);
@@ -235,7 +231,8 @@ PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
{"decompress", (PyCFunction)zlib_Decompress_decompress, METH_VARARGS, zlib_Decompress_decompress__doc__},
static PyObject *
-zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, unsigned int max_length);
+zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
+ unsigned int max_length);
static PyObject *
zlib_Decompress_decompress(compobject *self, PyObject *args)
@@ -244,8 +241,7 @@ zlib_Decompress_decompress(compobject *self, PyObject *args)
Py_buffer data = {NULL, NULL};
unsigned int max_length = 0;
- if (!PyArg_ParseTuple(args,
- "y*|O&:decompress",
+ if (!PyArg_ParseTuple(args, "y*|O&:decompress",
&data, uint_converter, &max_length))
goto exit;
return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
@@ -282,8 +278,7 @@ zlib_Compress_flush(compobject *self, PyObject *args)
PyObject *return_value = NULL;
int mode = Z_FINISH;
- if (!PyArg_ParseTuple(args,
- "|i:flush",
+ if (!PyArg_ParseTuple(args, "|i:flush",
&mode))
goto exit;
return_value = zlib_Compress_flush_impl(self, mode);
@@ -314,10 +309,6 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
#endif /* defined(HAVE_ZLIB_COPY) */
-#ifndef ZLIB_COMPRESS_COPY_METHODDEF
- #define ZLIB_COMPRESS_COPY_METHODDEF
-#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
-
#if defined(HAVE_ZLIB_COPY)
PyDoc_STRVAR(zlib_Decompress_copy__doc__,
@@ -340,10 +331,6 @@ zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
#endif /* defined(HAVE_ZLIB_COPY) */
-#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
- #define ZLIB_DECOMPRESS_COPY_METHODDEF
-#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
-
PyDoc_STRVAR(zlib_Decompress_flush__doc__,
"flush($self, length=zlib.DEF_BUF_SIZE, /)\n"
"--\n"
@@ -365,8 +352,7 @@ zlib_Decompress_flush(compobject *self, PyObject *args)
PyObject *return_value = NULL;
unsigned int length = DEF_BUF_SIZE;
- if (!PyArg_ParseTuple(args,
- "|O&:flush",
+ if (!PyArg_ParseTuple(args, "|O&:flush",
uint_converter, &length))
goto exit;
return_value = zlib_Decompress_flush_impl(self, length);
@@ -399,8 +385,7 @@ zlib_adler32(PyModuleDef *module, PyObject *args)
Py_buffer data = {NULL, NULL};
unsigned int value = 1;
- if (!PyArg_ParseTuple(args,
- "y*|I:adler32",
+ if (!PyArg_ParseTuple(args, "y*|I:adler32",
&data, &value))
goto exit;
return_value = zlib_adler32_impl(module, &data, value);
@@ -437,8 +422,7 @@ zlib_crc32(PyModuleDef *module, PyObject *args)
Py_buffer data = {NULL, NULL};
unsigned int value = 0;
- if (!PyArg_ParseTuple(args,
- "y*|I:crc32",
+ if (!PyArg_ParseTuple(args, "y*|I:crc32",
&data, &value))
goto exit;
return_value = zlib_crc32_impl(module, &data, value);
@@ -450,4 +434,8 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=bc9473721ca7c962 input=a9049054013a1b77]*/
+
+#ifndef ZLIB_COMPRESS_COPY_METHODDEF
+ #define ZLIB_COMPRESS_COPY_METHODDEF
+#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
+/*[clinic end generated code: output=56ed1147bbbb4788 input=a9049054013a1b77]*/