[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread STINNER Victor
STINNER Victor added the comment: Do you want to propose to write a PR to fix this issue? -- versions: +Python 3.9 ___ Python tracker ___ _

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread Ben Boeckel
Ben Boeckel added the comment: > The paths are not user provided: they are hardcoded paths from the sysconfig > module: No, those paths are the *replacement* values, not the input. From the trace docs: > trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs This is the string where `

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread STINNER Victor
STINNER Victor added the comment: > These should *not* be replaced: > > r"not/a/$prefix" > r"$prefix spacevar/subdir" Honestly, I don't see an issue to replace $prefix in these examples. These examples seem artificial. The paths are not user provided: they are hardcoded paths from the syscon

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-13 Thread STINNER Victor
STINNER Victor added the comment: Would you mind to add examples of patterns should be replaced and patterns which should not be replaced? -- ___ Python tracker ___ _

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-13 Thread Ben Boeckel
Ben Boeckel added the comment: `\b` is a bit too loose. That example should *not* have it replaced because it is not a full path component. (Granted, any of these conflicting paths are "dumb" in general; I'm fine with just leaving this as a low priority, but if it does get modified, it shoul

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-13 Thread STINNER Victor
STINNER Victor added the comment: str.replace() can be replaced with re.sub() and \b marker. Example: >>> re.sub(r'\$prefix\b', '[xxx]', '$prefix $prefixpath') '[xxx] $prefixpath' -- ___ Python tracker ___

[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-13 Thread Ben Boeckel
New submission from Ben Boeckel : Previously reported as a sidenote in Issue21016. The `--ignore-dir` option in trace.py replaces `$prefix` and `$exec_prefix` *anywhere* in the path when it really should just replace it in the start of the path and if it is followed by nothing or a path separ