[Python-checkins] bpo-33041: Fix downcast warning on Windows (#6595)

Victor Stinner webhook-mailer at python.org
Fri Apr 27 08:30:04 EDT 2018


https://github.com/python/cpython/commit/078c4e3519deeef8014541925da057bb064eb5a8
commit: 078c4e3519deeef8014541925da057bb064eb5a8
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-04-27T14:30:01+02:00
summary:

bpo-33041: Fix downcast warning on Windows (#6595)

Cast pointer difference from ssize_t to int: a frame is very unlikely
larger than 2 GB.

files:
M Objects/frameobject.c

diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 864a8f977ea3..14935a2147c4 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -297,7 +297,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
     if (delta_iblock > 0) {
         f->f_iblock -= delta_iblock;
         PyTryBlock *b = &f->f_blockstack[f->f_iblock];
-        delta += (f->f_stacktop - f->f_valuestack) - b->b_level;
+        delta += (int)(f->f_stacktop - f->f_valuestack) - b->b_level;
         if (b->b_type == SETUP_FINALLY &&
             code[b->b_handler] == WITH_CLEANUP_START)
         {



More information about the Python-checkins mailing list