https://github.com/python/cpython/commit/98f93a32f395cc75dd30f95428e28b10442b4344
commit: 98f93a32f395cc75dd30f95428e28b10442b4344
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2024-09-17T14:43:39Z
summary:
gh-124064: Fix -Wconversion warnings in pycore_{gc,list,stackref}.h (#124174)
files:
M Include/internal/pycore_gc.h
M Include/internal/pycore_list.h
M Include/internal/pycore_stackref.h
M Tools/build/.warningignore_macos
M Tools/build/.warningignore_ubuntu
diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h
index b674313d97ff82..0d6b292b9f3530 100644
--- a/Include/internal/pycore_gc.h
+++ b/Include/internal/pycore_gc.h
@@ -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
}
diff --git a/Include/internal/pycore_list.h b/Include/internal/pycore_list.h
index 12b42c1b788607..2c666f9be4bd79 100644
--- a/Include/internal/pycore_list.h
+++ b/Include/internal/pycore_list.h
@@ -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;
}
}
diff --git a/Include/internal/pycore_stackref.h
b/Include/internal/pycore_stackref.h
index f23f641a47e25f..7035f9545703c4 100644
--- a/Include/internal/pycore_stackref.h
+++ b/Include/internal/pycore_stackref.h
@@ -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))
diff --git a/Tools/build/.warningignore_macos b/Tools/build/.warningignore_macos
index 3034638595353a..b5b1661b4c11e8 100644
--- a/Tools/build/.warningignore_macos
+++ b/Tools/build/.warningignore_macos
@@ -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
diff --git a/Tools/build/.warningignore_ubuntu
b/Tools/build/.warningignore_ubuntu
index e98305e81808d6..ff7038f42d6c2d 100644
--- a/Tools/build/.warningignore_ubuntu
+++ b/Tools/build/.warningignore_ubuntu
@@ -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
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]