Skip to content

Commit

Permalink
Restored original state using finally
Browse files Browse the repository at this point in the history
Co-authored-by: Ondrej Baranovič <[email protected]>
  • Loading branch information
radarhere and nulano authored Jan 23, 2024
1 parent 8caae87 commit e2d1b26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Tests/test_font_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
def test_leak(self):
if features.check_module("freetype2"):
ImageFont.core = _util.DeferredError(ImportError)
default_font = ImageFont.load_default()
ImageFont.core = original_core
try:
default_font = ImageFont.load_default()
finally:
ImageFont.core = original_core

self._test_font(default_font)

0 comments on commit e2d1b26

Please sign in to comment.