Skip to content

Leftover code in sysconfig.expand_makefile_vars #128978

Closed

Description

@picnixz

Bug report

Bug description:

I think there is some leftover code in sysconfig.expand_makefile_vars (4a53a39):

while True:
m = re.search(_findvar1_rx, s) or re.search(_findvar2_rx, s)
if m:
(beg, end) = m.span()
s = s[0:beg] + vars.get(m.group(1)) + s[end:]
else:
break
return s

The _findvar1_rx and _findvar2_rx variables are not declared at all (they were moved to sysconfig/__main__.py). Since the function is publicly named (but not exported nor documented), I prefer backporting the changes of #110785, namely re-use the patterns as is.

cc @FFY00

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or error
    on Jan 18, 2025
  2. self-assigned this
    on Jan 18, 2025
  3. added
    3.13only security fixes
    3.14bugs and security fixes
    3.12only security fixes
    on Jan 18, 2025
  4. vstinner commented on Jan 20, 2025

    @vstinner
    Member

    Is it time to deprecate this untested and undocumented function?

  5. picnixz commented on Jan 20, 2025

    @picnixz
    MemberAuthor

    Probably. It was introduced in 2000 and fixed in 2016 but nothing else: https://github.com/search?q=repo%3Apython%2Fcpython+expand_makefile_vars&type=commits.

    So how about I first fix the NameError, then in a follow-up PR, I deprecate the function (so that I can have a dedicated What's New entry)?

  6. picnixz commented on Jan 20, 2025

    @picnixz
    MemberAuthor

    Also, distutils or graalpython seems to provide a (working) bundled version of that function so I don't think we need to worry about?

  7. vstinner commented on Jan 20, 2025

    @vstinner
    Member

    So how about I first fix the NameError, then in a follow-up PR, I deprecate the function (so that I can have a dedicated What's New entry)?

    Sure, if we decide to deprecate the function, it should be done in separated change.

  8. added a commit that references this issue on Jan 20, 2025
  9. added 2 commits that reference this issue on Jan 20, 2025
  10. added a commit that references this issue on Jan 20, 2025
  11. FFY00 commented on Jan 20, 2025

    @FFY00
    Member

    Is it time to deprecate this untested and undocumented function?

    It's sort-of tested through sysconfig.get_paths. Edit: It's not. sysconfig.get_paths uses sysconfig._expand_vars.

    I am up to rename it to _expand_makefile_vars, and deprecate expand_makefile_vars. Searching Github for usages of this function (https://github.com/search?q=expand_makefile_vars%20language:Python&type=code&l=Python), I only very few unique usages of it in the wild. And for folks that still need it, as a quick fix, they can add a dependency on setuptools and use distutils.sysconfig.expand_makefile_vars instead.

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

Metadata

Metadata

Assignees

Labels

3.13only security fixes3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions