From 14cce75299645467adcd17352cb07caada32c444 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 26 Feb 2022 17:48:50 -0500 Subject: [PATCH] Prefer re.findall, which returns materialized results. Fixes #369. --- CHANGES.rst | 6 ++++++ importlib_metadata/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8499e422..fde89269 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v4.11.2 +======= + +* #369: Fixed bug where ``EntryPoint.extras`` was returning + match objects and not the extras strings. + v4.11.1 ======= diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index 3717c8f3..045881b3 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -217,7 +217,7 @@ def attr(self): @property def extras(self): match = self.pattern.match(self.value) - return list(re.finditer(r'\w+', match.group('extras') or '')) + return re.findall(r'\w+', match.group('extras') or '') def _for(self, dist): vars(self).update(dist=dist)