]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106267: Add type cast to generated code (#106289)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Fri, 30 Jun 2023 19:11:10 +0000 (22:11 +0300)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2023 19:11:10 +0000 (12:11 -0700)
Python/executor_cases.c.h
Tools/cases_generator/generate_cases.py

index ccef2736b7120bc8a3da0d33a023745ee9a80b73..546b3d9f50ac76cb5c361e3f70107264b0bdd2ec 100644 (file)
         case TO_BOOL_ALWAYS_TRUE: {
             PyObject *value = stack_pointer[-1];
             PyObject *res;
-            uint32_t version = operand;
+            uint32_t version = (uint32_t)operand;
             #line 359 "Python/bytecodes.c"
             // This one is a bit weird, because we expect *some* failures:
             assert(version);
index ff88b63d3bdd8082c6de01b5720971c0ed905f6d..2332d12c6c0c68139a3c45734400d160dd43b506 100644 (file)
@@ -520,7 +520,7 @@ class Instruction:
                     f"{typ}{ceffect.name} = {func}(&next_instr[{active.offset}].cache);"
                 )
             else:
-                out.emit(f"{typ}{ceffect.name} = operand;")
+                out.emit(f"{typ}{ceffect.name} = ({typ.strip()})operand;")
 
         # Write the body, substituting a goto for ERROR_IF() and other stuff
         assert dedent <= 0