From: Petr Viktorin Date: Thu, 29 Feb 2024 10:40:18 +0000 (+0100) Subject: gh-116103: Prevent error in WindowsLoadTracker.__del__ on permission error (GH-116105) X-Git-Tag: v3.13.0a5~186 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=186fa9387669bcba6d3974a99c012c2b2c6fb4ce;p=thirdparty%2FPython%2Fcpython.git gh-116103: Prevent error in WindowsLoadTracker.__del__ on permission error (GH-116105) gh-116103: Prevent error in WindowsLoadTracker.__del__ if there was a permission error --- diff --git a/Lib/test/libregrtest/win_utils.py b/Lib/test/libregrtest/win_utils.py index 5736cdfd3c72..b51fde0af57d 100644 --- a/Lib/test/libregrtest/win_utils.py +++ b/Lib/test/libregrtest/win_utils.py @@ -24,6 +24,10 @@ class WindowsLoadTracker(): """ def __init__(self): + # make __del__ not fail if pre-flight test fails + self._running = None + self._stopped = None + # Pre-flight test for access to the performance data; # `PermissionError` will be raised if not allowed winreg.QueryInfoKey(winreg.HKEY_PERFORMANCE_DATA)