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.
While working on an another PR I discovered that my PR #586 (Do not expand into other years) was incomplete: I missed that holidays for Saudi Arabia for 2006 would also return holidays for 2007, violating the "do not expand into other years" rule and triggering the "dict expansion while iterating" error in people's code.
The issue, it turns out, is multi-day Islamic holidays; in this specific case it was the Eid al-Adha Holiday running from 30-Dec-2006 to 03-Jan-2007, across Gregorian years.
Here is a fix for this issue, covering Saudi Arabia and all other countries affected. It's not very elegant but I couldn't think of a better solution (open to ideas). The fix has been successfully tested on all years from 1950 to 2050 inclusive.
I also addressed:
test_all_countries
test I wrote for PR Do not expand into other years #586 (Do not expand into other years) does not need to be run in all Python versions since it's a logic test, not a code compatibility one; I fixed this so we don't have needlessly long test times (they are already getting a bit too lengthy IMHO).