Message304083
The following code causes an assertion error in timedelta constructor.
from datetime import timedelta
class BadInt(int):
def __mul__(self, other):
return Prod()
class Prod:
def __radd__(self, other):
return Sum()
class Sum:
def __divmod__(self, other):
return (0, -1)
timedelta(hours=BadInt(1))
Result:
python: /home/serhiy/py/cpython/Modules/_datetimemodule.c:1573: microseconds_to_delta_ex: Assertion `0 <= temp && temp < 1000000' failed.
Aborted (core dumped) |
|
Date |
User |
Action |
Args |
2017-10-10 21:29:28 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, belopolsky, Oren Milman |
2017-10-10 21:29:28 | serhiy.storchaka | set | messageid: <1507670968.8.0.213398074469.issue31752@psf.upfronthosting.co.za> |
2017-10-10 21:29:28 | serhiy.storchaka | link | issue31752 messages |
2017-10-10 21:29:28 | serhiy.storchaka | create | |
|