From afd986c577f32b5adbbdb888d2380cbcc3d8909e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 3 Oct 2017 19:08:56 +0100 Subject: [PATCH] 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. --- Source/Modules/python.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 4e9053395..259d7c0d8 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -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) {