mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-94512: Fix forced arg format in AC-processed resource (GH-94515)
This commit is contained in:
parent
e003b64f40
commit
a739ee412c
2 changed files with 37 additions and 30 deletions
|
|
@ -24,8 +24,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 +276,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 +300,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue