Issue2510

classification
Title: TypeError when monkey-patching time.time with an unbound function
Type: Severity: normal
Components: Jythonc compiler Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: progval
Priority: Keywords:

Created on 2016-07-30.09:13:14 by progval, last changed 2016-09-14.16:19:21 by zyasoft.

Messages
msg10883 (view) Author: (progval) Date: 2016-07-30.09:13:13
Hi,

I run the following script:

import time
def fake_time():
    return 42

time.time = fake_time
print(time.time())


With CPython and Pypy, it print 42. With Jython 2.7.1b3, I get this:

Traceback (most recent call last):
  File "foo.py", line 6, in <module>
    print(time.time())
TypeError: unbound method fake_time() must be called with time instance as first argument (got nothing instead)
History
Date User Action Args
2016-09-14 16:19:21zyasoftsettitle: Crash after monkey-patching time.time with an unbound function -> TypeError when monkey-patching time.time with an unbound function
2016-09-14 16:18:17zyasoftsetmilestone: Jython 2.7.2
2016-07-30 09:13:14progvalcreate