Issue2035

classification
Title: datetime.date.fromtimestamp(None) should raise TypeError
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
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 2014-10-06.13:46:55 by zyasoft.

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
History
Date User Action Args
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