Skip to content

bpo-46670: Remove unused macros in the Python directory #31192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Python/ast_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,6 @@ static int astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTOptimizeState
} \
}

#define CALL_INT_SEQ(FUNC, TYPE, ARG) { \
int i; \
asdl_int_seq *seq = (ARG); /* avoid variable capture */ \
for (i = 0; i < asdl_seq_LEN(seq); i++) { \
TYPE elt = (TYPE)asdl_seq_GET(seq, i); \
if (!FUNC(elt, ctx_, state)) \
return 0; \
} \
}

static int
astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
Expand Down Expand Up @@ -1085,7 +1076,6 @@ astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat
#undef CALL
#undef CALL_OPT
#undef CALL_SEQ
#undef CALL_INT_SEQ

/* See comments in symtable.c. */
#define COMPILER_STACK_FRAME_SCALE 3
Expand Down
13 changes: 0 additions & 13 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


#define DEFAULT_BLOCK_SIZE 16
#define DEFAULT_BLOCKS 8
#define DEFAULT_CODE_SIZE 128
#define DEFAULT_LNOTAB_SIZE 16
#define DEFAULT_CNOTAB_SIZE 32
Expand Down Expand Up @@ -1472,13 +1471,6 @@ compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b)
Py_DECREF(__new_const); \
}

#define ADDOP_O(C, OP, O, TYPE) { \
assert(!HAS_CONST(OP)); /* use ADDOP_LOAD_CONST */ \
if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) \
return 0; \
}

/* Same as ADDOP_O, but steals a reference. */
#define ADDOP_N(C, OP, O, TYPE) { \
assert(!HAS_CONST(OP)); /* use ADDOP_LOAD_CONST_NEW */ \
if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) { \
Expand Down Expand Up @@ -1552,11 +1544,6 @@ compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b)
} \
}

#define VISIT_SLICE(C, V, CTX) {\
if (!compiler_visit_slice((C), (V), (CTX))) \
return 0; \
}

#define VISIT_SEQ(C, TYPE, SEQ) { \
int _i; \
asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
Expand Down
2 changes: 0 additions & 2 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
extern "C" {
#endif

#define CACHEDIR "__pycache__"

/* Forward references */
static PyObject *import_add_module(PyThreadState *tstate, PyObject *name);

Expand Down
6 changes: 2 additions & 4 deletions Python/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@

#ifdef Py_DEBUG
static int thread_debug = 0;
#define dprintf(args) (void)((thread_debug & 1) && printf args)
#define d2printf(args) ((thread_debug & 8) && printf args)
# define dprintf(args) (void)((thread_debug & 1) && printf args)
#else
#define dprintf(args)
#define d2printf(args)
# define dprintf(args)
#endif

static int initialized;
Expand Down