diff options
author | shadchin <shadchin@yandex-team.com> | 2024-02-12 07:53:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@ydb.tech> | 2024-02-14 14:26:16 +0000 |
commit | 31f2a419764a8ba77c2a970cfc80056c6cd06756 (patch) | |
tree | c1995d239eba8571cefc640f6648e1d5dd4ce9e2 /contrib/tools/python3/src/Modules/resource.c | |
parent | fe2ef02b38d9c85d80060963b265a1df9f38c3bb (diff) | |
download | ydb-31f2a419764a8ba77c2a970cfc80056c6cd06756.tar.gz |
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Modules/resource.c')
-rw-r--r-- | contrib/tools/python3/src/Modules/resource.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/contrib/tools/python3/src/Modules/resource.c b/contrib/tools/python3/src/Modules/resource.c index d8bba2e398..3c89468c48 100644 --- a/contrib/tools/python3/src/Modules/resource.c +++ b/contrib/tools/python3/src/Modules/resource.c @@ -1,7 +1,10 @@ #include "Python.h" #include <sys/resource.h> +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> +#endif +#include <time.h> #include <string.h> #include <errno.h> #include <unistd.h> @@ -24,8 +27,16 @@ module resource class pid_t_converter(CConverter): type = 'pid_t' format_unit = '" _Py_PARSE_PID "' + + def parse_arg(self, argname, displayname): + return """ + {paramname} = PyLong_AsPid({argname}); + if ({paramname} == -1 && PyErr_Occurred()) {{{{ + goto exit; + }}}} + """.format(argname=argname, paramname=self.parser_name) [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=0c1d19f640d57e48]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=5af1c116d56cbb5a]*/ #include "clinic/resource.c.h" @@ -268,17 +279,15 @@ resource.prlimit pid: pid_t resource: int - [ - limits: object - ] + limits: object = None / [clinic start generated code]*/ static PyObject * resource_prlimit_impl(PyObject *module, pid_t pid, int resource, - int group_right_1, PyObject *limits) -/*[clinic end generated code: output=ee976b393187a7a3 input=b77743bdccc83564]*/ + PyObject *limits) +/*[clinic end generated code: output=6ebc49ff8c3a816e input=54bb69c9585e33bf]*/ { struct rlimit old_limit, new_limit; int retval; @@ -294,7 +303,7 @@ resource_prlimit_impl(PyObject *module, pid_t pid, int resource, return NULL; } - if (group_right_1) { + if (limits != Py_None) { if (py2rlimit(limits, &new_limit) < 0) { return NULL; } @@ -508,6 +517,7 @@ resource_exec(PyObject *module) static struct PyModuleDef_Slot resource_slots[] = { {Py_mod_exec, resource_exec}, + {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, {0, NULL} }; |