Deprecate accepting out of range values for unsigned integers in PyArg_Parse #132629
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-C-API
type-feature
A feature request or enhancement
Uh oh!
There was an error while loading. Please reload this page.
Feature or enhancement
For unsigned integer formats (
B
,H
,I
,k
,K
) inPyArg_Parse
, there is no overflow check. If the Python integer value is out of range of the corresponding C type, only the lowest bits are stored, and the higher bits are silently dropped. There are two reasons for this:But values that cannot be represented neither in unsigned not in signed C type, are obviously invalid. Silently accepting them can provoke bugs.
At first, I propose to emit a deprecation warning for such values. Later they will became errors.
Linked PRs
The text was updated successfully, but these errors were encountered: