Skip to content

Fix re.subn DeprecationWarning in file module#69497

Open
jprenken wants to merge 1 commit into
saltstack:3006.xfrom
jprenken:re-subn
Open

Fix re.subn DeprecationWarning in file module#69497
jprenken wants to merge 1 commit into
saltstack:3006.xfrom
jprenken:re-subn

Conversation

@jprenken

Copy link
Copy Markdown

What issues does this PR fix or reference?

This is a drive-by fix for a trivial Python DeprecationWarning.

Previous Behavior

/opt/saltstack/salt/lib/python3.14/site-packages/salt/modules/file.py:2833: DeprecationWarning: 'count' is passed as positional argument

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

@jprenken jprenken requested a review from a team as a code owner June 20, 2026 20:50
@welcome

welcome Bot commented Jun 20, 2026

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject.pdl@broadcom.com. We're glad you've joined our community and look forward to doing awesome things with you!

dwoz added a commit to dwoz/salt that referenced this pull request Jun 20, 2026
…pdates"

This reverts commit 7d58645.

The dependabot bump landed in an inconsistent state and red-lit the
3008.x pre-commit run (saltstack#69497).

  - It bumped ``cryptography>=46.0.7,<48.0.0; python_version < '3.10'``
    to ``>=49.0.0,<50.0.0`` in ``requirements/base.txt`` line 19. The
    comment immediately above that line (lines 13-18) explicitly says
    "cryptography 48.0.0 drops support for Python 3.9.0 and 3.9.1 ...
    the py3.9 lock files are compiled with ``--python-version=3.9``
    which includes those releases. Cap at the last 46.x release for
    Python 3.9 so uv pip compile can still resolve." Every cryptography
    release from 44.0.0 onward carries
    ``requires_python = !=3.9.0,!=3.9.1,>=3.9`` and dependabot ignored
    the cap. uv then errored: "the requested Python version (>=3.9)
    does not satisfy ... Python>3.9.0,<3.9.1 / Python>3.9.1".
  - The matching pin in ``requirements/static/ci/common.txt`` was left
    at ``>=46.0.7,<48.0.0; python_version < '3.10'``, producing the
    second uv error: "Because you require
    cryptography{python_full_version < '3.10'}>=49.0.0 and
    cryptography{python_full_version < '3.10'}>=46.0.7,<48.0.0, we can
    conclude that your requirements are unsatisfiable".
  - Because ``pip-compile`` aborted on the cryptography conflict before
    regenerating the lockfiles, the rest of the bump (virtualenv
    21.4.2->21.5.1, pyopenssl 26.2.0->26.3.0, urllib3 <3.10
    1.26.20->2.6.3, tornado 6.5.6->6.5.7) was applied to base.txt and
    common.txt but never reached the ``.lock`` files. Running
    ``pip-compile`` post-merge surfaces the secondary unsatisfiable
    constraint "you require virtualenv>=21.5.1 and virtualenv==21.4.2",
    etc. So the failure mode chains: any one bump in the group could
    pass on its own, but the group as committed is unsatisfiable on
    py3.9 and stale on every other lockfile.

Reverting the whole group restores the last known-good state. Dependabot
will reopen the bumps individually; the cryptography ``< '3.10'`` line
should stay capped at 46.x until 3008.x drops py3.9 support entirely.
@dwoz dwoz changed the base branch from master to 3006.x June 20, 2026 22:13
@dwoz dwoz added this to the Sulphur v3006.26 milestone Jun 20, 2026
@dwoz dwoz added the test:full Run the full test suite label Jun 20, 2026
Pass count as a keyword argument to all three re.subn() calls in
salt.modules.file.replace to silence the Python 3.12+
DeprecationWarning: 'count' is passed as positional argument.

Add regression test and changelog entry.
@dwoz

dwoz commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Re-targeted to 3006.x, added changelog entry and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants