Issue1875

classification
Title: sys.setdefaultencoding(): AttributeError: '
Type: Severity: normal
Components: Core Versions: 2.5.3b2
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: amak, pjenvey
Priority: Keywords:

Created on 2012-04-14.18:41:53 by amak, last changed 2012-04-15.18:13:06 by pjenvey.

Messages
msg7055 (view) Author: Alan Kennedy (amak) Date: 2012-04-14.18:41:53
Jython 2.5.3+ (, Apr 14 2012, 19:33:03)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.5.0_22
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'ascii'
>>> sys.setdefaultencoding("ascii")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute 'setdefaultencoding'
>>>
msg7058 (view) Author: Philip Jenvey (pjenvey) Date: 2012-04-15.00:00:44
This isn't a bug, the site module removes setdefaultencoding during startup:

http://docs.python.org/library/sys.html#sys.setdefaultencoding
msg7059 (view) Author: Alan Kennedy (amak) Date: 2012-04-15.18:02:37
Thanks Philip, that makes sense.

Looks like either

A: test_xmlrpc.py is making an invalid use of sys.setdefaultencoding()

http://hg.python.org/jython/file/652f4e90623e/Lib/test/test_xmlrpc.py#l167

Or 

B: perhaps our implementation of test_support.CleanImport() is not working as expected?
msg7060 (view) Author: Philip Jenvey (pjenvey) Date: 2012-04-15.18:13:06
B: sounds pretty likely, I would think it's doing a reload() or something similar. Since our sys module acts like a singleton (per PythonInterpreter, anyway), it's probably not 'reloading' correctly
History
Date User Action Args
2012-04-15 18:13:06pjenveysetmessages: + msg7060
2012-04-15 18:02:37amaksetmessages: + msg7059
2012-04-15 00:00:44pjenveysetstatus: open -> closed
resolution: invalid
messages: + msg7058
nosy: + pjenvey
2012-04-14 18:41:53amakcreate