From 42d64527bf635d5de91c994ae60870828df19ea2 Mon Sep 17 00:00:00 2001 From: Ee Durbin Date: Thu, 3 Oct 2024 19:15:18 -0400 Subject: [PATCH] pass globals/locals to eval --- src/packaging/licenses/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packaging/licenses/__init__.py b/src/packaging/licenses/__init__.py index 2385b67b..569156d6 100644 --- a/src/packaging/licenses/__init__.py +++ b/src/packaging/licenses/__init__.py @@ -97,7 +97,7 @@ def canonicalize_license_expression( python_expression = " ".join(python_tokens) try: - invalid = eval(python_expression) + invalid = eval(python_expression, globals(), locals()) except Exception: invalid = True