[Python-bugs-list] [ python-Bugs-825676 ] code.InteractiveConsole interprets escape chars incorrectly

SourceForge.net noreply at sourceforge.net
Fri Oct 17 14:50:53 EDT 2003


Bugs item #825676, was opened at 2003-10-17 12:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=825676&group_id=5470

Category: Python Library
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Richardson (markrichardson)
Assigned to: Nobody/Anonymous (nobody)
Summary: code.InteractiveConsole interprets escape chars incorrectly

Initial Comment:
code.InteractiveConsole interprets escape characters 
incorrectly. For example, it interprets "\t" the same 
as "\t", so it prints a tab instead of a backslash t.

to reproduce:

import sys
import code

class MyConsole(code.InteractiveConsole):
    def __init__(self):
        code.InteractiveConsole.__init__(self)

    # I tried it with runsource too. Same result.
    def run_code(self, cmdString):
        self.runcode(cmdString)

    def write(self, data):
        sys.__stdout__.write(data)

instance = MyConsole()
instance.run_code('print "\thello\tworld"')
print "\thello\tworld"



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=825676&group_id=5470



More information about the Python-bugs-list mailing list