-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Open
Labels
easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Both functions have old TODO comments:
Lines 671 to 676 in 453d886
| if (overflow) { | |
| /* XXX: could be cute and give a different | |
| message for overflow == -1 */ | |
| PyErr_SetString(PyExc_OverflowError, | |
| "Python int too large to convert to C long"); | |
| } |
Lines 688 to 694 in 453d886
| if (overflow || result > INT_MAX || result < INT_MIN) { | |
| /* XXX: could be cute and give a different | |
| message for overflow == -1 */ | |
| PyErr_SetString(PyExc_OverflowError, | |
| "Python int too large to convert to C int"); | |
| return -1; | |
| } |
Lets either remove these marks or provide different error messages, for example for longs:
if (overflow > 0) {
PyErr_Format(PyExc_OverflowError,
"Python int too large to convert to C long, value > %ld",
LONG_MAX);
return -1;
}
else if (overflow < 0) {
PyErr_Format(PyExc_OverflowError,
"Python int too large to convert to C long, value < %ld",
LONG_MIN);
return -1;
}Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement