Opened 12 years ago
Last modified 5 weeks ago
#10365 needs_info defect
timedelta doesn't recognize Sage integers
Reported by: | jason | Owned by: | AlexGhitza |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | basic arithmetic | Keywords: | |
Cc: | robertwb | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
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?
Change History (12)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
comment:3 Changed 9 years ago by
Milestone: | sage-5.11 → sage-5.12 |
---|
comment:4 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:5 Changed 9 years ago by
Milestone: | sage-6.2 → sage-6.3 |
---|
comment:6 Changed 8 years ago by
Milestone: | sage-6.3 → sage-6.4 |
---|
comment:7 Changed 5 years ago by
Milestone: | sage-6.4 → sage-duplicate/invalid/wontfix |
---|---|
Status: | new → needs_review |
Let us close this one.
comment:9 Changed 5 years ago by
Milestone: | sage-duplicate/invalid/wontfix → sage-8.3 |
---|---|
Status: | needs_review → needs_info |
comment:10 Changed 5 years ago by
Well, anybody needing that can just wrap with int(). No need for anything sophisticated.. And after 5 years of nobody doing nothing, should we wait for another 5 years ?
comment:12 Changed 5 weeks ago by
Milestone: | sage-8.4 |
---|
Note: See
TracTickets for help on using
tickets.
There's no way to do this without patching Python. The timedelta function has explicit
PyInt_Check
,PyLong_Check
, andPyFloat_Check
. So, unless we make integer a subclass of int/long, this won't work without an upstream change.