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;
|
String *result = NIL;
|
||||||
|
|
||||||
// Check if this is an integer number in any base.
|
// Check if this is an integer number in any base.
|
||||||
|
errno = 0;
|
||||||
long value = strtol(s, &end, 0);
|
long value = strtol(s, &end, 0);
|
||||||
if (errno == ERANGE || end == s)
|
if (errno == ERANGE || end == s)
|
||||||
return NIL;
|
return NIL;
|
||||||
|
|
@ -2105,6 +2106,7 @@ public:
|
||||||
const char *const s = Char(v);
|
const char *const s = Char(v);
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
double value = strtod(s, &end);
|
double value = strtod(s, &end);
|
||||||
(void) value;
|
(void) value;
|
||||||
if (errno != ERANGE && end != s) {
|
if (errno != ERANGE && end != s) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue