classification
Title: Lib/sysconfig.py expands non-variables
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, lepaperwan, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-09-14 20:11 by lepaperwan, last changed 2020-07-06 08:47 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 9362 closed lepaperwan, 2018-09-17 17:53
PR 20439 open lepaperwan, 2020-05-26 21:20
Messages (1)
msg325393 - (view) Author: Erwan Le Pape (lepaperwan) * Date: 2018-09-14 20:11
Lib/sysconfig.py _parse_makefile needs to expand Makefile-style variables which includes `$()` `${}` variables with a litteral `$` being `$$`.

That last particular point is properly accounted for in the first half of the function when determining values that need expansion and those that don't. However, the second half that actually performs variable expansion doesn't.

Sample breaking input:
VAR1=  VALUE1
VAR2=  VALUE2
VAR3=$${VAR1} ${VAR2}

Output:
Expect: {'VAR1': 'VALUE1', 'VAR2': 'VALUE2', 'VAR3': '$${VAR1} VALUE2'}
Actual: {'VAR1': 'VALUE1', 'VAR2': 'VALUE2', 'VAR3': '$VALUE1 VALUE2'}

I'm working on patching this but I'm putting this here as feedback is welcome.

As far as I could tell, this is a side effect of b2b1217, which patched #24705.
History
Date User Action Args
2020-07-06 08:47:02terry.reedysetnosy: + berker.peksag, serhiy.storchaka

versions: + Python 3.10, - Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
2020-05-26 21:20:35lepaperwansetpull_requests: + pull_request19696
2018-09-17 17:53:11lepaperwansetkeywords: + patch
stage: patch review
pull_requests: + pull_request8786
2018-09-14 20:11:33lepaperwancreate