File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 382
382
Traceback (most recent call last):
383
383
SyntaxError: invalid syntax
384
384
385
+ # But prefixes of soft keywords should
386
+ # still raise specialized errors
387
+
388
+ >>> (mat x)
389
+ Traceback (most recent call last):
390
+ SyntaxError: invalid syntax. Perhaps you forgot a comma?
391
+
385
392
From compiler_complex_args():
386
393
387
394
>>> def f(None=1):
Original file line number Diff line number Diff line change @@ -620,7 +620,8 @@ expr_ty _PyPegen_soft_keyword_token(Parser *p) {
620
620
Py_ssize_t size ;
621
621
PyBytes_AsStringAndSize (t -> bytes , & the_token , & size );
622
622
for (char * * keyword = p -> soft_keywords ; * keyword != NULL ; keyword ++ ) {
623
- if (strncmp (* keyword , the_token , (size_t )size ) == 0 ) {
623
+ if (strlen (* keyword ) == (size_t )size &&
624
+ strncmp (* keyword , the_token , (size_t )size ) == 0 ) {
624
625
return _PyPegen_name_from_token (p , t );
625
626
}
626
627
}
You can’t perform that action at this time.
0 commit comments