Skip to content

Lib/sysconfig.py expands non-variables #78870

Closed

Description

@lepaperwan
BPO 34689
Nosy @berkerpeksag, @serhiy-storchaka, @lepaperwan
PRs
  • bpo-34689: Prevent sysconfig._parse_makefile from expanding $${variables} #9362
  • bpo-34689: Prevent sysconfig._parse_makefile from expanding $${variables} #20439
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-09-14.20:11:33.198>
    labels = ['type-bug', 'library', '3.10']
    title = 'Lib/sysconfig.py expands non-variables'
    updated_at = <Date 2020-07-06.08:47:02.118>
    user = 'https://github.com/lepaperwan'

    bugs.python.org fields:

    activity = <Date 2020-07-06.08:47:02.118>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-09-14.20:11:33.198>
    creator = 'lepaperwan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34689
    keywords = ['patch']
    message_count = 1.0
    messages = ['325393']
    nosy_count = 3.0
    nosy_names = ['berker.peksag', 'serhiy.storchaka', 'lepaperwan']
    pr_nums = ['9362', '20439']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34689'
    versions = ['Python 3.10']

    Linked PRs

    Activity

    1. lepaperwan commented on Sep 14, 2018

      lepaperwanmannequin
      MannequinAuthor

      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 bpo-24705.

    2. added
      3.7 (EOL)
      3.8 (EOL)
      stdlib
      type-bug
      on Sep 14, 2018
    3. added
      3.10 (EOL)
      and removed
      3.7 (EOL)
      3.8 (EOL)
      on Jul 6, 2020
    4. transferred this issue fromon Apr 10, 2022
    5. added
      3.11
      3.12
      on Apr 3, 2023
    6. removed
      3.11
      3.10 (EOL)
      3.12
      on Aug 12, 2025
    7. added a commit that references this issue on Oct 10, 2025
    8. FFY00 commented on Oct 10, 2025

      @FFY00
      Member

      This issue seems to have been fixed by GH-136166.

    9. added a commit that references this issue on Oct 10, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibtopic-sysconfigtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions