You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
check_component() resolved None fields (include_completed, todo, event,
journal) and normalised date start/end/alarm_start/alarm_end values by
writing back to self. This made a Searcher instance stateful: calling
check_component() twice could yield different results, and reusing a
Searcher across multiple operations changed behaviour after the first call.
Fix: compute all resolved/normalised values as local variables inside
check_component(). Thread them to the internal filter helpers via new
keyword parameters (_start, _end, _alarm_start, _alarm_end for
_check_range/_check_alarm_range; _include_completed for
_check_completed_filter). The parameters default to None which falls
back to self.* for existing callers that do not pass them.
Add tests/test_no_mutation.py to guard against regression.
Triggered by python-caldav/caldav#650
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [Unreleased]
9
+
10
+
### Fixed
11
+
12
+
-**`check_component()` mutated `self` on every call**: The method resolved `None` fields (`include_completed`, `todo`, `event`, `journal`) and normalised `start`/`end`/`alarm_start`/`alarm_end` date objects to datetimes by writing back to `self`. This made a `Searcher` instance stateful: calling `check_component()` twice could produce different results, and reusing a `Searcher` across multiple search operations (e.g. in the python-caldav library) could silently change behaviour after the first call. All these values are now computed as local variables inside `check_component()` and threaded to the internal filter methods via new keyword parameters (`_start`, `_end`, `_alarm_start`, `_alarm_end`, `_include_completed`), keeping `self` immutable throughout. (Triggered by https://github.com/python-caldav/caldav/issues/650)
0 commit comments