Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1e16af

Browse files
committed
upgrade_pythoncapi.py: fix ID_REGEX
1 parent 4b19a14 commit f1e16af

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

upgrade_pythoncapi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717

1818
# Match a C identifier: 'identifier', 'var_3', 'NameCamelCase'
19-
ID_REGEX = r'[a-zA-Z][a-zA-Z0-9_]*'
19+
# Use \b to only match a full word: match "a_b", but not just "b" in "a_b".
20+
ID_REGEX = r'\b[a-zA-Z][a-zA-Z0-9_]*\b'
2021
# Match 'array[3]'
2122
SUBEXPR_REGEX = fr'{ID_REGEX}(?:\[[^]]+\])*'
2223
# Match a C expression like "frame", "frame.attr" or "obj->attr".

0 commit comments

Comments
 (0)