pendulum icon indicating copy to clipboard operation
pendulum copied to clipboard

Unable to deepcopy Interval, TypeError: Interval.__new__() got an unexpected keyword argument 'days'

Open aploium opened this issue 4 months ago • 0 comments

  • [ x ] I am on the latest Pendulum version.
  • [ x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: Debian 12 (os independent)
  • Pendulum version: 3.0.0 pypi

Issue

As title describes.

Reproduce

docker run -it python:3.12 bash
pip install pendulum==3.0.0
python -c "import pendulum,copy
copy.deepcopy(pendulum.now() - pendulum.now().subtract(days=1))
"
# Traceback (most recent call last):
#  File "<string>", line 2, in <module>
#  File "/usr/local/lib/python3.12/copy.py", line 143, in deepcopy
#    y = copier(memo)
#        ^^^^^^^^^^^^
#  File "/usr/local/lib/python3.12/site-packages/pendulum/duration.py", line 464, in __deepcopy__
#    return self.__class__(
#           ^^^^^^^^^^^^^^^
# TypeError: Interval.__new__() got an unexpected keyword argument 'days'

Potential Fix

#851

aploium avatar Oct 13 '24 08:10 aploium