Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError when creating custom class with Dec 31st holiday #3

Closed
ghost opened this issue Aug 29, 2014 · 0 comments
Closed

RuntimeError when creating custom class with Dec 31st holiday #3

ghost opened this issue Aug 29, 2014 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 29, 2014

>>> from datetime import date
>>> import holidays
>>> 
>>> class TestHolidays(holidays.US):
...     def _populate(self, year):
...         holidays.US._populate(self, year)
...         self[date(year, 12, 31)] = "New Year's Eve"
... 
>>> '2014-12-31' in TestHolidays()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "holidays.py", line 79, in __contains__
    return dict.__contains__(self, self.__keytransform__(key))
  File "holidays.py", line 75, in __keytransform__
    self._populate(year)
  File "<stdin>", line 4, in _populate
  File "holidays.py", line 85, in __setitem__
    return dict.__setitem__(self, self.__keytransform__(key), value)
  File "holidays.py", line 75, in __keytransform__
    self._populate(year)
  File "<stdin>", line 4, in _populate
  File "holidays.py", line 85, in __setitem__
    return dict.__setitem__(self, self.__keytransform__(key), value))
...
  File "holidays.py", line 75, in __keytransform__
    self._populate(year)
  File "<stdin>", line 3, in _populate
  File "holidays.py", line 112, in _populate
    self[date(year, 1, 1)] = name
  File "holidays.py", line 85, in __setitem__
    return dict.__setitem__(self, self.__keytransform__(key), value)
  File "holidays.py", line 72, in __keytransform__
    year = (key + rd(days=+1)).year
RuntimeError: maximum recursion depth exceeded while calling a Python object
@ghost ghost added the bug label Aug 29, 2014
@ghost ghost self-assigned this Aug 29, 2014
@ghost ghost closed this as completed Aug 29, 2014
ghost pushed a commit that referenced this issue Aug 29, 2014
dr-prodigy pushed a commit that referenced this issue Jul 18, 2021
arkid15r pushed a commit that referenced this issue Feb 10, 2023
@arkid15r arkid15r mentioned this issue Mar 18, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants