Skip to content

Commit

Permalink
feat: Python 3.13 support (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoboTiG authored Jul 28, 2024
1 parent 7503d34 commit cff604e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "pypy-3.8"
- "pypy-3.9"
include:
Expand Down
1 change: 1 addition & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog

2024-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v4.0.1...HEAD>`__

- Add support for Python 3.13 (`#1052 <https://github.com/gorakhargosh/watchdog/pull/1052>`__)
- [core] Run ``ruff``, apply several fixes (`#1033 <https://github.com/gorakhargosh/watchdog/pull/1033>`__)
- [fsevents] Add missing ``event_filter`` keyword-argument to ``FSEventsObserver.schedule()`` (`#1049 <https://github.com/gorakhargosh/watchdog/pull/1049>`__)
- Thanks to our beloved contributors: @BoboTiG
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eventlet
eventlet; python_version < "3.13"
flaky
pytest
pytest-cov
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Topic :: Software Development :: Libraries",
Expand Down
10 changes: 5 additions & 5 deletions src/watchdog/observers/read_directory_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class WindowsApiEmitter(EventEmitter):
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT, event_filter=None):
super().__init__(event_queue, watch, timeout, event_filter)
self._lock = threading.Lock()
self._handle = None
self._whandle = None

def on_thread_start(self):
self._handle = get_directory_handle(self.watch.path)
self._whandle = get_directory_handle(self.watch.path)

if platform.python_implementation() == "PyPy":

Expand All @@ -62,11 +62,11 @@ def start(self):
sleep(0.01)

def on_thread_stop(self):
if self._handle:
close_directory_handle(self._handle)
if self._whandle:
close_directory_handle(self._whandle)

def _read_events(self):
return read_events(self._handle, self.watch.path, self.watch.is_recursive)
return read_events(self._whandle, self.watch.path, self.watch.is_recursive)

def queue_events(self, timeout):
winapi_events = self._read_events()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_observers_winapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_root_deleted(event_queue, emitter):
File "watchdog\observers\read_directory_changes.py", line 76, in queue_events
winapi_events = self._read_events()
File "watchdog\observers\read_directory_changes.py", line 73, in _read_events
return read_events(self._handle, self.watch.path, self.watch.is_recursive)
return read_events(self._whandle, self.watch.path, self.watch.is_recursive)
File "watchdog\observers\winapi.py", line 387, in read_events
buf, nbytes = read_directory_changes(handle, path, recursive)
File "watchdog\observers\winapi.py", line 340, in read_directory_changes
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py3{8,9,10,11,12}
py3{8,9,10,11,12,13}
pypy3
docs
types
Expand Down

0 comments on commit cff604e

Please sign in to comment.