Repository navigation
reject a day-of-week literal mixed with nth/L for the same weekday - #307
Open
Raghuvardhan-Reddy78 wants to merge 1 commit into
Open
Raghuvardhan-Reddy78 wants to merge 1 commit into
Raghuvardhan-Reddy78 wants to merge 1 commit into
Conversation
The check that rejects mixing a literal weekday with an nth or last
entry ("5,6#3") subtracted the nth keys from the literals, so a literal
for the same weekday ("5,5#3", "5,L5") slipped through. The nth entry
then replaced the literal and the schedule fired on the 3rd (or last)
Friday only instead of every Friday. Reject it like "5,6#3".
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_expand rejects a day-of-week field that mixes a literal weekday with an nth or last entry for another weekday, so
5,6#3raises CroniterUnsupportedSyntaxError. The check builds its set of literals by subtracting the nth keys from the expanded field, which also removes a literal for the same weekday, so0 0 * * 5,5#3and0 0 * * 5,L5pass is_valid. At run time proc_day_of_week_nth only fires the nth entry and the literal is gone: from 2021-03-01,5,5#3yields Mar 19, Apr 16, May 21 instead of every Friday, and croniter.match returns False for Friday 2021-03-05. I found it while reading the nth handling next to test_hash_mixup_all_fri_3rd_sat and confirmed it with a short script. _expand now records the literal weekdays it parses and treats one that collides with an nth key as the same unsupported mix. A literal list covering the whole week is still accepted, so the pinned0-6,sat#3and*,sat#3cases are unchanged, and the new test fails without the fix.