summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-09-17 14:43:39 (GMT)
committerGitHub <noreply@github.com>2024-09-17 14:43:39 (GMT)
commit98f93a32f395cc75dd30f95428e28b10442b4344 (patch)
tree2b69142896cddf132bfbc7b9db7a5b9bcfc4ed3b /Include
parent33eeccf6d4f16e483b4c8a180bad718545aeaeaf (diff)
downloadcpython-98f93a32f395cc75dd30f95428e28b10442b4344.zip
cpython-98f93a32f395cc75dd30f95428e28b10442b4344.tar.gz
cpython-98f93a32f395cc75dd30f95428e28b10442b4344.tar.bz2
gh-124064: Fix -Wconversion warnings in pycore_{gc,list,stackref}.h (#124174)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_gc.h2
-rw-r--r--Include/internal/pycore_list.h2
-rw-r--r--Include/internal/pycore_stackref.h4
3 files changed, 4 insertions, 4 deletions
diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h
index b674313..0d6b292 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 12b42c1..2c666f9 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 f23f641..7035f95 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))