Skip to content

Commit e2b6368

Browse files
committed
minor tweaks
1 parent e1a5414 commit e2b6368

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed

Python/compile.c

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,10 +1318,6 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
13181318
return stack_effect(opcode, oparg, -1);
13191319
}
13201320

1321-
/* Add an opcode with no argument.
1322-
Returns 0 on failure, 1 on success.
1323-
*/
1324-
13251321
static int
13261322
basicblock_addop(basicblock *b, int opcode, int oparg, location loc)
13271323
{
@@ -1605,7 +1601,7 @@ cfg_builder_addop_j(cfg_builder *g, location loc,
16051601
}
16061602

16071603
#define ADDOP(C, LOC, OP) \
1608-
RETURN_IF_ERROR(cfg_builder_addop_noarg(CFG_BUILDER(C), (OP), (LOC)));
1604+
RETURN_IF_ERROR(cfg_builder_addop_noarg(CFG_BUILDER(C), (OP), (LOC)))
16091605

16101606
#define ADDOP_IN_SCOPE(C, LOC, OP) { \
16111607
if (cfg_builder_addop_noarg(CFG_BUILDER(C), (OP), (LOC)) < 0) { \
@@ -1615,7 +1611,7 @@ cfg_builder_addop_j(cfg_builder *g, location loc,
16151611
}
16161612

16171613
#define ADDOP_LOAD_CONST(C, LOC, O) \
1618-
RETURN_IF_ERROR(compiler_addop_load_const((C), (LOC), (O)));
1614+
RETURN_IF_ERROR(compiler_addop_load_const((C), (LOC), (O)))
16191615

16201616
/* Same as ADDOP_LOAD_CONST, but steals a reference. */
16211617
#define ADDOP_LOAD_CONST_NEW(C, LOC, O) { \
@@ -1640,31 +1636,31 @@ cfg_builder_addop_j(cfg_builder *g, location loc,
16401636
}
16411637

16421638
#define ADDOP_NAME(C, LOC, OP, O, TYPE) \
1643-
RETURN_IF_ERROR(compiler_addop_name((C), (LOC), (OP), (C)->u->u_ ## TYPE, (O)));
1639+
RETURN_IF_ERROR(compiler_addop_name((C), (LOC), (OP), (C)->u->u_ ## TYPE, (O)))
16441640

16451641
#define ADDOP_I(C, LOC, OP, O) \
1646-
RETURN_IF_ERROR(cfg_builder_addop_i(CFG_BUILDER(C), (OP), (O), (LOC)));
1642+
RETURN_IF_ERROR(cfg_builder_addop_i(CFG_BUILDER(C), (OP), (O), (LOC)))
16471643

16481644
#define ADDOP_JUMP(C, LOC, OP, O) \
1649-
RETURN_IF_ERROR(cfg_builder_addop_j(CFG_BUILDER(C), (LOC), (OP), (O)));
1645+
RETURN_IF_ERROR(cfg_builder_addop_j(CFG_BUILDER(C), (LOC), (OP), (O)))
16501646

16511647
#define ADDOP_COMPARE(C, LOC, CMP) \
1652-
RETURN_IF_ERROR(compiler_addcompare((C), (LOC), (cmpop_ty)(CMP)));
1648+
RETURN_IF_ERROR(compiler_addcompare((C), (LOC), (cmpop_ty)(CMP)))
16531649

16541650
#define ADDOP_BINARY(C, LOC, BINOP) \
1655-
RETURN_IF_ERROR(addop_binary((C), (LOC), (BINOP), false));
1651+
RETURN_IF_ERROR(addop_binary((C), (LOC), (BINOP), false))
16561652

16571653
#define ADDOP_INPLACE(C, LOC, BINOP) \
1658-
RETURN_IF_ERROR(addop_binary((C), (LOC), (BINOP), true));
1654+
RETURN_IF_ERROR(addop_binary((C), (LOC), (BINOP), true))
16591655

1660-
#define ADD_YIELD_FROM(C, LOC, await) \
1661-
RETURN_IF_ERROR(compiler_add_yield_from((C), (LOC), (await)));
1656+
#define ADD_YIELD_FROM(C, LOC, await) \
1657+
RETURN_IF_ERROR(compiler_add_yield_from((C), (LOC), (await)))
16621658

1663-
#define POP_EXCEPT_AND_RERAISE(C, LOC) \
1664-
RETURN_IF_ERROR(compiler_pop_except_and_reraise((C), (LOC)));
1659+
#define POP_EXCEPT_AND_RERAISE(C, LOC) \
1660+
RETURN_IF_ERROR(compiler_pop_except_and_reraise((C), (LOC)))
16651661

16661662
#define ADDOP_YIELD(C, LOC) \
1667-
RETURN_IF_ERROR(addop_yield((C), (LOC)));
1663+
RETURN_IF_ERROR(addop_yield((C), (LOC)))
16681664

16691665
/* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use
16701666
the ASDL name to synthesize the name of the C type and the visit function.
@@ -1784,17 +1780,13 @@ compiler_enter_scope(struct compiler *c, identifier name,
17841780
c->c_nestlevel++;
17851781

17861782
cfg_builder *g = CFG_BUILDER(c);
1787-
if (cfg_builder_init(g) < 0) {
1788-
return ERROR;
1789-
}
1783+
RETURN_IF_ERROR(cfg_builder_init(g));
17901784

17911785
if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
17921786
loc.lineno = 0;
17931787
}
17941788
else {
1795-
if (compiler_set_qualname(c) < 0){
1796-
return ERROR;
1797-
}
1789+
RETURN_IF_ERROR(compiler_set_qualname(c));
17981790
}
17991791
ADDOP_I(c, loc, RESUME, 0);
18001792

@@ -2110,9 +2102,7 @@ compiler_unwind_fblock_stack(struct compiler *c, location *ploc,
21102102
}
21112103
struct fblockinfo copy = *top;
21122104
c->u->u_nfblocks--;
2113-
if (compiler_unwind_fblock(c, ploc, &copy, preserve_tos) < 0) {
2114-
return ERROR;
2115-
}
2105+
RETURN_IF_ERROR(compiler_unwind_fblock(c, ploc, &copy, preserve_tos));
21162106
RETURN_IF_ERROR(compiler_unwind_fblock_stack(c, ploc, preserve_tos, loop));
21172107
c->u->u_fblock[c->u->u_nfblocks] = copy;
21182108
c->u->u_nfblocks++;
@@ -6204,7 +6194,7 @@ compiler_subscript(struct compiler *c, expr_ty e)
62046194
}
62056195

62066196
/* Returns the number of the values emitted,
6207-
* thus are needed to build the slice, or 0 if there is an error. */
6197+
* thus are needed to build the slice, or -1 if there is an error. */
62086198
static int
62096199
compiler_slice(struct compiler *c, expr_ty s)
62106200
{

0 commit comments

Comments
 (0)