Issue1223

classification
Title: Methods in Java classes aren't considered methods or functions by inspect
Type: Severity: normal
Components: Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukaszd7, pekka.klarck, pjenvey
Priority: normal Keywords: patch

Created on 2009-01-08.14:54:15 by pekka.klarck, last changed 2010-04-11.00:18:31 by pjenvey.

Files
File name Uploaded Description Edit Remove
issue1223_patch.patch lukaszd7, 2009-08-18.09:18:20
Messages
msg4016 (view) Author: Pekka Klärck (pekka.klarck) Date: 2009-01-08.14:54:15
Jython 2.2 on java1.6.0_03
Type "copyright", "credits" or "license" for more information.
>>> import inspect
>>> from java.lang import String
>>> inspect.isroutine(String.toUpperCase)
0
>>> inspect.isroutine(str.upper)
1
>>> inspect.isroutine(String().toUpperCase)
1
>>> inspect.isroutine(str().upper)
1
>>> type(String.toUpperCase)
<type 'reflectedfunction'>
>>> type(str.upper)
<type 'methoddescr'>
>>> type(String().toUpperCase)
<type 'method'>
>>> type(str().upper)
<type 'builtin_function_or_method'>


It seems that PyReflectedFunction is not exposed correctly as a method.
We used this kind of a workaround:

  def _isroutine(self, item):
      return inspect.isroutine(item) \
 	    or (utils.is_jython and isinstance(item, PyReflectedFunction))
msg4028 (view) Author: Pekka Klärck (pekka.klarck) Date: 2009-01-12.00:32:24
Same problem appears also with 2.5b1.
msg5056 (view) Author: Łukasz (lukaszd7) Date: 2009-08-18.09:18:19
I made some simple patch.
msg5654 (view) Author: Philip Jenvey (pjenvey) Date: 2010-04-11.00:18:30
This was actually already fixed in r6883
History
Date User Action Args
2010-04-11 00:18:31pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg5654
nosy: + pjenvey
2009-08-18 09:18:21lukaszd7setfiles: + issue1223_patch.patch
keywords: + patch
messages: + msg5056
nosy: + lukaszd7
2009-03-14 14:13:39fwierzbickisetpriority: normal
versions: + 2.5.1
2009-01-12 00:32:25pekka.klarcksetmessages: + msg4028
2009-01-08 14:54:15pekka.klarckcreate