Kaydet (Commit) f7a8899f authored tarafından Kurt B. Kaiser's avatar Kurt B. Kaiser

The change in the linecache.checkcache() signature at rev 1.13 caused IDLE to exit

when an exception was raised while running w/o the subprocess.  Python Bug 1063840

M NEWS.txt
M PyShell.py
üst 1681b622
...@@ -3,6 +3,9 @@ What's New in IDLE 1.1b3/rc1? ...@@ -3,6 +3,9 @@ What's New in IDLE 1.1b3/rc1?
*Release date: XX-XXX-2004* *Release date: XX-XXX-2004*
- A change to the linecache.py API caused IDLE to exit when an exception was
raised while running without the subprocess (-n switch). Python Bug 1063840.
What's New in IDLE 1.1b2? What's New in IDLE 1.1b2?
========================= =========================
......
...@@ -73,14 +73,16 @@ else: ...@@ -73,14 +73,16 @@ else:
return s return s
warnings.formatwarning = idle_formatwarning warnings.formatwarning = idle_formatwarning
def extended_linecache_checkcache(orig_checkcache=linecache.checkcache): def extended_linecache_checkcache(filename=None,
orig_checkcache=linecache.checkcache):
"""Extend linecache.checkcache to preserve the <pyshell#...> entries """Extend linecache.checkcache to preserve the <pyshell#...> entries
Rather than repeating the linecache code, patch it to save the pyshell# Rather than repeating the linecache code, patch it to save the
entries, call the original linecache.checkcache(), and then restore the <pyshell#...> entries, call the original linecache.checkcache()
saved entries. Assigning the orig_checkcache keyword arg freezes its value (which destroys them), and then restore the saved entries.
at definition time to the (original) method linecache.checkcache(), i.e.
makes orig_checkcache lexical. orig_checkcache is bound at definition time to the original
method, allowing it to be patched.
""" """
cache = linecache.cache cache = linecache.cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment