summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgeneric/tclStrToD.c2
-rw-r--r--tests/expr.test3
2 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index f98f8c3..1892d70 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -1121,7 +1121,7 @@ TclParseNumber(
while(0) {
checktrail:
- if ((c>='0')&&(c<='9')||(c>='A')&&(c<='Z')||(c>='a')&&(c<='z')||(c=='_')) {
+ if (isalnum(UCHAR(c))||(c=='_')) {
/* bareword prefixed by Nan, Inf, etc. */
acceptState = INITIAL;
}
diff --git a/tests/expr.test b/tests/expr.test
index 6679569..81f9b1c 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -907,6 +907,9 @@ test expr-22.9 {non-numeric floats: shared object equality and NaN} {
set x NaN
expr {$x == $x}
} 0
+test expr-22.10 {bareword prefixed by a non-numeric} -body {
+ list [catch {expr {nancy}} msg] $msg
+} -match glob -result {1 {invalid bareword "nancy"*}}
# Tests for exponentiation handling
test expr-23.1 {CompileExponentialExpr: just exponential expr} {expr 4**2} 16