Skip to content

utils: Move flags into re.compile statements#46

Open
RedL0tus wants to merge 1 commit intoproductionfrom
fix-3.14-re
Open

utils: Move flags into re.compile statements#46
RedL0tus wants to merge 1 commit intoproductionfrom
fix-3.14-re

Conversation

@RedL0tus
Copy link
Copy Markdown
Member

@RedL0tus RedL0tus commented May 6, 2026

re in Python 3.14 no longer allows setting flags with compiled statements.

Example error log:

[ERROR]: cannot process flags argument with a compiled pattern
Traceback (most recent call last):
  File "/usr/lib/python3.14/site-packages/acbs/main.py", line 213, in build
    self.build_sequential(build_timings, packages)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/acbs/main.py", line 315, in build_sequential
    write_checksums(spec_location, checksum)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/acbs/utils.py", line 422, in write_checksums
    if re.search(chksum_pattern, content, re.MULTILINE | re.DOTALL):
       ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/re/__init__.py", line 177, in search
    return _compile(pattern, flags).search(string)
           ~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/re/__init__.py", line 345, in _compile
    raise ValueError(
        "cannot process flags argument with a compiled pattern")
ValueError: cannot process flags argument with a compiled pattern
[INFO]: ACBS is trying to save your build status...
[INFO]: ... saved to /tmp/1778094153.acbs-ckpt

[CRIT]: Oops! RuntimeError: Build error.
Use `acbs-build --resume /tmp/1778094153.acbs-ckpt` to resume after you sorted out the situation.

re module in Python 3.14 no longer allows setting flags with compiled
statements.
@RedL0tus RedL0tus requested a review from liushuyu May 6, 2026 19:55
@what-the-diff
Copy link
Copy Markdown

what-the-diff Bot commented May 6, 2026

PR Summary

  • Expanded Matching Capabilities in Pattern Regex Compilations
    The update adds flags re.MULTILINE | re.DOTALL to the chksum_pattern and tarball_pattern regular expressions. This enhances their compiling process, boosting the ability to match patterns across different lines and to consider all characters in the process.

  • Default Matching in write_checksums Function
    The update also removes flags from the re.search and re.sub calls within the write_checksums function. This reversion means the function now uses default matching behaviour, which simplifies the overall code execution.

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.

1 participant