Fix re.subn DeprecationWarning in file module#69497
Conversation
|
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. 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. |
…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.
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.
|
Re-targeted to 3006.x, added changelog entry and test. |
What issues does this PR fix or reference?
This is a drive-by fix for a trivial Python DeprecationWarning.
Previous Behavior
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.