Skip to content

Fix WorkQueue.pack(): use flags=re.I instead of positional re.I argument - #777

Merged
tmaeno merged 2 commits into
PanDAWMS:masterfrom
veprbl:pr/re.sub_bug
Aug 28, 2026
Merged

Fix WorkQueue.pack(): use flags=re.I instead of positional re.I argument#777
tmaeno merged 2 commits into
PanDAWMS:masterfrom
veprbl:pr/re.sub_bug

Conversation

@veprbl

@veprbl veprbl commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

The re.sub() calls were passing re.I as the 4th positional argument (count), not as flags=re.I. This meant only the first AND/OR/NOT/IN/LIKE/NULL replacement would occur, causing eval() failures for criteria with multiple conditions.

Example broken criteria:
'prodSourceLabel="test" AND processingType="x" AND workingGroup="EIC"'
After pack():
'prodSourceLabel="test" and processingType="x" AND workingGroup="EIC"'
The 2nd+ AND remain uppercase -> eval() crashes with NameError: AND

Fixed by using flags=re.I keyword argument in all re.sub() calls.

n.b. use of positional count and flags arguments are deprecated in Python 3.13 https://docs.python.org/3/library/re.html

The re.sub() calls were passing re.I as the 4th positional argument (count),
not as flags=re.I. This meant only the first AND/OR/NOT/IN/LIKE/NULL
replacement would occur, causing eval() failures for criteria with multiple
conditions.

Example broken criteria: 'prodSourceLabel="test" AND processingType="x" AND workingGroup="EIC"'
After pack(): 'prodSourceLabel="test" and processingType="x" AND workingGroup="EIC"'
The 2nd+ AND remain uppercase -> eval() crashes with NameError: AND

Fixed by using flags=re.I keyword argument in all re.sub() calls.
Comment thread pandaserver/taskbuffer/WorkQueue.py Outdated
@tmaeno
tmaeno merged commit fe966a2 into PanDAWMS:master Aug 28, 2026
1 check passed
@veprbl
veprbl deleted the pr/re.sub_bug branch August 28, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants