From 52eb8509c069f143c7f0089583d5693fc5d4abae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Mon, 24 Feb 2025 11:15:20 +0100 Subject: [PATCH] Ensure graceful error in GeosLibrary.__del__ with missing instance attributes --- packages/basemap/utils/GeosLibrary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/basemap/utils/GeosLibrary.py b/packages/basemap/utils/GeosLibrary.py index 4db6b88e9..0462d6775 100644 --- a/packages/basemap/utils/GeosLibrary.py +++ b/packages/basemap/utils/GeosLibrary.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2021-2024 Víctor Molina García +# Copyright (c) 2021-2025 Víctor Molina García # # GeosLibrary.py is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -62,7 +62,7 @@ def __init__(self, version, root=None): def __del__(self): """Clean up after :class:`GeosLibrary` destruction.""" - if self.temp: + if getattr(self, "temp", None) and getattr(self, "root", None): try: shutil.rmtree(self.root) except OSError: