8000 pattern_helper_rotate return SUCCESS/ERROR · python/cpython@a5d017d · GitHub
[go: up one dir, main page]

Skip to content

Commit a5d017d

Browse files
committed
pattern_helper_rotate return SUCCESS/ERROR
1 parent 4f10612 commit a5d017d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Python/compile.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6548,9 +6548,9 @@ static int
65486548
pattern_helper_rotate(struct compiler *c, location loc, Py_ssize_t count)
65496549
{
65506550
while (1 < count) {
6551-
_ADDOP_I(c, loc, SWAP, count--);
6551+
ADDOP_I(c, loc, SWAP, count--);
65526552
}
6553-
return 1;
6553+
return SUCCESS;
65546554
}
65556555

65566556
static int
@@ -6575,7 +6575,9 @@ pattern_helper_store_name(struct compiler *c, location loc,
65756575
}
65766576
// Rotate this object underneath any items we need to preserve:
65776577
Py_ssize_t rotations = pc->on_top + PyList_GET_SIZE(pc->stores) + 1;
6578-
RETURN_IF_FALSE(pattern_helper_rotate(c, loc, rotations));
6578+
if (pattern_helper_rotate(c, loc, rotations) < 0) {
6579+
return 0;
6580+
}
65796581
return !PyList_Append(pc->stores, n);
65806582
}
65816583

@@ -7024,7 +7026,7 @@ compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
70247026
// Do the same thing to the stack, using several
70257027
// rotations:
70267028
while (rotations--) {
7027-
if (!pattern_helper_rotate(c, LOC(alt), icontrol + 1)){
7029+
if (pattern_helper_rotate(c, LOC(alt), icontrol + 1) < 0) {
70287030
goto error;
70297031
}
70307032
}
@@ -7060,7 +7062,7 @@ compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
70607062
Py_ssize_t nrots = nstores + 1 + pc->on_top + PyList_GET_SIZE(pc->stores);
70617063
for (Py_ssize_t i = 0; i < nstores; i++) {
70627064
// Rotate this capture to its proper place on the stack:
7063-
if (!pattern_helper_rotate(c, LOC(p), nrots)) {
7065+
if (pattern_helper_rotate(c, LOC(p), nrots) < 0) {
70647066
goto error;
70657067
}
70667068
// Update the list of previous stores with this new name, checking for

0 commit comments

Comments
 (0)
0