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

in_timezone on PyPy env causes RecursionError #361

Open
anyat8 opened this issue Apr 2, 2019 · 3 comments
Open

in_timezone on PyPy env causes RecursionError #361

anyat8 opened this issue Apr 2, 2019 · 3 comments
Labels

Comments

@anyat8
Copy link

anyat8 commented Apr 2, 2019

Hi!
I am running on PyPy 7.1.0 (same happens on PyPy 6.0.0).

now_string = pendulum.now().isoformat()
now_pendulum = pendulum.parse(now_string)
now_pendulum.in_timezone('UTC')

Causes RecursionError (on CPython works fine).

...
...
...
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 1442, in __add__
    return self._add_timedelta(other)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 750, in _add_timedelta
    return self.add(seconds=delta.total_seconds())
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 660, in add
    dt = self.tz.convert(dt)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/tz/timezone.py", line 66, in convert
    return self._convert(dt)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/tz/timezone.py", line 334, in _convert
    return dt.astimezone(self)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 1466, in astimezone
    return pendulum.instance(super(DateTime, self).astimezone(tz))
  File "/Users/user1/anaconda/envs/pypy/lib-python/3/datetime.py", line 1548, in astimezone
    utc = (self - myoffset).replace(tzinfo=tz)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 1397, in __sub__
    return self._subtract_timedelta(other)
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 774, in _subtract_timedelta
    days=delta.days, seconds=delta.seconds, microseconds=delta.microseconds
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 722, in subtract
    microseconds=-microseconds,
  File "/Users/user1/anaconda/envs/pypy/site-packages/pendulum/datetime.py", line 621, in add
    offset = self.utcoffset()
  File "/Users/user1/anaconda/envs/pypy/lib-python/3/datetime.py", line 1625, in utcoffset
    _check_utc_offset("utcoffset", offset)
  File "/Users/user1/anaconda/envs/pypy/lib-python/3/datetime.py", line 236, in _check_utc_offset
    assert name in ("utcoffset", "dst")
RecursionError: maximum recursion depth exceeded
@anyat8 anyat8 changed the title in_timezone in PyPy env causes RecursionError in_timezone in PyPy env causes RecursionError Apr 2, 2019
@anyat8 anyat8 changed the title in_timezone in PyPy env causes RecursionError in_timezone on PyPy env causes RecursionError Apr 2, 2019
@sdispater sdispater added the bug label May 21, 2019
@yardensachs
Copy link

This is also an issue with python 3.8

@Tomcat-Engineering
Copy link

It isn't just in_timezone that is broken, this code also causes the same problem on Python 3.8:

now_string = pendulum.now('UTC').isoformat()
now_pendulum = pendulum.parse(now_string)
now_pendulum + pendulum.duration(hours=1)

@Tomcat-Engineering
Copy link

Ah, I guess that this will be fixed by #431

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

4 participants