]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-124064: Fix -Wconversion warnings in pycore_{gc,list,stackref}.h (#124174)
authorVictor Stinner <vstinner@python.org>
Tue, 17 Sep 2024 14:43:39 +0000 (16:43 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2024 14:43:39 +0000 (14:43 +0000)
Include/internal/pycore_gc.h
Include/internal/pycore_list.h
Include/internal/pycore_stackref.h
Tools/build/.warningignore_macos
Tools/build/.warningignore_ubuntu

index b674313d97ff82930483be6e2baf0957c59bad04..0d6b292b9f3530a3958c727f9337cca6ba5db6f9 100644 (file)
@@ -227,7 +227,7 @@ static inline void _PyGC_CLEAR_FINALIZED(PyObject *op) {
     _PyObject_CLEAR_GC_BITS(op, _PyGC_BITS_FINALIZED);
 #else
     PyGC_Head *gc = _Py_AS_GC(op);
-    gc->_gc_prev &= ~_PyGC_PREV_MASK_FINALIZED;
+    gc->_gc_prev &= ~(uintptr_t)_PyGC_PREV_MASK_FINALIZED;
 #endif
 }
 
index 12b42c1b788607ca0accb82527de320475e5627a..2c666f9be4bd795aa25fe113836c61a258645f0f 100644 (file)
@@ -45,7 +45,7 @@ _Py_memory_repeat(char* dest, Py_ssize_t len_dest, Py_ssize_t len_src)
     Py_ssize_t copied = len_src;
     while (copied < len_dest) {
         Py_ssize_t bytes_to_copy = Py_MIN(copied, len_dest - copied);
-        memcpy(dest + copied, dest, bytes_to_copy);
+        memcpy(dest + copied, dest, (size_t)bytes_to_copy);
         copied += bytes_to_copy;
     }
 }
index f23f641a47e25fa25fb9c83fa2afc622dbdc442f..7035f9545703c40df7a980a0b514c3fd02915967 100644 (file)
@@ -98,7 +98,7 @@ typedef union _PyStackRef {
 static inline PyObject *
 PyStackRef_AsPyObjectBorrow(_PyStackRef stackref)
 {
-    PyObject *cleared = ((PyObject *)((stackref).bits & (~Py_TAG_BITS)));
+    PyObject *cleared = ((PyObject *)((stackref).bits & (~(uintptr_t)Py_TAG_BITS)));
     return cleared;
 }
 #else
@@ -133,7 +133,7 @@ _PyStackRef_FromPyObjectSteal(PyObject *obj)
 {
     // Make sure we don't take an already tagged value.
     assert(((uintptr_t)obj & Py_TAG_BITS) == 0);
-    int tag = (obj == NULL || _Py_IsImmortal(obj)) ? (Py_TAG_DEFERRED) : Py_TAG_PTR;
+    unsigned int tag = (obj == NULL || _Py_IsImmortal(obj)) ? (Py_TAG_DEFERRED) : Py_TAG_PTR;
     return ((_PyStackRef){.bits = ((uintptr_t)(obj)) | tag});
 }
 #   define PyStackRef_FromPyObjectSteal(obj) _PyStackRef_FromPyObjectSteal(_PyObject_CAST(obj))
index 3034638595353a275045da996397687eaac8dfe0..b5b1661b4c11e84abdc5c6eaa647f756094fafa6 100644 (file)
@@ -6,7 +6,6 @@
 Include/internal/mimalloc/mimalloc/internal.h 4
 Include/internal/pycore_backoff.h 1
 Include/internal/pycore_dict.h 2
-Include/internal/pycore_gc.h 1
 Include/internal/pycore_long.h 2
 Include/internal/pycore_object.h 4
 Modules/_asynciomodule.c 3
index e98305e81808d68c538f2ebdafdfc4da8568fb9c..ff7038f42d6c2dda62decc436fc54702842fda13 100644 (file)
@@ -19,10 +19,7 @@ Include/internal/pycore_asdl.h 1
 Include/internal/pycore_backoff.h 3
 Include/internal/pycore_blocks_output_buffer.h 1
 Include/internal/pycore_dict.h 2
-Include/internal/pycore_gc.h 1
-Include/internal/pycore_gc.h 1
 Include/internal/pycore_interp.h 1
-Include/internal/pycore_list.h 1
 Include/internal/pycore_long.h 3
 Include/internal/pycore_object.h 4
 Include/internal/pycore_obmalloc.h 1
@@ -233,7 +230,6 @@ Python/generated_cases.c.h 27
 Python/generated_cases.c.h 27
 Python/getargs.c 7
 Python/hashtable.c 1
-Python/import.c 6
 Python/import.c 7
 Python/initconfig.c 11
 Python/instrumentation.c 43