Incorrect warning when assign an unsigned integer member #114388
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
Description
Activity
- addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixes
on Jan 21, 2024 - added 6 commits that reference this issue
on Feb 4, 2024 - added a commit that references this issue
on Feb 4, 2024 With this change, there's a new warning emitted for “Writing negative value into unsigned field”.
@zooba, you might be interested in this
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(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