8000 gh-94512: Fix forced arg format in AC-processed resource (GH-94515) · python-docs-tr/cpython@a739ee4 · GitHub
[go: up one dir, main page]

Skip to content

Commit a739ee4

Browse files
authored
pythongh-94512: Fix forced arg format in AC-processed resource (pythonGH-94515)
1 parent e003b64 commit a739ee4

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

Modules/clinic/resource.c.h

Lines changed: 25 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/resource.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ module resource
2424
class pid_t_converter(CConverter):
2525
type = 'pid_t'
2626
format_unit = '" _Py_PARSE_PID "'
27+
28+
def parse_arg(self, argname, displayname):
29+
return """
30+
{paramname} = PyLong_AsPid({argname});
31+
if ({paramname} == -1 && PyErr_Occurred()) {{{{
32+
goto exit;
33+
}}}}
34+
""".format(argname=argname, paramname=self.parser_name)
2735
[python start generated code]*/
28-
/*[python end generated code: output=da39a3ee5e6b4b0d input=0c1d19f640d57e48]*/
36+
/*[python end generated code: output=da39a3ee5e6b4b0d input=5af1c116d56cbb5a]*/
2937

3038
#include "clinic/resource.c.h"
3139

@@ -268,17 +276,15 @@ resource.prlimit
268276
269277
pid: pid_t
270278
resource: int
271-
[
272-
limits: object
273-
]
279+
limits: object = None
274280
/
275281
276282
[clinic start generated code]*/
277283

278284
static PyObject *
279285
resource_prlimit_impl(PyObject *module, pid_t pid, int resource,
280-
int group_right_1, PyObject *limits)
281-
/*[clinic end generated code: output=ee976b393187a7a3 input=b77743bdccc83564]*/
286+
PyObject *limits)
287+
/*[clinic end generated code: output=6ebc49ff8c3a816e input=54bb69c9585e33bf]*/
282288
{
283289
struct rlimit old_limit, new_limit;
284290
int retval;
@@ -294,7 +300,7 @@ resource_prlimit_impl(PyObject *module, pid_t pid, int resource,
294300
return NULL;
295301
}
296302

297-
if (group_right_1) {
303+
if (limits != Py_None) {
298304
if (py2rlimit(limits, &new_limit) < 0) {
299305
return NULL;
300306
}

0 commit comments

Comments
 (0)
0