Issue2035

classification
Title: datetime.date.fromtimestamp(None) should raise TypeError
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: cht, fwierzbicki, santa4nt, zyasoft
Priority: high Keywords:

Created on 2013-03-26.06:20:34 by cht, last changed 2018-03-07.19:04:35 by jeff.allen.

Messages
msg7982 (view) Author: cht (cht) Date: 2013-03-26.06:20:34
In Python, "datetime.date.fromtimestamp(None)" raises TypeError, but in Jython, it returns as if "datetime.date.fromtimestamp(time.time())" was called.
msg7985 (view) Author: Santoso Wijaya (santa4nt) Date: 2013-04-01.02:26:22
It seems like the prototype module Lib/datetime.py no longer exists in CPython 2.7. `import datetime` loads specifically from a C module `lib-dynload/datetime.so`.
msg8670 (view) Author: Jim Baker (zyasoft) Date: 2014-06-18.17:46:57
Still present in trunk, with the different behavior reported
msg8671 (view) Author: Jim Baker (zyasoft) Date: 2014-06-18.17:47:20
Target beta 4
msg8678 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-06-18.18:41:03
For reference:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime
<module 'datetime' from '/usr/lib/python2.7/lib-dynload/datetime.x86_64-linux-gnu.so'>
>>> datetime.fromtimestamp(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'fromtimestamp'
msg8679 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-06-18.18:42:40
Oops.

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime
<module 'datetime' from '/usr/lib/python2.7/lib-dynload/datetime.x86_64-linux-gnu.so'>
>>> datetime.date.fromtimestamp(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a float is required
msg9112 (view) Author: Jim Baker (zyasoft) Date: 2014-10-06.13:46:55
This issue may be fixed in PyPy, so consider resyncing
msg9508 (view) Author: Jim Baker (zyasoft) Date: 2015-02-08.06:28:19
Not fixed in datetime from PyPy, which was synced as of https://hg.python.org/jython/rev/daa6bf9a14d5
msg9912 (view) Author: Jim Baker (zyasoft) Date: 2015-04-20.20:56:38
Need to look into this some more, especially given PyPy's divergence. Feature? or bug? ;)
History
Date User Action Args
2018-03-07 19:04:35jeff.allensetmilestone: Jython 2.7.2 ->
2015-12-29 23:48:34zyasoftsetmilestone: Jython 2.7.1 -> Jython 2.7.2
2015-04-20 20:56:38zyasoftsetmessages: + msg9912
milestone: Jython 2.7.1
2015-02-08 06:28:19zyasoftsetmessages: + msg9508
2014-10-06 13:46:55zyasoftsetmessages: + msg9112
2014-10-06 12:39:40zyasoftsetpriority: high
2014-06-18 18:42:40santa4ntsetmessages: + msg8679
title: datetime.date.fromtimestamp(None) should raise AttributeError -> datetime.date.fromtimestamp(None) should raise TypeError
2014-06-18 18:41:04santa4ntsetmessages: + msg8678
title: datetime.date.fromtimestamp(None) should raise TypeError -> datetime.date.fromtimestamp(None) should raise AttributeError
2014-06-18 17:47:20zyasoftsetmessages: + msg8671
2014-06-18 17:46:57zyasoftsetresolution: accepted
messages: + msg8670
nosy: + zyasoft
2013-04-08 17:32:18fwierzbickisetnosy: + fwierzbicki
2013-04-01 02:26:22santa4ntsettype: behaviour
messages: + msg7985
nosy: + santa4nt
components: + Library, - None
versions: + Jython 2.7, - Jython 2.5
2013-03-26 06:20:34chtcreate