Issue1727
Created on 2011-04-02.21:37:54 by offby1, last changed 2011-04-03.00:59:17 by pjenvey.
msg6460 (view) |
Author: Chris R (offby1) |
Date: 2011-04-02.21:37:54 |
|
The following code fails to run in Jython:
$ jython
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_24
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
import os
>>> args = ('/Users/offline/projects/PyHamcrest/pytest.ini',)
args = ('/Users/offline/projects/PyHamcrest/pytest.ini',)
>>> os.stat(*args)
os.stat(*args)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'builtin_function_or_method' object is not callable
>>> os.stat('/Users/offline/projects/PyHamcrest/pytest.ini')
os.stat('/Users/offline/projects/PyHamcrest/pytest.ini')
(33188, 24017506L, 234881026L, 1, 501, 20, 47L, 1301777760, 1301777759, 1301777759)
|
msg6461 (view) |
Author: Alex Grönholm (alex.gronholm) |
Date: 2011-04-02.21:43:16 |
|
This bug seems to be also preventing RPyC from working properly under Jython.
|
msg6462 (view) |
Author: Alex Grönholm (alex.gronholm) |
Date: 2011-04-02.22:44:28 |
|
The attached patch fixes the problem. How do I make sure it doesn't break anything elsewhere?
|
msg6463 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2011-04-03.00:04:54 |
|
This fix wouldn't break anything but it actually makes the stat callpath slower (patch would make it go through reflection). stat is actually perf critical in some cases. We need the fix to be on the PyBuiltinFunctions
Probably adding an override that takes PyObject[], String[] would solve the problem. This is an odd bug though because I'm surprised it's not getting to the currently defined __call__ override automatically. We might have an issue on how we are dealing with PyObject.__call__ overrides
But we can go ahead with a local fix in the StatFunction classes for now
|
msg6464 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2011-04-03.00:15:08 |
|
I think I see the problem, PyBuiltinFunctions are made to always override the __call__(PyObject[] String[]) method. Whereas we want to define this is a "narrower" override: so try making the StatFunctions subclass PyBuiltinFunctionNarrow instead of PyBuiltinFunction
also, I suppose this could use a testcase
|
msg6465 (view) |
Author: Alex Grönholm (alex.gronholm) |
Date: 2011-04-03.00:27:52 |
|
Attached is a better fix that does not cause performance degradation.
|
msg6466 (view) |
Author: Alex Grönholm (alex.gronholm) |
Date: 2011-04-03.00:32:37 |
|
Also, the problem affecting RPyC, although superficially similar, is something else entirely. It is still likely a Jython bug though.
|
msg6467 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2011-04-03.00:59:17 |
|
applied in r7285 & r7286, thanks!
|
|
Date |
User |
Action |
Args |
2011-04-03 00:59:17 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg6467 |
2011-04-03 00:32:37 | alex.gronholm | set | messages:
+ msg6466 |
2011-04-03 00:27:52 | alex.gronholm | set | files:
+ osstat-fix2.diff messages:
+ msg6465 |
2011-04-03 00:15:08 | pjenvey | set | messages:
+ msg6464 |
2011-04-03 00:04:54 | pjenvey | set | nosy:
+ pjenvey messages:
+ msg6463 |
2011-04-02 22:44:29 | alex.gronholm | set | files:
+ osstat-fix.diff keywords:
+ patch messages:
+ msg6462 |
2011-04-02 21:43:17 | alex.gronholm | set | nosy:
+ alex.gronholm messages:
+ msg6461 |
2011-04-02 21:37:54 | offby1 | create | |
|