8000 compiler_visit_kwonlydefaults returns SUCCESS/ERROR · python/cpython@9d93635 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d93635

Browse files
committed
compiler_visit_kwonlydefaults returns SUCCESS/ERROR
1 parent 19235f7 commit 9d93635

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Python/compile.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,7 +2480,7 @@ compiler_visit_kwonlydefaults(struct compiler *c, location loc,
24802480
{
24812481
/* Push a dict of keyword-only default values.
24822482
2483-
Return 0 on error, -1 if no dict pushed, 1 if a dict is pushed.
2483+
Return -1 on error, 0 if no dict pushed, 1 if a dict is pushed.
24842484
*/
24852485
int i;
24862486
PyObject *keys = NULL;
@@ -2497,7 +2497,7 @@ compiler_visit_kwonlydefaults(struct compiler *c, location loc,
24972497
keys = PyList_New(1);
24982498
if (keys == NULL) {
24992499
Py_DECREF(mangled);
2500-
return 0;
2500+
return ERROR;
25012501
}
25022502
PyList_SET_ITEM(keys, 0, mangled);
25032503
}
@@ -2523,12 +2523,12 @@ compiler_visit_kwonlydefaults(struct compiler *c, location loc,
25232523
return 1;
25242524
}
25252525
else {
2526-
return -1;
2526+
return 0;
25272527
}
25282528

25292529
error:
25302530
Py_XDECREF(keys);
2531-
return 0;
2531+
return ERROR;
25322532
}
25332533

25342534
static int
@@ -2653,8 +2653,8 @@ compiler_default_arguments(struct compiler *c, location loc,
26532653
int res = compiler_visit_kwonlydefaults(c, loc,
26542654
args->kwonlyargs,
26552655
args->kw_defaults);
2656-
if (res == 0) {
2657-
return -1;
2656+
if (res < 0) {
2657+
return ERROR;
26582658
}
26592659
else if (res > 0) {
26602660
funcflags |= 0x02;

0 commit comments

Comments
 (0)
0