Message4016

Author pekka.klarck
Recipients pekka.klarck
Date 2009-01-08.14:54:15
SpamBayes Score 1.47023e-05
Marked as misclassified No
Message-id <1231426455.76.0.210510924581.issue1223@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2009-01-08 14:54:15pekka.klarcksetrecipients: + pekka.klarck
2009-01-08 14:54:15pekka.klarcksetmessageid: <1231426455.76.0.210510924581.issue1223@psf.upfronthosting.co.za>
2009-01-08 14:54:15pekka.klarcklinkissue1223 messages
2009-01-08 14:54:15pekka.klarckcreate