8000 Warning "Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]" · Issue #115827 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Warning "Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]" #115827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sobolevn opened this issue Feb 22, 2024 · 1 comment
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member
sobolevn commented Feb 22, 2024

Bug report

It happens here:

cpython/Objects/longobject.c

Lines 1166 to 1193 in b348313

#if PY_LITTLE_ENDIAN
if (little_endian) {
memcpy(buffer, cv.b, sizeof(cv.b));
memset((char *)buffer + sizeof(cv.b), fill, n - sizeof(cv.b));
}
else {
unsigned char *b = (unsigned char *)buffer;
for (Py_ssize_t i = 0; i < n - (int)sizeof(cv.b); ++i) {
*b++ = fill;
}
for (Py_ssize_t i = sizeof(cv.b); i > 0; --i) {
*b++ = cv.b[i - 1];
}
}
#else
if (little_endian) {
unsigned char *b = (unsigned char *)buffer;
for (Py_ssize_t i = sizeof(cv.b); i > 0; --i) {
*b++ = cv.b[i - 1];
}
for (Py_ssize_t i = 0; i < n - sizeof(cv.b); ++i) {
*b++ = fill;
}
}
else {
memset(buffer, fill, n - sizeof(cv.b));
memcpy((char *)buffer + n - sizeof(cv.b), cv.b, sizeof(cv.b));
}

Line 1186. The problem is:

Buildbot link: https://buildbot.python.org/all/#/builders/332/builds/1372

I have a PR ready.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Feb 22, 2024
@sobolevn sobolevn self-assigned this Feb 22, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Feb 22, 2024
sobolevn added a commit that referenced this issue Feb 22, 2024
Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
@sobolevn
Copy link
Member Author

Backports are not needed, this is new in 3.13

smontanaro pushed a commit to smontanaro/cpython that referenced this issue Feb 23, 2024
…GH-115828)

Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
(cherry picked from commit 465df88)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this issue Mar 4, 2024
Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this issue Jan 22, 2025
Objects/longobject.c:1186:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
0