From f8f93c18d47bb10df483d8d2478720347b99b391 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 8 Jul 2024 11:20:55 -0400 Subject: [PATCH] Support older Pythons --- pyperf/_hooks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyperf/_hooks.py b/pyperf/_hooks.py index 21c3012a..83260d6a 100644 --- a/pyperf/_hooks.py +++ b/pyperf/_hooks.py @@ -9,8 +9,13 @@ def get_hooks(): + hook_prefix = "pyperf.hook" entry_points = importlib.metadata.entry_points() - return (x.load() for x in entry_points.select(group="pyperf.hook")) + if sys.version_info[:2] < (3, 10): + group = entry_points[hook_prefix] + else: + group = entry_points.select(hook_prefix) + return (x.load() for x in group) def get_hook_names():