From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:54:48 +0000 (+0100) Subject: [3.13] gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (GH-128979... X-Git-Tag: v3.13.2~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55d3d8165c0aa522d90fe92b92ade74beb27d9f9;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (GH-128979) (#129065) gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (GH-128979) This fixes a regression introduced by 4a53a397c311567f05553bc25a28aebaba4f6f65. (cherry picked from commit df66ff14b49f4388625212f6bc86b754cb51d4eb) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index ec3b638f0076..43eda00ea92c 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -695,6 +695,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 index 000000000000..521496d6a2f8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-01-18-11-04-44.gh-issue-128978.hwg7-w.rst @@ -0,0 +1,2 @@ +Fix a :exc:`NameError` in :func:`!sysconfig.expand_makefile_vars`. Patch by +Bénédikt Tran.