Path: blob/main/Modules/_multiprocessing/clinic/multiprocessing.c.h
12 views
/*[clinic input]1preserve2[clinic start generated code]*/34#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)5# include "pycore_gc.h" // PyGC_Head6# include "pycore_runtime.h" // _Py_ID()7#endif8910#if defined(MS_WINDOWS)1112PyDoc_STRVAR(_multiprocessing_closesocket__doc__,13"closesocket($module, handle, /)\n"14"--\n"15"\n");1617#define _MULTIPROCESSING_CLOSESOCKET_METHODDEF \18{"closesocket", (PyCFunction)_multiprocessing_closesocket, METH_O, _multiprocessing_closesocket__doc__},1920static PyObject *21_multiprocessing_closesocket_impl(PyObject *module, HANDLE handle);2223static PyObject *24_multiprocessing_closesocket(PyObject *module, PyObject *arg)25{26PyObject *return_value = NULL;27HANDLE handle;2829handle = PyLong_AsVoidPtr(arg);30if (!handle && PyErr_Occurred()) {31goto exit;32}33return_value = _multiprocessing_closesocket_impl(module, handle);3435exit:36return return_value;37}3839#endif /* defined(MS_WINDOWS) */4041#if defined(MS_WINDOWS)4243PyDoc_STRVAR(_multiprocessing_recv__doc__,44"recv($module, handle, size, /)\n"45"--\n"46"\n");4748#define _MULTIPROCESSING_RECV_METHODDEF \49{"recv", _PyCFunction_CAST(_multiprocessing_recv), METH_FASTCALL, _multiprocessing_recv__doc__},5051static PyObject *52_multiprocessing_recv_impl(PyObject *module, HANDLE handle, int size);5354static PyObject *55_multiprocessing_recv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)56{57PyObject *return_value = NULL;58HANDLE handle;59int size;6061if (!_PyArg_CheckPositional("recv", nargs, 2, 2)) {62goto exit;63}64handle = PyLong_AsVoidPtr(args[0]);65if (!handle && PyErr_Occurred()) {66goto exit;67}68size = _PyLong_AsInt(args[1]);69if (size == -1 && PyErr_Occurred()) {70goto exit;71}72return_value = _multiprocessing_recv_impl(module, handle, size);7374exit:75return return_value;76}7778#endif /* defined(MS_WINDOWS) */7980#if defined(MS_WINDOWS)8182PyDoc_STRVAR(_multiprocessing_send__doc__,83"send($module, handle, buf, /)\n"84"--\n"85"\n");8687#define _MULTIPROCESSING_SEND_METHODDEF \88{"send", _PyCFunction_CAST(_multiprocessing_send), METH_FASTCALL, _multiprocessing_send__doc__},8990static PyObject *91_multiprocessing_send_impl(PyObject *module, HANDLE handle, Py_buffer *buf);9293static PyObject *94_multiprocessing_send(PyObject *module, PyObject *const *args, Py_ssize_t nargs)95{96PyObject *return_value = NULL;97HANDLE handle;98Py_buffer buf = {NULL, NULL};99100if (!_PyArg_CheckPositional("send", nargs, 2, 2)) {101goto exit;102}103handle = PyLong_AsVoidPtr(args[0]);104if (!handle && PyErr_Occurred()) {105goto exit;106}107if (PyObject_GetBuffer(args[1], &buf, PyBUF_SIMPLE) != 0) {108goto exit;109}110if (!PyBuffer_IsContiguous(&buf, 'C')) {111_PyArg_BadArgument("send", "argument 2", "contiguous buffer", args[1]);112goto exit;113}114return_value = _multiprocessing_send_impl(module, handle, &buf);115116exit:117/* Cleanup for buf */118if (buf.obj) {119PyBuffer_Release(&buf);120}121122return return_value;123}124125#endif /* defined(MS_WINDOWS) */126127PyDoc_STRVAR(_multiprocessing_sem_unlink__doc__,128"sem_unlink($module, name, /)\n"129"--\n"130"\n");131132#define _MULTIPROCESSING_SEM_UNLINK_METHODDEF \133{"sem_unlink", (PyCFunction)_multiprocessing_sem_unlink, METH_O, _multiprocessing_sem_unlink__doc__},134135static PyObject *136_multiprocessing_sem_unlink_impl(PyObject *module, const char *name);137138static PyObject *139_multiprocessing_sem_unlink(PyObject *module, PyObject *arg)140{141PyObject *return_value = NULL;142const char *name;143144if (!PyUnicode_Check(arg)) {145_PyArg_BadArgument("sem_unlink", "argument", "str", arg);146goto exit;147}148Py_ssize_t name_length;149name = PyUnicode_AsUTF8AndSize(arg, &name_length);150if (name == NULL) {151goto exit;152}153if (strlen(name) != (size_t)name_length) {154PyErr_SetString(PyExc_ValueError, "embedded null character");155goto exit;156}157return_value = _multiprocessing_sem_unlink_impl(module, name);158159exit:160return return_value;161}162163#ifndef _MULTIPROCESSING_CLOSESOCKET_METHODDEF164#define _MULTIPROCESSING_CLOSESOCKET_METHODDEF165#endif /* !defined(_MULTIPROCESSING_CLOSESOCKET_METHODDEF) */166167#ifndef _MULTIPROCESSING_RECV_METHODDEF168#define _MULTIPROCESSING_RECV_METHODDEF169#endif /* !defined(_MULTIPROCESSING_RECV_METHODDEF) */170171#ifndef _MULTIPROCESSING_SEND_METHODDEF172#define _MULTIPROCESSING_SEND_METHODDEF173#endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */174/*[clinic end generated code: output=4a6afc67c1f5ec85 input=a9049054013a1b77]*/175176177