Message8184

Author richardfearn
Recipients richardfearn
Date 2013-11-30.13:59:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385819984.66.0.257843138894.issue2105@psf.upfronthosting.co.za>
In-reply-to
Content
Running the test program using CPython (2.7.5 in this case) shows an object's __str__ method is called:

  $ python issue2105.py 
  str

Running with Jython 2.5.3 or the trunk also shows the __str__ method being called:

  $ jython issue2105.py 
  str

so out of the box, Jython is consistent with CPython.

But if stdout/stderr are changed to point to a Writer, so that Jython uses a PyFileWriter, for example by changing jython.java to:

  InteractiveConsole interp = new InteractiveConsole();
  interp.setOut(new PrintWriter(System.out));
  interp.setErr(new PrintWriter(System.err));

then the __repr__ method is called instead:

  $ jython issue2105.py 
  repr
History
Date User Action Args
2013-11-30 13:59:44richardfearnsetmessageid: <1385819984.66.0.257843138894.issue2105@psf.upfronthosting.co.za>
2013-11-30 13:59:44richardfearnsetrecipients: + richardfearn
2013-11-30 13:59:44richardfearnlinkissue2105 messages
2013-11-30 13:59:44richardfearncreate