Anthony Sottile <asott...@umich.edu> added the comment:

Here's a simpler reproduction without involving a third party library:

>>> import cProfile
>>> from datetime import timedelta
>>> pr = cProfile.Profile()
>>> timedelta.total_seconds(-25200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor 'total_seconds' requires a 'datetime.timedelta' object 
but received a 'int'
>>> pr.enable()
>>> timedelta.total_seconds(-25200)
2177366085.870893
>>> pr.disable()
>>> timedelta.total_seconds(-25200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor 'total_seconds' requires a 'datetime.timedelta' object 
but received a 'int'


However, it appears fixed on master:

$ ./python
Python 3.8.0a0 (heads/master:c984d20ec8, Oct 16 2018, 20:47:49) 
[GCC 7.3.0] on linux
>>> 
>>> import cProfile
>>> from datetime import timedelta
>>> pr = cProfile.Profile()
>>> timedelta.total_seconds(-25200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor 'total_seconds' requires a 'datetime.timedelta' object 
but received a 'int'
>>> pr.enable()
>>> timedelta.total_seconds(-25200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor 'total_seconds' for 'datetime.timedelta' objects doesn't 
apply to 'int' object
>>> pr.disable()
>>> timedelta.total_seconds(-25200)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor 'total_seconds' requires a 'datetime.timedelta' object 
but received a 'int'


Doing a git bisect shows that this commit fixed the issue: 
https://github.com/python/cpython/pull/8300

Here's the bpo for that: https://bugs.python.org/issue34126

----------
nosy: +Anthony Sottile

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35004>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to