summaryrefslogtreecommitdiff
path: root/python3/pyinotify.py
diff options
context:
space:
mode:
Diffstat (limited to 'python3/pyinotify.py')
-rwxr-xr-xpython3/pyinotify.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
index 23fae15..9fb815e 100755
--- a/python3/pyinotify.py
+++ b/python3/pyinotify.py
@@ -1391,9 +1391,12 @@ class Notifier:
Close inotify's instance (close its file descriptor).
It destroys all existing watches, pending events,...
This method is automatically called at the end of loop().
+ Afterward it is invalid to access this instance.
"""
- self._pollobj.unregister(self._fd)
- os.close(self._fd)
+ if self._fd is not None:
+ self._pollobj.unregister(self._fd)
+ os.close(self._fd)
+ self._fd = None
self._sys_proc_fun = None