`HolidayBase: boolean years argument is accepted as years 0 and 1`
Describe the bug
HolidayBase.__init__ sets self.years via _normalize_arguments(int, years) in holidays/helpers.py. In Python, bool is a subclass of int, so years=False becomes year 0 and years=True becomes year 1 without any error.
That can happen by mistake (for example confusing years=False with expand=False) and yields an empty or meaningless calendar instead of rejecting invalid input.
To Reproduce
import holidays
h = holidays.country_holidays("US", years=False)
print(h.years) # {0}
print(len(h)) # 0
h2 = holidays.country_holidays("US", years=True)
print(h2.years) # {1}
print(len(h2)) # 0
# Same for financial calendars:
nse = holidays.financial_holidays("XNSE", years=False)
print(nse.years) # {0}
Expected behavior
Boolean values must not be accepted as years. The constructor should raise a clear exception, for example:
TypeError: years must be int, an iterable of int, or None; got bool
(or ValueError with the same meaning), consistent with other invalid years input (e.g. years='' raises ValueError).
Actual behavior
No exception. years=False populates (attempts) year 0; years=True populates year 1. Both typically produce no holidays with no warning.
Hi! I'm interested in working on this issue as my first contribution to Holidays. I would like to investigate the years validation, add tests for boolean inputs, and implement a fix if the issue is still available. Could I take this issue?
Hi, I am Aarambh, a 3rd year CSE student getting ready for GSoC 2027. I checked this, years=False silently becomes year 0 with no holidays. I can add a check that rejects bool years in the constructor. Is it still free?