Skip to content

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

Closed

Description

@aploium
  • [ 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

Activity

  1. added 2 commits that reference this issue on Oct 13, 2024
    6cab5ff
    ab5e95b
  2. added a commit that references this issue on Jul 16, 2025
    8cc6392
  3. added a commit that references this issue on Jul 16, 2025
    c8068a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions