Skip to content

Commit 25de4fa

Browse files
zachs18SiegeLord
authored andcommitted
Fix regex on line 65 of generate_python_ctypes.py
The previous regex on line 65 r"\bstruct|union\b" matches "struct" at the beginning of a word or "union" at the end of a word (e.g. it matches twice on "structured reunion" and re.sub will give "ured re"). The proposed regex r"\b(struct|union)\b" matches "struct" or "union" as a whole word only.
1 parent cda2757 commit 25de4fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/generate_python_ctypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_type(self, ptype):
6262
"postprocess_callback_t": c_void_p,
6363
}
6464

65-
ptype = re.sub(r"\bstruct|union\b", "", ptype)
65+
ptype = re.sub(r"\b(struct|union)\b", "", ptype)
6666
ptype = re.sub(r"\bconst\b", "", ptype)
6767
ptype = re.sub(r"\bextern\b", "", ptype)
6868
ptype = re.sub(r"\b__inline__\b", "", ptype)

0 commit comments

Comments
 (0)