Skip to content

Commit 52eb850

Browse files
committed
Ensure graceful error in GeosLibrary.__del__ with missing instance attributes
1 parent 1b6ee1c commit 52eb850

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/basemap/utils/GeosLibrary.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
4-
# Copyright (c) 2021-2024 Víctor Molina García
4+
# Copyright (c) 2021-2025 Víctor Molina García
55
#
66
# GeosLibrary.py is free software: you can redistribute it and/or modify
77
# it under the terms of the GNU Lesser General Public License as published
@@ -62,7 +62,7 @@ def __init__(self, version, root=None):
6262
def __del__(self):
6363
"""Clean up after :class:`GeosLibrary` destruction."""
6464

65-
if self.temp:
65+
if getattr(self, "temp", None) and getattr(self, "root", None):
6666
try:
6767
shutil.rmtree(self.root)
6868
except OSError:

0 commit comments

Comments
 (0)