aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2026-06-03 04:37:29 +0000
committerXin LI <delphij@FreeBSD.org>2026-06-03 04:37:29 +0000
commit79746c47b95c50bfab9b70e86bafdfeb844d9118 (patch)
tree3e1ea3960c21349604c2a4f3744f6da7c0ecad45 /python
parent995a16e0c2eb64b0875bccf37e696bddf35c3846 (diff)
Diffstat (limited to 'python')
-rw-r--r--python/magic.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/magic.py b/python/magic.py
index 4300ee0719a9..14938281c659 100644
--- a/python/magic.py
+++ b/python/magic.py
@@ -127,12 +127,14 @@ _setparam.argtypes = [magic_t, c_int, c_void_p]
class Magic(object):
def __init__(self, ms):
self._magic_t = ms
+ self._close = _close
def close(self):
"""
Closes the magic database and deallocates any resources used.
"""
- _close(self._magic_t)
+ if _close:
+ _close(self._magic_t)
@staticmethod
def __tostr(s):