Skip to content

Commit 8fd667d

Browse files
committed
remove u_loc from compiler_unit
1 parent 091266f commit 8fd667d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

Python/compile.c

+3-15
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ struct compiler_unit {
386386
struct fblockinfo u_fblock[CO_MAXBLOCKS];
387387

388388
int u_firstlineno; /* the first lineno of the block */
389-
struct location u_loc; /* line/column info of the current stmt */
390389
};
391390

392391
/* This struct captures the global state of a compilation.
@@ -990,10 +989,10 @@ basicblock_next_instr(basicblock *b)
990989
- before the "except" and "finally" clauses
991990
*/
992991

993-
#define SET_LOC(c, x) (c)->u->u_loc = LOC(x);
992+
#define SET_LOC(c, x)
994993

995994
// Artificial instructions
996-
#define UNSET_LOC(c) (c)->u->u_loc = NO_LOCATION;
995+
#define UNSET_LOC(c)
997996

998997
#define LOC(x) LOCATION((x)->lineno, \
999998
(x)->end_lineno, \
@@ -1733,7 +1732,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
17331732

17341733
u->u_nfblocks = 0;
17351734
u->u_firstlineno = lineno;
1736-
u->u_loc = loc;
17371735
u->u_consts = PyDict_New();
17381736
if (!u->u_consts) {
17391737
compiler_unit_free(u);
@@ -1770,7 +1768,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
17701768

17711769
if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
17721770
loc.lineno = 0;
1773-
c->u->u_loc = loc;
17741771
}
17751772
else {
17761773
if (!compiler_set_qualname(c))
@@ -1780,7 +1777,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
17801777

17811778
if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
17821779
loc.lineno = -1;
1783-
c->u->u_loc = loc;
17841780
}
17851781
return 1;
17861782
}
@@ -2159,7 +2155,6 @@ compiler_mod(struct compiler *c, mod_ty mod)
21592155
return NULL;
21602156
}
21612157
struct location loc = LOCATION(1, 1, 0, 0);
2162-
c->u->u_loc = loc;
21632158
switch (mod->kind) {
21642159
case Module_kind:
21652160
if (!compiler_body(c, loc, mod->v.Module.body)) {
@@ -2303,13 +2298,11 @@ compiler_apply_decorators(struct compiler *c, asdl_expr_seq* decos)
23032298
if (!decos)
23042299
return 1;
23052300

2306-
struct location old_loc = c->u->u_loc;
23072301
for (Py_ssize_t i = asdl_seq_LEN(decos) - 1; i > -1; i--) {
23082302
SET_LOC(c, (expr_ty)asdl_seq_GET(decos, i));
23092303
struct location loc = LOC((expr_ty)asdl_seq_GET(decos, i));
23102304
ADDOP_I(c, loc, CALL, 0);
23112305
}
2312-
c->u->u_loc = old_loc;
23132306
return 1;
23142307
}
23152308

@@ -4809,7 +4802,6 @@ update_start_location_to_match_attr(struct compiler *c, struct location loc,
48094802
loc.end_col_offset = Py_MAX(loc.col_offset, loc.end_col_offset);
48104803
}
48114804
}
4812-
c->u->u_loc = loc;
48134805
return loc;
48144806
}
48154807

@@ -5933,10 +5925,8 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
59335925
static int
59345926
compiler_visit_expr(struct compiler *c, expr_ty e)
59355927
{
5936-
struct location old_loc = c->u->u_loc;
59375928
SET_LOC(c, e);
59385929
int res = compiler_visit_expr1(c, e);
5939-
c->u->u_loc = old_loc;
59405930
return res;
59415931
}
59425932

@@ -5954,7 +5944,6 @@ compiler_augassign(struct compiler *c, stmt_ty s)
59545944
expr_ty e = s->v.AugAssign.target;
59555945

59565946
struct location loc = LOC(e);
5957-
struct location old_loc = c->u->u_loc;
59585947
SET_LOC(c, e);
59595948

59605949
switch (e->kind) {
@@ -5993,8 +5982,7 @@ compiler_augassign(struct compiler *c, stmt_ty s)
59935982
return 0;
59945983
}
59955984

5996-
c->u->u_loc = old_loc;
5997-
loc = old_loc;
5985+
loc = LOC(s);
59985986

59995987
VISIT(c, expr, s->v.AugAssign.value);
60005988
ADDOP_INPLACE(c, loc, s->v.AugAssign.op);

0 commit comments

Comments
 (0)