From: Victor Stinner Date: Tue, 9 Dec 2025 16:03:13 +0000 (+0100) Subject: gh-142447: Fix cast warning in pycore_backoff.h (#142465) X-Git-Tag: v3.15.0a3~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b20722c300a78c38462081a3f1c45190b5434e71;p=thirdparty%2FPython%2Fcpython.git gh-142447: Fix cast warning in pycore_backoff.h (#142465) MAKE_VALUE_AND_BACKOFF() macro casts its result to uint16_t. Add pycore_backoff.h header to test_cppext tests. --- diff --git a/Include/internal/pycore_backoff.h b/Include/internal/pycore_backoff.h index 7f60eb495080..23ca7299e0d2 100644 --- a/Include/internal/pycore_backoff.h +++ b/Include/internal/pycore_backoff.h @@ -40,7 +40,7 @@ extern "C" { #define MAX_VALUE 0x1FFF #define MAKE_VALUE_AND_BACKOFF(value, backoff) \ - ((value << BACKOFF_BITS) | backoff) + ((uint16_t)(((value) << BACKOFF_BITS) | (backoff))) // For previous backoff b we use value x such that // x + 1 is near to 2**(2*b+1) and x + 1 is prime. diff --git a/Lib/test/test_cppext/extension.cpp b/Lib/test/test_cppext/extension.cpp index 1affa176088d..f95655eccded 100644 --- a/Lib/test/test_cppext/extension.cpp +++ b/Lib/test/test_cppext/extension.cpp @@ -14,6 +14,7 @@ #ifdef TEST_INTERNAL_C_API // gh-135906: Check for compiler warnings in the internal C API +# include "internal/pycore_backoff.h" # include "internal/pycore_frame.h" #endif