Message187513
NO,this thread should not be closed!
This is IDLE Bug.I found, IDLE has issue in using unicode literal.
In normal interpreter in console.
>>> u"こんにちは"
u'\u3053\u3093\u306b\u3061\u306f'
In IDLE.
>>> u"こんにちは"
u'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf'
I take a look IDLE codes, found bug in IDLE.
In idlelib/PyShell.py.
def runsource(self, source):
"Extend base class method: Stuff the source in the line cache first"
filename = self.stuffsource(source)
self.more = 0
self.save_warnings_filters = warnings.filters[:]
warnings.filterwarnings(action="error", category=SyntaxWarning)
print(source,len(source))
if isinstance(source, types.UnicodeType):
from idlelib import IOBinding
try:
source = source.encode(IOBinding.encoding)
except UnicodeError:
self.tkconsole.resetoutput()
self.write("Unsupported characters in input\n")
return
try:
print(source,len(source))
# InteractiveInterpreter.runsource() calls its runcode() method,
# which is overridden (see below)
return InteractiveInterpreter.runsource(self, source, filename)
finally:
if self.save_warnings_filters is not None:
warnings.filters[:] = self.save_warnings_filters
self.save_warnings_filters = None
This codes change u"こんにちは" to u'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf'
I commented out following lines.
if isinstance(source, types.UnicodeType):
from idlelib import IOBinding
try:
source = source.encode(IOBinding.encoding)
except UnicodeError:
self.tkconsole.resetoutput()
self.write("Unsupported characters in input\n")
return
And now works.
Not well tested, I'll do unittest in GSoC (if I can). |
|
Date |
User |
Action |
Args |
2013-04-21 16:34:56 | Tomoki.Imai | set | recipients:
+ Tomoki.Imai, terry.reedy, ezio.melotti, pradyunsg |
2013-04-21 16:34:56 | Tomoki.Imai | set | messageid: <1366562096.74.0.982375643091.issue17348@psf.upfronthosting.co.za> |
2013-04-21 16:34:56 | Tomoki.Imai | link | issue17348 messages |
2013-04-21 16:34:56 | Tomoki.Imai | create | |
|