- [core] Allow pattern matching to evaluate relative paths against the watched root directory, supporting intuitive non-recursive patterns (e.g.
*.json,logs/*.log) underfull_match(). (#1430 Thanks to @prateek-dagar) - [core]
RegexMatchingEventHandlernow accepts a single string forignore_regexes, as it already does for regexes, instead of compiling each character as a separate regex. (#1419, thanks to @arieleven) - [observers] Fix race condition between
Observer.start()andObserver.schedule(), and release observer lock during event handler dispatch to prevent blocking concurrentschedule()andunschedule()calls. (#1044, thanks to @prateek-dagar) - [fsevents] Fix compiler warnings in the C extension. (#1411, thanks to @BoboTiG)
- [inotify] A recursive watch that hits the inotify watch or instance limit (
ENOSPC,EMFILE) on a subdirectory raisesOSErrorfromstart()andschedule()again, as in 6.0.0, instead of silently watching part of the tree. A subdirectory created later that cannot be watched is logged as a warning. (#1454, thanks to @Kernel-Hunter) - [inotify] Defer allocating an observer's inotify instance and reader thread until its first scheduled watch. Empty observers no longer consume inotify instances; resource-limit errors are raised by
schedule()rather than construction. (#1432, thanks to @kushaldave002) - [inotify] Do not log an error when
InotifyEmitter.queue_events()is invoked while the emitter is inactive. (#1462, thanks to @prateek-dagar) - [inotify] Events read before a kernel queue overflow are delivered instead of discarded, ahead of the
EventsLostEvent. (#1440, thanks to @KurathSec and @fstrasz) - [inotify] Properly format the duplicate-callback
RuntimeWarningmessage. (#1435, thanks to @BoboTiG) - [inotify] Refactor watch tracking from flat string path dictionaries to a hierarchical directory tree (
DirNode), making recursive subtree moves atomic operations with cycle detection and ancestor placeholder pruning. ("1459, thanks to @prateek-dagar) - [inotify] Report lost events: after a kernel queue overflow, each watch gets an
EventsLostEventfor its directory or file, dispatched to the newFileSystemEventHandler.on_events_lost()once the watches are repaired. Pattern and regex handlers (and so tricks) receive it only throughon_events_lost(). (#1440, thanks to @fstrasz) - [inotify] Stop watching directories moved out of a watched tree and emit synthetic deletion/moved events for their subdirectories. (#354, thanks to @prateek-dagar)
- [kqueue] Queue each event once per kqueue wakeup. A move reported the parent
DirModifiedEventtwice, and a write reportedFileModifiedEventtwice. (#1442, thanks to @karolyi) - [kqueue] Register the kevents when the emitter is created, not on the emitter thread's first
kqueue.control()call. Deletes, renames and attribute changes made in between were lost, every time on free-threaded Python. (#1445, thanks to @karolyi) - [kqueue] Stop the emitter with a
DirDeletedEventwhen the watched directory is removed or moved, instead of letting its thread die withFileNotFoundError. The kevents read in the same batch are still reported. (#1436, thanks to @karolyi) - [windows] A
ReadDirectoryChangesWorReadDirectoryChangesExWbuffer overflow is now signalled instead of being silently dropped as zero events. (#1019, thanks to @MohammedAlkindi) - [windows] Deliver events while the watched tree keeps changing:
DirectoryChangeReader.get_events()now returns within its timeout instead of waiting until no buffer has arrived for a full timeout. (#1469, thanks to @zzoraemon043) - [windows] Make the
DirectoryChangeReaderthread a daemon so an unstopped observer does not block interpreter exit. (#1470, thanks to @devskad) - [windows] Report lost events: when the
ReadDirectoryChangesWbuffer of a watch overflows, the watch gets anEventsLostEvent, dispatched toFileSystemEventHandler.on_events_lost(), as on inotify. (#1440, thanks to @fstrasz) - [windows]
WindowsApiObserver,WindowsApiEmitter, andDirectoryChangeReaderaccept a notify_filter bitmask, thedwNotifyFilterpassed toReadDirectoryChangesWandReadDirectoryChangesExW. The default is stillWATCHDOG_FILE_NOTIFY_FLAGS, includingFILE_NOTIFY_CHANGE_LAST_ACCESS. Mask that flag out (WATCHDOG_FILE_NOTIFY_FLAGS & ~FILE_NOTIFY_CHANGE_LAST_ACCESS) when access-time updates are not useful. (#1447, thanks to @gero-robert) - [dirsnapshot] Avoid duplicate create or delete events when a renamed file has another hard link in the watched directory. (#1425, thanks to @parijat1222q)
- [dirsnapshot] Capture Linux birth times while taking a snapshot so deleted paths retain their historical identity during move detection. (#1429, thanks to @FFspiky)
- [dirsnapshot] Detect replacements at the same path when an inode is reused but the entry type or available birth time changes, instead of missing the replacement or reporting it as a modification. (#1464, thanks to @anticipate218)
- [dirsnapshot] Fix false move detection on inode recycling by verifying file type, birth time, and nanosecond stat invariants. (#992, #303, thanks to @prateek-dagar)
- [watchmedo] Without
--command, shell-command printed every event as"<type> <object> from <src> to"with an empty destination. It now prints the destination for moved events only. (#1448, thanks to @Kernel-Hunter) - [ci] Run the test suite in FreeBSD 14 (kqueue, also on free-threaded 3.13t) and FreeBSD 15 (inotify) VMs on pull requests. (#1445, thanks to @karolyi)