Issue1707892

classification
Title: Type compatibility issue between Jython 2.1 and 2.2
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, karthin
Priority: normal Keywords:

Created on 2007-04-26.08:24:39 by karthin, last changed 2007-04-26.14:33:26 by fwierzbicki.

Messages
msg1560 (view) Author: karthin (karthin) Date: 2007-04-26.08:24:39
In Jython2.1,

Variables holding an integer, long, float or string values are interpreted as jython data objects i.e., PyInteger, PyLong, PyFloat,  PyString respectively.

These Objects support toString() method which is used by us in many places.
for eg:
>>> c = 1
>>> c.toString() 
'1'

here type(c) = <jclass org.python.core.PyInteger at 7481256>
 

In Jython2.2,

Variables holding an integer, long, float or string values are interpreted as basic types i.e, int, long, float, str respectively.

They don’t have toString() method…hence our scripts becomes incompatible throwing the below exception.
AttributeError: 'int' object has no attribute 'toString'

for eg:
>>> c = 1
>>> c.toString()
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: 'int' object has no attribute 'toString'
>>> type(c) = <type 'int'>

Can you please let us know

1.Why the type has been changed?any link/document that addresses it?
2.How to convert the primitive type to String in Jython2.2? 

Thanks a lot!!!
msg1561 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2007-04-26.14:33:26
c.toString() isn't going to work from Jython -- Jython 2.2 no
longer exposes the underlying Java methods for built in classes -- you
need to do this using the Python idiom:

>>> c = 1
>>> str(c)
'1'
History
Date User Action Args
2007-04-26 08:24:39karthincreate