]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (#128979)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Mon, 20 Jan 2025 13:27:14 +0000 (14:27 +0100)
committerGitHub <noreply@github.com>
Mon, 20 Jan 2025 13:27:14 +0000 (13:27 +0000)
This fixes a regression introduced by 4a53a397c311567f05553bc25a28aebaba4f6f65.

Lib/sysconfig/__init__.py
Misc/NEWS.d/next/Library/2025-01-18-11-04-44.gh-issue-128978.hwg7-w.rst [new file with mode: 0644]

index 7a4a8f65a5eb3e2e0cb4c0bc964aa0786d48410f..ec9bb705925cdbc7f976a92b1b6a2f1a60a1edd1 100644 (file)
@@ -718,6 +718,9 @@ def expand_makefile_vars(s, vars):
     """
     import re
 
+    _findvar1_rx = r"\$\(([A-Za-z][A-Za-z0-9_]*)\)"
+    _findvar2_rx = r"\${([A-Za-z][A-Za-z0-9_]*)}"
+
     # This algorithm does multiple expansion, so if vars['foo'] contains
     # "${bar}", it will expand ${foo} to ${bar}, and then expand
     # ${bar}... and so forth.  This is fine as long as 'vars' comes from
diff --git a/Misc/NEWS.d/next/Library/2025-01-18-11-04-44.gh-issue-128978.hwg7-w.rst b/Misc/NEWS.d/next/Library/2025-01-18-11-04-44.gh-issue-128978.hwg7-w.rst
new file mode 100644 (file)
index 0000000..521496d
--- /dev/null
@@ -0,0 +1,2 @@
+Fix a :exc:`NameError` in :func:`!sysconfig.expand_makefile_vars`. Patch by
+Bénédikt Tran.