summaryrefslogtreecommitdiff
path: root/Modules/clinic
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_asynciomodule.c.h520
-rw-r--r--Modules/clinic/_bz2module.c.h35
-rw-r--r--Modules/clinic/_codecsmodule.c.h334
-rw-r--r--Modules/clinic/_cryptmodule.c.h5
-rw-r--r--Modules/clinic/_cursesmodule.c.h14
-rw-r--r--Modules/clinic/_datetimemodule.c.h14
-rw-r--r--Modules/clinic/_dbmmodule.c.h11
-rw-r--r--Modules/clinic/_elementtree.c.h120
-rw-r--r--Modules/clinic/_gdbmmodule.c.h14
-rw-r--r--Modules/clinic/_hashopenssl.c.h60
-rw-r--r--Modules/clinic/_lzmamodule.c.h43
-rw-r--r--Modules/clinic/_opcode.c.h8
-rw-r--r--Modules/clinic/_pickle.c.h75
-rw-r--r--Modules/clinic/_sre.c.h206
-rw-r--r--Modules/clinic/_ssl.c.h198
-rw-r--r--Modules/clinic/_tkinter.c.h53
-rw-r--r--Modules/clinic/_weakref.c.h8
-rw-r--r--Modules/clinic/_winapi.c.h143
-rw-r--r--Modules/clinic/arraymodule.c.h29
-rw-r--r--Modules/clinic/audioop.c.h167
-rw-r--r--Modules/clinic/binascii.c.h118
-rw-r--r--Modules/clinic/cmathmodule.c.h83
-rw-r--r--Modules/clinic/fcntlmodule.c.h14
-rw-r--r--Modules/clinic/grpmodule.c.h26
-rw-r--r--Modules/clinic/md5module.c.h14
-rw-r--r--Modules/clinic/posixmodule.c.h1219
-rw-r--r--Modules/clinic/pwdmodule.c.h5
-rw-r--r--Modules/clinic/pyexpat.c.h32
-rw-r--r--Modules/clinic/sha1module.c.h14
-rw-r--r--Modules/clinic/sha256module.c.h26
-rw-r--r--Modules/clinic/sha512module.c.h74
-rw-r--r--Modules/clinic/signalmodule.c.h32
-rw-r--r--Modules/clinic/spwdmodule.c.h5
-rw-r--r--Modules/clinic/unicodedata.c.h44
-rw-r--r--Modules/clinic/zlibmodule.c.h115
35 files changed, 2681 insertions, 1197 deletions
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h
new file mode 100644
index 0000000000..052d252331
--- /dev/null
+++ b/Modules/clinic/_asynciomodule.c.h
@@ -0,0 +1,520 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_asyncio_Future___init____doc__,
+"Future(*, loop=None)\n"
+"--\n"
+"\n"
+"This class is *almost* compatible with concurrent.futures.Future.\n"
+"\n"
+" Differences:\n"
+"\n"
+" - result() and exception() do not take a timeout argument and\n"
+" raise an exception when the future isn\'t done yet.\n"
+"\n"
+" - Callbacks registered with add_done_callback() are always called\n"
+" via the event loop\'s call_soon_threadsafe().\n"
+"\n"
+" - This class is not compatible with the wait() and as_completed()\n"
+" methods in the concurrent.futures package.");
+
+static int
+_asyncio_Future___init___impl(FutureObj *self, PyObject *loop);
+
+static int
+_asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ int return_value = -1;
+ static const char * const _keywords[] = {"loop", NULL};
+ static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0};
+ PyObject *loop = NULL;
+
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &loop)) {
+ goto exit;
+ }
+ return_value = _asyncio_Future___init___impl((FutureObj *)self, loop);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Future_result__doc__,
+"result($self, /)\n"
+"--\n"
+"\n"
+"Return the result this future represents.\n"
+"\n"
+"If the future has been cancelled, raises CancelledError. If the\n"
+"future\'s result isn\'t yet available, raises InvalidStateError. If\n"
+"the future is done and has an exception set, this exception is raised.");
+
+#define _ASYNCIO_FUTURE_RESULT_METHODDEF \
+ {"result", (PyCFunction)_asyncio_Future_result, METH_NOARGS, _asyncio_Future_result__doc__},
+
+static PyObject *
+_asyncio_Future_result_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future_result(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future_result_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future_exception__doc__,
+"exception($self, /)\n"
+"--\n"
+"\n"
+"Return the exception that was set on this future.\n"
+"\n"
+"The exception (or None if no exception was set) is returned only if\n"
+"the future is done. If the future has been cancelled, raises\n"
+"CancelledError. If the future isn\'t done yet, raises\n"
+"InvalidStateError.");
+
+#define _ASYNCIO_FUTURE_EXCEPTION_METHODDEF \
+ {"exception", (PyCFunction)_asyncio_Future_exception, METH_NOARGS, _asyncio_Future_exception__doc__},
+
+static PyObject *
+_asyncio_Future_exception_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future_exception(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future_exception_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future_set_result__doc__,
+"set_result($self, res, /)\n"
+"--\n"
+"\n"
+"Mark the future done and set its result.\n"
+"\n"
+"If the future is already done when this method is called, raises\n"
+"InvalidStateError.");
+
+#define _ASYNCIO_FUTURE_SET_RESULT_METHODDEF \
+ {"set_result", (PyCFunction)_asyncio_Future_set_result, METH_O, _asyncio_Future_set_result__doc__},
+
+PyDoc_STRVAR(_asyncio_Future_set_exception__doc__,
+"set_exception($self, exception, /)\n"
+"--\n"
+"\n"
+"Mark the future done and set an exception.\n"
+"\n"
+"If the future is already done when this method is called, raises\n"
+"InvalidStateError.");
+
+#define _ASYNCIO_FUTURE_SET_EXCEPTION_METHODDEF \
+ {"set_exception", (PyCFunction)_asyncio_Future_set_exception, METH_O, _asyncio_Future_set_exception__doc__},
+
+PyDoc_STRVAR(_asyncio_Future_add_done_callback__doc__,
+"add_done_callback($self, fn, /)\n"
+"--\n"
+"\n"
+"Add a callback to be run when the future becomes done.\n"
+"\n"
+"The callback is called with a single argument - the future object. If\n"
+"the future is already done when this is called, the callback is\n"
+"scheduled with call_soon.");
+
+#define _ASYNCIO_FUTURE_ADD_DONE_CALLBACK_METHODDEF \
+ {"add_done_callback", (PyCFunction)_asyncio_Future_add_done_callback, METH_O, _asyncio_Future_add_done_callback__doc__},
+
+PyDoc_STRVAR(_asyncio_Future_remove_done_callback__doc__,
+"remove_done_callback($self, fn, /)\n"
+"--\n"
+"\n"
+"Remove all instances of a callback from the \"call when done\" list.\n"
+"\n"
+"Returns the number of callbacks removed.");
+
+#define _ASYNCIO_FUTURE_REMOVE_DONE_CALLBACK_METHODDEF \
+ {"remove_done_callback", (PyCFunction)_asyncio_Future_remove_done_callback, METH_O, _asyncio_Future_remove_done_callback__doc__},
+
+PyDoc_STRVAR(_asyncio_Future_cancel__doc__,
+"cancel($self, /)\n"
+"--\n"
+"\n"
+"Cancel the future and schedule callbacks.\n"
+"\n"
+"If the future is already done or cancelled, return False. Otherwise,\n"
+"change the future\'s state to cancelled, schedule the callbacks and\n"
+"return True.");
+
+#define _ASYNCIO_FUTURE_CANCEL_METHODDEF \
+ {"cancel", (PyCFunction)_asyncio_Future_cancel, METH_NOARGS, _asyncio_Future_cancel__doc__},
+
+static PyObject *
+_asyncio_Future_cancel_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future_cancel(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future_cancel_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future_cancelled__doc__,
+"cancelled($self, /)\n"
+"--\n"
+"\n"
+"Return True if the future was cancelled.");
+
+#define _ASYNCIO_FUTURE_CANCELLED_METHODDEF \
+ {"cancelled", (PyCFunction)_asyncio_Future_cancelled, METH_NOARGS, _asyncio_Future_cancelled__doc__},
+
+static PyObject *
+_asyncio_Future_cancelled_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future_cancelled(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future_cancelled_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future_done__doc__,
+"done($self, /)\n"
+"--\n"
+"\n"
+"Return True if the future is done.\n"
+"\n"
+"Done means either that a result / exception are available, or that the\n"
+"future was cancelled.");
+
+#define _ASYNCIO_FUTURE_DONE_METHODDEF \
+ {"done", (PyCFunction)_asyncio_Future_done, METH_NOARGS, _asyncio_Future_done__doc__},
+
+static PyObject *
+_asyncio_Future_done_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future_done(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future_done_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future__repr_info__doc__,
+"_repr_info($self, /)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO_FUTURE__REPR_INFO_METHODDEF \
+ {"_repr_info", (PyCFunction)_asyncio_Future__repr_info, METH_NOARGS, _asyncio_Future__repr_info__doc__},
+
+static PyObject *
+_asyncio_Future__repr_info_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__repr_info(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future__repr_info_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Future__schedule_callbacks__doc__,
+"_schedule_callbacks($self, /)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO_FUTURE__SCHEDULE_CALLBACKS_METHODDEF \
+ {"_schedule_callbacks", (PyCFunction)_asyncio_Future__schedule_callbacks, METH_NOARGS, _asyncio_Future__schedule_callbacks__doc__},
+
+static PyObject *
+_asyncio_Future__schedule_callbacks_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__schedule_callbacks(FutureObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Future__schedule_callbacks_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Task___init____doc__,
+"Task(coro, *, loop=None)\n"
+"--\n"
+"\n"
+"A coroutine wrapped in a Future.");
+
+static int
+_asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop);
+
+static int
+_asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ int return_value = -1;
+ static const char * const _keywords[] = {"coro", "loop", NULL};
+ static _PyArg_Parser _parser = {"O|$O:Task", _keywords, 0};
+ PyObject *coro;
+ PyObject *loop = NULL;
+
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &coro, &loop)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task___init___impl((TaskObj *)self, coro, loop);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task_current_task__doc__,
+"current_task($type, /, loop=None)\n"
+"--\n"
+"\n"
+"Return the currently running task in an event loop or None.\n"
+"\n"
+"By default the current task for the current event loop is returned.\n"
+"\n"
+"None is returned when called not in the context of a Task.");
+
+#define _ASYNCIO_TASK_CURRENT_TASK_METHODDEF \
+ {"current_task", (PyCFunction)_asyncio_Task_current_task, METH_FASTCALL|METH_CLASS, _asyncio_Task_current_task__doc__},
+
+static PyObject *
+_asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop);
+
+static PyObject *
+_asyncio_Task_current_task(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"loop", NULL};
+ static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
+ PyObject *loop = NULL;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &loop)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task_current_task_impl(type, loop);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task_all_tasks__doc__,
+"all_tasks($type, /, loop=None)\n"
+"--\n"
+"\n"
+"Return a set of all tasks for an event loop.\n"
+"\n"
+"By default all tasks for the current event loop are returned.");
+
+#define _ASYNCIO_TASK_ALL_TASKS_METHODDEF \
+ {"all_tasks", (PyCFunction)_asyncio_Task_all_tasks, METH_FASTCALL|METH_CLASS, _asyncio_Task_all_tasks__doc__},
+
+static PyObject *
+_asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop);
+
+static PyObject *
+_asyncio_Task_all_tasks(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"loop", NULL};
+ static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
+ PyObject *loop = NULL;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &loop)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task_all_tasks_impl(type, loop);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task__repr_info__doc__,
+"_repr_info($self, /)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO_TASK__REPR_INFO_METHODDEF \
+ {"_repr_info", (PyCFunction)_asyncio_Task__repr_info, METH_NOARGS, _asyncio_Task__repr_info__doc__},
+
+static PyObject *
+_asyncio_Task__repr_info_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task__repr_info(TaskObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Task__repr_info_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Task_cancel__doc__,
+"cancel($self, /)\n"
+"--\n"
+"\n"
+"Request that this task cancel itself.\n"
+"\n"
+"This arranges for a CancelledError to be thrown into the\n"
+"wrapped coroutine on the next cycle through the event loop.\n"
+"The coroutine then has a chance to clean up or even deny\n"
+"the request using try/except/finally.\n"
+"\n"
+"Unlike Future.cancel, this does not guarantee that the\n"
+"task will be cancelled: the exception might be caught and\n"
+"acted upon, delaying cancellation of the task or preventing\n"
+"cancellation completely. The task may also return a value or\n"
+"raise a different exception.\n"
+"\n"
+"Immediately after this method is called, Task.cancelled() will\n"
+"not return True (unless the task was already cancelled). A\n"
+"task will be marked as cancelled when the wrapped coroutine\n"
+"terminates with a CancelledError exception (even if cancel()\n"
+"was not called).");
+
+#define _ASYNCIO_TASK_CANCEL_METHODDEF \
+ {"cancel", (PyCFunction)_asyncio_Task_cancel, METH_NOARGS, _asyncio_Task_cancel__doc__},
+
+static PyObject *
+_asyncio_Task_cancel_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task_cancel(TaskObj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _asyncio_Task_cancel_impl(self);
+}
+
+PyDoc_STRVAR(_asyncio_Task_get_stack__doc__,
+"get_stack($self, /, *, limit=None)\n"
+"--\n"
+"\n"
+"Return the list of stack frames for this task\'s coroutine.\n"
+"\n"
+"If the coroutine is not done, this returns the stack where it is\n"
+"suspended. If the coroutine has completed successfully or was\n"
+"cancelled, this returns an empty list. If the coroutine was\n"
+"terminated by an exception, this returns the list of traceback\n"
+"frames.\n"
+"\n"
+"The frames are always ordered from oldest to newest.\n"
+"\n"
+"The optional limit gives the maximum number of frames to\n"
+"return; by default all available frames are returned. Its\n"
+"meaning differs depending on whether a stack or a traceback is\n"
+"returned: the newest frames of a stack are returned, but the\n"
+"oldest frames of a traceback are returned. (This matches the\n"
+"behavior of the traceback module.)\n"
+"\n"
+"For reasons beyond our control, only one stack frame is\n"
+"returned for a suspended coroutine.");
+
+#define _ASYNCIO_TASK_GET_STACK_METHODDEF \
+ {"get_stack", (PyCFunction)_asyncio_Task_get_stack, METH_FASTCALL, _asyncio_Task_get_stack__doc__},
+
+static PyObject *
+_asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit);
+
+static PyObject *
+_asyncio_Task_get_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"limit", NULL};
+ static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0};
+ PyObject *limit = Py_None;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &limit)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task_get_stack_impl(self, limit);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task_print_stack__doc__,
+"print_stack($self, /, *, limit=None, file=None)\n"
+"--\n"
+"\n"
+"Print the stack or traceback for this task\'s coroutine.\n"
+"\n"
+"This produces output similar to that of the traceback module,\n"
+"for the frames retrieved by get_stack(). The limit argument\n"
+"is passed to get_stack(). The file argument is an I/O stream\n"
+"to which the output is written; by default output is written\n"
+"to sys.stderr.");
+
+#define _ASYNCIO_TASK_PRINT_STACK_METHODDEF \
+ {"print_stack", (PyCFunction)_asyncio_Task_print_stack, METH_FASTCALL, _asyncio_Task_print_stack__doc__},
+
+static PyObject *
+_asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit,
+ PyObject *file);
+
+static PyObject *
+_asyncio_Task_print_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"limit", "file", NULL};
+ static _PyArg_Parser _parser = {"|$OO:print_stack", _keywords, 0};
+ PyObject *limit = Py_None;
+ PyObject *file = Py_None;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &limit, &file)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task_print_stack_impl(self, limit, file);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task__step__doc__,
+"_step($self, /, exc=None)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO_TASK__STEP_METHODDEF \
+ {"_step", (PyCFunction)_asyncio_Task__step, METH_FASTCALL, _asyncio_Task__step__doc__},
+
+static PyObject *
+_asyncio_Task__step_impl(TaskObj *self, PyObject *exc);
+
+static PyObject *
+_asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"exc", NULL};
+ static _PyArg_Parser _parser = {"|O:_step", _keywords, 0};
+ PyObject *exc = NULL;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &exc)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task__step_impl(self, exc);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_asyncio_Task__wakeup__doc__,
+"_wakeup($self, /, fut)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO_TASK__WAKEUP_METHODDEF \
+ {"_wakeup", (PyCFunction)_asyncio_Task__wakeup, METH_FASTCALL, _asyncio_Task__wakeup__doc__},
+
+static PyObject *
+_asyncio_Task__wakeup_impl(TaskObj *self, PyObject *fut);
+
+static PyObject *
+_asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"fut", NULL};
+ static _PyArg_Parser _parser = {"O:_wakeup", _keywords, 0};
+ PyObject *fut;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fut)) {
+ goto exit;
+ }
+ return_value = _asyncio_Task__wakeup_impl(self, fut);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=8f036321bb083066 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index 3ed8303e95..1ca810c9e7 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -25,14 +25,16 @@ _bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:compress", &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data)) {
goto exit;
+ }
return_value = _bz2_BZ2Compressor_compress_impl(self, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -80,11 +82,13 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
int compresslevel = 9;
if ((Py_TYPE(self) == &BZ2Compressor_Type) &&
- !_PyArg_NoKeywords("BZ2Compressor", kwargs))
+ !_PyArg_NoKeywords("BZ2Compressor", kwargs)) {
goto exit;
+ }
if (!PyArg_ParseTuple(args, "|i:BZ2Compressor",
- &compresslevel))
+ &compresslevel)) {
goto exit;
+ }
return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel);
exit:
@@ -111,29 +115,32 @@ PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
"the unused_data attribute.");
#define _BZ2_BZ2DECOMPRESSOR_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_VARARGS|METH_KEYWORDS, _bz2_BZ2Decompressor_decompress__doc__},
+ {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_FASTCALL, _bz2_BZ2Decompressor_decompress__doc__},
static PyObject *
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
Py_ssize_t max_length);
static PyObject *
-_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args, PyObject *kwargs)
+_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"data", "max_length", NULL};
+ static const char * const _keywords[] = {"data", "max_length", NULL};
+ static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords,
- &data, &max_length))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &max_length)) {
goto exit;
+ }
return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -155,14 +162,16 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
int return_value = -1;
if ((Py_TYPE(self) == &BZ2Decompressor_Type) &&
- !_PyArg_NoPositional("BZ2Decompressor", args))
+ !_PyArg_NoPositional("BZ2Decompressor", args)) {
goto exit;
+ }
if ((Py_TYPE(self) == &BZ2Decompressor_Type) &&
- !_PyArg_NoKeywords("BZ2Decompressor", kwargs))
+ !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) {
goto exit;
+ }
return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self);
exit:
return return_value;
}
-/*[clinic end generated code: output=fef29b76b3314fc7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7e57af0b368d3e55 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index af06c6d9e0..056287d06a 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -33,8 +33,9 @@ _codecs_lookup(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
const char *encoding;
- if (!PyArg_Parse(arg, "s:lookup", &encoding))
+ if (!PyArg_Parse(arg, "s:lookup", &encoding)) {
goto exit;
+ }
return_value = _codecs_lookup_impl(module, encoding);
exit:
@@ -54,24 +55,26 @@ PyDoc_STRVAR(_codecs_encode__doc__,
"codecs.register_error that can handle ValueErrors.");
#define _CODECS_ENCODE_METHODDEF \
- {"encode", (PyCFunction)_codecs_encode, METH_VARARGS|METH_KEYWORDS, _codecs_encode__doc__},
+ {"encode", (PyCFunction)_codecs_encode, METH_FASTCALL, _codecs_encode__doc__},
static PyObject *
_codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
const char *errors);
static PyObject *
-_codecs_encode(PyObject *module, PyObject *args, PyObject *kwargs)
+_codecs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"obj", "encoding", "errors", NULL};
+ static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
+ static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0};
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:encode", _keywords,
- &obj, &encoding, &errors))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &obj, &encoding, &errors)) {
goto exit;
+ }
return_value = _codecs_encode_impl(module, obj, encoding, errors);
exit:
@@ -91,24 +94,26 @@ PyDoc_STRVAR(_codecs_decode__doc__,
"codecs.register_error that can handle ValueErrors.");
#define _CODECS_DECODE_METHODDEF \
- {"decode", (PyCFunction)_codecs_decode, METH_VARARGS|METH_KEYWORDS, _codecs_decode__doc__},
+ {"decode", (PyCFunction)_codecs_decode, METH_FASTCALL, _codecs_decode__doc__},
static PyObject *
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
const char *errors);
static PyObject *
-_codecs_decode(PyObject *module, PyObject *args, PyObject *kwargs)
+_codecs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"obj", "encoding", "errors", NULL};
+ static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
+ static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0};
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:decode", _keywords,
- &obj, &encoding, &errors))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &obj, &encoding, &errors)) {
goto exit;
+ }
return_value = _codecs_decode_impl(module, obj, encoding, errors);
exit:
@@ -133,8 +138,9 @@ _codecs__forget_codec(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
const char *encoding;
- if (!PyArg_Parse(arg, "s:_forget_codec", &encoding))
+ if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) {
goto exit;
+ }
return_value = _codecs__forget_codec_impl(module, encoding);
exit:
@@ -161,14 +167,16 @@ _codecs_escape_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:escape_decode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_escape_decode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -193,8 +201,9 @@ _codecs_escape_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "O!|z:escape_encode",
- &PyBytes_Type, &data, &errors))
+ &PyBytes_Type, &data, &errors)) {
goto exit;
+ }
return_value = _codecs_escape_encode_impl(module, data, errors);
exit:
@@ -221,8 +230,9 @@ _codecs_unicode_internal_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode",
- &obj, &errors))
+ &obj, &errors)) {
goto exit;
+ }
return_value = _codecs_unicode_internal_decode_impl(module, obj, errors);
exit:
@@ -250,14 +260,16 @@ _codecs_utf_7_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_7_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -283,14 +295,16 @@ _codecs_utf_8_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_8_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -316,14 +330,16 @@ _codecs_utf_16_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_16_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -349,14 +365,16 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -382,14 +400,16 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -417,14 +437,16 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode",
- &data, &errors, &byteorder, &final))
+ &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)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -450,14 +472,16 @@ _codecs_utf_32_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_32_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -483,14 +507,16 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -516,14 +542,16 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -551,14 +579,16 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode",
- &data, &errors, &byteorder, &final))
+ &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)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -583,14 +613,16 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -615,14 +647,16 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -647,14 +681,16 @@ _codecs_latin_1_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_latin_1_decode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -679,14 +715,16 @@ _codecs_ascii_decode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "y*|z:ascii_decode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_ascii_decode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -712,19 +750,21 @@ _codecs_charmap_decode(PyObject *module, PyObject *args)
PyObject *mapping = NULL;
if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode",
- &data, &errors, &mapping))
+ &data, &errors, &mapping)) {
goto exit;
+ }
return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
-#if defined(HAVE_MBCS)
+#if defined(MS_WINDOWS)
PyDoc_STRVAR(_codecs_mbcs_decode__doc__,
"mbcs_decode($module, data, errors=None, final=False, /)\n"
@@ -747,21 +787,62 @@ _codecs_mbcs_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode",
- &data, &errors, &final))
+ &data, &errors, &final)) {
goto exit;
+ }
return_value = _codecs_mbcs_decode_impl(module, &data, errors, final);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
-#endif /* defined(HAVE_MBCS) */
+#endif /* defined(MS_WINDOWS) */
-#if defined(HAVE_MBCS)
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_codecs_oem_decode__doc__,
+"oem_decode($module, data, errors=None, final=False, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_OEM_DECODE_METHODDEF \
+ {"oem_decode", (PyCFunction)_codecs_oem_decode, METH_VARARGS, _codecs_oem_decode__doc__},
+
+static PyObject *
+_codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
+ const char *errors, int final);
+
+static PyObject *
+_codecs_oem_decode(PyObject *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:oem_decode",
+ &data, &errors, &final)) {
+ goto exit;
+ }
+ return_value = _codecs_oem_decode_impl(module, &data, errors, final);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj) {
+ PyBuffer_Release(&data);
+ }
+
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
PyDoc_STRVAR(_codecs_code_page_decode__doc__,
"code_page_decode($module, codepage, data, errors=None, final=False, /)\n"
@@ -785,19 +866,21 @@ _codecs_code_page_decode(PyObject *module, PyObject *args)
int final = 0;
if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode",
- &codepage, &data, &errors, &final))
+ &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)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
-#endif /* defined(HAVE_MBCS) */
+#endif /* defined(MS_WINDOWS) */
PyDoc_STRVAR(_codecs_readbuffer_encode__doc__,
"readbuffer_encode($module, data, errors=None, /)\n"
@@ -819,14 +902,16 @@ _codecs_readbuffer_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode",
- &data, &errors))
+ &data, &errors)) {
goto exit;
+ }
return_value = _codecs_readbuffer_encode_impl(module, &data, errors);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -851,8 +936,9 @@ _codecs_unicode_internal_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode",
- &obj, &errors))
+ &obj, &errors)) {
goto exit;
+ }
return_value = _codecs_unicode_internal_encode_impl(module, obj, errors);
exit:
@@ -878,9 +964,10 @@ _codecs_utf_7_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_7_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_7_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_7_encode_impl(module, str, errors);
exit:
@@ -906,9 +993,10 @@ _codecs_utf_8_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_8_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_8_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_8_encode_impl(module, str, errors);
exit:
@@ -935,9 +1023,10 @@ _codecs_utf_16_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
int byteorder = 0;
- if (!PyArg_ParseTuple(args, "O|zi:utf_16_encode",
- &str, &errors, &byteorder))
+ if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode",
+ &str, &errors, &byteorder)) {
goto exit;
+ }
return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder);
exit:
@@ -963,9 +1052,10 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_16_le_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_16_le_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_16_le_encode_impl(module, str, errors);
exit:
@@ -991,9 +1081,10 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_16_be_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_16_be_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_16_be_encode_impl(module, str, errors);
exit:
@@ -1020,9 +1111,10 @@ _codecs_utf_32_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
int byteorder = 0;
- if (!PyArg_ParseTuple(args, "O|zi:utf_32_encode",
- &str, &errors, &byteorder))
+ if (!PyArg_ParseTuple(args, "U|zi:utf_32_encode",
+ &str, &errors, &byteorder)) {
goto exit;
+ }
return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder);
exit:
@@ -1048,9 +1140,10 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_32_le_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_32_le_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_32_le_encode_impl(module, str, errors);
exit:
@@ -1076,9 +1169,10 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:utf_32_be_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:utf_32_be_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_utf_32_be_encode_impl(module, str, errors);
exit:
@@ -1104,9 +1198,10 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:unicode_escape_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_unicode_escape_encode_impl(module, str, errors);
exit:
@@ -1132,9 +1227,10 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:raw_unicode_escape_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors);
exit:
@@ -1160,9 +1256,10 @@ _codecs_latin_1_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:latin_1_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:latin_1_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_latin_1_encode_impl(module, str, errors);
exit:
@@ -1188,9 +1285,10 @@ _codecs_ascii_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:ascii_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:ascii_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_ascii_encode_impl(module, str, errors);
exit:
@@ -1217,9 +1315,10 @@ _codecs_charmap_encode(PyObject *module, PyObject *args)
const char *errors = NULL;
PyObject *mapping = NULL;
- if (!PyArg_ParseTuple(args, "O|zO:charmap_encode",
- &str, &errors, &mapping))
+ if (!PyArg_ParseTuple(args, "U|zO:charmap_encode",
+ &str, &errors, &mapping)) {
goto exit;
+ }
return_value = _codecs_charmap_encode_impl(module, str, errors, mapping);
exit:
@@ -1243,15 +1342,16 @@ _codecs_charmap_build(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *map;
- if (!PyArg_Parse(arg, "U:charmap_build", &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)
+#if defined(MS_WINDOWS)
PyDoc_STRVAR(_codecs_mbcs_encode__doc__,
"mbcs_encode($module, str, errors=None, /)\n"
@@ -1271,18 +1371,51 @@ _codecs_mbcs_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "O|z:mbcs_encode",
- &str, &errors))
+ if (!PyArg_ParseTuple(args, "U|z:mbcs_encode",
+ &str, &errors)) {
goto exit;
+ }
return_value = _codecs_mbcs_encode_impl(module, str, errors);
exit:
return return_value;
}
-#endif /* defined(HAVE_MBCS) */
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_codecs_oem_encode__doc__,
+"oem_encode($module, str, errors=None, /)\n"
+"--\n"
+"\n");
+
+#define _CODECS_OEM_ENCODE_METHODDEF \
+ {"oem_encode", (PyCFunction)_codecs_oem_encode, METH_VARARGS, _codecs_oem_encode__doc__},
-#if defined(HAVE_MBCS)
+static PyObject *
+_codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors);
+
+static PyObject *
+_codecs_oem_encode(PyObject *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ PyObject *str;
+ const char *errors = NULL;
+
+ if (!PyArg_ParseTuple(args, "U|z:oem_encode",
+ &str, &errors)) {
+ goto exit;
+ }
+ return_value = _codecs_oem_encode_impl(module, str, errors);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
PyDoc_STRVAR(_codecs_code_page_encode__doc__,
"code_page_encode($module, code_page, str, errors=None, /)\n"
@@ -1304,16 +1437,17 @@ _codecs_code_page_encode(PyObject *module, PyObject *args)
PyObject *str;
const char *errors = NULL;
- if (!PyArg_ParseTuple(args, "iO|z:code_page_encode",
- &code_page, &str, &errors))
+ if (!PyArg_ParseTuple(args, "iU|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) */
+#endif /* defined(MS_WINDOWS) */
PyDoc_STRVAR(_codecs_register_error__doc__,
"register_error($module, errors, handler, /)\n"
@@ -1340,8 +1474,9 @@ _codecs_register_error(PyObject *module, PyObject *args)
PyObject *handler;
if (!PyArg_ParseTuple(args, "sO:register_error",
- &errors, &handler))
+ &errors, &handler)) {
goto exit;
+ }
return_value = _codecs_register_error_impl(module, errors, handler);
exit:
@@ -1369,8 +1504,9 @@ _codecs_lookup_error(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
const char *name;
- if (!PyArg_Parse(arg, "s:lookup_error", &name))
+ if (!PyArg_Parse(arg, "s:lookup_error", &name)) {
goto exit;
+ }
return_value = _codecs_lookup_error_impl(module, name);
exit:
@@ -1381,6 +1517,10 @@ exit:
#define _CODECS_MBCS_DECODE_METHODDEF
#endif /* !defined(_CODECS_MBCS_DECODE_METHODDEF) */
+#ifndef _CODECS_OEM_DECODE_METHODDEF
+ #define _CODECS_OEM_DECODE_METHODDEF
+#endif /* !defined(_CODECS_OEM_DECODE_METHODDEF) */
+
#ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF
#define _CODECS_CODE_PAGE_DECODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */
@@ -1389,7 +1529,11 @@ exit:
#define _CODECS_MBCS_ENCODE_METHODDEF
#endif /* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */
+#ifndef _CODECS_OEM_ENCODE_METHODDEF
+ #define _CODECS_OEM_ENCODE_METHODDEF
+#endif /* !defined(_CODECS_OEM_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=42fed94e2ab765ba input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6d6afcabde10ed79 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h
index a3c371cbaa..412c6fe8a1 100644
--- a/Modules/clinic/_cryptmodule.c.h
+++ b/Modules/clinic/_cryptmodule.c.h
@@ -27,11 +27,12 @@ crypt_crypt(PyObject *module, PyObject *args)
const char *salt;
if (!PyArg_ParseTuple(args, "ss:crypt",
- &word, &salt))
+ &word, &salt)) {
goto exit;
+ }
return_value = crypt_crypt_impl(module, word, salt);
exit:
return return_value;
}
-/*[clinic end generated code: output=e0493a9691537690 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8dfc88264e662df4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 5e11742499..62ff1c8ae1 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -40,22 +40,26 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
- if (!PyArg_ParseTuple(args, "O:addch", &ch))
+ if (!PyArg_ParseTuple(args, "O:addch", &ch)) {
goto exit;
+ }
break;
case 2:
- if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
+ 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))
+ 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))
+ if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) {
goto exit;
+ }
group_right_1 = 1;
group_left_1 = 1;
break;
@@ -68,4 +72,4 @@ curses_window_addch(PyCursesWindowObject *self, PyObject *args)
exit:
return return_value;
}
-/*[clinic end generated code: output=982b1e709577f3ec input=a9049054013a1b77]*/
+/*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h
index 688c903e2f..dcb992b1af 100644
--- a/Modules/clinic/_datetimemodule.c.h
+++ b/Modules/clinic/_datetimemodule.c.h
@@ -14,24 +14,26 @@ PyDoc_STRVAR(datetime_datetime_now__doc__,
"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__},
+ {"now", (PyCFunction)datetime_datetime_now, METH_FASTCALL|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)
+datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"tz", NULL};
+ static const char * const _keywords[] = {"tz", NULL};
+ static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
PyObject *tz = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:now", _keywords,
- &tz))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &tz)) {
goto exit;
+ }
return_value = datetime_datetime_now_impl(type, tz);
exit:
return return_value;
}
-/*[clinic end generated code: output=7f45c670d6e4953a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8aaac0705add61ca input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index 49cbceb1ef..06cf7e6741 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -60,8 +60,9 @@ _dbm_dbm_get(dbmobject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "s#|O:get",
- &key, &key_length, &default_value))
+ &key, &key_length, &default_value)) {
goto exit;
+ }
return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
exit:
@@ -93,8 +94,9 @@ _dbm_dbm_setdefault(dbmobject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "s#|O:setdefault",
- &key, &key_length, &default_value))
+ &key, &key_length, &default_value)) {
goto exit;
+ }
return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
exit:
@@ -131,11 +133,12 @@ dbmopen(PyObject *module, PyObject *args)
int mode = 438;
if (!PyArg_ParseTuple(args, "s|si:open",
- &filename, &flags, &mode))
+ &filename, &flags, &mode)) {
goto exit;
+ }
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
-/*[clinic end generated code: output=fff12f168cdf8b43 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=99adf966ef0475ff input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 86b4c4cec7..1b309cd88c 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -19,8 +19,9 @@ _elementtree_Element_append(ElementObject *self, PyObject *arg)
PyObject *return_value = NULL;
PyObject *subelement;
- if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement))
+ if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement)) {
goto exit;
+ }
return_value = _elementtree_Element_append_impl(self, subelement);
exit:
@@ -87,8 +88,9 @@ _elementtree_Element___sizeof__(ElementObject *self, PyObject *Py_UNUSED(ignored
Py_ssize_t _return_value;
_return_value = _elementtree_Element___sizeof___impl(self);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -134,23 +136,25 @@ PyDoc_STRVAR(_elementtree_Element_find__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FIND_METHODDEF \
- {"find", (PyCFunction)_elementtree_Element_find, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_find__doc__},
+ {"find", (PyCFunction)_elementtree_Element_find, METH_FASTCALL, _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)
+_elementtree_Element_find(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "namespaces", NULL};
+ static const char * const _keywords[] = {"path", "namespaces", NULL};
+ static _PyArg_Parser _parser = {"O|O:find", _keywords, 0};
PyObject *path;
PyObject *namespaces = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:find", _keywords,
- &path, &namespaces))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path, &namespaces)) {
goto exit;
+ }
return_value = _elementtree_Element_find_impl(self, path, namespaces);
exit:
@@ -163,7 +167,7 @@ PyDoc_STRVAR(_elementtree_Element_findtext__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FINDTEXT_METHODDEF \
- {"findtext", (PyCFunction)_elementtree_Element_findtext, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_findtext__doc__},
+ {"findtext", (PyCFunction)_elementtree_Element_findtext, METH_FASTCALL, _elementtree_Element_findtext__doc__},
static PyObject *
_elementtree_Element_findtext_impl(ElementObject *self, PyObject *path,
@@ -171,17 +175,19 @@ _elementtree_Element_findtext_impl(ElementObject *self, PyObject *path,
PyObject *namespaces);
static PyObject *
-_elementtree_Element_findtext(ElementObject *self, PyObject *args, PyObject *kwargs)
+_elementtree_Element_findtext(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "default", "namespaces", NULL};
+ static const char * const _keywords[] = {"path", "default", "namespaces", NULL};
+ static _PyArg_Parser _parser = {"O|OO:findtext", _keywords, 0};
PyObject *path;
PyObject *default_value = Py_None;
PyObject *namespaces = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:findtext", _keywords,
- &path, &default_value, &namespaces))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path, &default_value, &namespaces)) {
goto exit;
+ }
return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces);
exit:
@@ -194,23 +200,25 @@ PyDoc_STRVAR(_elementtree_Element_findall__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FINDALL_METHODDEF \
- {"findall", (PyCFunction)_elementtree_Element_findall, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_findall__doc__},
+ {"findall", (PyCFunction)_elementtree_Element_findall, METH_FASTCALL, _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)
+_elementtree_Element_findall(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "namespaces", NULL};
+ static const char * const _keywords[] = {"path", "namespaces", NULL};
+ static _PyArg_Parser _parser = {"O|O:findall", _keywords, 0};
PyObject *path;
PyObject *namespaces = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:findall", _keywords,
- &path, &namespaces))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path, &namespaces)) {
goto exit;
+ }
return_value = _elementtree_Element_findall_impl(self, path, namespaces);
exit:
@@ -223,23 +231,25 @@ PyDoc_STRVAR(_elementtree_Element_iterfind__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF \
- {"iterfind", (PyCFunction)_elementtree_Element_iterfind, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_iterfind__doc__},
+ {"iterfind", (PyCFunction)_elementtree_Element_iterfind, METH_FASTCALL, _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)
+_elementtree_Element_iterfind(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "namespaces", NULL};
+ static const char * const _keywords[] = {"path", "namespaces", NULL};
+ static _PyArg_Parser _parser = {"O|O:iterfind", _keywords, 0};
PyObject *path;
PyObject *namespaces = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:iterfind", _keywords,
- &path, &namespaces))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path, &namespaces)) {
goto exit;
+ }
return_value = _elementtree_Element_iterfind_impl(self, path, namespaces);
exit:
@@ -252,23 +262,25 @@ PyDoc_STRVAR(_elementtree_Element_get__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_GET_METHODDEF \
- {"get", (PyCFunction)_elementtree_Element_get, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_get__doc__},
+ {"get", (PyCFunction)_elementtree_Element_get, METH_FASTCALL, _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)
+_elementtree_Element_get(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"key", "default", NULL};
+ static const char * const _keywords[] = {"key", "default", NULL};
+ static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
PyObject *key;
PyObject *default_value = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get", _keywords,
- &key, &default_value))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &key, &default_value)) {
goto exit;
+ }
return_value = _elementtree_Element_get_impl(self, key, default_value);
exit:
@@ -298,21 +310,23 @@ PyDoc_STRVAR(_elementtree_Element_iter__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_ITER_METHODDEF \
- {"iter", (PyCFunction)_elementtree_Element_iter, METH_VARARGS|METH_KEYWORDS, _elementtree_Element_iter__doc__},
+ {"iter", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL, _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)
+_elementtree_Element_iter(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"tag", NULL};
+ static const char * const _keywords[] = {"tag", NULL};
+ static _PyArg_Parser _parser = {"|O:iter", _keywords, 0};
PyObject *tag = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:iter", _keywords,
- &tag))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &tag)) {
goto exit;
+ }
return_value = _elementtree_Element_iter_impl(self, tag);
exit:
@@ -356,8 +370,9 @@ _elementtree_Element_insert(ElementObject *self, PyObject *args)
PyObject *subelement;
if (!PyArg_ParseTuple(args, "nO!:insert",
- &index, &Element_Type, &subelement))
+ &index, &Element_Type, &subelement)) {
goto exit;
+ }
return_value = _elementtree_Element_insert_impl(self, index, subelement);
exit:
@@ -419,8 +434,9 @@ _elementtree_Element_makeelement(ElementObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "makeelement",
2, 2,
- &tag, &attrib))
+ &tag, &attrib)) {
goto exit;
+ }
return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
exit:
@@ -444,8 +460,9 @@ _elementtree_Element_remove(ElementObject *self, PyObject *arg)
PyObject *return_value = NULL;
PyObject *subelement;
- if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement))
+ if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement)) {
goto exit;
+ }
return_value = _elementtree_Element_remove_impl(self, subelement);
exit:
@@ -473,8 +490,9 @@ _elementtree_Element_set(ElementObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "set",
2, 2,
- &key, &value))
+ &key, &value)) {
goto exit;
+ }
return_value = _elementtree_Element_set_impl(self, key, value);
exit:
@@ -489,12 +507,14 @@ static int
_elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static char *_keywords[] = {"element_factory", NULL};
+ static const char * const _keywords[] = {"element_factory", NULL};
+ static _PyArg_Parser _parser = {"|O:TreeBuilder", _keywords, 0};
PyObject *element_factory = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:TreeBuilder", _keywords,
- &element_factory))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &element_factory)) {
goto exit;
+ }
return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory);
exit:
@@ -555,8 +575,9 @@ _elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "start",
1, 2,
- &tag, &attrs))
+ &tag, &attrs)) {
goto exit;
+ }
return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
exit:
@@ -571,14 +592,16 @@ static int
_elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static char *_keywords[] = {"html", "target", "encoding", NULL};
+ static const char * const _keywords[] = {"html", "target", "encoding", NULL};
+ static _PyArg_Parser _parser = {"|OOz:XMLParser", _keywords, 0};
PyObject *html = NULL;
PyObject *target = NULL;
const char *encoding = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOz:XMLParser", _keywords,
- &html, &target, &encoding))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &html, &target, &encoding)) {
goto exit;
+ }
return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, html, target, encoding);
exit:
@@ -640,8 +663,9 @@ _elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "doctype",
3, 3,
- &name, &pubid, &system))
+ &name, &pubid, &system)) {
goto exit;
+ }
return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system);
exit:
@@ -668,12 +692,14 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args)
PyObject *events_queue;
PyObject *events_to_report = Py_None;
- if (!PyArg_ParseTuple(args, "O!|O:_setevents",
- &PyList_Type, &events_queue, &events_to_report))
+ if (!PyArg_UnpackTuple(args, "_setevents",
+ 1, 2,
+ &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]*/
+/*[clinic end generated code: output=b4a571a98ced3163 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index 2d87cfc760..fdd589c07a 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -23,8 +23,9 @@ _gdbm_gdbm_get(dbmobject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "get",
1, 2,
- &key, &default_value))
+ &key, &default_value)) {
goto exit;
+ }
return_value = _gdbm_gdbm_get_impl(self, key, default_value);
exit:
@@ -53,8 +54,9 @@ _gdbm_gdbm_setdefault(dbmobject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "setdefault",
1, 2,
- &key, &default_value))
+ &key, &default_value)) {
goto exit;
+ }
return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
exit:
@@ -147,8 +149,9 @@ _gdbm_gdbm_nextkey(dbmobject *self, PyObject *arg)
const char *key;
Py_ssize_clean_t key_length;
- if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length))
+ if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) {
goto exit;
+ }
return_value = _gdbm_gdbm_nextkey_impl(self, key, key_length);
exit:
@@ -242,11 +245,12 @@ dbmopen(PyObject *module, PyObject *args)
int mode = 438;
if (!PyArg_ParseTuple(args, "s|si:open",
- &name, &flags, &mode))
+ &name, &flags, &mode)) {
goto exit;
+ }
return_value = dbmopen_impl(module, name, flags, mode);
exit:
return return_value;
}
-/*[clinic end generated code: output=9ac7a89858a9765f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ed0f5d4e3d79b80c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
new file mode 100644
index 0000000000..0445352604
--- /dev/null
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -0,0 +1,60 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER))
+
+PyDoc_STRVAR(_hashlib_scrypt__doc__,
+"scrypt($module, /, password, *, salt=None, n=None, r=None, p=None,\n"
+" maxmem=0, dklen=64)\n"
+"--\n"
+"\n"
+"scrypt password-based key derivation function.");
+
+#define _HASHLIB_SCRYPT_METHODDEF \
+ {"scrypt", (PyCFunction)_hashlib_scrypt, METH_FASTCALL, _hashlib_scrypt__doc__},
+
+static PyObject *
+_hashlib_scrypt_impl(PyObject *module, Py_buffer *password, Py_buffer *salt,
+ PyObject *n_obj, PyObject *r_obj, PyObject *p_obj,
+ long maxmem, long dklen);
+
+static PyObject *
+_hashlib_scrypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"password", "salt", "n", "r", "p", "maxmem", "dklen", NULL};
+ static _PyArg_Parser _parser = {"y*|$y*O!O!O!ll:scrypt", _keywords, 0};
+ Py_buffer password = {NULL, NULL};
+ Py_buffer salt = {NULL, NULL};
+ PyObject *n_obj = Py_None;
+ PyObject *r_obj = Py_None;
+ PyObject *p_obj = Py_None;
+ long maxmem = 0;
+ long dklen = 64;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &password, &salt, &PyLong_Type, &n_obj, &PyLong_Type, &r_obj, &PyLong_Type, &p_obj, &maxmem, &dklen)) {
+ goto exit;
+ }
+ return_value = _hashlib_scrypt_impl(module, &password, &salt, n_obj, r_obj, p_obj, maxmem, dklen);
+
+exit:
+ /* Cleanup for password */
+ if (password.obj) {
+ PyBuffer_Release(&password);
+ }
+ /* Cleanup for salt */
+ if (salt.obj) {
+ PyBuffer_Release(&salt);
+ }
+
+ return return_value;
+}
+
+#endif /* (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER)) */
+
+#ifndef _HASHLIB_SCRYPT_METHODDEF
+ #define _HASHLIB_SCRYPT_METHODDEF
+#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
+/*[clinic end generated code: output=118cd7036fa0fb52 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index f8d38ea1fc..9e6075954a 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -25,14 +25,16 @@ _lzma_LZMACompressor_compress(Compressor *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:compress", &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data)) {
goto exit;
+ }
return_value = _lzma_LZMACompressor_compress_impl(self, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -79,29 +81,32 @@ PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__,
"the unused_data attribute.");
#define _LZMA_LZMADECOMPRESSOR_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_VARARGS|METH_KEYWORDS, _lzma_LZMADecompressor_decompress__doc__},
+ {"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_FASTCALL, _lzma_LZMADecompressor_decompress__doc__},
static PyObject *
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
Py_ssize_t max_length);
static PyObject *
-_lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *args, PyObject *kwargs)
+_lzma_LZMADecompressor_decompress(Decompressor *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"data", "max_length", NULL};
+ static const char * const _keywords[] = {"data", "max_length", NULL};
+ static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords,
- &data, &max_length))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &max_length)) {
goto exit;
+ }
return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -137,14 +142,16 @@ static int
_lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static char *_keywords[] = {"format", "memlimit", "filters", NULL};
+ static const char * const _keywords[] = {"format", "memlimit", "filters", NULL};
+ static _PyArg_Parser _parser = {"|iOO:LZMADecompressor", _keywords, 0};
int format = FORMAT_AUTO;
PyObject *memlimit = Py_None;
PyObject *filters = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOO:LZMADecompressor", _keywords,
- &format, &memlimit, &filters))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &format, &memlimit, &filters)) {
goto exit;
+ }
return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters);
exit:
@@ -171,8 +178,9 @@ _lzma_is_check_supported(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int check_id;
- if (!PyArg_Parse(arg, "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);
exit:
@@ -199,8 +207,9 @@ _lzma__encode_filter_properties(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -234,15 +243,17 @@ _lzma__decode_filter_properties(PyObject *module, PyObject *args)
Py_buffer encoded_props = {NULL, NULL};
if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties",
- lzma_vli_converter, &filter_id, &encoded_props))
+ lzma_vli_converter, &filter_id, &encoded_props)) {
goto exit;
+ }
return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
exit:
/* Cleanup for encoded_props */
- if (encoded_props.obj)
+ if (encoded_props.obj) {
PyBuffer_Release(&encoded_props);
+ }
return return_value;
}
-/*[clinic end generated code: output=fada06020fd318cc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f27abae460122706 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h
index a5f644265a..513cbfdad8 100644
--- a/Modules/clinic/_opcode.c.h
+++ b/Modules/clinic/_opcode.c.h
@@ -23,14 +23,16 @@ _opcode_stack_effect(PyObject *module, PyObject *args)
int _return_value;
if (!PyArg_ParseTuple(args, "i|O:stack_effect",
- &opcode, &oparg))
+ &opcode, &oparg)) {
goto exit;
+ }
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
return return_value;
}
-/*[clinic end generated code: output=984d6de140303d10 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4d91c6a765097853 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h
index bd12d2a0c4..9ad4c37f47 100644
--- a/Modules/clinic/_pickle.c.h
+++ b/Modules/clinic/_pickle.c.h
@@ -53,8 +53,9 @@ _pickle_Pickler___sizeof__(PicklerObject *self, PyObject *Py_UNUSED(ignored))
Py_ssize_t _return_value;
_return_value = _pickle_Pickler___sizeof___impl(self);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -92,14 +93,16 @@ static int
_pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static char *_keywords[] = {"file", "protocol", "fix_imports", NULL};
+ static const char * const _keywords[] = {"file", "protocol", "fix_imports", NULL};
+ static _PyArg_Parser _parser = {"O|Op:Pickler", _keywords, 0};
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Op:Pickler", _keywords,
- &file, &protocol, &fix_imports))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &file, &protocol, &fix_imports)) {
goto exit;
+ }
return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports);
exit:
@@ -212,8 +215,9 @@ _pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "find_class",
2, 2,
- &module_name, &global_name))
+ &module_name, &global_name)) {
goto exit;
+ }
return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
exit:
@@ -239,8 +243,9 @@ _pickle_Unpickler___sizeof__(UnpicklerObject *self, PyObject *Py_UNUSED(ignored)
Py_ssize_t _return_value;
_return_value = _pickle_Unpickler___sizeof___impl(self);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -281,15 +286,17 @@ static int
_pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static char *_keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
+ static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
+ static _PyArg_Parser _parser = {"O|$pss:Unpickler", _keywords, 0};
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:Unpickler", _keywords,
- &file, &fix_imports, &encoding, &errors))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &file, &fix_imports, &encoding, &errors)) {
goto exit;
+ }
return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors);
exit:
@@ -377,25 +384,27 @@ PyDoc_STRVAR(_pickle_dump__doc__,
"2, so that the pickle data stream is readable with Python 2.");
#define _PICKLE_DUMP_METHODDEF \
- {"dump", (PyCFunction)_pickle_dump, METH_VARARGS|METH_KEYWORDS, _pickle_dump__doc__},
+ {"dump", (PyCFunction)_pickle_dump, METH_FASTCALL, _pickle_dump__doc__},
static PyObject *
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
PyObject *protocol, int fix_imports);
static PyObject *
-_pickle_dump(PyObject *module, PyObject *args, PyObject *kwargs)
+_pickle_dump(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"obj", "file", "protocol", "fix_imports", NULL};
+ static const char * const _keywords[] = {"obj", "file", "protocol", "fix_imports", NULL};
+ static _PyArg_Parser _parser = {"OO|O$p:dump", _keywords, 0};
PyObject *obj;
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O$p:dump", _keywords,
- &obj, &file, &protocol, &fix_imports))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &obj, &file, &protocol, &fix_imports)) {
goto exit;
+ }
return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports);
exit:
@@ -421,24 +430,26 @@ PyDoc_STRVAR(_pickle_dumps__doc__,
"Python 2, so that the pickle data stream is readable with Python 2.");
#define _PICKLE_DUMPS_METHODDEF \
- {"dumps", (PyCFunction)_pickle_dumps, METH_VARARGS|METH_KEYWORDS, _pickle_dumps__doc__},
+ {"dumps", (PyCFunction)_pickle_dumps, METH_FASTCALL, _pickle_dumps__doc__},
static PyObject *
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
int fix_imports);
static PyObject *
-_pickle_dumps(PyObject *module, PyObject *args, PyObject *kwargs)
+_pickle_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"obj", "protocol", "fix_imports", NULL};
+ static const char * const _keywords[] = {"obj", "protocol", "fix_imports", NULL};
+ static _PyArg_Parser _parser = {"O|O$p:dumps", _keywords, 0};
PyObject *obj;
PyObject *protocol = NULL;
int fix_imports = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O$p:dumps", _keywords,
- &obj, &protocol, &fix_imports))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &obj, &protocol, &fix_imports)) {
goto exit;
+ }
return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports);
exit:
@@ -475,25 +486,27 @@ PyDoc_STRVAR(_pickle_load__doc__,
"string instances as bytes objects.");
#define _PICKLE_LOAD_METHODDEF \
- {"load", (PyCFunction)_pickle_load, METH_VARARGS|METH_KEYWORDS, _pickle_load__doc__},
+ {"load", (PyCFunction)_pickle_load, METH_FASTCALL, _pickle_load__doc__},
static PyObject *
_pickle_load_impl(PyObject *module, PyObject *file, int fix_imports,
const char *encoding, const char *errors);
static PyObject *
-_pickle_load(PyObject *module, PyObject *args, PyObject *kwargs)
+_pickle_load(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
+ static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
+ static _PyArg_Parser _parser = {"O|$pss:load", _keywords, 0};
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:load", _keywords,
- &file, &fix_imports, &encoding, &errors))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &file, &fix_imports, &encoding, &errors)) {
goto exit;
+ }
return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors);
exit:
@@ -521,28 +534,30 @@ PyDoc_STRVAR(_pickle_loads__doc__,
"string instances as bytes objects.");
#define _PICKLE_LOADS_METHODDEF \
- {"loads", (PyCFunction)_pickle_loads, METH_VARARGS|METH_KEYWORDS, _pickle_loads__doc__},
+ {"loads", (PyCFunction)_pickle_loads, METH_FASTCALL, _pickle_loads__doc__},
static PyObject *
_pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports,
const char *encoding, const char *errors);
static PyObject *
-_pickle_loads(PyObject *module, PyObject *args, PyObject *kwargs)
+_pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"data", "fix_imports", "encoding", "errors", NULL};
+ static const char * const _keywords[] = {"data", "fix_imports", "encoding", "errors", NULL};
+ static _PyArg_Parser _parser = {"O|$pss:loads", _keywords, 0};
PyObject *data;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:loads", _keywords,
- &data, &fix_imports, &encoding, &errors))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &fix_imports, &encoding, &errors)) {
goto exit;
+ }
return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors);
exit:
return return_value;
}
-/*[clinic end generated code: output=93657e55d6a748af input=a9049054013a1b77]*/
+/*[clinic end generated code: output=82be137b3c09cb9f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index 3281717218..0612005d1e 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -20,8 +20,9 @@ _sre_getcodesize(PyObject *module, PyObject *Py_UNUSED(ignored))
int _return_value;
_return_value = _sre_getcodesize_impl(module);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -48,11 +49,13 @@ _sre_getlower(PyObject *module, PyObject *args)
int _return_value;
if (!PyArg_ParseTuple(args, "ii:getlower",
- &character, &flags))
+ &character, &flags)) {
goto exit;
+ }
_return_value = _sre_getlower_impl(module, character, flags);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -66,7 +69,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
"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__},
+ {"match", (PyCFunction)_sre_SRE_Pattern_match, METH_FASTCALL, _sre_SRE_Pattern_match__doc__},
static PyObject *
_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
@@ -74,18 +77,20 @@ _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
PyObject *pattern);
static PyObject *
-_sre_SRE_Pattern_match(PatternObject *self, PyObject *args, PyObject *kwargs)
+_sre_SRE_Pattern_match(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static _PyArg_Parser _parser = {"|Onn$O:match", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos, &pattern)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern);
exit:
@@ -100,7 +105,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
"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__},
+ {"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_FASTCALL, _sre_SRE_Pattern_fullmatch__doc__},
static PyObject *
_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
@@ -108,18 +113,20 @@ _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
PyObject *pattern);
static PyObject *
-_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *args, PyObject *kwargs)
+_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static _PyArg_Parser _parser = {"|Onn$O:fullmatch", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos, &pattern)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern);
exit:
@@ -136,7 +143,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
"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__},
+ {"search", (PyCFunction)_sre_SRE_Pattern_search, METH_FASTCALL, _sre_SRE_Pattern_search__doc__},
static PyObject *
_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
@@ -144,18 +151,20 @@ _sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
PyObject *pattern);
static PyObject *
-_sre_SRE_Pattern_search(PatternObject *self, PyObject *args, PyObject *kwargs)
+_sre_SRE_Pattern_search(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", "pattern", NULL};
+ static _PyArg_Parser _parser = {"|Onn$O:search", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos, &pattern)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern);
exit:
@@ -170,7 +179,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
"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__},
+ {"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_FASTCALL, _sre_SRE_Pattern_findall__doc__},
static PyObject *
_sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
@@ -178,18 +187,20 @@ _sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
PyObject *source);
static PyObject *
-_sre_SRE_Pattern_findall(PatternObject *self, PyObject *args, PyObject *kwargs)
+_sre_SRE_Pattern_findall(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", "source", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", "source", NULL};
+ static _PyArg_Parser _parser = {"|Onn$O:findall", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos, &source)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source);
exit:
@@ -205,24 +216,26 @@ PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
"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__},
+ {"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_FASTCALL, _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)
+_sre_SRE_Pattern_finditer(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
+ static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
exit:
@@ -235,24 +248,26 @@ PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
"\n");
#define _SRE_SRE_PATTERN_SCANNER_METHODDEF \
- {"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
+ {"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_FASTCALL, _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)
+_sre_SRE_Pattern_scanner(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "pos", "endpos", NULL};
+ static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
+ static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &pos, &endpos)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
exit:
@@ -266,24 +281,26 @@ PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
"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__},
+ {"split", (PyCFunction)_sre_SRE_Pattern_split, METH_FASTCALL, _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)
+_sre_SRE_Pattern_split(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", "maxsplit", "source", NULL};
+ static const char * const _keywords[] = {"string", "maxsplit", "source", NULL};
+ static _PyArg_Parser _parser = {"|On$O:split", _keywords, 0};
PyObject *string = NULL;
Py_ssize_t maxsplit = 0;
PyObject *source = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On$O:split", _keywords,
- &string, &maxsplit, &source))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string, &maxsplit, &source)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source);
exit:
@@ -297,24 +314,26 @@ PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
"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__},
+ {"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_FASTCALL, _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)
+_sre_SRE_Pattern_sub(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"repl", "string", "count", NULL};
+ static const char * const _keywords[] = {"repl", "string", "count", NULL};
+ static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0};
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:sub", _keywords,
- &repl, &string, &count))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &repl, &string, &count)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
exit:
@@ -328,24 +347,26 @@ PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
"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__},
+ {"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_FASTCALL, _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)
+_sre_SRE_Pattern_subn(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"repl", "string", "count", NULL};
+ static const char * const _keywords[] = {"repl", "string", "count", NULL};
+ static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0};
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:subn", _keywords,
- &repl, &string, &count))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &repl, &string, &count)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
exit:
@@ -375,21 +396,23 @@ PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
"\n");
#define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF \
- {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Pattern___deepcopy____doc__},
+ {"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_FASTCALL, _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)
+_sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"memo", NULL};
+ static const char * const _keywords[] = {"memo", NULL};
+ static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
PyObject *memo;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords,
- &memo))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &memo)) {
goto exit;
+ }
return_value = _sre_SRE_Pattern___deepcopy___impl(self, memo);
exit:
@@ -403,7 +426,7 @@ PyDoc_STRVAR(_sre_compile__doc__,
"\n");
#define _SRE_COMPILE_METHODDEF \
- {"compile", (PyCFunction)_sre_compile, METH_VARARGS|METH_KEYWORDS, _sre_compile__doc__},
+ {"compile", (PyCFunction)_sre_compile, METH_FASTCALL, _sre_compile__doc__},
static PyObject *
_sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
@@ -411,10 +434,11 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
PyObject *indexgroup);
static PyObject *
-_sre_compile(PyObject *module, PyObject *args, PyObject *kwargs)
+_sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
+ static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
+ static _PyArg_Parser _parser = {"OiO!nOO:compile", _keywords, 0};
PyObject *pattern;
int flags;
PyObject *code;
@@ -422,9 +446,10 @@ _sre_compile(PyObject *module, PyObject *args, PyObject *kwargs)
PyObject *groupindex;
PyObject *indexgroup;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO!nOO:compile", _keywords,
- &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) {
goto exit;
+ }
return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
exit:
@@ -438,21 +463,23 @@ PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
"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__},
+ {"expand", (PyCFunction)_sre_SRE_Match_expand, METH_FASTCALL, _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)
+_sre_SRE_Match_expand(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"template", NULL};
+ static const char * const _keywords[] = {"template", NULL};
+ static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
PyObject *template;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:expand", _keywords,
- &template))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &template)) {
goto exit;
+ }
return_value = _sre_SRE_Match_expand_impl(self, template);
exit:
@@ -469,21 +496,23 @@ PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
" 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__},
+ {"groups", (PyCFunction)_sre_SRE_Match_groups, METH_FASTCALL, _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)
+_sre_SRE_Match_groups(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"default", NULL};
+ static const char * const _keywords[] = {"default", NULL};
+ static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
PyObject *default_value = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groups", _keywords,
- &default_value))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &default_value)) {
goto exit;
+ }
return_value = _sre_SRE_Match_groups_impl(self, default_value);
exit:
@@ -500,21 +529,23 @@ PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
" 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__},
+ {"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_FASTCALL, _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)
+_sre_SRE_Match_groupdict(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"default", NULL};
+ static const char * const _keywords[] = {"default", NULL};
+ static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
PyObject *default_value = Py_None;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groupdict", _keywords,
- &default_value))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &default_value)) {
goto exit;
+ }
return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
exit:
@@ -542,11 +573,13 @@ _sre_SRE_Match_start(MatchObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "start",
0, 1,
- &group))
+ &group)) {
goto exit;
+ }
_return_value = _sre_SRE_Match_start_impl(self, group);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -574,11 +607,13 @@ _sre_SRE_Match_end(MatchObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "end",
0, 1,
- &group))
+ &group)) {
goto exit;
+ }
_return_value = _sre_SRE_Match_end_impl(self, group);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -605,8 +640,9 @@ _sre_SRE_Match_span(MatchObject *self, PyObject *args)
if (!PyArg_UnpackTuple(args, "span",
0, 1,
- &group))
+ &group)) {
goto exit;
+ }
return_value = _sre_SRE_Match_span_impl(self, group);
exit:
@@ -636,21 +672,23 @@ PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
"\n");
#define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF \
- {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_VARARGS|METH_KEYWORDS, _sre_SRE_Match___deepcopy____doc__},
+ {"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_FASTCALL, _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)
+_sre_SRE_Match___deepcopy__(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"memo", NULL};
+ static const char * const _keywords[] = {"memo", NULL};
+ static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
PyObject *memo;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords,
- &memo))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &memo)) {
goto exit;
+ }
return_value = _sre_SRE_Match___deepcopy___impl(self, memo);
exit:
@@ -690,4 +728,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
-/*[clinic end generated code: output=a4ce9e5b748ce532 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a4a246bca1963bc9 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index 852e3658b6..29f5838439 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -36,8 +36,9 @@ _ssl__test_decode_cert(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *path;
- if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path))
+ if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) {
goto exit;
+ }
return_value = _ssl__test_decode_cert_impl(module, path);
exit:
@@ -71,8 +72,9 @@ _ssl__SSLSocket_peer_certificate(PySSLSocket *self, PyObject *args)
int binary_mode = 0;
if (!PyArg_ParseTuple(args, "|p:peer_certificate",
- &binary_mode))
+ &binary_mode)) {
goto exit;
+ }
return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode);
exit:
@@ -209,14 +211,16 @@ _ssl__SSLSocket_write(PySSLSocket *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer b = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:write", &b))
+ if (!PyArg_Parse(arg, "y*:write", &b)) {
goto exit;
+ }
return_value = _ssl__SSLSocket_write_impl(self, &b);
exit:
/* Cleanup for b */
- if (b.obj)
+ if (b.obj) {
PyBuffer_Release(&b);
+ }
return return_value;
}
@@ -260,12 +264,14 @@ _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args)
switch (PyTuple_GET_SIZE(args)) {
case 1:
- if (!PyArg_ParseTuple(args, "i:read", &len))
+ if (!PyArg_ParseTuple(args, "i:read", &len)) {
goto exit;
+ }
break;
case 2:
- if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer))
+ if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) {
goto exit;
+ }
group_right_1 = 1;
break;
default:
@@ -276,8 +282,9 @@ _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args)
exit:
/* Cleanup for buffer */
- if (buffer.obj)
+ if (buffer.obj) {
PyBuffer_Release(&buffer);
+ }
return return_value;
}
@@ -332,11 +339,13 @@ _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs)
int proto_version;
if ((type == &PySSLContext_Type) &&
- !_PyArg_NoKeywords("_SSLContext", kwargs))
+ !_PyArg_NoKeywords("_SSLContext", kwargs)) {
goto exit;
+ }
if (!PyArg_ParseTuple(args, "i:_SSLContext",
- &proto_version))
+ &proto_version)) {
goto exit;
+ }
return_value = _ssl__SSLContext_impl(type, proto_version);
exit:
@@ -360,14 +369,36 @@ _ssl__SSLContext_set_ciphers(PySSLContext *self, PyObject *arg)
PyObject *return_value = NULL;
const char *cipherlist;
- if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist))
+ if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) {
goto exit;
+ }
return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist);
exit:
return return_value;
}
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000UL)
+
+PyDoc_STRVAR(_ssl__SSLContext_get_ciphers__doc__,
+"get_ciphers($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF \
+ {"get_ciphers", (PyCFunction)_ssl__SSLContext_get_ciphers, METH_NOARGS, _ssl__SSLContext_get_ciphers__doc__},
+
+static PyObject *
+_ssl__SSLContext_get_ciphers_impl(PySSLContext *self);
+
+static PyObject *
+_ssl__SSLContext_get_ciphers(PySSLContext *self, PyObject *Py_UNUSED(ignored))
+{
+ return _ssl__SSLContext_get_ciphers_impl(self);
+}
+
+#endif /* (OPENSSL_VERSION_NUMBER >= 0x10002000UL) */
+
PyDoc_STRVAR(_ssl__SSLContext__set_npn_protocols__doc__,
"_set_npn_protocols($self, protos, /)\n"
"--\n"
@@ -386,14 +417,16 @@ _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))
+ 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)
+ if (protos.obj) {
PyBuffer_Release(&protos);
+ }
return return_value;
}
@@ -416,14 +449,16 @@ _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))
+ 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)
+ if (protos.obj) {
PyBuffer_Release(&protos);
+ }
return return_value;
}
@@ -434,24 +469,26 @@ PyDoc_STRVAR(_ssl__SSLContext_load_cert_chain__doc__,
"\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__},
+ {"load_cert_chain", (PyCFunction)_ssl__SSLContext_load_cert_chain, METH_FASTCALL, _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)
+_ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"certfile", "keyfile", "password", NULL};
+ static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL};
+ static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0};
PyObject *certfile;
PyObject *keyfile = NULL;
PyObject *password = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:load_cert_chain", _keywords,
- &certfile, &keyfile, &password))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &certfile, &keyfile, &password)) {
goto exit;
+ }
return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
exit:
@@ -464,7 +501,7 @@ PyDoc_STRVAR(_ssl__SSLContext_load_verify_locations__doc__,
"\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__},
+ {"load_verify_locations", (PyCFunction)_ssl__SSLContext_load_verify_locations, METH_FASTCALL, _ssl__SSLContext_load_verify_locations__doc__},
static PyObject *
_ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
@@ -473,17 +510,19 @@ _ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
PyObject *cadata);
static PyObject *
-_ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *args, PyObject *kwargs)
+_ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"cafile", "capath", "cadata", NULL};
+ static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL};
+ static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0};
PyObject *cafile = NULL;
PyObject *capath = NULL;
PyObject *cadata = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:load_verify_locations", _keywords,
- &cafile, &capath, &cadata))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &cafile, &capath, &cadata)) {
goto exit;
+ }
return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
exit:
@@ -504,24 +543,26 @@ PyDoc_STRVAR(_ssl__SSLContext__wrap_socket__doc__,
"\n");
#define _SSL__SSLCONTEXT__WRAP_SOCKET_METHODDEF \
- {"_wrap_socket", (PyCFunction)_ssl__SSLContext__wrap_socket, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext__wrap_socket__doc__},
+ {"_wrap_socket", (PyCFunction)_ssl__SSLContext__wrap_socket, METH_FASTCALL, _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)
+_ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"sock", "server_side", "server_hostname", NULL};
+ static const char * const _keywords[] = {"sock", "server_side", "server_hostname", NULL};
+ static _PyArg_Parser _parser = {"O!i|O:_wrap_socket", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) {
goto exit;
+ }
return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj);
exit:
@@ -535,7 +576,7 @@ PyDoc_STRVAR(_ssl__SSLContext__wrap_bio__doc__,
"\n");
#define _SSL__SSLCONTEXT__WRAP_BIO_METHODDEF \
- {"_wrap_bio", (PyCFunction)_ssl__SSLContext__wrap_bio, METH_VARARGS|METH_KEYWORDS, _ssl__SSLContext__wrap_bio__doc__},
+ {"_wrap_bio", (PyCFunction)_ssl__SSLContext__wrap_bio, METH_FASTCALL, _ssl__SSLContext__wrap_bio__doc__},
static PyObject *
_ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming,
@@ -543,18 +584,20 @@ _ssl__SSLContext__wrap_bio_impl(PySSLContext *self, PySSLMemoryBIO *incoming,
PyObject *hostname_obj);
static PyObject *
-_ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *args, PyObject *kwargs)
+_ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", NULL};
+ static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", NULL};
+ static _PyArg_Parser _parser = {"O!O!i|O:_wrap_bio", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &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:
@@ -657,21 +700,23 @@ PyDoc_STRVAR(_ssl__SSLContext_get_ca_certs__doc__,
"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__},
+ {"get_ca_certs", (PyCFunction)_ssl__SSLContext_get_ca_certs, METH_FASTCALL, _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)
+_ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"binary_form", NULL};
+ static const char * const _keywords[] = {"binary_form", NULL};
+ static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
int binary_form = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:get_ca_certs", _keywords,
- &binary_form))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &binary_form)) {
goto exit;
+ }
return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
exit:
@@ -687,11 +732,13 @@ _ssl_MemoryBIO(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PyObject *return_value = NULL;
if ((type == &PySSLMemoryBIO_Type) &&
- !_PyArg_NoPositional("MemoryBIO", args))
+ !_PyArg_NoPositional("MemoryBIO", args)) {
goto exit;
+ }
if ((type == &PySSLMemoryBIO_Type) &&
- !_PyArg_NoKeywords("MemoryBIO", kwargs))
+ !_PyArg_NoKeywords("MemoryBIO", kwargs)) {
goto exit;
+ }
return_value = _ssl_MemoryBIO_impl(type);
exit:
@@ -722,8 +769,9 @@ _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *args)
int len = -1;
if (!PyArg_ParseTuple(args, "|i:read",
- &len))
+ &len)) {
goto exit;
+ }
return_value = _ssl_MemoryBIO_read_impl(self, len);
exit:
@@ -750,14 +798,16 @@ _ssl_MemoryBIO_write(PySSLMemoryBIO *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer b = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:write", &b))
+ if (!PyArg_Parse(arg, "y*:write", &b)) {
goto exit;
+ }
return_value = _ssl_MemoryBIO_write_impl(self, &b);
exit:
/* Cleanup for b */
- if (b.obj)
+ if (b.obj) {
PyBuffer_Release(&b);
+ }
return return_value;
}
@@ -805,14 +855,16 @@ _ssl_RAND_add(PyObject *module, PyObject *args)
double entropy;
if (!PyArg_ParseTuple(args, "s*d:RAND_add",
- &view, &entropy))
+ &view, &entropy)) {
goto exit;
+ }
return_value = _ssl_RAND_add_impl(module, &view, entropy);
exit:
/* Cleanup for view */
- if (view.obj)
+ if (view.obj) {
PyBuffer_Release(&view);
+ }
return return_value;
}
@@ -835,8 +887,9 @@ _ssl_RAND_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int n;
- if (!PyArg_Parse(arg, "i:RAND_bytes", &n))
+ if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) {
goto exit;
+ }
return_value = _ssl_RAND_bytes_impl(module, n);
exit:
@@ -864,8 +917,9 @@ _ssl_RAND_pseudo_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int n;
- if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n))
+ if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) {
goto exit;
+ }
return_value = _ssl_RAND_pseudo_bytes_impl(module, n);
exit:
@@ -916,8 +970,9 @@ _ssl_RAND_egd(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *path;
- if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path))
+ if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) {
goto exit;
+ }
return_value = _ssl_RAND_egd_impl(module, path);
exit:
@@ -956,22 +1011,24 @@ PyDoc_STRVAR(_ssl_txt2obj__doc__,
"long name are also matched.");
#define _SSL_TXT2OBJ_METHODDEF \
- {"txt2obj", (PyCFunction)_ssl_txt2obj, METH_VARARGS|METH_KEYWORDS, _ssl_txt2obj__doc__},
+ {"txt2obj", (PyCFunction)_ssl_txt2obj, METH_FASTCALL, _ssl_txt2obj__doc__},
static PyObject *
_ssl_txt2obj_impl(PyObject *module, const char *txt, int name);
static PyObject *
-_ssl_txt2obj(PyObject *module, PyObject *args, PyObject *kwargs)
+_ssl_txt2obj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"txt", "name", NULL};
+ static const char * const _keywords[] = {"txt", "name", NULL};
+ static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0};
const char *txt;
int name = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|p:txt2obj", _keywords,
- &txt, &name))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &txt, &name)) {
goto exit;
+ }
return_value = _ssl_txt2obj_impl(module, txt, name);
exit:
@@ -996,8 +1053,9 @@ _ssl_nid2obj(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int nid;
- if (!PyArg_Parse(arg, "i:nid2obj", &nid))
+ if (!PyArg_Parse(arg, "i:nid2obj", &nid)) {
goto exit;
+ }
return_value = _ssl_nid2obj_impl(module, nid);
exit:
@@ -1019,21 +1077,23 @@ PyDoc_STRVAR(_ssl_enum_certificates__doc__,
"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__},
+ {"enum_certificates", (PyCFunction)_ssl_enum_certificates, METH_FASTCALL, _ssl_enum_certificates__doc__},
static PyObject *
_ssl_enum_certificates_impl(PyObject *module, const char *store_name);
static PyObject *
-_ssl_enum_certificates(PyObject *module, PyObject *args, PyObject *kwargs)
+_ssl_enum_certificates(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"store_name", NULL};
+ static const char * const _keywords[] = {"store_name", NULL};
+ static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
const char *store_name;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_certificates", _keywords,
- &store_name))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &store_name)) {
goto exit;
+ }
return_value = _ssl_enum_certificates_impl(module, store_name);
exit:
@@ -1056,21 +1116,23 @@ PyDoc_STRVAR(_ssl_enum_crls__doc__,
"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__},
+ {"enum_crls", (PyCFunction)_ssl_enum_crls, METH_FASTCALL, _ssl_enum_crls__doc__},
static PyObject *
_ssl_enum_crls_impl(PyObject *module, const char *store_name);
static PyObject *
-_ssl_enum_crls(PyObject *module, PyObject *args, PyObject *kwargs)
+_ssl_enum_crls(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"store_name", NULL};
+ static const char * const _keywords[] = {"store_name", NULL};
+ static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
const char *store_name;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_crls", _keywords,
- &store_name))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &store_name)) {
goto exit;
+ }
return_value = _ssl_enum_crls_impl(module, store_name);
exit:
@@ -1087,6 +1149,10 @@ exit:
#define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
#endif /* !defined(_SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF) */
+#ifndef _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
+ #define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
+#endif /* !defined(_SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF) */
+
#ifndef _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
#define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
#endif /* !defined(_SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF) */
@@ -1102,4 +1168,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=6fb10594d8351dc5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a859b21fe68a6115 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h
index 77af083c06..edd5380005 100644
--- a/Modules/clinic/_tkinter.c.h
+++ b/Modules/clinic/_tkinter.c.h
@@ -19,8 +19,9 @@ _tkinter_tkapp_eval(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *script;
- if (!PyArg_Parse(arg, "s:eval", &script))
+ if (!PyArg_Parse(arg, "s:eval", &script)) {
goto exit;
+ }
return_value = _tkinter_tkapp_eval_impl(self, script);
exit:
@@ -44,8 +45,9 @@ _tkinter_tkapp_evalfile(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *fileName;
- if (!PyArg_Parse(arg, "s:evalfile", &fileName))
+ if (!PyArg_Parse(arg, "s:evalfile", &fileName)) {
goto exit;
+ }
return_value = _tkinter_tkapp_evalfile_impl(self, fileName);
exit:
@@ -69,8 +71,9 @@ _tkinter_tkapp_record(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *script;
- if (!PyArg_Parse(arg, "s:record", &script))
+ if (!PyArg_Parse(arg, "s:record", &script)) {
goto exit;
+ }
return_value = _tkinter_tkapp_record_impl(self, script);
exit:
@@ -94,8 +97,9 @@ _tkinter_tkapp_adderrinfo(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *msg;
- if (!PyArg_Parse(arg, "s:adderrinfo", &msg))
+ if (!PyArg_Parse(arg, "s:adderrinfo", &msg)) {
goto exit;
+ }
return_value = _tkinter_tkapp_adderrinfo_impl(self, msg);
exit:
@@ -143,8 +147,9 @@ _tkinter_tkapp_exprstring(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *s;
- if (!PyArg_Parse(arg, "s:exprstring", &s))
+ if (!PyArg_Parse(arg, "s:exprstring", &s)) {
goto exit;
+ }
return_value = _tkinter_tkapp_exprstring_impl(self, s);
exit:
@@ -168,8 +173,9 @@ _tkinter_tkapp_exprlong(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *s;
- if (!PyArg_Parse(arg, "s:exprlong", &s))
+ if (!PyArg_Parse(arg, "s:exprlong", &s)) {
goto exit;
+ }
return_value = _tkinter_tkapp_exprlong_impl(self, s);
exit:
@@ -193,8 +199,9 @@ _tkinter_tkapp_exprdouble(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *s;
- if (!PyArg_Parse(arg, "s:exprdouble", &s))
+ if (!PyArg_Parse(arg, "s:exprdouble", &s)) {
goto exit;
+ }
return_value = _tkinter_tkapp_exprdouble_impl(self, s);
exit:
@@ -218,8 +225,9 @@ _tkinter_tkapp_exprboolean(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *s;
- if (!PyArg_Parse(arg, "s:exprboolean", &s))
+ if (!PyArg_Parse(arg, "s:exprboolean", &s)) {
goto exit;
+ }
return_value = _tkinter_tkapp_exprboolean_impl(self, s);
exit:
@@ -262,8 +270,9 @@ _tkinter_tkapp_createcommand(TkappObject *self, PyObject *args)
PyObject *func;
if (!PyArg_ParseTuple(args, "sO:createcommand",
- &name, &func))
+ &name, &func)) {
goto exit;
+ }
return_value = _tkinter_tkapp_createcommand_impl(self, name, func);
exit:
@@ -287,8 +296,9 @@ _tkinter_tkapp_deletecommand(TkappObject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *name;
- if (!PyArg_Parse(arg, "s:deletecommand", &name))
+ if (!PyArg_Parse(arg, "s:deletecommand", &name)) {
goto exit;
+ }
return_value = _tkinter_tkapp_deletecommand_impl(self, name);
exit:
@@ -318,8 +328,9 @@ _tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *args)
PyObject *func;
if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
- &file, &mask, &func))
+ &file, &mask, &func)) {
goto exit;
+ }
return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func);
exit:
@@ -377,8 +388,9 @@ _tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *args)
PyObject *func;
if (!PyArg_ParseTuple(args, "iO:createtimerhandler",
- &milliseconds, &func))
+ &milliseconds, &func)) {
goto exit;
+ }
return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func);
exit:
@@ -403,8 +415,9 @@ _tkinter_tkapp_mainloop(TkappObject *self, PyObject *args)
int threshold = 0;
if (!PyArg_ParseTuple(args, "|i:mainloop",
- &threshold))
+ &threshold)) {
goto exit;
+ }
return_value = _tkinter_tkapp_mainloop_impl(self, threshold);
exit:
@@ -429,8 +442,9 @@ _tkinter_tkapp_dooneevent(TkappObject *self, PyObject *args)
int flags = 0;
if (!PyArg_ParseTuple(args, "|i:dooneevent",
- &flags))
+ &flags)) {
goto exit;
+ }
return_value = _tkinter_tkapp_dooneevent_impl(self, flags);
exit:
@@ -551,8 +565,9 @@ _tkinter_create(PyObject *module, PyObject *args)
const char *use = NULL;
if (!PyArg_ParseTuple(args, "|zssiiiiz:create",
- &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use))
+ &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:
@@ -579,8 +594,9 @@ _tkinter_setbusywaitinterval(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_val;
- if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val))
+ if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val)) {
goto exit;
+ }
return_value = _tkinter_setbusywaitinterval_impl(module, new_val);
exit:
@@ -606,8 +622,9 @@ _tkinter_getbusywaitinterval(PyObject *module, PyObject *Py_UNUSED(ignored))
int _return_value;
_return_value = _tkinter_getbusywaitinterval_impl(module);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -621,4 +638,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
-/*[clinic end generated code: output=f9057c8bf288633d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=836c578b71d69097 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h
index 2d93679e12..ab84c304d9 100644
--- a/Modules/clinic/_weakref.c.h
+++ b/Modules/clinic/_weakref.c.h
@@ -21,8 +21,9 @@ _weakref_getweakrefcount(PyObject *module, PyObject *object)
Py_ssize_t _return_value;
_return_value = _weakref_getweakrefcount_impl(module, object);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -50,11 +51,12 @@ _weakref__remove_dead_weakref(PyObject *module, PyObject *args)
PyObject *key;
if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref",
- &PyDict_Type, &dct, &key))
+ &PyDict_Type, &dct, &key)) {
goto exit;
+ }
return_value = _weakref__remove_dead_weakref_impl(module, dct, key);
exit:
return return_value;
}
-/*[clinic end generated code: output=5764cb64a6f66ffd input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e860dd818a44bc9b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h
index ac38d374a2..5bfbaf0d56 100644
--- a/Modules/clinic/_winapi.c.h
+++ b/Modules/clinic/_winapi.c.h
@@ -19,8 +19,9 @@ _winapi_Overlapped_GetOverlappedResult(OverlappedObject *self, PyObject *arg)
PyObject *return_value = NULL;
int wait;
- if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait))
+ if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) {
goto exit;
+ }
return_value = _winapi_Overlapped_GetOverlappedResult_impl(self, wait);
exit:
@@ -79,8 +80,9 @@ _winapi_CloseHandle(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
HANDLE handle;
- if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle))
+ if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) {
goto exit;
+ }
return_value = _winapi_CloseHandle_impl(module, handle);
exit:
@@ -93,23 +95,25 @@ PyDoc_STRVAR(_winapi_ConnectNamedPipe__doc__,
"\n");
#define _WINAPI_CONNECTNAMEDPIPE_METHODDEF \
- {"ConnectNamedPipe", (PyCFunction)_winapi_ConnectNamedPipe, METH_VARARGS|METH_KEYWORDS, _winapi_ConnectNamedPipe__doc__},
+ {"ConnectNamedPipe", (PyCFunction)_winapi_ConnectNamedPipe, METH_FASTCALL, _winapi_ConnectNamedPipe__doc__},
static PyObject *
_winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle,
int use_overlapped);
static PyObject *
-_winapi_ConnectNamedPipe(PyObject *module, PyObject *args, PyObject *kwargs)
+_winapi_ConnectNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"handle", "overlapped", NULL};
+ static const char * const _keywords[] = {"handle", "overlapped", NULL};
+ static _PyArg_Parser _parser = {"" F_HANDLE "|i:ConnectNamedPipe", _keywords, 0};
HANDLE handle;
int use_overlapped = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "|i:ConnectNamedPipe", _keywords,
- &handle, &use_overlapped))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &handle, &use_overlapped)) {
goto exit;
+ }
return_value = _winapi_ConnectNamedPipe_impl(module, handle, use_overlapped);
exit:
@@ -147,13 +151,16 @@ _winapi_CreateFile(PyObject *module, PyObject *args)
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))
+ &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())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -180,8 +187,9 @@ _winapi_CreateJunction(PyObject *module, PyObject *args)
LPWSTR dst_path;
if (!PyArg_ParseTuple(args, "uu:CreateJunction",
- &src_path, &dst_path))
+ &src_path, &dst_path)) {
goto exit;
+ }
return_value = _winapi_CreateJunction_impl(module, src_path, dst_path);
exit:
@@ -220,13 +228,16 @@ _winapi_CreateNamedPipe(PyObject *module, PyObject *args)
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))
+ &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())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -258,8 +269,9 @@ _winapi_CreatePipe(PyObject *module, PyObject *args)
DWORD size;
if (!PyArg_ParseTuple(args, "Ok:CreatePipe",
- &pipe_attrs, &size))
+ &pipe_attrs, &size)) {
goto exit;
+ }
return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size);
exit:
@@ -308,8 +320,9 @@ _winapi_CreateProcess(PyObject *module, PyObject *args)
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))
+ &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:
@@ -351,13 +364,16 @@ _winapi_DuplicateHandle(PyObject *module, PyObject *args)
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))
+ &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())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -381,8 +397,9 @@ _winapi_ExitProcess(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
UINT ExitCode;
- if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode))
+ if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) {
goto exit;
+ }
return_value = _winapi_ExitProcess_impl(module, ExitCode);
exit:
@@ -408,10 +425,12 @@ _winapi_GetCurrentProcess(PyObject *module, PyObject *Py_UNUSED(ignored))
HANDLE _return_value;
_return_value = _winapi_GetCurrentProcess_impl(module);
- if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -437,11 +456,13 @@ _winapi_GetExitCodeProcess(PyObject *module, PyObject *arg)
HANDLE process;
DWORD _return_value;
- if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process))
+ if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) {
goto exit;
+ }
_return_value = _winapi_GetExitCodeProcess_impl(module, process);
- if ((_return_value == DWORD_MAX) && PyErr_Occurred())
+ if ((_return_value == DWORD_MAX) && PyErr_Occurred()) {
goto exit;
+ }
return_value = Py_BuildValue("k", _return_value);
exit:
@@ -466,8 +487,9 @@ _winapi_GetLastError(PyObject *module, PyObject *Py_UNUSED(ignored))
DWORD _return_value;
_return_value = _winapi_GetLastError_impl(module);
- if ((_return_value == DWORD_MAX) && PyErr_Occurred())
+ if ((_return_value == DWORD_MAX) && PyErr_Occurred()) {
goto exit;
+ }
return_value = Py_BuildValue("k", _return_value);
exit:
@@ -499,8 +521,9 @@ _winapi_GetModuleFileName(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
HMODULE module_handle;
- if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle))
+ if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) {
goto exit;
+ }
return_value = _winapi_GetModuleFileName_impl(module, module_handle);
exit:
@@ -531,13 +554,16 @@ _winapi_GetStdHandle(PyObject *module, PyObject *arg)
DWORD std_handle;
HANDLE _return_value;
- if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle))
+ 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())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -563,8 +589,9 @@ _winapi_GetVersion(PyObject *module, PyObject *Py_UNUSED(ignored))
long _return_value;
_return_value = _winapi_GetVersion_impl(module);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -593,13 +620,16 @@ _winapi_OpenProcess(PyObject *module, PyObject *args)
HANDLE _return_value;
if (!PyArg_ParseTuple(args, "kik:OpenProcess",
- &desired_access, &inherit_handle, &process_id))
+ &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())
+ if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
goto exit;
- if (_return_value == NULL)
+ }
+ if (_return_value == NULL) {
Py_RETURN_NONE;
+ }
return_value = HANDLE_TO_PYNUM(_return_value);
exit:
@@ -625,8 +655,9 @@ _winapi_PeekNamedPipe(PyObject *module, PyObject *args)
int size = 0;
if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe",
- &handle, &size))
+ &handle, &size)) {
goto exit;
+ }
return_value = _winapi_PeekNamedPipe_impl(module, handle, size);
exit:
@@ -639,24 +670,26 @@ PyDoc_STRVAR(_winapi_ReadFile__doc__,
"\n");
#define _WINAPI_READFILE_METHODDEF \
- {"ReadFile", (PyCFunction)_winapi_ReadFile, METH_VARARGS|METH_KEYWORDS, _winapi_ReadFile__doc__},
+ {"ReadFile", (PyCFunction)_winapi_ReadFile, METH_FASTCALL, _winapi_ReadFile__doc__},
static PyObject *
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size,
int use_overlapped);
static PyObject *
-_winapi_ReadFile(PyObject *module, PyObject *args, PyObject *kwargs)
+_winapi_ReadFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"handle", "size", "overlapped", NULL};
+ static const char * const _keywords[] = {"handle", "size", "overlapped", NULL};
+ static _PyArg_Parser _parser = {"" F_HANDLE "i|i:ReadFile", _keywords, 0};
HANDLE handle;
int size;
int use_overlapped = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "i|i:ReadFile", _keywords,
- &handle, &size, &use_overlapped))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &handle, &size, &use_overlapped)) {
goto exit;
+ }
return_value = _winapi_ReadFile_impl(module, handle, size, use_overlapped);
exit:
@@ -688,8 +721,9 @@ _winapi_SetNamedPipeHandleState(PyObject *module, PyObject *args)
PyObject *collect_data_timeout;
if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState",
- &named_pipe, &mode, &max_collection_count, &collect_data_timeout))
+ &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:
@@ -717,8 +751,9 @@ _winapi_TerminateProcess(PyObject *module, PyObject *args)
UINT exit_code;
if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess",
- &handle, &exit_code))
+ &handle, &exit_code)) {
goto exit;
+ }
return_value = _winapi_TerminateProcess_impl(module, handle, exit_code);
exit:
@@ -744,8 +779,9 @@ _winapi_WaitNamedPipe(PyObject *module, PyObject *args)
DWORD timeout;
if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe",
- &name, &timeout))
+ &name, &timeout)) {
goto exit;
+ }
return_value = _winapi_WaitNamedPipe_impl(module, name, timeout);
exit:
@@ -774,8 +810,9 @@ _winapi_WaitForMultipleObjects(PyObject *module, PyObject *args)
DWORD milliseconds = INFINITE;
if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects",
- &handle_seq, &wait_flag, &milliseconds))
+ &handle_seq, &wait_flag, &milliseconds)) {
goto exit;
+ }
return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds);
exit:
@@ -808,11 +845,13 @@ _winapi_WaitForSingleObject(PyObject *module, PyObject *args)
long _return_value;
if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject",
- &handle, &milliseconds))
+ &handle, &milliseconds)) {
goto exit;
+ }
_return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -825,27 +864,29 @@ PyDoc_STRVAR(_winapi_WriteFile__doc__,
"\n");
#define _WINAPI_WRITEFILE_METHODDEF \
- {"WriteFile", (PyCFunction)_winapi_WriteFile, METH_VARARGS|METH_KEYWORDS, _winapi_WriteFile__doc__},
+ {"WriteFile", (PyCFunction)_winapi_WriteFile, METH_FASTCALL, _winapi_WriteFile__doc__},
static PyObject *
_winapi_WriteFile_impl(PyObject *module, HANDLE handle, PyObject *buffer,
int use_overlapped);
static PyObject *
-_winapi_WriteFile(PyObject *module, PyObject *args, PyObject *kwargs)
+_winapi_WriteFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"handle", "buffer", "overlapped", NULL};
+ static const char * const _keywords[] = {"handle", "buffer", "overlapped", NULL};
+ static _PyArg_Parser _parser = {"" F_HANDLE "O|i:WriteFile", _keywords, 0};
HANDLE handle;
PyObject *buffer;
int use_overlapped = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "O|i:WriteFile", _keywords,
- &handle, &buffer, &use_overlapped))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &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=a4c4b2a9fcb0bea1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=46d6382a6662c4a9 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
index 0c7061a1d2..3b9fcdab0a 100644
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -77,8 +77,9 @@ array_array_pop(arrayobject *self, PyObject *args)
Py_ssize_t i = -1;
if (!PyArg_ParseTuple(args, "|n:pop",
- &i))
+ &i)) {
goto exit;
+ }
return_value = array_array_pop_impl(self, i);
exit:
@@ -114,8 +115,9 @@ array_array_insert(arrayobject *self, PyObject *args)
PyObject *v;
if (!PyArg_ParseTuple(args, "nO:insert",
- &i, &v))
+ &i, &v)) {
goto exit;
+ }
return_value = array_array_insert_impl(self, i, v);
exit:
@@ -211,8 +213,9 @@ array_array_fromfile(arrayobject *self, PyObject *args)
Py_ssize_t n;
if (!PyArg_ParseTuple(args, "On:fromfile",
- &f, &n))
+ &f, &n)) {
goto exit;
+ }
return_value = array_array_fromfile_impl(self, f, n);
exit:
@@ -275,14 +278,16 @@ array_array_fromstring(arrayobject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (!PyArg_Parse(arg, "s*:fromstring", &buffer))
+ if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) {
goto exit;
+ }
return_value = array_array_fromstring_impl(self, &buffer);
exit:
/* Cleanup for buffer */
- if (buffer.obj)
+ if (buffer.obj) {
PyBuffer_Release(&buffer);
+ }
return return_value;
}
@@ -305,14 +310,16 @@ array_array_frombytes(arrayobject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:frombytes", &buffer))
+ if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) {
goto exit;
+ }
return_value = array_array_frombytes_impl(self, &buffer);
exit:
/* Cleanup for buffer */
- if (buffer.obj)
+ if (buffer.obj) {
PyBuffer_Release(&buffer);
+ }
return return_value;
}
@@ -379,8 +386,9 @@ array_array_fromunicode(arrayobject *self, PyObject *arg)
Py_UNICODE *ustr;
Py_ssize_clean_t ustr_length;
- if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length))
+ if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) {
goto exit;
+ }
return_value = array_array_fromunicode_impl(self, ustr, ustr_length);
exit:
@@ -453,8 +461,9 @@ array__array_reconstructor(PyObject *module, PyObject *args)
PyObject *items;
if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor",
- &arraytype, &typecode, &mformat_code, &items))
+ &arraytype, &typecode, &mformat_code, &items)) {
goto exit;
+ }
return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
exit:
@@ -496,4 +505,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=305df3f5796039e4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b2054fb764c8cc64 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h
index 62e313b5bf..be4b718843 100644
--- a/Modules/clinic/audioop.c.h
+++ b/Modules/clinic/audioop.c.h
@@ -24,14 +24,16 @@ audioop_getsample(PyObject *module, PyObject *args)
Py_ssize_t index;
if (!PyArg_ParseTuple(args, "y*in:getsample",
- &fragment, &width, &index))
+ &fragment, &width, &index)) {
goto exit;
+ }
return_value = audioop_getsample_impl(module, &fragment, width, index);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -56,14 +58,16 @@ audioop_max(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:max",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_max_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -88,14 +92,16 @@ audioop_minmax(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:minmax",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_minmax_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -120,14 +126,16 @@ audioop_avg(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:avg",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_avg_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -152,14 +160,16 @@ audioop_rms(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:rms",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_rms_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -185,17 +195,20 @@ audioop_findfit(PyObject *module, PyObject *args)
Py_buffer reference = {NULL, NULL};
if (!PyArg_ParseTuple(args, "y*y*:findfit",
- &fragment, &reference))
+ &fragment, &reference)) {
goto exit;
+ }
return_value = audioop_findfit_impl(module, &fragment, &reference);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
/* Cleanup for reference */
- if (reference.obj)
+ if (reference.obj) {
PyBuffer_Release(&reference);
+ }
return return_value;
}
@@ -221,17 +234,20 @@ audioop_findfactor(PyObject *module, PyObject *args)
Py_buffer reference = {NULL, NULL};
if (!PyArg_ParseTuple(args, "y*y*:findfactor",
- &fragment, &reference))
+ &fragment, &reference)) {
goto exit;
+ }
return_value = audioop_findfactor_impl(module, &fragment, &reference);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
/* Cleanup for reference */
- if (reference.obj)
+ if (reference.obj) {
PyBuffer_Release(&reference);
+ }
return return_value;
}
@@ -257,14 +273,16 @@ audioop_findmax(PyObject *module, PyObject *args)
Py_ssize_t length;
if (!PyArg_ParseTuple(args, "y*n:findmax",
- &fragment, &length))
+ &fragment, &length)) {
goto exit;
+ }
return_value = audioop_findmax_impl(module, &fragment, length);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -289,14 +307,16 @@ audioop_avgpp(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:avgpp",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_avgpp_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -321,14 +341,16 @@ audioop_maxpp(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:maxpp",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_maxpp_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -353,14 +375,16 @@ audioop_cross(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:cross",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_cross_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -387,14 +411,16 @@ audioop_mul(PyObject *module, PyObject *args)
double factor;
if (!PyArg_ParseTuple(args, "y*id:mul",
- &fragment, &width, &factor))
+ &fragment, &width, &factor)) {
goto exit;
+ }
return_value = audioop_mul_impl(module, &fragment, width, factor);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -422,14 +448,16 @@ audioop_tomono(PyObject *module, PyObject *args)
double rfactor;
if (!PyArg_ParseTuple(args, "y*idd:tomono",
- &fragment, &width, &lfactor, &rfactor))
+ &fragment, &width, &lfactor, &rfactor)) {
goto exit;
+ }
return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -457,14 +485,16 @@ audioop_tostereo(PyObject *module, PyObject *args)
double rfactor;
if (!PyArg_ParseTuple(args, "y*idd:tostereo",
- &fragment, &width, &lfactor, &rfactor))
+ &fragment, &width, &lfactor, &rfactor)) {
goto exit;
+ }
return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -491,17 +521,20 @@ audioop_add(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*y*i:add",
- &fragment1, &fragment2, &width))
+ &fragment1, &fragment2, &width)) {
goto exit;
+ }
return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
exit:
/* Cleanup for fragment1 */
- if (fragment1.obj)
+ if (fragment1.obj) {
PyBuffer_Release(&fragment1);
+ }
/* Cleanup for fragment2 */
- if (fragment2.obj)
+ if (fragment2.obj) {
PyBuffer_Release(&fragment2);
+ }
return return_value;
}
@@ -527,14 +560,16 @@ audioop_bias(PyObject *module, PyObject *args)
int bias;
if (!PyArg_ParseTuple(args, "y*ii:bias",
- &fragment, &width, &bias))
+ &fragment, &width, &bias)) {
goto exit;
+ }
return_value = audioop_bias_impl(module, &fragment, width, bias);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -559,14 +594,16 @@ audioop_reverse(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:reverse",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_reverse_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -591,14 +628,16 @@ audioop_byteswap(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:byteswap",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_byteswap_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -625,14 +664,16 @@ audioop_lin2lin(PyObject *module, PyObject *args)
int newwidth;
if (!PyArg_ParseTuple(args, "y*ii:lin2lin",
- &fragment, &width, &newwidth))
+ &fragment, &width, &newwidth)) {
goto exit;
+ }
return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -666,14 +707,16 @@ audioop_ratecv(PyObject *module, PyObject *args)
int weightB = 0;
if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv",
- &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB))
+ &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) {
goto exit;
+ }
return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -698,14 +741,16 @@ audioop_lin2ulaw(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:lin2ulaw",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_lin2ulaw_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -730,14 +775,16 @@ audioop_ulaw2lin(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:ulaw2lin",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_ulaw2lin_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -762,14 +809,16 @@ audioop_lin2alaw(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:lin2alaw",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_lin2alaw_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -794,14 +843,16 @@ audioop_alaw2lin(PyObject *module, PyObject *args)
int width;
if (!PyArg_ParseTuple(args, "y*i:alaw2lin",
- &fragment, &width))
+ &fragment, &width)) {
goto exit;
+ }
return_value = audioop_alaw2lin_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -828,14 +879,16 @@ audioop_lin2adpcm(PyObject *module, PyObject *args)
PyObject *state;
if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm",
- &fragment, &width, &state))
+ &fragment, &width, &state)) {
goto exit;
+ }
return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
@@ -862,15 +915,17 @@ audioop_adpcm2lin(PyObject *module, PyObject *args)
PyObject *state;
if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin",
- &fragment, &width, &state))
+ &fragment, &width, &state)) {
goto exit;
+ }
return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
exit:
/* Cleanup for fragment */
- if (fragment.obj)
+ if (fragment.obj) {
PyBuffer_Release(&fragment);
+ }
return return_value;
}
-/*[clinic end generated code: output=385fb09fa21a62c0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e0ab74c3fa57c39c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index 6ace4d5381..743bf46ea8 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -20,8 +20,9 @@ binascii_a2b_uu(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -50,14 +51,16 @@ binascii_b2a_uu(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_uu", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) {
goto exit;
+ }
return_value = binascii_b2a_uu_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -80,8 +83,9 @@ binascii_a2b_base64(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -93,31 +97,37 @@ exit:
}
PyDoc_STRVAR(binascii_b2a_base64__doc__,
-"b2a_base64($module, data, /)\n"
+"b2a_base64($module, /, data, *, newline=True)\n"
"--\n"
"\n"
"Base64-code line of data.");
#define BINASCII_B2A_BASE64_METHODDEF \
- {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_O, binascii_b2a_base64__doc__},
+ {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_FASTCALL, binascii_b2a_base64__doc__},
static PyObject *
-binascii_b2a_base64_impl(PyObject *module, Py_buffer *data);
+binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline);
static PyObject *
-binascii_b2a_base64(PyObject *module, PyObject *arg)
+binascii_b2a_base64(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"data", "newline", NULL};
+ static _PyArg_Parser _parser = {"y*|$i:b2a_base64", _keywords, 0};
Py_buffer data = {NULL, NULL};
+ int newline = 1;
- if (!PyArg_Parse(arg, "y*:b2a_base64", &data))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &newline)) {
goto exit;
- return_value = binascii_b2a_base64_impl(module, &data);
+ }
+ return_value = binascii_b2a_base64_impl(module, &data, newline);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -140,8 +150,9 @@ binascii_a2b_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -170,14 +181,16 @@ binascii_rlecode_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) {
goto exit;
+ }
return_value = binascii_rlecode_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -200,14 +213,16 @@ binascii_b2a_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) {
goto exit;
+ }
return_value = binascii_b2a_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -230,14 +245,16 @@ binascii_rledecode_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) {
goto exit;
+ }
return_value = binascii_rledecode_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -263,17 +280,20 @@ binascii_crc_hqx(PyObject *module, PyObject *args)
unsigned int _return_value;
if (!PyArg_ParseTuple(args, "y*I:crc_hqx",
- &data, &crc))
+ &data, &crc)) {
goto exit;
+ }
_return_value = binascii_crc_hqx_impl(module, &data, crc);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -299,17 +319,20 @@ binascii_crc32(PyObject *module, PyObject *args)
unsigned int _return_value;
if (!PyArg_ParseTuple(args, "y*|I:crc32",
- &data, &crc))
+ &data, &crc)) {
goto exit;
+ }
_return_value = binascii_crc32_impl(module, &data, crc);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -335,14 +358,16 @@ binascii_b2a_hex(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_hex", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) {
goto exit;
+ }
return_value = binascii_b2a_hex_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -367,14 +392,16 @@ binascii_hexlify(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:hexlify", &data))
+ if (!PyArg_Parse(arg, "y*:hexlify", &data)) {
goto exit;
+ }
return_value = binascii_hexlify_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -400,8 +427,9 @@ binascii_a2b_hex(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer hexstr = {NULL, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -432,8 +460,9 @@ binascii_unhexlify(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer hexstr = {NULL, NULL};
- if (!PyArg_Parse(arg, "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);
exit:
@@ -451,22 +480,24 @@ PyDoc_STRVAR(binascii_a2b_qp__doc__,
"Decode a string of qp-encoded data.");
#define BINASCII_A2B_QP_METHODDEF \
- {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS|METH_KEYWORDS, binascii_a2b_qp__doc__},
+ {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_FASTCALL, binascii_a2b_qp__doc__},
static PyObject *
binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header);
static PyObject *
-binascii_a2b_qp(PyObject *module, PyObject *args, PyObject *kwargs)
+binascii_a2b_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"data", "header", NULL};
+ static const char * const _keywords[] = {"data", "header", NULL};
+ static _PyArg_Parser _parser = {"O&|i:a2b_qp", _keywords, 0};
Py_buffer data = {NULL, NULL};
int header = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i:a2b_qp", _keywords,
- ascii_buffer_converter, &data, &header))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ ascii_buffer_converter, &data, &header)) {
goto exit;
+ }
return_value = binascii_a2b_qp_impl(module, &data, header);
exit:
@@ -488,32 +519,35 @@ PyDoc_STRVAR(binascii_b2a_qp__doc__,
"are both encoded. When quotetabs is set, space and tabs are encoded.");
#define BINASCII_B2A_QP_METHODDEF \
- {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS|METH_KEYWORDS, binascii_b2a_qp__doc__},
+ {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_FASTCALL, binascii_b2a_qp__doc__},
static PyObject *
binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
int istext, int header);
static PyObject *
-binascii_b2a_qp(PyObject *module, PyObject *args, PyObject *kwargs)
+binascii_b2a_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"data", "quotetabs", "istext", "header", NULL};
+ static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL};
+ static _PyArg_Parser _parser = {"y*|iii:b2a_qp", _keywords, 0};
Py_buffer data = {NULL, NULL};
int quotetabs = 0;
int istext = 1;
int header = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii:b2a_qp", _keywords,
- &data, &quotetabs, &istext, &header))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &quotetabs, &istext, &header)) {
goto exit;
+ }
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
-/*[clinic end generated code: output=6d70d5edd9373d92 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h
index a255353d4a..05431fa7af 100644
--- a/Modules/clinic/cmathmodule.c.h
+++ b/Modules/clinic/cmathmodule.c.h
@@ -21,8 +21,9 @@ cmath_acos(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:acos", &z))
+ 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);
@@ -62,8 +63,9 @@ cmath_acosh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:acosh", &z))
+ 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);
@@ -103,8 +105,9 @@ cmath_asin(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:asin", &z))
+ 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);
@@ -144,8 +147,9 @@ cmath_asinh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:asinh", &z))
+ 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);
@@ -185,8 +189,9 @@ cmath_atan(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:atan", &z))
+ 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);
@@ -226,8 +231,9 @@ cmath_atanh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:atanh", &z))
+ 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);
@@ -267,8 +273,9 @@ cmath_cos(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:cos", &z))
+ 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);
@@ -308,8 +315,9 @@ cmath_cosh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:cosh", &z))
+ 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);
@@ -349,8 +357,9 @@ cmath_exp(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:exp", &z))
+ 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);
@@ -390,8 +399,9 @@ cmath_log10(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:log10", &z))
+ 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);
@@ -431,8 +441,9 @@ cmath_sin(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:sin", &z))
+ 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);
@@ -472,8 +483,9 @@ cmath_sinh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:sinh", &z))
+ 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);
@@ -513,8 +525,9 @@ cmath_sqrt(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:sqrt", &z))
+ 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);
@@ -554,8 +567,9 @@ cmath_tan(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:tan", &z))
+ 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);
@@ -595,8 +609,9 @@ cmath_tanh(PyObject *module, PyObject *arg)
Py_complex z;
Py_complex _return_value;
- if (!PyArg_Parse(arg, "D:tanh", &z))
+ 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);
@@ -639,8 +654,9 @@ cmath_log(PyObject *module, PyObject *args)
PyObject *y_obj = NULL;
if (!PyArg_ParseTuple(args, "D|O:log",
- &x, &y_obj))
+ &x, &y_obj)) {
goto exit;
+ }
return_value = cmath_log_impl(module, x, y_obj);
exit:
@@ -665,8 +681,9 @@ cmath_phase(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_complex z;
- if (!PyArg_Parse(arg, "D:phase", &z))
+ if (!PyArg_Parse(arg, "D:phase", &z)) {
goto exit;
+ }
return_value = cmath_phase_impl(module, z);
exit:
@@ -693,8 +710,9 @@ cmath_polar(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_complex z;
- if (!PyArg_Parse(arg, "D:polar", &z))
+ if (!PyArg_Parse(arg, "D:polar", &z)) {
goto exit;
+ }
return_value = cmath_polar_impl(module, z);
exit:
@@ -721,8 +739,9 @@ cmath_rect(PyObject *module, PyObject *args)
double phi;
if (!PyArg_ParseTuple(args, "dd:rect",
- &r, &phi))
+ &r, &phi)) {
goto exit;
+ }
return_value = cmath_rect_impl(module, r, phi);
exit:
@@ -747,8 +766,9 @@ cmath_isfinite(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_complex z;
- if (!PyArg_Parse(arg, "D:isfinite", &z))
+ if (!PyArg_Parse(arg, "D:isfinite", &z)) {
goto exit;
+ }
return_value = cmath_isfinite_impl(module, z);
exit:
@@ -773,8 +793,9 @@ cmath_isnan(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_complex z;
- if (!PyArg_Parse(arg, "D:isnan", &z))
+ if (!PyArg_Parse(arg, "D:isnan", &z)) {
goto exit;
+ }
return_value = cmath_isnan_impl(module, z);
exit:
@@ -799,8 +820,9 @@ cmath_isinf(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_complex z;
- if (!PyArg_Parse(arg, "D:isinf", &z))
+ if (!PyArg_Parse(arg, "D:isinf", &z)) {
goto exit;
+ }
return_value = cmath_isinf_impl(module, z);
exit:
@@ -829,32 +851,35 @@ PyDoc_STRVAR(cmath_isclose__doc__,
"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__},
+ {"isclose", (PyCFunction)cmath_isclose, METH_FASTCALL, cmath_isclose__doc__},
static int
cmath_isclose_impl(PyObject *module, Py_complex a, Py_complex b,
double rel_tol, double abs_tol);
static PyObject *
-cmath_isclose(PyObject *module, PyObject *args, PyObject *kwargs)
+cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
+ static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
+ static _PyArg_Parser _parser = {"DD|$dd:isclose", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &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())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
return return_value;
}
-/*[clinic end generated code: output=732194029b7fb1e7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=978f59702b41655f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h
index 67660ebdcb..84a004bb59 100644
--- a/Modules/clinic/fcntlmodule.c.h
+++ b/Modules/clinic/fcntlmodule.c.h
@@ -33,8 +33,9 @@ fcntl_fcntl(PyObject *module, PyObject *args)
PyObject *arg = NULL;
if (!PyArg_ParseTuple(args, "O&i|O:fcntl",
- conv_descriptor, &fd, &code, &arg))
+ conv_descriptor, &fd, &code, &arg)) {
goto exit;
+ }
return_value = fcntl_fcntl_impl(module, fd, code, arg);
exit:
@@ -91,8 +92,9 @@ fcntl_ioctl(PyObject *module, PyObject *args)
int mutate_arg = 1;
if (!PyArg_ParseTuple(args, "O&I|Op:ioctl",
- conv_descriptor, &fd, &code, &ob_arg, &mutate_arg))
+ conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) {
goto exit;
+ }
return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
exit:
@@ -122,8 +124,9 @@ fcntl_flock(PyObject *module, PyObject *args)
int code;
if (!PyArg_ParseTuple(args, "O&i:flock",
- conv_descriptor, &fd, &code))
+ conv_descriptor, &fd, &code)) {
goto exit;
+ }
return_value = fcntl_flock_impl(module, fd, code);
exit:
@@ -175,11 +178,12 @@ fcntl_lockf(PyObject *module, PyObject *args)
int whence = 0;
if (!PyArg_ParseTuple(args, "O&i|OOi:lockf",
- conv_descriptor, &fd, &code, &lenobj, &startobj, &whence))
+ 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=97b1306b864c01c8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=36cff76a8fb2c9a6 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h
index 2c47a4236b..0282b4e477 100644
--- a/Modules/clinic/grpmodule.c.h
+++ b/Modules/clinic/grpmodule.c.h
@@ -11,21 +11,23 @@ PyDoc_STRVAR(grp_getgrgid__doc__,
"If id is not valid, raise KeyError.");
#define GRP_GETGRGID_METHODDEF \
- {"getgrgid", (PyCFunction)grp_getgrgid, METH_VARARGS|METH_KEYWORDS, grp_getgrgid__doc__},
+ {"getgrgid", (PyCFunction)grp_getgrgid, METH_FASTCALL, grp_getgrgid__doc__},
static PyObject *
grp_getgrgid_impl(PyObject *module, PyObject *id);
static PyObject *
-grp_getgrgid(PyObject *module, PyObject *args, PyObject *kwargs)
+grp_getgrgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"id", NULL};
+ static const char * const _keywords[] = {"id", NULL};
+ static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
PyObject *id;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:getgrgid", _keywords,
- &id))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &id)) {
goto exit;
+ }
return_value = grp_getgrgid_impl(module, id);
exit:
@@ -41,21 +43,23 @@ PyDoc_STRVAR(grp_getgrnam__doc__,
"If name is not valid, raise KeyError.");
#define GRP_GETGRNAM_METHODDEF \
- {"getgrnam", (PyCFunction)grp_getgrnam, METH_VARARGS|METH_KEYWORDS, grp_getgrnam__doc__},
+ {"getgrnam", (PyCFunction)grp_getgrnam, METH_FASTCALL, grp_getgrnam__doc__},
static PyObject *
grp_getgrnam_impl(PyObject *module, PyObject *name);
static PyObject *
-grp_getgrnam(PyObject *module, PyObject *args, PyObject *kwargs)
+grp_getgrnam(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"name", NULL};
+ static const char * const _keywords[] = {"name", NULL};
+ static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
PyObject *name;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:getgrnam", _keywords,
- &name))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &name)) {
goto exit;
+ }
return_value = grp_getgrnam_impl(module, name);
exit:
@@ -82,4 +86,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return grp_getgrall_impl(module);
}
-/*[clinic end generated code: output=bee09feefc54a2cb input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d6417ae0a7298e0e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h
index 0bd958ac6e..a841fe5786 100644
--- a/Modules/clinic/md5module.c.h
+++ b/Modules/clinic/md5module.c.h
@@ -72,24 +72,26 @@ PyDoc_STRVAR(_md5_md5__doc__,
"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__},
+ {"md5", (PyCFunction)_md5_md5, METH_FASTCALL, _md5_md5__doc__},
static PyObject *
_md5_md5_impl(PyObject *module, PyObject *string);
static PyObject *
-_md5_md5(PyObject *module, PyObject *args, PyObject *kwargs)
+_md5_md5(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:md5", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:md5", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string)) {
goto exit;
+ }
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=4cd3cc96e35563d2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=54cd50db050f2589 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index b3521d81c6..0d3ce6eed6 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -9,7 +9,8 @@ PyDoc_STRVAR(os_stat__doc__,
"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"
+" Path to be examined; can be string, bytes, path-like object or\n"
+" 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"
@@ -27,23 +28,25 @@ PyDoc_STRVAR(os_stat__doc__,
" an open file descriptor.");
#define OS_STAT_METHODDEF \
- {"stat", (PyCFunction)os_stat, METH_VARARGS|METH_KEYWORDS, os_stat__doc__},
+ {"stat", (PyCFunction)os_stat, METH_FASTCALL, os_stat__doc__},
static PyObject *
os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks);
static PyObject *
-os_stat(PyObject *module, PyObject *args, PyObject *kwargs)
+os_stat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "dir_fd", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&|$O&p:stat", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -63,22 +66,24 @@ PyDoc_STRVAR(os_lstat__doc__,
"Equivalent to stat(path, follow_symlinks=False).");
#define OS_LSTAT_METHODDEF \
- {"lstat", (PyCFunction)os_lstat, METH_VARARGS|METH_KEYWORDS, os_lstat__doc__},
+ {"lstat", (PyCFunction)os_lstat, METH_FASTCALL, os_lstat__doc__},
static PyObject *
os_lstat_impl(PyObject *module, path_t *path, int dir_fd);
static PyObject *
-os_lstat(PyObject *module, PyObject *args, PyObject *kwargs)
+os_lstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|$O&:lstat", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_lstat_impl(module, &path, dir_fd);
exit:
@@ -121,17 +126,18 @@ PyDoc_STRVAR(os_access__doc__,
" has the specified access to the path.");
#define OS_ACCESS_METHODDEF \
- {"access", (PyCFunction)os_access, METH_VARARGS|METH_KEYWORDS, os_access__doc__},
+ {"access", (PyCFunction)os_access, METH_FASTCALL, os_access__doc__},
static int
os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd,
int effective_ids, int follow_symlinks);
static PyObject *
-os_access(PyObject *module, PyObject *args, PyObject *kwargs)
+os_access(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "mode", "dir_fd", "effective_ids", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&i|$O&pp:access", _keywords, 0};
path_t path = PATH_T_INITIALIZE("access", "path", 0, 0);
int mode;
int dir_fd = DEFAULT_DIR_FD;
@@ -139,12 +145,14 @@ os_access(PyObject *module, PyObject *args, PyObject *kwargs)
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -178,11 +186,13 @@ os_ttyname(PyObject *module, PyObject *arg)
int fd;
char *_return_value;
- if (!PyArg_Parse(arg, "i:ttyname", &fd))
+ if (!PyArg_Parse(arg, "i:ttyname", &fd)) {
goto exit;
+ }
_return_value = os_ttyname_impl(module, fd);
- if (_return_value == NULL)
+ if (_return_value == NULL) {
goto exit;
+ }
return_value = PyUnicode_DecodeFSDefault(_return_value);
exit:
@@ -224,21 +234,23 @@ PyDoc_STRVAR(os_chdir__doc__,
" 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__},
+ {"chdir", (PyCFunction)os_chdir, METH_FASTCALL, os_chdir__doc__},
static PyObject *
os_chdir_impl(PyObject *module, path_t *path);
static PyObject *
-os_chdir(PyObject *module, PyObject *args, PyObject *kwargs)
+os_chdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"O&:chdir", _keywords, 0};
path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR);
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chdir", _keywords,
- path_converter, &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_chdir_impl(module, &path);
exit:
@@ -260,21 +272,23 @@ PyDoc_STRVAR(os_fchdir__doc__,
"Equivalent to os.chdir(fd).");
#define OS_FCHDIR_METHODDEF \
- {"fchdir", (PyCFunction)os_fchdir, METH_VARARGS|METH_KEYWORDS, os_fchdir__doc__},
+ {"fchdir", (PyCFunction)os_fchdir, METH_FASTCALL, os_fchdir__doc__},
static PyObject *
os_fchdir_impl(PyObject *module, int fd);
static PyObject *
-os_fchdir(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fchdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"O&:fchdir", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fchdir", _keywords,
- fildes_converter, &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fchdir_impl(module, fd);
exit:
@@ -310,25 +324,27 @@ PyDoc_STRVAR(os_chmod__doc__,
" 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__},
+ {"chmod", (PyCFunction)os_chmod, METH_FASTCALL, os_chmod__doc__},
static PyObject *
os_chmod_impl(PyObject *module, path_t *path, int mode, int dir_fd,
int follow_symlinks);
static PyObject *
-os_chmod(PyObject *module, PyObject *args, PyObject *kwargs)
+os_chmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "mode", "dir_fd", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&i|$O&p:chmod", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -349,22 +365,24 @@ PyDoc_STRVAR(os_fchmod__doc__,
"Equivalent to os.chmod(fd, mode).");
#define OS_FCHMOD_METHODDEF \
- {"fchmod", (PyCFunction)os_fchmod, METH_VARARGS|METH_KEYWORDS, os_fchmod__doc__},
+ {"fchmod", (PyCFunction)os_fchmod, METH_FASTCALL, os_fchmod__doc__},
static PyObject *
os_fchmod_impl(PyObject *module, int fd, int mode);
static PyObject *
-os_fchmod(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", "mode", NULL};
+ static const char * const _keywords[] = {"fd", "mode", NULL};
+ static _PyArg_Parser _parser = {"ii:fchmod", _keywords, 0};
int fd;
int mode;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:fchmod", _keywords,
- &fd, &mode))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd, &mode)) {
goto exit;
+ }
return_value = os_fchmod_impl(module, fd, mode);
exit:
@@ -385,22 +403,24 @@ PyDoc_STRVAR(os_lchmod__doc__,
"Equivalent to chmod(path, mode, follow_symlinks=False).\"");
#define OS_LCHMOD_METHODDEF \
- {"lchmod", (PyCFunction)os_lchmod, METH_VARARGS|METH_KEYWORDS, os_lchmod__doc__},
+ {"lchmod", (PyCFunction)os_lchmod, METH_FASTCALL, os_lchmod__doc__},
static PyObject *
os_lchmod_impl(PyObject *module, path_t *path, int mode);
static PyObject *
-os_lchmod(PyObject *module, PyObject *args, PyObject *kwargs)
+os_lchmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", NULL};
+ static const char * const _keywords[] = {"path", "mode", NULL};
+ static _PyArg_Parser _parser = {"O&i:lchmod", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &mode)) {
goto exit;
+ }
return_value = os_lchmod_impl(module, &path, mode);
exit:
@@ -427,24 +447,26 @@ PyDoc_STRVAR(os_chflags__doc__,
"unavailable, using it will raise a NotImplementedError.");
#define OS_CHFLAGS_METHODDEF \
- {"chflags", (PyCFunction)os_chflags, METH_VARARGS|METH_KEYWORDS, os_chflags__doc__},
+ {"chflags", (PyCFunction)os_chflags, METH_FASTCALL, os_chflags__doc__},
static PyObject *
os_chflags_impl(PyObject *module, path_t *path, unsigned long flags,
int follow_symlinks);
static PyObject *
-os_chflags(PyObject *module, PyObject *args, PyObject *kwargs)
+os_chflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "flags", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "flags", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&k|p:chflags", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &flags, &follow_symlinks)) {
goto exit;
+ }
return_value = os_chflags_impl(module, &path, flags, follow_symlinks);
exit:
@@ -468,22 +490,24 @@ PyDoc_STRVAR(os_lchflags__doc__,
"Equivalent to chflags(path, flags, follow_symlinks=False).");
#define OS_LCHFLAGS_METHODDEF \
- {"lchflags", (PyCFunction)os_lchflags, METH_VARARGS|METH_KEYWORDS, os_lchflags__doc__},
+ {"lchflags", (PyCFunction)os_lchflags, METH_FASTCALL, os_lchflags__doc__},
static PyObject *
os_lchflags_impl(PyObject *module, path_t *path, unsigned long flags);
static PyObject *
-os_lchflags(PyObject *module, PyObject *args, PyObject *kwargs)
+os_lchflags(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "flags", NULL};
+ static const char * const _keywords[] = {"path", "flags", NULL};
+ static _PyArg_Parser _parser = {"O&k:lchflags", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &flags)) {
goto exit;
+ }
return_value = os_lchflags_impl(module, &path, flags);
exit:
@@ -504,21 +528,23 @@ PyDoc_STRVAR(os_chroot__doc__,
"Change root directory to path.");
#define OS_CHROOT_METHODDEF \
- {"chroot", (PyCFunction)os_chroot, METH_VARARGS|METH_KEYWORDS, os_chroot__doc__},
+ {"chroot", (PyCFunction)os_chroot, METH_FASTCALL, os_chroot__doc__},
static PyObject *
os_chroot_impl(PyObject *module, path_t *path);
static PyObject *
-os_chroot(PyObject *module, PyObject *args, PyObject *kwargs)
+os_chroot(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"O&:chroot", _keywords, 0};
path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0);
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chroot", _keywords,
- path_converter, &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_chroot_impl(module, &path);
exit:
@@ -539,21 +565,23 @@ PyDoc_STRVAR(os_fsync__doc__,
"Force write of fd to disk.");
#define OS_FSYNC_METHODDEF \
- {"fsync", (PyCFunction)os_fsync, METH_VARARGS|METH_KEYWORDS, os_fsync__doc__},
+ {"fsync", (PyCFunction)os_fsync, METH_FASTCALL, os_fsync__doc__},
static PyObject *
os_fsync_impl(PyObject *module, int fd);
static PyObject *
-os_fsync(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fsync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"O&:fsync", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fsync", _keywords,
- fildes_converter, &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fsync_impl(module, fd);
exit:
@@ -593,21 +621,23 @@ PyDoc_STRVAR(os_fdatasync__doc__,
"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__},
+ {"fdatasync", (PyCFunction)os_fdatasync, METH_FASTCALL, os_fdatasync__doc__},
static PyObject *
os_fdatasync_impl(PyObject *module, int fd);
static PyObject *
-os_fdatasync(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fdatasync(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"O&:fdatasync", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fdatasync", _keywords,
- fildes_converter, &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ fildes_converter, &fd)) {
goto exit;
+ }
return_value = os_fdatasync_impl(module, fd);
exit:
@@ -649,26 +679,28 @@ PyDoc_STRVAR(os_chown__doc__,
" 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__},
+ {"chown", (PyCFunction)os_chown, METH_FASTCALL, os_chown__doc__},
static PyObject *
os_chown_impl(PyObject *module, path_t *path, uid_t uid, gid_t gid,
int dir_fd, int follow_symlinks);
static PyObject *
-os_chown(PyObject *module, PyObject *args, PyObject *kwargs)
+os_chown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "uid", "gid", "dir_fd", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "uid", "gid", "dir_fd", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&O&O&|$O&p:chown", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -691,23 +723,25 @@ PyDoc_STRVAR(os_fchown__doc__,
"Equivalent to os.chown(fd, uid, gid).");
#define OS_FCHOWN_METHODDEF \
- {"fchown", (PyCFunction)os_fchown, METH_VARARGS|METH_KEYWORDS, os_fchown__doc__},
+ {"fchown", (PyCFunction)os_fchown, METH_FASTCALL, os_fchown__doc__},
static PyObject *
os_fchown_impl(PyObject *module, int fd, uid_t uid, gid_t gid);
static PyObject *
-os_fchown(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", "uid", "gid", NULL};
+ static const char * const _keywords[] = {"fd", "uid", "gid", NULL};
+ static _PyArg_Parser _parser = {"iO&O&:fchown", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_fchown_impl(module, fd, uid, gid);
exit:
@@ -728,23 +762,25 @@ PyDoc_STRVAR(os_lchown__doc__,
"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__},
+ {"lchown", (PyCFunction)os_lchown, METH_FASTCALL, os_lchown__doc__},
static PyObject *
os_lchown_impl(PyObject *module, path_t *path, uid_t uid, gid_t gid);
static PyObject *
-os_lchown(PyObject *module, PyObject *args, PyObject *kwargs)
+os_lchown(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "uid", "gid", NULL};
+ static const char * const _keywords[] = {"path", "uid", "gid", NULL};
+ static _PyArg_Parser _parser = {"O&O&O&:lchown", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_lchown_impl(module, &path, uid, gid);
exit:
@@ -812,26 +848,28 @@ PyDoc_STRVAR(os_link__doc__,
" NotImplementedError.");
#define OS_LINK_METHODDEF \
- {"link", (PyCFunction)os_link, METH_VARARGS|METH_KEYWORDS, os_link__doc__},
+ {"link", (PyCFunction)os_link, METH_FASTCALL, os_link__doc__},
static PyObject *
os_link_impl(PyObject *module, path_t *src, path_t *dst, int src_dir_fd,
int dst_dir_fd, int follow_symlinks);
static PyObject *
-os_link(PyObject *module, PyObject *args, PyObject *kwargs)
+os_link(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&O&|$O&O&p:link", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -863,21 +901,23 @@ PyDoc_STRVAR(os_listdir__doc__,
"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__},
+ {"listdir", (PyCFunction)os_listdir, METH_FASTCALL, os_listdir__doc__},
static PyObject *
os_listdir_impl(PyObject *module, path_t *path);
static PyObject *
-os_listdir(PyObject *module, PyObject *args, PyObject *kwargs)
+os_listdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"|O&:listdir", _keywords, 0};
path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR);
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", _keywords,
- path_converter, &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_listdir_impl(module, &path);
exit:
@@ -906,8 +946,9 @@ os__getfullpathname(PyObject *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))
+ if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) {
goto exit;
+ }
return_value = os__getfullpathname_impl(module, &path);
exit:
@@ -939,8 +980,9 @@ os__getfinalpathname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *path;
- if (!PyArg_Parse(arg, "U:_getfinalpathname", &path))
+ if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) {
goto exit;
+ }
return_value = os__getfinalpathname_impl(module, path);
exit:
@@ -969,8 +1011,9 @@ os__isdir(PyObject *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))
+ if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) {
goto exit;
+ }
return_value = os__isdir_impl(module, &path);
exit:
@@ -991,21 +1034,23 @@ PyDoc_STRVAR(os__getvolumepathname__doc__,
"A helper function for ismount on Win32.");
#define OS__GETVOLUMEPATHNAME_METHODDEF \
- {"_getvolumepathname", (PyCFunction)os__getvolumepathname, METH_VARARGS|METH_KEYWORDS, os__getvolumepathname__doc__},
+ {"_getvolumepathname", (PyCFunction)os__getvolumepathname, METH_FASTCALL, os__getvolumepathname__doc__},
static PyObject *
os__getvolumepathname_impl(PyObject *module, PyObject *path);
static PyObject *
-os__getvolumepathname(PyObject *module, PyObject *args, PyObject *kwargs)
+os__getvolumepathname(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"U:_getvolumepathname", _keywords, 0};
PyObject *path;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:_getvolumepathname", _keywords,
- &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path)) {
goto exit;
+ }
return_value = os__getvolumepathname_impl(module, path);
exit:
@@ -1028,23 +1073,25 @@ PyDoc_STRVAR(os_mkdir__doc__,
"The mode argument is ignored on Windows.");
#define OS_MKDIR_METHODDEF \
- {"mkdir", (PyCFunction)os_mkdir, METH_VARARGS|METH_KEYWORDS, os_mkdir__doc__},
+ {"mkdir", (PyCFunction)os_mkdir, METH_FASTCALL, os_mkdir__doc__},
static PyObject *
os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd);
static PyObject *
-os_mkdir(PyObject *module, PyObject *args, PyObject *kwargs)
+os_mkdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|i$O&:mkdir", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_mkdir_impl(module, &path, mode, dir_fd);
exit:
@@ -1074,8 +1121,9 @@ os_nice(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int increment;
- if (!PyArg_Parse(arg, "i:nice", &increment))
+ if (!PyArg_Parse(arg, "i:nice", &increment)) {
goto exit;
+ }
return_value = os_nice_impl(module, increment);
exit:
@@ -1093,22 +1141,24 @@ PyDoc_STRVAR(os_getpriority__doc__,
"Return program scheduling priority.");
#define OS_GETPRIORITY_METHODDEF \
- {"getpriority", (PyCFunction)os_getpriority, METH_VARARGS|METH_KEYWORDS, os_getpriority__doc__},
+ {"getpriority", (PyCFunction)os_getpriority, METH_FASTCALL, os_getpriority__doc__},
static PyObject *
os_getpriority_impl(PyObject *module, int which, int who);
static PyObject *
-os_getpriority(PyObject *module, PyObject *args, PyObject *kwargs)
+os_getpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"which", "who", NULL};
+ static const char * const _keywords[] = {"which", "who", NULL};
+ static _PyArg_Parser _parser = {"ii:getpriority", _keywords, 0};
int which;
int who;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:getpriority", _keywords,
- &which, &who))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &which, &who)) {
goto exit;
+ }
return_value = os_getpriority_impl(module, which, who);
exit:
@@ -1126,23 +1176,25 @@ PyDoc_STRVAR(os_setpriority__doc__,
"Set program scheduling priority.");
#define OS_SETPRIORITY_METHODDEF \
- {"setpriority", (PyCFunction)os_setpriority, METH_VARARGS|METH_KEYWORDS, os_setpriority__doc__},
+ {"setpriority", (PyCFunction)os_setpriority, METH_FASTCALL, os_setpriority__doc__},
static PyObject *
os_setpriority_impl(PyObject *module, int which, int who, int priority);
static PyObject *
-os_setpriority(PyObject *module, PyObject *args, PyObject *kwargs)
+os_setpriority(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"which", "who", "priority", NULL};
+ static const char * const _keywords[] = {"which", "who", "priority", NULL};
+ static _PyArg_Parser _parser = {"iii:setpriority", _keywords, 0};
int which;
int who;
int priority;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iii:setpriority", _keywords,
- &which, &who, &priority))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &which, &who, &priority)) {
goto exit;
+ }
return_value = os_setpriority_impl(module, which, who, priority);
exit:
@@ -1164,25 +1216,27 @@ PyDoc_STRVAR(os_rename__doc__,
" 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__},
+ {"rename", (PyCFunction)os_rename, METH_FASTCALL, os_rename__doc__},
static PyObject *
os_rename_impl(PyObject *module, path_t *src, path_t *dst, int src_dir_fd,
int dst_dir_fd);
static PyObject *
-os_rename(PyObject *module, PyObject *args, PyObject *kwargs)
+os_rename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&O&|$O&O&:rename", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -1207,25 +1261,27 @@ PyDoc_STRVAR(os_replace__doc__,
" 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__},
+ {"replace", (PyCFunction)os_replace, METH_FASTCALL, os_replace__doc__},
static PyObject *
os_replace_impl(PyObject *module, path_t *src, path_t *dst, int src_dir_fd,
int dst_dir_fd);
static PyObject *
-os_replace(PyObject *module, PyObject *args, PyObject *kwargs)
+os_replace(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ static const char * const _keywords[] = {"src", "dst", "src_dir_fd", "dst_dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&O&|$O&O&:replace", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -1249,22 +1305,24 @@ PyDoc_STRVAR(os_rmdir__doc__,
" 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__},
+ {"rmdir", (PyCFunction)os_rmdir, METH_FASTCALL, os_rmdir__doc__},
static PyObject *
os_rmdir_impl(PyObject *module, path_t *path, int dir_fd);
static PyObject *
-os_rmdir(PyObject *module, PyObject *args, PyObject *kwargs)
+os_rmdir(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|$O&:rmdir", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_rmdir_impl(module, &path, dir_fd);
exit:
@@ -1283,25 +1341,28 @@ PyDoc_STRVAR(os_system__doc__,
"Execute the command in a subshell.");
#define OS_SYSTEM_METHODDEF \
- {"system", (PyCFunction)os_system, METH_VARARGS|METH_KEYWORDS, os_system__doc__},
+ {"system", (PyCFunction)os_system, METH_FASTCALL, os_system__doc__},
static long
os_system_impl(PyObject *module, Py_UNICODE *command);
static PyObject *
-os_system(PyObject *module, PyObject *args, PyObject *kwargs)
+os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"command", NULL};
+ static const char * const _keywords[] = {"command", NULL};
+ static _PyArg_Parser _parser = {"u:system", _keywords, 0};
Py_UNICODE *command;
long _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:system", _keywords,
- &command))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &command)) {
goto exit;
+ }
_return_value = os_system_impl(module, command);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -1319,25 +1380,28 @@ PyDoc_STRVAR(os_system__doc__,
"Execute the command in a subshell.");
#define OS_SYSTEM_METHODDEF \
- {"system", (PyCFunction)os_system, METH_VARARGS|METH_KEYWORDS, os_system__doc__},
+ {"system", (PyCFunction)os_system, METH_FASTCALL, os_system__doc__},
static long
os_system_impl(PyObject *module, PyObject *command);
static PyObject *
-os_system(PyObject *module, PyObject *args, PyObject *kwargs)
+os_system(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"command", NULL};
+ static const char * const _keywords[] = {"command", NULL};
+ static _PyArg_Parser _parser = {"O&:system", _keywords, 0};
PyObject *command = NULL;
long _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:system", _keywords,
- PyUnicode_FSConverter, &command))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ PyUnicode_FSConverter, &command)) {
goto exit;
+ }
_return_value = os_system_impl(module, command);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -1367,8 +1431,9 @@ os_umask(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int mask;
- if (!PyArg_Parse(arg, "i:umask", &mask))
+ if (!PyArg_Parse(arg, "i:umask", &mask)) {
goto exit;
+ }
return_value = os_umask_impl(module, mask);
exit:
@@ -1387,22 +1452,24 @@ PyDoc_STRVAR(os_unlink__doc__,
" 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__},
+ {"unlink", (PyCFunction)os_unlink, METH_FASTCALL, os_unlink__doc__},
static PyObject *
os_unlink_impl(PyObject *module, path_t *path, int dir_fd);
static PyObject *
-os_unlink(PyObject *module, PyObject *args, PyObject *kwargs)
+os_unlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|$O&:unlink", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_unlink_impl(module, &path, dir_fd);
exit:
@@ -1424,22 +1491,24 @@ PyDoc_STRVAR(os_remove__doc__,
" 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__},
+ {"remove", (PyCFunction)os_remove, METH_FASTCALL, os_remove__doc__},
static PyObject *
os_remove_impl(PyObject *module, path_t *path, int dir_fd);
static PyObject *
-os_remove(PyObject *module, PyObject *args, PyObject *kwargs)
+os_remove(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|$O&:remove", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_remove_impl(module, &path, dir_fd);
exit:
@@ -1504,26 +1573,28 @@ PyDoc_STRVAR(os_utime__doc__,
" 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__},
+ {"utime", (PyCFunction)os_utime, METH_FASTCALL, os_utime__doc__},
static PyObject *
os_utime_impl(PyObject *module, path_t *path, PyObject *times, PyObject *ns,
int dir_fd, int follow_symlinks);
static PyObject *
-os_utime(PyObject *module, PyObject *args, PyObject *kwargs)
+os_utime(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "times", "ns", "dir_fd", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "times", "ns", "dir_fd", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&|O$OO&p:utime", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -1540,21 +1611,23 @@ PyDoc_STRVAR(os__exit__doc__,
"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__},
+ {"_exit", (PyCFunction)os__exit, METH_FASTCALL, os__exit__doc__},
static PyObject *
os__exit_impl(PyObject *module, int status);
static PyObject *
-os__exit(PyObject *module, PyObject *args, PyObject *kwargs)
+os__exit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:_exit", _keywords, 0};
int status;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:_exit", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
return_value = os__exit_impl(module, status);
exit:
@@ -1578,23 +1651,24 @@ PyDoc_STRVAR(os_execv__doc__,
{"execv", (PyCFunction)os_execv, METH_VARARGS, os_execv__doc__},
static PyObject *
-os_execv_impl(PyObject *module, PyObject *path, PyObject *argv);
+os_execv_impl(PyObject *module, path_t *path, PyObject *argv);
static PyObject *
os_execv(PyObject *module, PyObject *args)
{
PyObject *return_value = NULL;
- PyObject *path = NULL;
+ path_t path = PATH_T_INITIALIZE("execv", "path", 0, 0);
PyObject *argv;
if (!PyArg_ParseTuple(args, "O&O:execv",
- PyUnicode_FSConverter, &path, &argv))
+ path_converter, &path, &argv)) {
goto exit;
- return_value = os_execv_impl(module, path, argv);
+ }
+ return_value = os_execv_impl(module, &path, argv);
exit:
/* Cleanup for path */
- Py_XDECREF(path);
+ path_cleanup(&path);
return return_value;
}
@@ -1617,23 +1691,25 @@ PyDoc_STRVAR(os_execve__doc__,
" Dictionary of strings mapping to strings.");
#define OS_EXECVE_METHODDEF \
- {"execve", (PyCFunction)os_execve, METH_VARARGS|METH_KEYWORDS, os_execve__doc__},
+ {"execve", (PyCFunction)os_execve, METH_FASTCALL, os_execve__doc__},
static PyObject *
os_execve_impl(PyObject *module, path_t *path, PyObject *argv, PyObject *env);
static PyObject *
-os_execve(PyObject *module, PyObject *args, PyObject *kwargs)
+os_execve(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "argv", "env", NULL};
+ static const char * const _keywords[] = {"path", "argv", "env", NULL};
+ static _PyArg_Parser _parser = {"O&OO:execve", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &argv, &env)) {
goto exit;
+ }
return_value = os_execve_impl(module, &path, argv, env);
exit:
@@ -1645,7 +1721,7 @@ exit:
#endif /* defined(HAVE_EXECV) */
-#if defined(HAVE_SPAWNV)
+#if (defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV))
PyDoc_STRVAR(os_spawnv__doc__,
"spawnv($module, mode, path, argv, /)\n"
@@ -1664,31 +1740,32 @@ PyDoc_STRVAR(os_spawnv__doc__,
{"spawnv", (PyCFunction)os_spawnv, METH_VARARGS, os_spawnv__doc__},
static PyObject *
-os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv);
+os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv);
static PyObject *
os_spawnv(PyObject *module, PyObject *args)
{
PyObject *return_value = NULL;
int mode;
- PyObject *path = NULL;
+ path_t path = PATH_T_INITIALIZE("spawnv", "path", 0, 0);
PyObject *argv;
if (!PyArg_ParseTuple(args, "iO&O:spawnv",
- &mode, PyUnicode_FSConverter, &path, &argv))
+ &mode, path_converter, &path, &argv)) {
goto exit;
- return_value = os_spawnv_impl(module, mode, path, argv);
+ }
+ return_value = os_spawnv_impl(module, mode, &path, argv);
exit:
/* Cleanup for path */
- Py_XDECREF(path);
+ path_cleanup(&path);
return return_value;
}
-#endif /* defined(HAVE_SPAWNV) */
+#endif /* (defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV)) */
-#if defined(HAVE_SPAWNV)
+#if (defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV))
PyDoc_STRVAR(os_spawnve__doc__,
"spawnve($module, mode, path, argv, env, /)\n"
@@ -1709,7 +1786,7 @@ PyDoc_STRVAR(os_spawnve__doc__,
{"spawnve", (PyCFunction)os_spawnve, METH_VARARGS, os_spawnve__doc__},
static PyObject *
-os_spawnve_impl(PyObject *module, int mode, PyObject *path, PyObject *argv,
+os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
PyObject *env);
static PyObject *
@@ -1717,23 +1794,24 @@ os_spawnve(PyObject *module, PyObject *args)
{
PyObject *return_value = NULL;
int mode;
- PyObject *path = NULL;
+ path_t path = PATH_T_INITIALIZE("spawnve", "path", 0, 0);
PyObject *argv;
PyObject *env;
if (!PyArg_ParseTuple(args, "iO&OO:spawnve",
- &mode, PyUnicode_FSConverter, &path, &argv, &env))
+ &mode, path_converter, &path, &argv, &env)) {
goto exit;
- return_value = os_spawnve_impl(module, mode, path, argv, env);
+ }
+ return_value = os_spawnve_impl(module, mode, &path, argv, env);
exit:
/* Cleanup for path */
- Py_XDECREF(path);
+ path_cleanup(&path);
return return_value;
}
-#endif /* defined(HAVE_SPAWNV) */
+#endif /* (defined(HAVE_SPAWNV) || defined(HAVE_WSPAWNV)) */
#if defined(HAVE_FORK1)
@@ -1792,21 +1870,23 @@ PyDoc_STRVAR(os_sched_get_priority_max__doc__,
"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__},
+ {"sched_get_priority_max", (PyCFunction)os_sched_get_priority_max, METH_FASTCALL, os_sched_get_priority_max__doc__},
static PyObject *
os_sched_get_priority_max_impl(PyObject *module, int policy);
static PyObject *
-os_sched_get_priority_max(PyObject *module, PyObject *args, PyObject *kwargs)
+os_sched_get_priority_max(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"policy", NULL};
+ static const char * const _keywords[] = {"policy", NULL};
+ static _PyArg_Parser _parser = {"i:sched_get_priority_max", _keywords, 0};
int policy;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_max", _keywords,
- &policy))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &policy)) {
goto exit;
+ }
return_value = os_sched_get_priority_max_impl(module, policy);
exit:
@@ -1824,21 +1904,23 @@ PyDoc_STRVAR(os_sched_get_priority_min__doc__,
"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__},
+ {"sched_get_priority_min", (PyCFunction)os_sched_get_priority_min, METH_FASTCALL, os_sched_get_priority_min__doc__},
static PyObject *
os_sched_get_priority_min_impl(PyObject *module, int policy);
static PyObject *
-os_sched_get_priority_min(PyObject *module, PyObject *args, PyObject *kwargs)
+os_sched_get_priority_min(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"policy", NULL};
+ static const char * const _keywords[] = {"policy", NULL};
+ static _PyArg_Parser _parser = {"i:sched_get_priority_min", _keywords, 0};
int policy;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_min", _keywords,
- &policy))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &policy)) {
goto exit;
+ }
return_value = os_sched_get_priority_min_impl(module, policy);
exit:
@@ -1869,8 +1951,9 @@ os_sched_getscheduler(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) {
goto exit;
+ }
return_value = os_sched_getscheduler_impl(module, pid);
exit:
@@ -1897,12 +1980,14 @@ static PyObject *
os_sched_param(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"sched_priority", NULL};
+ static const char * const _keywords[] = {"sched_priority", NULL};
+ static _PyArg_Parser _parser = {"O:sched_param", _keywords, 0};
PyObject *sched_priority;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", _keywords,
- &sched_priority))
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &sched_priority)) {
goto exit;
+ }
return_value = os_sched_param_impl(type, sched_priority);
exit:
@@ -1938,8 +2023,9 @@ os_sched_setscheduler(PyObject *module, PyObject *args)
struct sched_param param;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler",
- &pid, &policy, convert_sched_param, &param))
+ &pid, &policy, convert_sched_param, &param)) {
goto exit;
+ }
return_value = os_sched_setscheduler_impl(module, pid, policy, &param);
exit:
@@ -1971,8 +2057,9 @@ os_sched_getparam(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) {
goto exit;
+ }
return_value = os_sched_getparam_impl(module, pid);
exit:
@@ -2007,8 +2094,9 @@ os_sched_setparam(PyObject *module, PyObject *args)
struct sched_param param;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam",
- &pid, convert_sched_param, &param))
+ &pid, convert_sched_param, &param)) {
goto exit;
+ }
return_value = os_sched_setparam_impl(module, pid, &param);
exit:
@@ -2040,11 +2128,13 @@ os_sched_rr_get_interval(PyObject *module, PyObject *arg)
pid_t pid;
double _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid))
+ 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())
+ if ((_return_value == -1.0) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyFloat_FromDouble(_return_value);
exit:
@@ -2099,8 +2189,9 @@ os_sched_setaffinity(PyObject *module, PyObject *args)
PyObject *mask;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity",
- &pid, &mask))
+ &pid, &mask)) {
goto exit;
+ }
return_value = os_sched_setaffinity_impl(module, pid, mask);
exit:
@@ -2115,7 +2206,7 @@ PyDoc_STRVAR(os_sched_getaffinity__doc__,
"sched_getaffinity($module, pid, /)\n"
"--\n"
"\n"
-"Return the affinity of the process identified by pid.\n"
+"Return the affinity of the process identified by pid (or the current process if zero).\n"
"\n"
"The affinity is returned as a set of CPU identifiers.");
@@ -2131,8 +2222,9 @@ os_sched_getaffinity(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) {
goto exit;
+ }
return_value = os_sched_getaffinity_impl(module, pid);
exit:
@@ -2259,6 +2351,8 @@ os_getgid(PyObject *module, PyObject *Py_UNUSED(ignored))
#endif /* defined(HAVE_GETGID) */
+#if defined(HAVE_GETPID)
+
PyDoc_STRVAR(os_getpid__doc__,
"getpid($module, /)\n"
"--\n"
@@ -2277,6 +2371,8 @@ os_getpid(PyObject *module, PyObject *Py_UNUSED(ignored))
return os_getpid_impl(module);
}
+#endif /* defined(HAVE_GETPID) */
+
#if defined(HAVE_GETGROUPS)
PyDoc_STRVAR(os_getgroups__doc__,
@@ -2308,21 +2404,23 @@ PyDoc_STRVAR(os_getpgid__doc__,
"Call the system call getpgid(), and return the result.");
#define OS_GETPGID_METHODDEF \
- {"getpgid", (PyCFunction)os_getpgid, METH_VARARGS|METH_KEYWORDS, os_getpgid__doc__},
+ {"getpgid", (PyCFunction)os_getpgid, METH_FASTCALL, os_getpgid__doc__},
static PyObject *
os_getpgid_impl(PyObject *module, pid_t pid);
static PyObject *
-os_getpgid(PyObject *module, PyObject *args, PyObject *kwargs)
+os_getpgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"pid", NULL};
+ static const char * const _keywords[] = {"pid", NULL};
+ static _PyArg_Parser _parser = {"" _Py_PARSE_PID ":getpgid", _keywords, 0};
pid_t pid;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID ":getpgid", _keywords,
- &pid))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &pid)) {
goto exit;
+ }
return_value = os_getpgid_impl(module, pid);
exit:
@@ -2466,8 +2564,9 @@ os_kill(PyObject *module, PyObject *args)
Py_ssize_t signal;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill",
- &pid, &signal))
+ &pid, &signal)) {
goto exit;
+ }
return_value = os_kill_impl(module, pid, signal);
exit:
@@ -2498,8 +2597,9 @@ os_killpg(PyObject *module, PyObject *args)
int signal;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg",
- &pgid, &signal))
+ &pgid, &signal)) {
goto exit;
+ }
return_value = os_killpg_impl(module, pgid, signal);
exit:
@@ -2528,8 +2628,9 @@ os_plock(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int op;
- if (!PyArg_Parse(arg, "i:plock", &op))
+ if (!PyArg_Parse(arg, "i:plock", &op)) {
goto exit;
+ }
return_value = os_plock_impl(module, op);
exit:
@@ -2558,8 +2659,9 @@ os_setuid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
uid_t uid;
- if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid))
+ if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) {
goto exit;
+ }
return_value = os_setuid_impl(module, uid);
exit:
@@ -2588,8 +2690,9 @@ os_seteuid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
uid_t euid;
- if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid))
+ if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) {
goto exit;
+ }
return_value = os_seteuid_impl(module, euid);
exit:
@@ -2618,8 +2721,9 @@ os_setegid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
gid_t egid;
- if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid))
+ if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) {
goto exit;
+ }
return_value = os_setegid_impl(module, egid);
exit:
@@ -2650,8 +2754,9 @@ os_setreuid(PyObject *module, PyObject *args)
uid_t euid;
if (!PyArg_ParseTuple(args, "O&O&:setreuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid))
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) {
goto exit;
+ }
return_value = os_setreuid_impl(module, ruid, euid);
exit:
@@ -2682,8 +2787,9 @@ os_setregid(PyObject *module, PyObject *args)
gid_t egid;
if (!PyArg_ParseTuple(args, "O&O&:setregid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid))
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) {
goto exit;
+ }
return_value = os_setregid_impl(module, rgid, egid);
exit:
@@ -2712,8 +2818,9 @@ os_setgid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
gid_t gid;
- if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid))
+ if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) {
goto exit;
+ }
return_value = os_setgid_impl(module, gid);
exit:
@@ -2747,21 +2854,23 @@ PyDoc_STRVAR(os_wait3__doc__,
" (pid, status, rusage)");
#define OS_WAIT3_METHODDEF \
- {"wait3", (PyCFunction)os_wait3, METH_VARARGS|METH_KEYWORDS, os_wait3__doc__},
+ {"wait3", (PyCFunction)os_wait3, METH_FASTCALL, os_wait3__doc__},
static PyObject *
os_wait3_impl(PyObject *module, int options);
static PyObject *
-os_wait3(PyObject *module, PyObject *args, PyObject *kwargs)
+os_wait3(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"options", NULL};
+ static const char * const _keywords[] = {"options", NULL};
+ static _PyArg_Parser _parser = {"i:wait3", _keywords, 0};
int options;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:wait3", _keywords,
- &options))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &options)) {
goto exit;
+ }
return_value = os_wait3_impl(module, options);
exit:
@@ -2782,22 +2891,24 @@ PyDoc_STRVAR(os_wait4__doc__,
" (pid, status, rusage)");
#define OS_WAIT4_METHODDEF \
- {"wait4", (PyCFunction)os_wait4, METH_VARARGS|METH_KEYWORDS, os_wait4__doc__},
+ {"wait4", (PyCFunction)os_wait4, METH_FASTCALL, os_wait4__doc__},
static PyObject *
os_wait4_impl(PyObject *module, pid_t pid, int options);
static PyObject *
-os_wait4(PyObject *module, PyObject *args, PyObject *kwargs)
+os_wait4(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"pid", "options", NULL};
+ static const char * const _keywords[] = {"pid", "options", NULL};
+ static _PyArg_Parser _parser = {"" _Py_PARSE_PID "i:wait4", _keywords, 0};
pid_t pid;
int options;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID "i:wait4", _keywords,
- &pid, &options))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &pid, &options)) {
goto exit;
+ }
return_value = os_wait4_impl(module, pid, options);
exit:
@@ -2840,8 +2951,9 @@ os_waitid(PyObject *module, PyObject *args)
int options;
if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid",
- &idtype, &id, &options))
+ &idtype, &id, &options)) {
goto exit;
+ }
return_value = os_waitid_impl(module, idtype, id, options);
exit:
@@ -2877,8 +2989,9 @@ os_waitpid(PyObject *module, PyObject *args)
int options;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid",
- &pid, &options))
+ &pid, &options)) {
goto exit;
+ }
return_value = os_waitpid_impl(module, pid, options);
exit:
@@ -2904,18 +3017,19 @@ PyDoc_STRVAR(os_waitpid__doc__,
{"waitpid", (PyCFunction)os_waitpid, METH_VARARGS, os_waitpid__doc__},
static PyObject *
-os_waitpid_impl(PyObject *module, Py_intptr_t pid, int options);
+os_waitpid_impl(PyObject *module, intptr_t pid, int options);
static PyObject *
os_waitpid(PyObject *module, PyObject *args)
{
PyObject *return_value = NULL;
- Py_intptr_t pid;
+ intptr_t pid;
int options;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid",
- &pid, &options))
+ &pid, &options)) {
goto exit;
+ }
return_value = os_waitpid_impl(module, pid, options);
exit:
@@ -2968,25 +3082,27 @@ PyDoc_STRVAR(os_symlink__doc__,
" 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__},
+ {"symlink", (PyCFunction)os_symlink, METH_FASTCALL, os_symlink__doc__},
static PyObject *
os_symlink_impl(PyObject *module, path_t *src, path_t *dst,
int target_is_directory, int dir_fd);
static PyObject *
-os_symlink(PyObject *module, PyObject *args, PyObject *kwargs)
+os_symlink(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"src", "dst", "target_is_directory", "dir_fd", NULL};
+ static const char * const _keywords[] = {"src", "dst", "target_is_directory", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&O&|p$O&:symlink", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -3046,8 +3162,9 @@ os_getsid(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
pid_t pid;
- if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid))
+ if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) {
goto exit;
+ }
return_value = os_getsid_impl(module, pid);
exit:
@@ -3100,8 +3217,9 @@ os_setpgid(PyObject *module, PyObject *args)
pid_t pgrp;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid",
- &pid, &pgrp))
+ &pid, &pgrp)) {
goto exit;
+ }
return_value = os_setpgid_impl(module, pid, pgrp);
exit:
@@ -3130,8 +3248,9 @@ os_tcgetpgrp(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd))
+ if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) {
goto exit;
+ }
return_value = os_tcgetpgrp_impl(module, fd);
exit:
@@ -3162,8 +3281,9 @@ os_tcsetpgrp(PyObject *module, PyObject *args)
pid_t pgid;
if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp",
- &fd, &pgid))
+ &fd, &pgid)) {
goto exit;
+ }
return_value = os_tcsetpgrp_impl(module, fd, pgid);
exit:
@@ -3184,28 +3304,31 @@ PyDoc_STRVAR(os_open__doc__,
" 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__},
+ {"open", (PyCFunction)os_open, METH_FASTCALL, os_open__doc__},
static int
os_open_impl(PyObject *module, path_t *path, int flags, int mode, int dir_fd);
static PyObject *
-os_open(PyObject *module, PyObject *args, PyObject *kwargs)
+os_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "flags", "mode", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "flags", "mode", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&i|i$O&:open", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -3222,21 +3345,23 @@ PyDoc_STRVAR(os_close__doc__,
"Close a file descriptor.");
#define OS_CLOSE_METHODDEF \
- {"close", (PyCFunction)os_close, METH_VARARGS|METH_KEYWORDS, os_close__doc__},
+ {"close", (PyCFunction)os_close, METH_FASTCALL, os_close__doc__},
static PyObject *
os_close_impl(PyObject *module, int fd);
static PyObject *
-os_close(PyObject *module, PyObject *args, PyObject *kwargs)
+os_close(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"i:close", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:close", _keywords,
- &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd)) {
goto exit;
+ }
return_value = os_close_impl(module, fd);
exit:
@@ -3263,8 +3388,9 @@ os_closerange(PyObject *module, PyObject *args)
int fd_high;
if (!PyArg_ParseTuple(args, "ii:closerange",
- &fd_low, &fd_high))
+ &fd_low, &fd_high)) {
goto exit;
+ }
return_value = os_closerange_impl(module, fd_low, fd_high);
exit:
@@ -3290,11 +3416,13 @@ os_dup(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:dup", &fd))
+ if (!PyArg_Parse(arg, "i:dup", &fd)) {
goto exit;
+ }
_return_value = os_dup_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -3308,23 +3436,25 @@ PyDoc_STRVAR(os_dup2__doc__,
"Duplicate file descriptor.");
#define OS_DUP2_METHODDEF \
- {"dup2", (PyCFunction)os_dup2, METH_VARARGS|METH_KEYWORDS, os_dup2__doc__},
+ {"dup2", (PyCFunction)os_dup2, METH_FASTCALL, os_dup2__doc__},
static PyObject *
os_dup2_impl(PyObject *module, int fd, int fd2, int inheritable);
static PyObject *
-os_dup2(PyObject *module, PyObject *args, PyObject *kwargs)
+os_dup2(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", "fd2", "inheritable", NULL};
+ static const char * const _keywords[] = {"fd", "fd2", "inheritable", NULL};
+ static _PyArg_Parser _parser = {"ii|p:dup2", _keywords, 0};
int fd;
int fd2;
int inheritable = 1;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|p:dup2", _keywords,
- &fd, &fd2, &inheritable))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd, &fd2, &inheritable)) {
goto exit;
+ }
return_value = os_dup2_impl(module, fd, fd2, inheritable);
exit:
@@ -3361,8 +3491,9 @@ os_lockf(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iiO&:lockf",
- &fd, &command, Py_off_t_converter, &length))
+ &fd, &command, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_lockf_impl(module, fd, command, length);
exit:
@@ -3396,11 +3527,13 @@ os_lseek(PyObject *module, PyObject *args)
Py_off_t _return_value;
if (!PyArg_ParseTuple(args, "iO&i:lseek",
- &fd, Py_off_t_converter, &position, &how))
+ &fd, Py_off_t_converter, &position, &how)) {
goto exit;
+ }
_return_value = os_lseek_impl(module, fd, position, how);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromPy_off_t(_return_value);
exit:
@@ -3427,8 +3560,9 @@ os_read(PyObject *module, PyObject *args)
Py_ssize_t length;
if (!PyArg_ParseTuple(args, "in:read",
- &fd, &length))
+ &fd, &length)) {
goto exit;
+ }
return_value = os_read_impl(module, fd, length);
exit:
@@ -3466,11 +3600,13 @@ os_readv(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iO:readv",
- &fd, &buffers))
+ &fd, &buffers)) {
goto exit;
+ }
_return_value = os_readv_impl(module, fd, buffers);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -3505,8 +3641,9 @@ os_pread(PyObject *module, PyObject *args)
Py_off_t offset;
if (!PyArg_ParseTuple(args, "iiO&:pread",
- &fd, &length, Py_off_t_converter, &offset))
+ &fd, &length, Py_off_t_converter, &offset)) {
goto exit;
+ }
return_value = os_pread_impl(module, fd, length, offset);
exit:
@@ -3536,17 +3673,20 @@ os_write(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iy*:write",
- &fd, &data))
+ &fd, &data)) {
goto exit;
+ }
_return_value = os_write_impl(module, fd, &data);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -3561,21 +3701,23 @@ PyDoc_STRVAR(os_fstat__doc__,
"Equivalent to os.stat(fd).");
#define OS_FSTAT_METHODDEF \
- {"fstat", (PyCFunction)os_fstat, METH_VARARGS|METH_KEYWORDS, os_fstat__doc__},
+ {"fstat", (PyCFunction)os_fstat, METH_FASTCALL, os_fstat__doc__},
static PyObject *
os_fstat_impl(PyObject *module, int fd);
static PyObject *
-os_fstat(PyObject *module, PyObject *args, PyObject *kwargs)
+os_fstat(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"i:fstat", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:fstat", _keywords,
- &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd)) {
goto exit;
+ }
return_value = os_fstat_impl(module, fd);
exit:
@@ -3604,11 +3746,13 @@ os_isatty(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:isatty", &fd))
+ if (!PyArg_Parse(arg, "i:isatty", &fd)) {
goto exit;
+ }
_return_value = os_isatty_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -3666,8 +3810,9 @@ os_pipe2(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flags;
- if (!PyArg_Parse(arg, "i:pipe2", &flags))
+ if (!PyArg_Parse(arg, "i:pipe2", &flags)) {
goto exit;
+ }
return_value = os_pipe2_impl(module, flags);
exit:
@@ -3702,11 +3847,13 @@ os_writev(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iO:writev",
- &fd, &buffers))
+ &fd, &buffers)) {
goto exit;
+ }
_return_value = os_writev_impl(module, fd, buffers);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
@@ -3743,17 +3890,20 @@ os_pwrite(PyObject *module, PyObject *args)
Py_ssize_t _return_value;
if (!PyArg_ParseTuple(args, "iy*O&:pwrite",
- &fd, &buffer, Py_off_t_converter, &offset))
+ &fd, &buffer, Py_off_t_converter, &offset)) {
goto exit;
+ }
_return_value = os_pwrite_impl(module, fd, &buffer, offset);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromSsize_t(_return_value);
exit:
/* Cleanup for buffer */
- if (buffer.obj)
+ if (buffer.obj) {
PyBuffer_Release(&buffer);
+ }
return return_value;
}
@@ -3774,23 +3924,25 @@ PyDoc_STRVAR(os_mkfifo__doc__,
" 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__},
+ {"mkfifo", (PyCFunction)os_mkfifo, METH_FASTCALL, os_mkfifo__doc__},
static PyObject *
os_mkfifo_impl(PyObject *module, path_t *path, int mode, int dir_fd);
static PyObject *
-os_mkfifo(PyObject *module, PyObject *args, PyObject *kwargs)
+os_mkfifo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "mode", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|i$O&:mkfifo", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) {
goto exit;
+ }
return_value = os_mkfifo_impl(module, &path, mode, dir_fd);
exit:
@@ -3823,25 +3975,27 @@ PyDoc_STRVAR(os_mknod__doc__,
" 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__},
+ {"mknod", (PyCFunction)os_mknod, METH_FASTCALL, os_mknod__doc__},
static PyObject *
os_mknod_impl(PyObject *module, path_t *path, int mode, dev_t device,
int dir_fd);
static PyObject *
-os_mknod(PyObject *module, PyObject *args, PyObject *kwargs)
+os_mknod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "mode", "device", "dir_fd", NULL};
+ static const char * const _keywords[] = {"path", "mode", "device", "dir_fd", NULL};
+ static _PyArg_Parser _parser = {"O&|iO&$O&:mknod", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -3874,11 +4028,13 @@ os_major(PyObject *module, PyObject *arg)
dev_t device;
unsigned int _return_value;
- if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device))
+ 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())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
@@ -3908,11 +4064,13 @@ os_minor(PyObject *module, PyObject *arg)
dev_t device;
unsigned int _return_value;
- if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device))
+ 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())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
@@ -3944,11 +4102,13 @@ os_makedev(PyObject *module, PyObject *args)
dev_t _return_value;
if (!PyArg_ParseTuple(args, "ii:makedev",
- &major, &minor))
+ &major, &minor)) {
goto exit;
+ }
_return_value = os_makedev_impl(module, major, minor);
- if ((_return_value == (dev_t)-1) && PyErr_Occurred())
+ if ((_return_value == (dev_t)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = _PyLong_FromDev(_return_value);
exit:
@@ -3979,8 +4139,9 @@ os_ftruncate(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iO&:ftruncate",
- &fd, Py_off_t_converter, &length))
+ &fd, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_ftruncate_impl(module, fd, length);
exit:
@@ -4001,22 +4162,24 @@ PyDoc_STRVAR(os_truncate__doc__,
" 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__},
+ {"truncate", (PyCFunction)os_truncate, METH_FASTCALL, os_truncate__doc__},
static PyObject *
os_truncate_impl(PyObject *module, path_t *path, Py_off_t length);
static PyObject *
-os_truncate(PyObject *module, PyObject *args, PyObject *kwargs)
+os_truncate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "length", NULL};
+ static const char * const _keywords[] = {"path", "length", NULL};
+ static _PyArg_Parser _parser = {"O&O&:truncate", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_truncate_impl(module, &path, length);
exit:
@@ -4055,8 +4218,9 @@ os_posix_fallocate(PyObject *module, PyObject *args)
Py_off_t length;
if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length))
+ &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) {
goto exit;
+ }
return_value = os_posix_fallocate_impl(module, fd, offset, length);
exit:
@@ -4098,8 +4262,9 @@ os_posix_fadvise(PyObject *module, PyObject *args)
int advice;
if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise",
- &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice))
+ &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:
@@ -4130,8 +4295,9 @@ os_putenv(PyObject *module, PyObject *args)
PyObject *value;
if (!PyArg_ParseTuple(args, "UU:putenv",
- &name, &value))
+ &name, &value)) {
goto exit;
+ }
return_value = os_putenv_impl(module, name, value);
exit:
@@ -4162,8 +4328,9 @@ os_putenv(PyObject *module, PyObject *args)
PyObject *value = NULL;
if (!PyArg_ParseTuple(args, "O&O&:putenv",
- PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value))
+ PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) {
goto exit;
+ }
return_value = os_putenv_impl(module, name, value);
exit:
@@ -4197,8 +4364,9 @@ os_unsetenv(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name = NULL;
- if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name))
+ if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) {
goto exit;
+ }
return_value = os_unsetenv_impl(module, name);
exit:
@@ -4228,8 +4396,9 @@ os_strerror(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int code;
- if (!PyArg_Parse(arg, "i:strerror", &code))
+ if (!PyArg_Parse(arg, "i:strerror", &code)) {
goto exit;
+ }
return_value = os_strerror_impl(module, code);
exit:
@@ -4257,11 +4426,13 @@ os_WCOREDUMP(PyObject *module, PyObject *arg)
int status;
int _return_value;
- if (!PyArg_Parse(arg, "i:WCOREDUMP", &status))
+ if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) {
goto exit;
+ }
_return_value = os_WCOREDUMP_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4282,25 +4453,28 @@ PyDoc_STRVAR(os_WIFCONTINUED__doc__,
"job control stop.");
#define OS_WIFCONTINUED_METHODDEF \
- {"WIFCONTINUED", (PyCFunction)os_WIFCONTINUED, METH_VARARGS|METH_KEYWORDS, os_WIFCONTINUED__doc__},
+ {"WIFCONTINUED", (PyCFunction)os_WIFCONTINUED, METH_FASTCALL, os_WIFCONTINUED__doc__},
static int
os_WIFCONTINUED_impl(PyObject *module, int status);
static PyObject *
-os_WIFCONTINUED(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WIFCONTINUED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WIFCONTINUED", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFCONTINUED", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WIFCONTINUED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4318,25 +4492,28 @@ PyDoc_STRVAR(os_WIFSTOPPED__doc__,
"Return True if the process returning status was stopped.");
#define OS_WIFSTOPPED_METHODDEF \
- {"WIFSTOPPED", (PyCFunction)os_WIFSTOPPED, METH_VARARGS|METH_KEYWORDS, os_WIFSTOPPED__doc__},
+ {"WIFSTOPPED", (PyCFunction)os_WIFSTOPPED, METH_FASTCALL, os_WIFSTOPPED__doc__},
static int
os_WIFSTOPPED_impl(PyObject *module, int status);
static PyObject *
-os_WIFSTOPPED(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WIFSTOPPED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WIFSTOPPED", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSTOPPED", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WIFSTOPPED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4354,25 +4531,28 @@ PyDoc_STRVAR(os_WIFSIGNALED__doc__,
"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__},
+ {"WIFSIGNALED", (PyCFunction)os_WIFSIGNALED, METH_FASTCALL, os_WIFSIGNALED__doc__},
static int
os_WIFSIGNALED_impl(PyObject *module, int status);
static PyObject *
-os_WIFSIGNALED(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WIFSIGNALED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WIFSIGNALED", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSIGNALED", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WIFSIGNALED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4390,25 +4570,28 @@ PyDoc_STRVAR(os_WIFEXITED__doc__,
"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__},
+ {"WIFEXITED", (PyCFunction)os_WIFEXITED, METH_FASTCALL, os_WIFEXITED__doc__},
static int
os_WIFEXITED_impl(PyObject *module, int status);
static PyObject *
-os_WIFEXITED(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WIFEXITED(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WIFEXITED", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFEXITED", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WIFEXITED_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -4426,25 +4609,28 @@ PyDoc_STRVAR(os_WEXITSTATUS__doc__,
"Return the process return code from status.");
#define OS_WEXITSTATUS_METHODDEF \
- {"WEXITSTATUS", (PyCFunction)os_WEXITSTATUS, METH_VARARGS|METH_KEYWORDS, os_WEXITSTATUS__doc__},
+ {"WEXITSTATUS", (PyCFunction)os_WEXITSTATUS, METH_FASTCALL, os_WEXITSTATUS__doc__},
static int
os_WEXITSTATUS_impl(PyObject *module, int status);
static PyObject *
-os_WEXITSTATUS(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WEXITSTATUS(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WEXITSTATUS", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WEXITSTATUS", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WEXITSTATUS_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4462,25 +4648,28 @@ PyDoc_STRVAR(os_WTERMSIG__doc__,
"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__},
+ {"WTERMSIG", (PyCFunction)os_WTERMSIG, METH_FASTCALL, os_WTERMSIG__doc__},
static int
os_WTERMSIG_impl(PyObject *module, int status);
static PyObject *
-os_WTERMSIG(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WTERMSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WTERMSIG", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WTERMSIG", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WTERMSIG_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4498,25 +4687,28 @@ PyDoc_STRVAR(os_WSTOPSIG__doc__,
"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__},
+ {"WSTOPSIG", (PyCFunction)os_WSTOPSIG, METH_FASTCALL, os_WSTOPSIG__doc__},
static int
os_WSTOPSIG_impl(PyObject *module, int status);
static PyObject *
-os_WSTOPSIG(PyObject *module, PyObject *args, PyObject *kwargs)
+os_WSTOPSIG(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"status", NULL};
+ static const char * const _keywords[] = {"status", NULL};
+ static _PyArg_Parser _parser = {"i:WSTOPSIG", _keywords, 0};
int status;
int _return_value;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WSTOPSIG", _keywords,
- &status))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &status)) {
goto exit;
+ }
_return_value = os_WSTOPSIG_impl(module, status);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -4547,8 +4739,9 @@ os_fstatvfs(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:fstatvfs", &fd))
+ if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) {
goto exit;
+ }
return_value = os_fstatvfs_impl(module, fd);
exit:
@@ -4570,21 +4763,23 @@ PyDoc_STRVAR(os_statvfs__doc__,
" 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__},
+ {"statvfs", (PyCFunction)os_statvfs, METH_FASTCALL, os_statvfs__doc__},
static PyObject *
os_statvfs_impl(PyObject *module, path_t *path);
static PyObject *
-os_statvfs(PyObject *module, PyObject *args, PyObject *kwargs)
+os_statvfs(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"O&:statvfs", _keywords, 0};
path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS);
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:statvfs", _keywords,
- path_converter, &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path)) {
goto exit;
+ }
return_value = os_statvfs_impl(module, &path);
exit:
@@ -4605,21 +4800,23 @@ PyDoc_STRVAR(os__getdiskusage__doc__,
"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__},
+ {"_getdiskusage", (PyCFunction)os__getdiskusage, METH_FASTCALL, os__getdiskusage__doc__},
static PyObject *
os__getdiskusage_impl(PyObject *module, Py_UNICODE *path);
static PyObject *
-os__getdiskusage(PyObject *module, PyObject *args, PyObject *kwargs)
+os__getdiskusage(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", NULL};
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"u:_getdiskusage", _keywords, 0};
Py_UNICODE *path;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:_getdiskusage", _keywords,
- &path))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path)) {
goto exit;
+ }
return_value = os__getdiskusage_impl(module, path);
exit:
@@ -4653,11 +4850,13 @@ os_fpathconf(PyObject *module, PyObject *args)
long _return_value;
if (!PyArg_ParseTuple(args, "iO&:fpathconf",
- &fd, conv_path_confname, &name))
+ &fd, conv_path_confname, &name)) {
goto exit;
+ }
_return_value = os_fpathconf_impl(module, fd, name);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4679,26 +4878,29 @@ PyDoc_STRVAR(os_pathconf__doc__,
" 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__},
+ {"pathconf", (PyCFunction)os_pathconf, METH_FASTCALL, os_pathconf__doc__},
static long
os_pathconf_impl(PyObject *module, path_t *path, int name);
static PyObject *
-os_pathconf(PyObject *module, PyObject *args, PyObject *kwargs)
+os_pathconf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "name", NULL};
+ static const char * const _keywords[] = {"path", "name", NULL};
+ static _PyArg_Parser _parser = {"O&O&:pathconf", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, conv_path_confname, &name)) {
goto exit;
+ }
_return_value = os_pathconf_impl(module, &path, name);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4730,8 +4932,9 @@ os_confstr(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int name;
- if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name))
+ if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) {
goto exit;
+ }
return_value = os_confstr_impl(module, name);
exit:
@@ -4761,11 +4964,13 @@ os_sysconf(PyObject *module, PyObject *arg)
int name;
long _return_value;
- if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name))
+ 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())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -4795,6 +5000,61 @@ os_abort(PyObject *module, PyObject *Py_UNUSED(ignored))
return os_abort_impl(module);
}
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os_startfile__doc__,
+"startfile($module, /, filepath, operation=None)\n"
+"--\n"
+"\n"
+"startfile(filepath [, operation])\n"
+"\n"
+"Start a file with its associated application.\n"
+"\n"
+"When \"operation\" is not specified or \"open\", this acts like\n"
+"double-clicking the file in Explorer, or giving the file name as an\n"
+"argument to the DOS \"start\" command: the file is opened with whatever\n"
+"application (if any) its extension is associated.\n"
+"When another \"operation\" is given, it specifies what should be done with\n"
+"the file. A typical operation is \"print\".\n"
+"\n"
+"startfile returns as soon as the associated application is launched.\n"
+"There is no option to wait for the application to close, and no way\n"
+"to retrieve the application\'s exit status.\n"
+"\n"
+"The filepath is relative to the current directory. If you want to use\n"
+"an absolute path, make sure the first character is not a slash (\"/\");\n"
+"the underlying Win32 ShellExecute function doesn\'t work if it is.");
+
+#define OS_STARTFILE_METHODDEF \
+ {"startfile", (PyCFunction)os_startfile, METH_FASTCALL, os_startfile__doc__},
+
+static PyObject *
+os_startfile_impl(PyObject *module, path_t *filepath, Py_UNICODE *operation);
+
+static PyObject *
+os_startfile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"filepath", "operation", NULL};
+ static _PyArg_Parser _parser = {"O&|u:startfile", _keywords, 0};
+ path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0);
+ Py_UNICODE *operation = NULL;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &filepath, &operation)) {
+ goto exit;
+ }
+ return_value = os_startfile_impl(module, &filepath, operation);
+
+exit:
+ /* Cleanup for filepath */
+ path_cleanup(&filepath);
+
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
#if defined(HAVE_GETLOADAVG)
PyDoc_STRVAR(os_getloadavg__doc__,
@@ -4831,21 +5091,23 @@ PyDoc_STRVAR(os_device_encoding__doc__,
"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__},
+ {"device_encoding", (PyCFunction)os_device_encoding, METH_FASTCALL, os_device_encoding__doc__},
static PyObject *
os_device_encoding_impl(PyObject *module, int fd);
static PyObject *
-os_device_encoding(PyObject *module, PyObject *args, PyObject *kwargs)
+os_device_encoding(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"fd", NULL};
+ static const char * const _keywords[] = {"fd", NULL};
+ static _PyArg_Parser _parser = {"i:device_encoding", _keywords, 0};
int fd;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:device_encoding", _keywords,
- &fd))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &fd)) {
goto exit;
+ }
return_value = os_device_encoding_impl(module, fd);
exit:
@@ -4875,8 +5137,9 @@ os_setresuid(PyObject *module, PyObject *args)
uid_t suid;
if (!PyArg_ParseTuple(args, "O&O&O&:setresuid",
- _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid))
+ _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) {
goto exit;
+ }
return_value = os_setresuid_impl(module, ruid, euid, suid);
exit:
@@ -4908,8 +5171,9 @@ os_setresgid(PyObject *module, PyObject *args)
gid_t sgid;
if (!PyArg_ParseTuple(args, "O&O&O&:setresgid",
- _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid))
+ _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) {
goto exit;
+ }
return_value = os_setresgid_impl(module, rgid, egid, sgid);
exit:
@@ -4976,24 +5240,26 @@ PyDoc_STRVAR(os_getxattr__doc__,
" the link points to.");
#define OS_GETXATTR_METHODDEF \
- {"getxattr", (PyCFunction)os_getxattr, METH_VARARGS|METH_KEYWORDS, os_getxattr__doc__},
+ {"getxattr", (PyCFunction)os_getxattr, METH_FASTCALL, os_getxattr__doc__},
static PyObject *
os_getxattr_impl(PyObject *module, path_t *path, path_t *attribute,
int follow_symlinks);
static PyObject *
-os_getxattr(PyObject *module, PyObject *args, PyObject *kwargs)
+os_getxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&O&|$p:getxattr", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
goto exit;
+ }
return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -5022,26 +5288,28 @@ PyDoc_STRVAR(os_setxattr__doc__,
" the link points to.");
#define OS_SETXATTR_METHODDEF \
- {"setxattr", (PyCFunction)os_setxattr, METH_VARARGS|METH_KEYWORDS, os_setxattr__doc__},
+ {"setxattr", (PyCFunction)os_setxattr, METH_FASTCALL, os_setxattr__doc__},
static PyObject *
os_setxattr_impl(PyObject *module, path_t *path, path_t *attribute,
Py_buffer *value, int flags, int follow_symlinks);
static PyObject *
-os_setxattr(PyObject *module, PyObject *args, PyObject *kwargs)
+os_setxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "attribute", "value", "flags", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "attribute", "value", "flags", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&O&y*|i$p:setxattr", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ 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:
@@ -5050,8 +5318,9 @@ exit:
/* Cleanup for attribute */
path_cleanup(&attribute);
/* Cleanup for value */
- if (value.obj)
+ if (value.obj) {
PyBuffer_Release(&value);
+ }
return return_value;
}
@@ -5072,24 +5341,26 @@ PyDoc_STRVAR(os_removexattr__doc__,
" the link points to.");
#define OS_REMOVEXATTR_METHODDEF \
- {"removexattr", (PyCFunction)os_removexattr, METH_VARARGS|METH_KEYWORDS, os_removexattr__doc__},
+ {"removexattr", (PyCFunction)os_removexattr, METH_FASTCALL, os_removexattr__doc__},
static PyObject *
os_removexattr_impl(PyObject *module, path_t *path, path_t *attribute,
int follow_symlinks);
static PyObject *
-os_removexattr(PyObject *module, PyObject *args, PyObject *kwargs)
+os_removexattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "attribute", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"O&O&|$p:removexattr", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, path_converter, &attribute, &follow_symlinks)) {
goto exit;
+ }
return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks);
exit:
@@ -5118,22 +5389,24 @@ PyDoc_STRVAR(os_listxattr__doc__,
" the link points to.");
#define OS_LISTXATTR_METHODDEF \
- {"listxattr", (PyCFunction)os_listxattr, METH_VARARGS|METH_KEYWORDS, os_listxattr__doc__},
+ {"listxattr", (PyCFunction)os_listxattr, METH_FASTCALL, os_listxattr__doc__},
static PyObject *
os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks);
static PyObject *
-os_listxattr(PyObject *module, PyObject *args, PyObject *kwargs)
+os_listxattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"path", "follow_symlinks", NULL};
+ static const char * const _keywords[] = {"path", "follow_symlinks", NULL};
+ static _PyArg_Parser _parser = {"|O&$p:listxattr", _keywords, 0};
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))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ path_converter, &path, &follow_symlinks)) {
goto exit;
+ }
return_value = os_listxattr_impl(module, &path, follow_symlinks);
exit:
@@ -5163,8 +5436,9 @@ os_urandom(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_ssize_t size;
- if (!PyArg_Parse(arg, "n:urandom", &size))
+ if (!PyArg_Parse(arg, "n:urandom", &size)) {
goto exit;
+ }
return_value = os_urandom_impl(module, size);
exit:
@@ -5175,7 +5449,11 @@ PyDoc_STRVAR(os_cpu_count__doc__,
"cpu_count($module, /)\n"
"--\n"
"\n"
-"Return the number of CPUs in the system; return None if indeterminable.");
+"Return the number of CPUs in the system; return None if indeterminable.\n"
+"\n"
+"This number is not equivalent to the number of CPUs the current process can\n"
+"use. The number of usable CPUs can be obtained with\n"
+"``len(os.sched_getaffinity(0))``");
#define OS_CPU_COUNT_METHODDEF \
{"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__},
@@ -5208,11 +5486,13 @@ os_get_inheritable(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (!PyArg_Parse(arg, "i:get_inheritable", &fd))
+ if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) {
goto exit;
+ }
_return_value = os_get_inheritable_impl(module, fd);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -5239,8 +5519,9 @@ os_set_inheritable(PyObject *module, PyObject *args)
int inheritable;
if (!PyArg_ParseTuple(args, "ii:set_inheritable",
- &fd, &inheritable))
+ &fd, &inheritable)) {
goto exit;
+ }
return_value = os_set_inheritable_impl(module, fd, inheritable);
exit:
@@ -5259,20 +5540,22 @@ PyDoc_STRVAR(os_get_handle_inheritable__doc__,
{"get_handle_inheritable", (PyCFunction)os_get_handle_inheritable, METH_O, os_get_handle_inheritable__doc__},
static int
-os_get_handle_inheritable_impl(PyObject *module, Py_intptr_t handle);
+os_get_handle_inheritable_impl(PyObject *module, intptr_t handle);
static PyObject *
os_get_handle_inheritable(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
- Py_intptr_t handle;
+ intptr_t handle;
int _return_value;
- if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle))
+ 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())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyBool_FromLong((long)_return_value);
exit:
@@ -5293,19 +5576,20 @@ PyDoc_STRVAR(os_set_handle_inheritable__doc__,
{"set_handle_inheritable", (PyCFunction)os_set_handle_inheritable, METH_VARARGS, os_set_handle_inheritable__doc__},
static PyObject *
-os_set_handle_inheritable_impl(PyObject *module, Py_intptr_t handle,
+os_set_handle_inheritable_impl(PyObject *module, intptr_t handle,
int inheritable);
static PyObject *
os_set_handle_inheritable(PyObject *module, PyObject *args)
{
PyObject *return_value = NULL;
- Py_intptr_t handle;
+ intptr_t handle;
int inheritable;
if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable",
- &handle, &inheritable))
+ &handle, &inheritable)) {
goto exit;
+ }
return_value = os_set_handle_inheritable_impl(module, handle, inheritable);
exit:
@@ -5314,6 +5598,75 @@ exit:
#endif /* defined(MS_WINDOWS) */
+PyDoc_STRVAR(os_fspath__doc__,
+"fspath($module, /, path)\n"
+"--\n"
+"\n"
+"Return the file system path representation of the object.\n"
+"\n"
+"If the object is str or bytes, then allow it to pass through as-is. If the\n"
+"object defines __fspath__(), then return the result of that method. All other\n"
+"types raise a TypeError.");
+
+#define OS_FSPATH_METHODDEF \
+ {"fspath", (PyCFunction)os_fspath, METH_FASTCALL, os_fspath__doc__},
+
+static PyObject *
+os_fspath_impl(PyObject *module, PyObject *path);
+
+static PyObject *
+os_fspath(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {"O:fspath", _keywords, 0};
+ PyObject *path;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &path)) {
+ goto exit;
+ }
+ return_value = os_fspath_impl(module, path);
+
+exit:
+ return return_value;
+}
+
+#if defined(HAVE_GETRANDOM_SYSCALL)
+
+PyDoc_STRVAR(os_getrandom__doc__,
+"getrandom($module, /, size, flags=0)\n"
+"--\n"
+"\n"
+"Obtain a series of random bytes.");
+
+#define OS_GETRANDOM_METHODDEF \
+ {"getrandom", (PyCFunction)os_getrandom, METH_FASTCALL, os_getrandom__doc__},
+
+static PyObject *
+os_getrandom_impl(PyObject *module, Py_ssize_t size, int flags);
+
+static PyObject *
+os_getrandom(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"size", "flags", NULL};
+ static _PyArg_Parser _parser = {"n|i:getrandom", _keywords, 0};
+ Py_ssize_t size;
+ int flags = 0;
+
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &size, &flags)) {
+ goto exit;
+ }
+ return_value = os_getrandom_impl(module, size, flags);
+
+exit:
+ return return_value;
+}
+
+#endif /* defined(HAVE_GETRANDOM_SYSCALL) */
+
#ifndef OS_TTYNAME_METHODDEF
#define OS_TTYNAME_METHODDEF
#endif /* !defined(OS_TTYNAME_METHODDEF) */
@@ -5494,6 +5847,10 @@ exit:
#define OS_GETGID_METHODDEF
#endif /* !defined(OS_GETGID_METHODDEF) */
+#ifndef OS_GETPID_METHODDEF
+ #define OS_GETPID_METHODDEF
+#endif /* !defined(OS_GETPID_METHODDEF) */
+
#ifndef OS_GETGROUPS_METHODDEF
#define OS_GETGROUPS_METHODDEF
#endif /* !defined(OS_GETGROUPS_METHODDEF) */
@@ -5742,6 +6099,10 @@ exit:
#define OS_SYSCONF_METHODDEF
#endif /* !defined(OS_SYSCONF_METHODDEF) */
+#ifndef OS_STARTFILE_METHODDEF
+ #define OS_STARTFILE_METHODDEF
+#endif /* !defined(OS_STARTFILE_METHODDEF) */
+
#ifndef OS_GETLOADAVG_METHODDEF
#define OS_GETLOADAVG_METHODDEF
#endif /* !defined(OS_GETLOADAVG_METHODDEF) */
@@ -5785,4 +6146,8 @@ exit:
#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
#define OS_SET_HANDLE_INHERITABLE_METHODDEF
#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
-/*[clinic end generated code: output=7690b72549d2524e input=a9049054013a1b77]*/
+
+#ifndef OS_GETRANDOM_METHODDEF
+ #define OS_GETRANDOM_METHODDEF
+#endif /* !defined(OS_GETRANDOM_METHODDEF) */
+/*[clinic end generated code: output=455def991740915a input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h
index cb191a0b77..f9e0644f26 100644
--- a/Modules/clinic/pwdmodule.c.h
+++ b/Modules/clinic/pwdmodule.c.h
@@ -33,8 +33,9 @@ pwd_getpwnam(PyObject *module, PyObject *arg_)
PyObject *return_value = NULL;
PyObject *arg;
- if (!PyArg_Parse(arg_, "U:getpwnam", &arg))
+ if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) {
goto exit;
+ }
return_value = pwd_getpwnam_impl(module, arg);
exit:
@@ -68,4 +69,4 @@ pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef PWD_GETPWALL_METHODDEF
#define PWD_GETPWALL_METHODDEF
#endif /* !defined(PWD_GETPWALL_METHODDEF) */
-/*[clinic end generated code: output=d0ea1c5c832f0c1a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fc41d8d88ec206d8 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index c5b5c71c99..75a096cdff 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -25,8 +25,9 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
int isfinal = 0;
if (!PyArg_ParseTuple(args, "O|i:Parse",
- &data, &isfinal))
+ &data, &isfinal)) {
goto exit;
+ }
return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
exit:
@@ -60,8 +61,9 @@ pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
PyObject *return_value = NULL;
const char *base;
- if (!PyArg_Parse(arg, "s:SetBase", &base))
+ if (!PyArg_Parse(arg, "s:SetBase", &base)) {
goto exit;
+ }
return_value = pyexpat_xmlparser_SetBase_impl(self, base);
exit:
@@ -129,8 +131,9 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *arg
const char *encoding = NULL;
if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate",
- &context, &encoding))
+ &context, &encoding)) {
goto exit;
+ }
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
exit:
@@ -160,8 +163,9 @@ pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag))
+ if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) {
goto exit;
+ }
return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
exit:
@@ -193,8 +197,9 @@ pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
int flag = 1;
if (!PyArg_ParseTuple(args, "|p:UseForeignDTD",
- &flag))
+ &flag)) {
goto exit;
+ }
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
exit:
@@ -228,24 +233,26 @@ PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
"Return a new XML parser object.");
#define PYEXPAT_PARSERCREATE_METHODDEF \
- {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
+ {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_FASTCALL, pyexpat_ParserCreate__doc__},
static PyObject *
pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
const char *namespace_separator, PyObject *intern);
static PyObject *
-pyexpat_ParserCreate(PyObject *module, PyObject *args, PyObject *kwargs)
+pyexpat_ParserCreate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
+ static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL};
+ static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0};
const char *encoding = NULL;
const char *namespace_separator = NULL;
PyObject *intern = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zzO:ParserCreate", _keywords,
- &encoding, &namespace_separator, &intern))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &encoding, &namespace_separator, &intern)) {
goto exit;
+ }
return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
exit:
@@ -270,8 +277,9 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
long code;
- if (!PyArg_Parse(arg, "l:ErrorString", &code))
+ if (!PyArg_Parse(arg, "l:ErrorString", &code)) {
goto exit;
+ }
return_value = pyexpat_ErrorString_impl(module, code);
exit:
@@ -281,4 +289,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=d479cfab607e9dc8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e889f7c6af6cc42f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h
index 5b8db8079b..b08e92d099 100644
--- a/Modules/clinic/sha1module.c.h
+++ b/Modules/clinic/sha1module.c.h
@@ -72,24 +72,26 @@ PyDoc_STRVAR(_sha1_sha1__doc__,
"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__},
+ {"sha1", (PyCFunction)_sha1_sha1, METH_FASTCALL, _sha1_sha1__doc__},
static PyObject *
_sha1_sha1_impl(PyObject *module, PyObject *string);
static PyObject *
-_sha1_sha1(PyObject *module, PyObject *args, PyObject *kwargs)
+_sha1_sha1(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha1", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string)) {
goto exit;
+ }
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=0b6a194fbb0b94f2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1430450f3f806895 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h
index 661569c4fe..115db500f4 100644
--- a/Modules/clinic/sha256module.c.h
+++ b/Modules/clinic/sha256module.c.h
@@ -72,21 +72,23 @@ PyDoc_STRVAR(_sha256_sha256__doc__,
"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__},
+ {"sha256", (PyCFunction)_sha256_sha256, METH_FASTCALL, _sha256_sha256__doc__},
static PyObject *
_sha256_sha256_impl(PyObject *module, PyObject *string);
static PyObject *
-_sha256_sha256(PyObject *module, PyObject *args, PyObject *kwargs)
+_sha256_sha256(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha256", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string)) {
goto exit;
+ }
return_value = _sha256_sha256_impl(module, string);
exit:
@@ -100,24 +102,26 @@ PyDoc_STRVAR(_sha256_sha224__doc__,
"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__},
+ {"sha224", (PyCFunction)_sha256_sha224, METH_FASTCALL, _sha256_sha224__doc__},
static PyObject *
_sha256_sha224_impl(PyObject *module, PyObject *string);
static PyObject *
-_sha256_sha224(PyObject *module, PyObject *args, PyObject *kwargs)
+_sha256_sha224(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha224", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &string)) {
goto exit;
+ }
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=5a1fc5480e399f95 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=19439d70db7ead5c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h
index d64c2a413f..a2b57f71b5 100644
--- a/Modules/clinic/sha512module.c.h
+++ b/Modules/clinic/sha512module.c.h
@@ -2,8 +2,6 @@
preserve
[clinic start generated code]*/
-#if defined(PY_LONG_LONG)
-
PyDoc_STRVAR(SHA512Type_copy__doc__,
"copy($self, /)\n"
"--\n"
@@ -22,10 +20,6 @@ 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"
@@ -44,10 +38,6 @@ 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"
@@ -66,10 +56,6 @@ 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"
@@ -79,10 +65,6 @@ PyDoc_STRVAR(SHA512Type_update__doc__,
#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"
@@ -90,31 +72,29 @@ PyDoc_STRVAR(_sha512_sha512__doc__,
"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__},
+ {"sha512", (PyCFunction)_sha512_sha512, METH_FASTCALL, _sha512_sha512__doc__},
static PyObject *
_sha512_sha512_impl(PyObject *module, PyObject *string);
static PyObject *
-_sha512_sha512(PyObject *module, PyObject *args, PyObject *kwargs)
+_sha512_sha512(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &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"
@@ -122,50 +102,26 @@ PyDoc_STRVAR(_sha512_sha384__doc__,
"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__},
+ {"sha384", (PyCFunction)_sha512_sha384, METH_FASTCALL, _sha512_sha384__doc__},
static PyObject *
_sha512_sha384_impl(PyObject *module, PyObject *string);
static PyObject *
-_sha512_sha384(PyObject *module, PyObject *args, PyObject *kwargs)
+_sha512_sha384(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"string", NULL};
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0};
PyObject *string = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords,
- &string))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &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=bb87f494df50ffc0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=18f15598c3487045 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h
index c8f4cd5c41..f8d5bd942b 100644
--- a/Modules/clinic/signalmodule.c.h
+++ b/Modules/clinic/signalmodule.c.h
@@ -23,11 +23,13 @@ signal_alarm(PyObject *module, PyObject *arg)
int seconds;
long _return_value;
- if (!PyArg_Parse(arg, "i:alarm", &seconds))
+ if (!PyArg_Parse(arg, "i:alarm", &seconds)) {
goto exit;
+ }
_return_value = signal_alarm_impl(module, seconds);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong(_return_value);
exit:
@@ -85,8 +87,9 @@ signal_signal(PyObject *module, PyObject *args)
PyObject *handler;
if (!PyArg_ParseTuple(args, "iO:signal",
- &signalnum, &handler))
+ &signalnum, &handler)) {
goto exit;
+ }
return_value = signal_signal_impl(module, signalnum, handler);
exit:
@@ -117,8 +120,9 @@ signal_getsignal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int signalnum;
- if (!PyArg_Parse(arg, "i:getsignal", &signalnum))
+ if (!PyArg_Parse(arg, "i:getsignal", &signalnum)) {
goto exit;
+ }
return_value = signal_getsignal_impl(module, signalnum);
exit:
@@ -150,8 +154,9 @@ signal_siginterrupt(PyObject *module, PyObject *args)
int flag;
if (!PyArg_ParseTuple(args, "ii:siginterrupt",
- &signalnum, &flag))
+ &signalnum, &flag)) {
goto exit;
+ }
return_value = signal_siginterrupt_impl(module, signalnum, flag);
exit:
@@ -189,8 +194,9 @@ signal_setitimer(PyObject *module, PyObject *args)
double interval = 0.0;
if (!PyArg_ParseTuple(args, "id|d:setitimer",
- &which, &seconds, &interval))
+ &which, &seconds, &interval)) {
goto exit;
+ }
return_value = signal_setitimer_impl(module, which, seconds, interval);
exit:
@@ -219,8 +225,9 @@ signal_getitimer(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int which;
- if (!PyArg_Parse(arg, "i:getitimer", &which))
+ if (!PyArg_Parse(arg, "i:getitimer", &which)) {
goto exit;
+ }
return_value = signal_getitimer_impl(module, which);
exit:
@@ -251,8 +258,9 @@ signal_pthread_sigmask(PyObject *module, PyObject *args)
PyObject *mask;
if (!PyArg_ParseTuple(args, "iO:pthread_sigmask",
- &how, &mask))
+ &how, &mask)) {
goto exit;
+ }
return_value = signal_pthread_sigmask_impl(module, how, mask);
exit:
@@ -344,8 +352,9 @@ signal_sigtimedwait(PyObject *module, PyObject *args)
if (!PyArg_UnpackTuple(args, "sigtimedwait",
2, 2,
- &sigset, &timeout_obj))
+ &sigset, &timeout_obj)) {
goto exit;
+ }
return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
exit:
@@ -376,8 +385,9 @@ signal_pthread_kill(PyObject *module, PyObject *args)
int signalnum;
if (!PyArg_ParseTuple(args, "li:pthread_kill",
- &thread_id, &signalnum))
+ &thread_id, &signalnum)) {
goto exit;
+ }
return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
exit:
@@ -429,4 +439,4 @@ exit:
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
#define SIGNAL_PTHREAD_KILL_METHODDEF
#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
-/*[clinic end generated code: output=dafa598412bfb8d2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c6990ef0d0ba72b6 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h
index e26acf1863..b2479ff245 100644
--- a/Modules/clinic/spwdmodule.c.h
+++ b/Modules/clinic/spwdmodule.c.h
@@ -24,8 +24,9 @@ spwd_getspnam(PyObject *module, PyObject *arg_)
PyObject *return_value = NULL;
PyObject *arg;
- if (!PyArg_Parse(arg_, "U:getspnam", &arg))
+ if (!PyArg_Parse(arg_, "U:getspnam", &arg)) {
goto exit;
+ }
return_value = spwd_getspnam_impl(module, arg);
exit:
@@ -65,4 +66,4 @@ spwd_getspall(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef SPWD_GETSPALL_METHODDEF
#define SPWD_GETSPALL_METHODDEF
#endif /* !defined(SPWD_GETSPALL_METHODDEF) */
-/*[clinic end generated code: output=510f681b36f54c30 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=07cd8af0afd77fe7 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h
index d520c1e3dd..d481ccbe64 100644
--- a/Modules/clinic/unicodedata.c.h
+++ b/Modules/clinic/unicodedata.c.h
@@ -27,8 +27,9 @@ unicodedata_UCD_decimal(PyObject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "C|O:decimal",
- &chr, &default_value))
+ &chr, &default_value)) {
goto exit;
+ }
return_value = unicodedata_UCD_decimal_impl(self, chr, default_value);
exit:
@@ -59,8 +60,9 @@ unicodedata_UCD_digit(PyObject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "C|O:digit",
- &chr, &default_value))
+ &chr, &default_value)) {
goto exit;
+ }
return_value = unicodedata_UCD_digit_impl(self, chr, default_value);
exit:
@@ -92,8 +94,9 @@ unicodedata_UCD_numeric(PyObject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "C|O:numeric",
- &chr, &default_value))
+ &chr, &default_value)) {
goto exit;
+ }
return_value = unicodedata_UCD_numeric_impl(self, chr, default_value);
exit:
@@ -118,8 +121,9 @@ unicodedata_UCD_category(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
int chr;
- if (!PyArg_Parse(arg, "C:category", &chr))
+ if (!PyArg_Parse(arg, "C:category", &chr)) {
goto exit;
+ }
return_value = unicodedata_UCD_category_impl(self, chr);
exit:
@@ -146,8 +150,9 @@ unicodedata_UCD_bidirectional(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
int chr;
- if (!PyArg_Parse(arg, "C:bidirectional", &chr))
+ if (!PyArg_Parse(arg, "C:bidirectional", &chr)) {
goto exit;
+ }
return_value = unicodedata_UCD_bidirectional_impl(self, chr);
exit:
@@ -175,11 +180,13 @@ unicodedata_UCD_combining(PyObject *self, PyObject *arg)
int chr;
int _return_value;
- if (!PyArg_Parse(arg, "C:combining", &chr))
+ if (!PyArg_Parse(arg, "C:combining", &chr)) {
goto exit;
+ }
_return_value = unicodedata_UCD_combining_impl(self, chr);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -208,11 +215,13 @@ unicodedata_UCD_mirrored(PyObject *self, PyObject *arg)
int chr;
int _return_value;
- if (!PyArg_Parse(arg, "C:mirrored", &chr))
+ if (!PyArg_Parse(arg, "C:mirrored", &chr)) {
goto exit;
+ }
_return_value = unicodedata_UCD_mirrored_impl(self, chr);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromLong((long)_return_value);
exit:
@@ -237,8 +246,9 @@ unicodedata_UCD_east_asian_width(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
int chr;
- if (!PyArg_Parse(arg, "C:east_asian_width", &chr))
+ if (!PyArg_Parse(arg, "C:east_asian_width", &chr)) {
goto exit;
+ }
return_value = unicodedata_UCD_east_asian_width_impl(self, chr);
exit:
@@ -265,8 +275,9 @@ unicodedata_UCD_decomposition(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
int chr;
- if (!PyArg_Parse(arg, "C:decomposition", &chr))
+ if (!PyArg_Parse(arg, "C:decomposition", &chr)) {
goto exit;
+ }
return_value = unicodedata_UCD_decomposition_impl(self, chr);
exit:
@@ -296,8 +307,9 @@ unicodedata_UCD_normalize(PyObject *self, PyObject *args)
PyObject *input;
if (!PyArg_ParseTuple(args, "sO!:normalize",
- &form, &PyUnicode_Type, &input))
+ &form, &PyUnicode_Type, &input)) {
goto exit;
+ }
return_value = unicodedata_UCD_normalize_impl(self, form, input);
exit:
@@ -327,8 +339,9 @@ unicodedata_UCD_name(PyObject *self, PyObject *args)
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args, "C|O:name",
- &chr, &default_value))
+ &chr, &default_value)) {
goto exit;
+ }
return_value = unicodedata_UCD_name_impl(self, chr, default_value);
exit:
@@ -358,11 +371,12 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
const char *name;
Py_ssize_clean_t name_length;
- if (!PyArg_Parse(arg, "s#:lookup", &name, &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]*/
+/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index b1af7ce57c..fda392a9cd 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -3,44 +3,48 @@ preserve
[clinic start generated code]*/
PyDoc_STRVAR(zlib_compress__doc__,
-"compress($module, bytes, level=Z_DEFAULT_COMPRESSION, /)\n"
+"compress($module, data, /, level=Z_DEFAULT_COMPRESSION)\n"
"--\n"
"\n"
"Returns a bytes object containing compressed data.\n"
"\n"
-" bytes\n"
+" data\n"
" Binary data to be compressed.\n"
" level\n"
-" Compression level, in 0-9.");
+" Compression level, in 0-9 or -1.");
#define ZLIB_COMPRESS_METHODDEF \
- {"compress", (PyCFunction)zlib_compress, METH_VARARGS, zlib_compress__doc__},
+ {"compress", (PyCFunction)zlib_compress, METH_FASTCALL, zlib_compress__doc__},
static PyObject *
-zlib_compress_impl(PyObject *module, Py_buffer *bytes, int level);
+zlib_compress_impl(PyObject *module, Py_buffer *data, int level);
static PyObject *
-zlib_compress(PyObject *module, PyObject *args)
+zlib_compress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- Py_buffer bytes = {NULL, NULL};
+ static const char * const _keywords[] = {"", "level", NULL};
+ static _PyArg_Parser _parser = {"y*|i:compress", _keywords, 0};
+ Py_buffer data = {NULL, NULL};
int level = Z_DEFAULT_COMPRESSION;
- if (!PyArg_ParseTuple(args, "y*|i:compress",
- &bytes, &level))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &level)) {
goto exit;
- return_value = zlib_compress_impl(module, &bytes, level);
+ }
+ return_value = zlib_compress_impl(module, &data, level);
exit:
- /* Cleanup for bytes */
- if (bytes.obj)
- PyBuffer_Release(&bytes);
+ /* Cleanup for data */
+ if (data.obj) {
+ PyBuffer_Release(&data);
+ }
return return_value;
}
PyDoc_STRVAR(zlib_decompress__doc__,
-"decompress($module, data, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE, /)\n"
+"decompress($module, data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)\n"
"--\n"
"\n"
"Returns a bytes object containing the uncompressed data.\n"
@@ -53,29 +57,33 @@ PyDoc_STRVAR(zlib_decompress__doc__,
" The initial output buffer size.");
#define ZLIB_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)zlib_decompress, METH_VARARGS, zlib_decompress__doc__},
+ {"decompress", (PyCFunction)zlib_decompress, METH_FASTCALL, zlib_decompress__doc__},
static PyObject *
zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
Py_ssize_t bufsize);
static PyObject *
-zlib_decompress(PyObject *module, PyObject *args)
+zlib_decompress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"", "wbits", "bufsize", NULL};
+ static _PyArg_Parser _parser = {"y*|iO&:decompress", _keywords, 0};
Py_buffer data = {NULL, NULL};
int wbits = MAX_WBITS;
Py_ssize_t bufsize = DEF_BUF_SIZE;
- if (!PyArg_ParseTuple(args, "y*|iO&:decompress",
- &data, &wbits, ssize_t_converter, &bufsize))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, &wbits, ssize_t_converter, &bufsize)) {
goto exit;
+ }
return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -111,17 +119,18 @@ PyDoc_STRVAR(zlib_compressobj__doc__,
" containing subsequences that are likely to occur in the input data.");
#define ZLIB_COMPRESSOBJ_METHODDEF \
- {"compressobj", (PyCFunction)zlib_compressobj, METH_VARARGS|METH_KEYWORDS, zlib_compressobj__doc__},
+ {"compressobj", (PyCFunction)zlib_compressobj, METH_FASTCALL, zlib_compressobj__doc__},
static PyObject *
zlib_compressobj_impl(PyObject *module, int level, int method, int wbits,
int memLevel, int strategy, Py_buffer *zdict);
static PyObject *
-zlib_compressobj(PyObject *module, PyObject *args, PyObject *kwargs)
+zlib_compressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL};
+ static const char * const _keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL};
+ static _PyArg_Parser _parser = {"|iiiiiy*:compressobj", _keywords, 0};
int level = Z_DEFAULT_COMPRESSION;
int method = DEFLATED;
int wbits = MAX_WBITS;
@@ -129,15 +138,17 @@ zlib_compressobj(PyObject *module, PyObject *args, PyObject *kwargs)
int strategy = Z_DEFAULT_STRATEGY;
Py_buffer zdict = {NULL, NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iiiiiy*:compressobj", _keywords,
- &level, &method, &wbits, &memLevel, &strategy, &zdict))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &level, &method, &wbits, &memLevel, &strategy, &zdict)) {
goto exit;
+ }
return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict);
exit:
/* Cleanup for zdict */
- if (zdict.obj)
+ if (zdict.obj) {
PyBuffer_Release(&zdict);
+ }
return return_value;
}
@@ -155,22 +166,24 @@ PyDoc_STRVAR(zlib_decompressobj__doc__,
" dictionary as used by the compressor that produced the input data.");
#define ZLIB_DECOMPRESSOBJ_METHODDEF \
- {"decompressobj", (PyCFunction)zlib_decompressobj, METH_VARARGS|METH_KEYWORDS, zlib_decompressobj__doc__},
+ {"decompressobj", (PyCFunction)zlib_decompressobj, METH_FASTCALL, zlib_decompressobj__doc__},
static PyObject *
zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict);
static PyObject *
-zlib_decompressobj(PyObject *module, PyObject *args, PyObject *kwargs)
+zlib_decompressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- static char *_keywords[] = {"wbits", "zdict", NULL};
+ static const char * const _keywords[] = {"wbits", "zdict", NULL};
+ static _PyArg_Parser _parser = {"|iO:decompressobj", _keywords, 0};
int wbits = MAX_WBITS;
PyObject *zdict = NULL;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iO:decompressobj", _keywords,
- &wbits, &zdict))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &wbits, &zdict)) {
goto exit;
+ }
return_value = zlib_decompressobj_impl(module, wbits, zdict);
exit:
@@ -202,20 +215,22 @@ zlib_Compress_compress(compobject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:compress", &data))
+ if (!PyArg_Parse(arg, "y*:compress", &data)) {
goto exit;
+ }
return_value = zlib_Compress_compress_impl(self, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
-"decompress($self, data, max_length=0, /)\n"
+"decompress($self, data, /, max_length=0)\n"
"--\n"
"\n"
"Return a bytes object containing the decompressed version of the data.\n"
@@ -232,28 +247,32 @@ PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
"Call the flush() method to clear these buffers.");
#define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF \
- {"decompress", (PyCFunction)zlib_Decompress_decompress, METH_VARARGS, zlib_Decompress_decompress__doc__},
+ {"decompress", (PyCFunction)zlib_Decompress_decompress, METH_FASTCALL, zlib_Decompress_decompress__doc__},
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
Py_ssize_t max_length);
static PyObject *
-zlib_Decompress_decompress(compobject *self, PyObject *args)
+zlib_Decompress_decompress(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"", "max_length", NULL};
+ static _PyArg_Parser _parser = {"y*|O&:decompress", _keywords, 0};
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = 0;
- if (!PyArg_ParseTuple(args, "y*|O&:decompress",
- &data, ssize_t_converter, &max_length))
+ if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
+ &data, ssize_t_converter, &max_length)) {
goto exit;
+ }
return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -283,8 +302,9 @@ zlib_Compress_flush(compobject *self, PyObject *args)
int mode = Z_FINISH;
if (!PyArg_ParseTuple(args, "|i:flush",
- &mode))
+ &mode)) {
goto exit;
+ }
return_value = zlib_Compress_flush_impl(self, mode);
exit:
@@ -357,8 +377,9 @@ zlib_Decompress_flush(compobject *self, PyObject *args)
Py_ssize_t length = DEF_BUF_SIZE;
if (!PyArg_ParseTuple(args, "|O&:flush",
- ssize_t_converter, &length))
+ ssize_t_converter, &length)) {
goto exit;
+ }
return_value = zlib_Decompress_flush_impl(self, length);
exit:
@@ -390,14 +411,16 @@ zlib_adler32(PyObject *module, PyObject *args)
unsigned int value = 1;
if (!PyArg_ParseTuple(args, "y*|I:adler32",
- &data, &value))
+ &data, &value)) {
goto exit;
+ }
return_value = zlib_adler32_impl(module, &data, value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -427,14 +450,16 @@ zlib_crc32(PyObject *module, PyObject *args)
unsigned int value = 0;
if (!PyArg_ParseTuple(args, "y*|I:crc32",
- &data, &value))
+ &data, &value)) {
goto exit;
+ }
return_value = zlib_crc32_impl(module, &data, value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -442,4 +467,4 @@ exit:
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
#define ZLIB_COMPRESS_COPY_METHODDEF
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
-/*[clinic end generated code: output=7711ef02d1d5776c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3a4e2bfe750423a3 input=a9049054013a1b77]*/