From d4b3781e0d814a44a538ef1f7b5c42914e2fd4b8 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sun, 24 Mar 2024 19:17:15 +0200 Subject: [PATCH 1/2] Add explicit conversion --- Python/optimizer_bytecodes.c | 2 +- Python/optimizer_cases.c.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index e761b1b3433f04..18fc58315be133 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -545,7 +545,7 @@ dummy_func(void) { PyCodeObject *co = NULL; assert((this_instr + 2)->opcode == _PUSH_FRAME); - uintptr_t push_operand = (this_instr + 2)->operand; + uintptr_t push_operand = (uintptr_t)((this_instr + 2)->operand); if (push_operand & 1) { co = (PyCodeObject *)(push_operand & ~1); DPRINTF(3, "code=%p ", co); diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 2908a26c20973e..b066e3e8e0fa2e 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -1598,7 +1598,7 @@ (void)callable; PyCodeObject *co = NULL; assert((this_instr + 2)->opcode == _PUSH_FRAME); - uintptr_t push_operand = (this_instr + 2)->operand; + uintptr_t push_operand = (uintptr_t)((this_instr + 2)->operand); if (push_operand & 1) { co = (PyCodeObject *)(push_operand & ~1); DPRINTF(3, "code=%p ", co); From f311c964091898c0a6d008b7e2c98d10b390cf37 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sun, 24 Mar 2024 20:00:03 +0200 Subject: [PATCH 2/2] Change type of push_operand to uint64_t --- Python/optimizer_bytecodes.c | 2 +- Python/optimizer_cases.c.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 18fc58315be133..e38428af108893 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -545,7 +545,7 @@ dummy_func(void) { PyCodeObject *co = NULL; assert((this_instr + 2)->opcode == _PUSH_FRAME); - uintptr_t push_operand = (uintptr_t)((this_instr + 2)->operand); + uint64_t push_operand = (this_instr + 2)->operand; if (push_operand & 1) { co = (PyCodeObject *)(push_operand & ~1); DPRINTF(3, "code=%p ", co); diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index b066e3e8e0fa2e..6aeea51e62584f 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -1598,7 +1598,7 @@ (void)callable; PyCodeObject *co = NULL; assert((this_instr + 2)->opcode == _PUSH_FRAME); - uintptr_t push_operand = (uintptr_t)((this_instr + 2)->operand); + uint64_t push_operand = (this_instr + 2)->operand; if (push_operand & 1) { co = (PyCodeObject *)(push_operand & ~1); DPRINTF(3, "code=%p ", co);