This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sign-conversion warning in 3.9 beta
Type: compile error Stage: resolved
Components: C API Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Henry Schreiner, methane, miss-islington, python-dev
Priority: normal Keywords: patch

Created on 2020-07-22 03:49 by Henry Schreiner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21592 merged python-dev, 2020-07-22 03:58
PR 21600 merged miss-islington, 2020-07-23 08:39
Messages (4)
msg374084 - (view) Author: Henry Schreiner (Henry Schreiner) * Date: 2020-07-22 03:49
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.
msg374130 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-07-23 08:39
New changeset 680254a8dc64e3ada00f88a7c42d41eb02108353 by Henry Schreiner in branch 'master':
bpo-41366: Fix clang warning for sign conversion (GH-21592)
https://github.com/python/cpython/commit/680254a8dc64e3ada00f88a7c42d41eb02108353
msg374131 - (view) Author: miss-islington (miss-islington) Date: 2020-07-23 08:59
New changeset e8dda907fbeb957436d2662714d993b073be55bb by Miss Islington (bot) in branch '3.9':
bpo-41366: Fix clang warning for sign conversion (GH-21592)
https://github.com/python/cpython/commit/e8dda907fbeb957436d2662714d993b073be55bb
msg374132 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-07-23 09:01
Thank you.
History
Date User Action Args
2022-04-11 14:59:33adminsetgithub: 85538
2020-07-23 09:01:18methanesetstatus: open -> closed
resolution: fixed
messages: + msg374132

stage: patch review -> resolved
2020-07-23 08:59:38miss-islingtonsetmessages: + msg374131
2020-07-23 08:39:45miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20739
2020-07-23 08:39:18methanesetnosy: + methane
messages: + msg374130
2020-07-22 03:58:58python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request20731
stage: patch review
2020-07-22 03:49:41Henry Schreinercreate