New submission from Henry Schreiner <henryschreiner...@gmail.com>:

The macro Py_UNICODE_COPY was replaced by a function in CPython 3.9, and that 
function cannot compile with full warnings enabled + warnings as errors under 
Clang. The problematic line:

Py_DEPRECATED(3.3) static inline void
Py_UNICODE_COPY(Py_UNICODE *target, const Py_UNICODE *source, Py_ssize_t 
length) {
    memcpy(target, source, length * sizeof(Py_UNICODE));
}

has an implicit conversion of Py_ssize_t into size_t, which creates:

/Users/runner/hostedtoolcache/Python/3.9.0-beta.5/x64/include/python3.9/cpython/unicodeobject.h:55::
 implicit conversion changes signedness: 'Py_ssize_t' (aka 'long') to 'unsigned 
long' [-Werror,-Wsign-conversion]

error: implicit conversion changes signedness: 'Py_ssize_t' (aka 'long') to 
'unsigned long' [-Werror,-Wsign-conversion]
    memcpy(target, source, length * sizeof(Py_UNICODE));    memcpy(target, 
source, length * sizeof(Py_UNICODE));

An explicit cast to size_t (is there a Py_size_t?) should be made.

----------
components: C API
messages: 374084
nosy: Henry Schreiner
priority: normal
severity: normal
status: open
title: sign-conversion warning in 3.9 beta
type: compile error
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41366>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to