From: Nikita Sobolev Date: Mon, 7 Aug 2023 13:52:36 +0000 (+0300) Subject: gh-107710: Speed up `logging.getHandlerNames` function (#107711) X-Git-Tag: v3.13.0a1~1050 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fcee6b2795a504f1bd39118759e5ce44183f689;p=thirdparty%2FPython%2Fcpython.git gh-107710: Speed up `logging.getHandlerNames` function (#107711) --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 46e86cb87ecf..527fc5c63173 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -916,8 +916,7 @@ def getHandlerNames(): """ Return all known handler names as an immutable set. """ - result = set(_handlers.keys()) - return frozenset(result) + return frozenset(_handlers) class Handler(Filterer): diff --git a/Misc/NEWS.d/next/Library/2023-08-07-14-24-42.gh-issue-107710.xfOCfj.rst b/Misc/NEWS.d/next/Library/2023-08-07-14-24-42.gh-issue-107710.xfOCfj.rst new file mode 100644 index 000000000000..70f8b58e7ff5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-08-07-14-24-42.gh-issue-107710.xfOCfj.rst @@ -0,0 +1 @@ +Speed up :func:`logging.getHandlerNames`.