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 382382Traceback (most recent call last):
383383SyntaxError: invalid syntax
384384
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+
385392From compiler_complex_args():
386393
387394>>> 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) {
620620 Py_ssize_t size ;
621621 PyBytes_AsStringAndSize (t -> bytes , & the_token , & size );
622622 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 ) {
624625 return _PyPegen_name_from_token (p , t );
625626 }
626627 }
You can’t perform that action at this time.
0 commit comments