Skip to content

Commit 5944a53

Browse files
authored
Fix warnings on main (GH-145104)
1 parent faea32b commit 5944a53

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

Modules/unicodedata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ _getcode(const char* name, int namelen, Py_UCS4* code)
14931493
}
14941494

14951495
if (i < (int)Py_ARRAY_LENGTH(derived_name_prefixes)) {
1496-
Py_UCS4 v = parse_hex_code(name + prefixlen, namelen - prefixlen);
1496+
Py_UCS4 v = parse_hex_code(name + prefixlen, namelen - (int)prefixlen);
14971497
if (find_prefix_id(v) != i) {
14981498
return 0;
14991499
}

Python/optimizer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#define _PyExecutorObject_CAST(op) ((_PyExecutorObject *)(op))
4242

43+
#ifndef Py_GIL_DISABLED
4344
static bool
4445
has_space_for_executor(PyCodeObject *code, _Py_CODEUNIT *instr)
4546
{
@@ -110,6 +111,7 @@ insert_executor(PyCodeObject *code, _Py_CODEUNIT *instr, int index, _PyExecutorO
110111
instr->op.code = ENTER_EXECUTOR;
111112
instr->op.arg = index;
112113
}
114+
#endif // Py_GIL_DISABLED
113115

114116
static _PyExecutorObject *
115117
make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, int length, const _PyBloomFilter *dependencies);
@@ -128,7 +130,6 @@ _PyOptimizer_Optimize(
128130
_PyInterpreterFrame *frame, PyThreadState *tstate)
129131
{
130132
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
131-
int chain_depth = _tstate->jit_tracer_state->initial_state.chain_depth;
132133
PyInterpreterState *interp = _PyInterpreterState_GET();
133134
if (!interp->jit) {
134135
// gh-140936: It is possible that interp->jit will become false during
@@ -152,6 +153,7 @@ _PyOptimizer_Optimize(
152153
// make progress in order to avoid infinite loops or excessively-long
153154
// side-exit chains. We can only insert the executor into the bytecode if
154155
// this is true, since a deopt won't infinitely re-enter the executor:
156+
int chain_depth = _tstate->jit_tracer_state->initial_state.chain_depth;
155157
chain_depth %= MAX_CHAIN_DEPTH;
156158
bool progress_needed = chain_depth == 0;
157159
PyCodeObject *code = (PyCodeObject *)_tstate->jit_tracer_state->initial_state.code;

Python/optimizer_bytecodes.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,8 @@ dummy_func(void) {
16411641
}
16421642

16431643
op(_GUARD_IP__PUSH_FRAME, (ip/4 --)) {
1644-
stack_pointer = sym_set_stack_depth(this_instr->operand1, stack_pointer);
1644+
(void)ip;
1645+
stack_pointer = sym_set_stack_depth((int)this_instr->operand1, stack_pointer);
16451646
// TO DO
16461647
// Normal function calls to known functions
16471648
// do not need an IP guard.
@@ -1659,24 +1660,27 @@ dummy_func(void) {
16591660
}
16601661

16611662
op(_GUARD_IP_YIELD_VALUE, (ip/4 --)) {
1663+
(void)ip;
16621664
if (ctx->frame->caller) {
16631665
REPLACE_OP(this_instr, _NOP, 0, 0);
16641666
}
1665-
stack_pointer = sym_set_stack_depth(this_instr->operand1, stack_pointer);
1667+
stack_pointer = sym_set_stack_depth((int)this_instr->operand1, stack_pointer);
16661668
}
16671669

16681670
op(_GUARD_IP_RETURN_VALUE, (ip/4 --)) {
1671+
(void)ip;
16691672
if (ctx->frame->caller) {
16701673
REPLACE_OP(this_instr, _NOP, 0, 0);
16711674
}
1672-
stack_pointer = sym_set_stack_depth(this_instr->operand1, stack_pointer);
1675+
stack_pointer = sym_set_stack_depth((int)this_instr->operand1, stack_pointer);
16731676
}
16741677

16751678
op(_GUARD_IP_RETURN_GENERATOR, (ip/4 --)) {
1679+
(void)ip;
16761680
if (ctx->frame->caller) {
16771681
REPLACE_OP(this_instr, _NOP, 0, 0);
16781682
}
1679-
stack_pointer = sym_set_stack_depth(this_instr->operand1, stack_pointer);
1683+
stack_pointer = sym_set_stack_depth((int)this_instr->operand1, stack_pointer);
16801684
}
16811685

16821686

Python/optimizer_cases.c.h

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)