From 2425c8d6d896dfb4eacb1b5877a5fa6274fde8d8 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 23 Jun 2017 14:54:50 +1200 Subject: [PATCH] Don't handle cases like -1U as Python constants --- Source/Modules/python.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index a55c8ab09..73706f240 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -2047,14 +2047,18 @@ public: if (errno == ERANGE || end == s) return NIL; if (*end != '\0') { - // If there is a suffix after the number, we can safely ignore any - // combination of "l" and "u", but not anything else. + // If there is a suffix after the number, we can safely ignore "l" + // and (provided the number is unsigned) "u", and also combinations of + // these, but not anything else. for (char *p = end; *p != '\0'; ++p) { switch (*p) { case 'l': case 'L': + break; case 'u': case 'U': + if (value < 0) + return NIL; break; default: return NIL;