From 037bf7c4d5fc671b0b822d611e850abc702281d0 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 9 May 2025 10:41:55 +0100 Subject: [PATCH] wsgi: Don't create, use lock in same line As noted on the mailing list some time back [1], pylint flags this as a useless lock [2]. Make it non-useless. [1] https://lists.openstack.org/archives/list/openstack-discuss@lists.openstack.org/message/CZVC6SEMUSEH7UT5LDHOWL7WBZ2OXUWZ/ [2] https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/useless-with-lock.html Change-Id: Ia0d3899d84db5fce92fad17d19f375681debe864 Signed-off-by: Stephen Finucane --- keystone/wsgi/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keystone/wsgi/api.py b/keystone/wsgi/api.py index f3a1bbf7fe..0539cb8c1a 100644 --- a/keystone/wsgi/api.py +++ b/keystone/wsgi/api.py @@ -17,6 +17,7 @@ import threading from keystone.server import wsgi application = None -with threading.Lock(): +lock = threading.Lock() +with lock: if application is None: application = wsgi.initialize_public_application()