Skip to content

timedelta doesn't recognize Sage integers #10365

@jasongrout

Description

@jasongrout

This gives an error:

sage: version()
'Sage Version 4.6, Release Date: 2010-10-30'
sage: import datetime
sage: datetime.timedelta(hours=6)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/grout/<ipython console> in <module>()

TypeError: unsupported type for timedelta hours component: sage.rings.integer.Integer

but this does not

sage: datetime.timedelta(hours=int(6))
datetime.timedelta(0, 21600)

Is this possible to fix without patching Python?

CC: @robertwb

Component: basic arithmetic

Issue created by migration from https://trac.sagemath.org/ticket/10365

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions