Merged
Conversation
When a replacement references a replacement in a non-testenv section it should also be expanded
Expand substitution expressions that result from a previous subsitution expression replacement value (up to 100 times). Fix tox-dev#2863
gaborbernat
reviewed
Jan 16, 2023
| REPLACE_START = "{" | ||
| REPLACE_END = "}" | ||
| BACKSLASH_ESCAPE_CHARS = ["\\", ARG_DELIMITER, REPLACE_START, REPLACE_END, "[", "]"] | ||
| MAX_REPLACE_DEPTH = 100 |
Member
There was a problem hiding this comment.
Can we add a test for this with a circular reference of length 5, and one with 101?
Contributor
Author
There was a problem hiding this comment.
Added a test that checks different recursion levels and asserts that the log message is triggered and that expansion stops at the correct level.
Create a long chain of substitution values and assert that they stop being processed after some time.
descope bot
referenced
this pull request
in descope/django-descope
Jan 30, 2023
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [tox](https://togithub.com/tox-dev/tox) ([changelog](https://tox.wiki/en/latest/changelog.html)) | dev | patch | `4.3.0` -> `4.3.1` | `4.4.2` (+6) | --- ### Release Notes <details> <summary>tox-dev/tox</summary> ### [`v4.3.1`](https://togithub.com/tox-dev/tox/releases/tag/4.3.1) [Compare Source](https://togithub.com/tox-dev/tox/compare/4.3.0...4.3.1) #### What's Changed - Recursive replace by [@​masenf](https://togithub.com/masenf) in [https://github.com/tox-dev/tox/pull/2864](https://togithub.com/tox-dev/tox/pull/2864) **Full Changelog**: tox-dev/tox@4.3.0...4.3.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDEuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEwMS4wIn0=--> Co-authored-by: descope[bot] <descope[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recursive Replace
Expand substitution expressions that result from a previous substitution expression replacement value (up to 100 times).
Add a new
MatchRecursionErrorand stack depth tracking to avoid infinite recursion or python throwing a RecursionError and blowing up tox. Instead, log an error and take the last value as-is, which is what tox did prior to 4.3.0.The behavior with this patch is more similar to pre-4.3.0 parser changes with the large caveat that replacement values are themselves expanded within their own context only, previously the value was replaced into the original string and the entire result was re-expanded, which led to some strange edge cases when expansions contained un-escaped special characters.
Fix #2863
Thanks for contribution
Please, make sure you address all the checklists (for details on how see
development documentation)!
tox -e fix)docs/changelogfolder