summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-08-07 13:52:36 (GMT)
committerGitHub <noreply@github.com>2023-08-07 13:52:36 (GMT)
commit8fcee6b2795a504f1bd39118759e5ce44183f689 (patch)
tree0b01bd9f628fb8538aca1976ce3b90891300ee88
parentc399b5e1a56f7c659fc92edc20bc4bf522bdeffd (diff)
downloadcpython-8fcee6b2795a504f1bd39118759e5ce44183f689.zip
cpython-8fcee6b2795a504f1bd39118759e5ce44183f689.tar.gz
cpython-8fcee6b2795a504f1bd39118759e5ce44183f689.tar.bz2
gh-107710: Speed up `logging.getHandlerNames` function (#107711)
-rw-r--r--Lib/logging/__init__.py3
-rw-r--r--Misc/NEWS.d/next/Library/2023-08-07-14-24-42.gh-issue-107710.xfOCfj.rst1
2 files changed, 2 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 46e86cb..527fc5c 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 0000000..70f8b58
--- /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`.