Skip to content

Commit

Permalink
Refinement of previous commit implemented with help of patch of
Browse files Browse the repository at this point in the history
Guillermo Gonzalez <[email protected]>.
  • Loading branch information
seb-m committed Jan 13, 2010
1 parent c3cdeba commit d334049
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
16 changes: 7 additions & 9 deletions python2/pyinotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,13 +730,6 @@ def process_default(self, raw_event, to_append=None):
IN_OPEN, IN_DELETE, IN_DELETE_SELF, IN_UNMOUNT.
"""
watch_ = self._watch_manager.get_watch(raw_event.wd)
if watch_ is None:
# Not really sure how we ended up here, nor how we should
# handle these types of events and if it is appropriate to
# completly skip them or not (like we are doing here).
log.debug("Unable to retrieve Watch object associated to event %s",
repr(raw_event))
return
if raw_event.mask & (IN_DELETE_SELF | IN_MOVE_SELF):
# Unfornulately this information is not provided by the kernel
dir_ = watch_.dir
Expand Down Expand Up @@ -1128,9 +1121,14 @@ def process_events(self):
while self._eventq:
raw_event = self._eventq.popleft() # pop next event
watch_ = self._watch_manager.get_watch(raw_event.wd)
revent = self._sys_proc_fun(raw_event) # system processings
if revent is None:
if watch_ is None:
# Not really sure how we ended up here, nor how we should
# handle these types of events and if it is appropriate to
# completly skip them (like we are doing here).
log.warning("Unable to retrieve Watch object associated to %s",
repr(raw_event))
continue
revent = self._sys_proc_fun(raw_event) # system processings
if watch_ and watch_.proc_fun:
watch_.proc_fun(revent) # user processings
else:
Expand Down
16 changes: 7 additions & 9 deletions python3/pyinotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,13 +694,6 @@ def process_default(self, raw_event, to_append=None):
IN_OPEN, IN_DELETE, IN_DELETE_SELF, IN_UNMOUNT.
"""
watch_ = self._watch_manager.get_watch(raw_event.wd)
if watch_ is None:
# Not really sure how we ended up here, nor how we should
# handle these types of events and if it is appropriate to
# completly skip them or not (like we are doing here).
log.debug("Unable to retrieve Watch object associated to event %s",
repr(raw_event))
return
if raw_event.mask & (IN_DELETE_SELF | IN_MOVE_SELF):
# Unfornulately this information is not provided by the kernel
dir_ = watch_.dir
Expand Down Expand Up @@ -1091,9 +1084,14 @@ def process_events(self):
while self._eventq:
raw_event = self._eventq.popleft() # pop next event
watch_ = self._watch_manager.get_watch(raw_event.wd)
revent = self._sys_proc_fun(raw_event) # system processings
if revent is None:
if watch_ is None:
# Not really sure how we ended up here, nor how we should
# handle these types of events and if it is appropriate to
# completly skip them (like we are doing here).
log.warning("Unable to retrieve Watch object associated to %s",
repr(raw_event))
continue
revent = self._sys_proc_fun(raw_event) # system processings
if watch_ and watch_.proc_fun:
watch_.proc_fun(revent) # user processings
else:
Expand Down

0 comments on commit d334049

Please sign in to comment.