Skip to content

Commit 755e08f

Browse files
jessp01nforro
authored andcommitted
With the new regex r"^([?!]+)", if condition does not start with ? or !,
re.split will return a list with a single element: the condition string itself. Consequently, len(tokens) will be 1, and prefix on line 275 will be assigned the entire condition string.
1 parent 5dbd1ca commit 755e08f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

specfile/value_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def find_macro_end(index):
272272
if ":" in value[start:end]:
273273
condition, body = value[start + 2 : end - 1].split(":", maxsplit=1)
274274
tokens = re.split(r"^([?!]+)", condition, maxsplit=1)
275-
prefix = tokens[0 if len(tokens) == 1 else 1]
275+
prefix = "" if len(tokens) == 1 else tokens[1]
276276
if "?" in prefix:
277277
result.append(
278278
ConditionalMacroExpansion(condition, cls.parse(body))

0 commit comments

Comments
 (0)