[Python-checkins] python/dist/src/Lib rexec.py,1.38,1.39
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 14 Jun 2002 06:48:27 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv26199
Modified Files:
rexec.py
Log Message:
Don't poorly emulate the interactive interpreter, use
code.InteractiveConsole to do a much better job.
Index: rexec.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** rexec.py 1 Jun 2002 14:18:46 -0000 1.38
--- rexec.py 14 Jun 2002 13:48:25 -0000 1.39
***************
*** 553,575 ****
return 1
if fp.isatty():
! print "*** RESTRICTED *** Python", sys.version
! print 'Type "help", "copyright", "credits" or "license" ' \
! 'for more information.'
!
! while 1:
! try:
! try:
! s = raw_input('>>> ')
! except EOFError:
! print
! break
! if s and s[0] != '#':
! s = s + '\n'
! c = compile(s, '<stdin>', 'single')
! r.s_exec(c)
! except SystemExit, n:
! return n
! except:
! traceback.print_exc()
else:
text = fp.read()
--- 553,565 ----
return 1
if fp.isatty():
! import code
! interp = code.InteractiveConsole(r.modules['__main__'].__dict__)
! try:
! interp.interact(
! "*** RESTRICTED *** Python %s on %s\n"
! 'Type "help", "copyright", "credits" or "license" '
! "for more information." % (sys.version, sys.platform))
! except SystemExit, n:
! return n
else:
text = fp.read()