)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"60dd7b82592b6b13279fcf76bb1f90b1bb97000d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"bfbe9d22_8e960d54","updated":"2025-05-08 16:04:10.000000000","message":"Looks OK to me","commit_id":"023be4f5615255d06f61b393605da1308f045220"}],"nova/wsgi/metadata.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"63d0cf54d47f9367e0d1ccc9284059062bdde6f6","unresolved":true,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"application \u003d None"},{"line_number":22,"context_line":"lock \u003d threading.Lock()"},{"line_number":23,"context_line":"with lock:"},{"line_number":24,"context_line":"    if application is None:"},{"line_number":25,"context_line":"        application \u003d wsgi_app.init_application(NAME)"}],"source_content_type":"text/x-python","patch_set":1,"id":"e72e2ca3_b8b7f24f","line":23,"updated":"2025-05-15 16:42:56.000000000","message":"Isn\u0027t it useless the same way as before?\nIf two parallel threads ever executes this code then each will create a separate lock objetc as we never check if the lock exits before we creating it at L22 and happily acquire it in the context manager.","commit_id":"023be4f5615255d06f61b393605da1308f045220"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"690f7d46211210ac941442afd5a498e0a814f3e1","unresolved":true,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"application \u003d None"},{"line_number":22,"context_line":"lock \u003d threading.Lock()"},{"line_number":23,"context_line":"with lock:"},{"line_number":24,"context_line":"    if application is None:"},{"line_number":25,"context_line":"        application \u003d wsgi_app.init_application(NAME)"}],"source_content_type":"text/x-python","patch_set":1,"id":"cc7a2111_68e6f806","line":23,"in_reply_to":"e72e2ca3_b8b7f24f","updated":"2025-05-17 12:21:53.000000000","message":"if we want to fix this in a simple way we can use the fact that\npython dict assignemtns are atomic \n\nso instead of \n\n```\nlock \u003d threading.Lock()\n```\nwe can access the module level scope using locals and do this\n\n```\nlocals().setdefault(\u0027lock\u0027, threading.Lock())\n```\nwe could be a littel more explcit and use globals since that\nalwasy returns the current modules scope rather then relying on the\nfact that our local scope will be currently the module\n```\nglobals().setdefault(\u0027lock\u0027, threading.Lock())\n```\nhttps://docs.python.org/3.10/library/functions.html#globals\nhttps://docs.python.org/3.10/library/functions.html#locals\nhttps://docs.python.org/3.10/library/stdtypes.html#dict.setdefault","commit_id":"023be4f5615255d06f61b393605da1308f045220"}]}
