[Python-checkins] bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997)

Victor Stinner webhook-mailer at python.org
Tue Jun 11 22:41:22 EDT 2019


https://github.com/python/cpython/commit/376ce9852eec4e97745c723f0dd0fe64383c6cd3
commit: 376ce9852eec4e97745c723f0dd0fe64383c6cd3
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-06-12T04:41:16+02:00
summary:

bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997)

Fix MSVC warning:

    objects\codeobject.c(285): warning C4244: '=':
    conversion from 'Py_ssize_t' to 'unsigned char',
    possible loss of data

files:
M Objects/codeobject.c

diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 63ce4793597a..1333cc833e1e 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -282,7 +282,7 @@ _PyCode_InitOpcache(PyCodeObject *co)
         co->co_opcache = NULL;
     }
 
-    co->co_opcache_size = opts;
+    co->co_opcache_size = (unsigned char)opts;
     return 0;
 }
 



More information about the Python-checkins mailing list