Python - set errno for default args handling
errno needs setting otherwise a failed strol may result in subsequent unnecessary code generation to use *args instead of actual default argument values. Related to issue #1108.
This commit is contained in:
parent
11a658db79
commit
afd986c577
1 changed files with 2 additions and 0 deletions
|
|
@ -2044,6 +2044,7 @@ public:
|
|||
String *result = NIL;
|
||||
|
||||
// Check if this is an integer number in any base.
|
||||
errno = 0;
|
||||
long value = strtol(s, &end, 0);
|
||||
if (errno == ERANGE || end == s)
|
||||
return NIL;
|
||||
|
|
@ -2105,6 +2106,7 @@ public:
|
|||
const char *const s = Char(v);
|
||||
char *end;
|
||||
|
||||
errno = 0;
|
||||
double value = strtod(s, &end);
|
||||
(void) value;
|
||||
if (errno != ERANGE && end != s) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue