Skip to content

Commit 9220fc1

Browse files
committed
are we const now?
1 parent fc74555 commit 9220fc1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Python/compile.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ struct location {
159159
#define LOCATION(LNO, END_LNO, COL, END_COL) \
160160
((const struct location){(LNO), (END_LNO), (COL), (END_COL)})
161161

162-
#define NO_LOCATION (LOCATION(-1, -1, -1, -1))
162+
#define NO_LOCATION {-1, -1, -1, -1}
163163

164164
struct instr {
165165
int i_opcode;
@@ -959,14 +959,18 @@ basicblock_next_instr(basicblock *b)
959959
- before the "except" and "finally" clauses
960960
*/
961961

962-
#define SET_LOC(c, x) \
963-
(c)->u->u_loc = LOCATION((x)->lineno, \
964-
(x)->end_lineno, \
965-
(x)->col_offset, \
966-
(x)->end_col_offset)
962+
#define SET_LOC(c, x) \
963+
(c)->u->u_loc.lineno = (x)->lineno; \
964+
(c)->u->u_loc.end_lineno = (x)->end_lineno; \
965+
(c)->u->u_loc.col_offset = (x)->col_offset; \
966+
(c)->u->u_loc.end_col_offset = (x)->end_col_offset;
967967

968968
// Artificial instructions
969-
#define UNSET_LOC(c) (c)->u->u_loc = NO_LOCATION
969+
#define UNSET_LOC(c) \
970+
(c)->u->u_loc.lineno = -1; \
971+
(c)->u->u_loc.end_lineno = -1; \
972+
(c)->u->u_loc.col_offset = -1; \
973+
(c)->u->u_loc.end_col_offset = -1;
970974

971975

972976
/* Return the stack effect of opcode with argument oparg.

0 commit comments

Comments
 (0)