https://github.com/python/cpython/commit/b6c2ef0c7a1e344681f9a8649bb662208ffd01cf
commit: b6c2ef0c7a1e344681f9a8649bb662208ffd01cf
branch: main
author: Wulian233 <1055917...@qq.com>
committer: zooba <steve.do...@microsoft.com>
date: 2025-05-05T17:45:15+01:00
summary:

gh-131296: Avoid posixmodule.c warning (GH-133142)

Clang-cl detects that on 32-bit builds the variable is always smaller than the 
value. But since the same code is used for other architectures, we can't just 
_fix_ it. This cast avoids the tautological-constant-out-of-range-compare 
warning.

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 964e988843110e..922694fa367ac3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4207,7 +4207,7 @@ posix_getcwd(int use_bytes)
        terminating \0. If the buffer is too small, len includes
        the space needed for the terminator. */
     if (len >= Py_ARRAY_LENGTH(wbuf)) {
-        if (len <= PY_SSIZE_T_MAX / sizeof(wchar_t)) {
+        if ((Py_ssize_t)len <= PY_SSIZE_T_MAX / sizeof(wchar_t)) {
             wbuf2 = PyMem_RawMalloc(len * sizeof(wchar_t));
         }
         else {

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to