[Idle-dev] CVS: idle PyShell.py,1.32,1.33
Kurt B. Kaiser
kbk@users.sourceforge.net
Fri, 29 Nov 2002 14:10:56 -0800
Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv11811
Modified Files:
PyShell.py
Log Message:
Correct an error introduced at Rev 1.30. The keyword arg is necessary
to freeze the value of orig_checkcache. Otherwise infinite recursion.
Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** PyShell.py 4 Nov 2002 23:39:45 -0000 1.32
--- PyShell.py 29 Nov 2002 22:10:53 -0000 1.33
***************
*** 46,58 ****
warnings.showwarning = idle_showwarning
! def linecache_checkcache():
"""Extend linecache.checkcache to preserve the <pyshell#...> entries
! Rather than repeating the linecache code, patch it by saving the pyshell#
! entries, call linecache.checkcache(), and then restore the saved
! entries.
"""
- orig_checkcache=linecache.checkcache
cache = linecache.cache
save = {}
--- 46,59 ----
warnings.showwarning = idle_showwarning
! def extended_linecache_checkcache(orig_checkcache=linecache.checkcache):
"""Extend linecache.checkcache to preserve the <pyshell#...> entries
! Rather than repeating the linecache code, patch it to save the pyshell#
! entries, call the original linecache.checkcache(), and then restore the
! saved entries. Assigning the orig_checkcache keyword arg freezes its value
! at definition time to the (original) method linecache.checkcache(), i.e.
! makes orig_checkcache lexical.
"""
cache = linecache.cache
save = {}
***************
*** 63,67 ****
cache.update(save)
! linecache.checkcache = linecache_checkcache
--- 64,69 ----
cache.update(save)
! # Patch linecache.checkcache():
! linecache.checkcache = extended_linecache_checkcache