-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Incorrect warning when assign an unsigned integer member #114388
Labels
3.11
only security fixes
3.12
bugs and security fixes
3.13
bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
Comments
serhiy-storchaka
added
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
3.11
only security fixes
3.12
bugs and security fixes
3.13
bugs and security fixes
labels
Jan 21, 2024
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jan 21, 2024
* Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.
This was referenced Jan 21, 2024
serhiy-storchaka
added a commit
that referenced
this issue
Feb 4, 2024
…4391) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Feb 4, 2024
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Feb 4, 2024
…member (pythonGH-114391) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT. (cherry picked from commit 3ddc515) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Feb 4, 2024
…member (pythonGH-114391) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT. (cherry picked from commit 3ddc515) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
that referenced
this issue
Feb 4, 2024
serhiy-storchaka
added a commit
that referenced
this issue
Feb 4, 2024
…GH-114391) (GH-115001) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT. (cherry picked from commit 3ddc515)
serhiy-storchaka
added a commit
that referenced
this issue
Feb 4, 2024
…GH-114391) (GH-115002) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT. (cherry picked from commit 3ddc515)
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
…ythonGH-114391) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
fsc-eriker
pushed a commit
to fsc-eriker/cpython
that referenced
this issue
Feb 14, 2024
…ythonGH-114391) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.
fsc-eriker
pushed a commit
to fsc-eriker/cpython
that referenced
this issue
Feb 14, 2024
With this change, there's a new warning emitted for “Writing negative value into unsigned field”. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.11
only security fixes
3.12
bugs and security fixes
3.13
bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
Assigning a negative value to an unsigned integer member can emit a RuntimeWarning.
(And for T_ULONGLONG it raises an OverflowError, but this is perhaps another issue).
The first issue is that it emits two warnings for T_UINT. It is also weird that warnings are different.
The second issue is that if the value is not an int subclass, it emits a warning also for positive values for T_UINT and T_ULONG:
(No warning is emitted for assigning a negative index to T_ULONGLONG, but this is perhaps another issue).
Linked PRs
The text was updated successfully, but these errors were encountered: