From 39da6cb6f095e5cce2bd5c07e829131f0f8f9947 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 23 Sep 2020 12:55:43 +0200 Subject: [PATCH] bpo-40941: Fix stackdepth compiler warnings Explicitly cast a difference of two pointers to int: PyFrameObject.f_stackdepth is an int. --- Python/ceval.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 3de372f45a2517..348ab58c2ffcda 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1443,9 +1443,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) if (_Py_TracingPossible(ceval2) && tstate->c_tracefunc != NULL && !tstate->tracing) { int err; - /* see maybe_call_line_trace + /* see maybe_call_line_trace() for expository comments */ - f->f_stackdepth = stack_pointer-f->f_valuestack; + f->f_stackdepth = (int)(stack_pointer - f->f_valuestack); err = maybe_call_line_trace(tstate->c_tracefunc, tstate->c_traceobj, @@ -2275,7 +2275,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) assert(f->f_lasti >= (int)sizeof(_Py_CODEUNIT)); f->f_lasti -= sizeof(_Py_CODEUNIT); f->f_state = FRAME_SUSPENDED; - f->f_stackdepth = stack_pointer-f->f_valuestack; + f->f_stackdepth = (int)(stack_pointer - f->f_valuestack); goto exiting; } @@ -2292,7 +2292,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) retval = w; } f->f_state = FRAME_SUSPENDED; - f->f_stackdepth = stack_pointer-f->f_valuestack; + f->f_stackdepth = (int)(stack_pointer - f->f_valuestack); goto exiting; }