bpo-37038: Make idlelib.run runnable; add test clause (GH-13560)
(cherry picked from commit 81bb97df61
)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
cee4ac8135
commit
c70ab1cca0
|
@ -3,6 +3,8 @@ Released on 2019-06-24?
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
|
|
||||||
|
bpo-37038: Make idlelib.run runnable; add test clause.
|
||||||
|
|
||||||
bpo-36958: Print any argument other than None or int passed to
|
bpo-36958: Print any argument other than None or int passed to
|
||||||
SystemExit or sys.exit().
|
SystemExit or sys.exit().
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
""" idlelib.run
|
||||||
|
|
||||||
|
Simplified, pyshell.ModifiedInterpreter spawns a subprocess with
|
||||||
|
f'''{sys.executable} -c "__import__('idlelib.run').run.main()"'''
|
||||||
|
'.run' is needed because __import__ returns idlelib, not idlelib.run.
|
||||||
|
"""
|
||||||
import io
|
import io
|
||||||
import linecache
|
import linecache
|
||||||
import queue
|
import queue
|
||||||
|
@ -8,8 +14,6 @@ import _thread as thread
|
||||||
import threading
|
import threading
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import tkinter # Tcl, deletions, messagebox if startup fails
|
|
||||||
|
|
||||||
from idlelib import autocomplete # AutoComplete, fetch_encodings
|
from idlelib import autocomplete # AutoComplete, fetch_encodings
|
||||||
from idlelib import calltip # Calltip
|
from idlelib import calltip # Calltip
|
||||||
from idlelib import debugger_r # start_debugger
|
from idlelib import debugger_r # start_debugger
|
||||||
|
@ -19,11 +23,16 @@ from idlelib import rpc # multiple objects
|
||||||
from idlelib import stackviewer # StackTreeItem
|
from idlelib import stackviewer # StackTreeItem
|
||||||
import __main__
|
import __main__
|
||||||
|
|
||||||
for mod in ('simpledialog', 'messagebox', 'font',
|
import tkinter # Use tcl and, if startup fails, messagebox.
|
||||||
'dialog', 'filedialog', 'commondialog',
|
if not hasattr(sys.modules['idlelib.run'], 'firstrun'):
|
||||||
'ttk'):
|
# Undo modifications of tkinter by idlelib imports; see bpo-25507.
|
||||||
delattr(tkinter, mod)
|
for mod in ('simpledialog', 'messagebox', 'font',
|
||||||
del sys.modules['tkinter.' + mod]
|
'dialog', 'filedialog', 'commondialog',
|
||||||
|
'ttk'):
|
||||||
|
delattr(tkinter, mod)
|
||||||
|
del sys.modules['tkinter.' + mod]
|
||||||
|
# Avoid AttributeError if run again; see bpo-37038.
|
||||||
|
sys.modules['idlelib.run'].firstrun = False
|
||||||
|
|
||||||
LOCALHOST = '127.0.0.1'
|
LOCALHOST = '127.0.0.1'
|
||||||
|
|
||||||
|
@ -523,4 +532,9 @@ class Executive(object):
|
||||||
item = stackviewer.StackTreeItem(flist, tb)
|
item = stackviewer.StackTreeItem(flist, tb)
|
||||||
return debugobj_r.remote_object_tree_item(item)
|
return debugobj_r.remote_object_tree_item(item)
|
||||||
|
|
||||||
capture_warnings(False) # Make sure turned off; see issue 18081
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from unittest import main
|
||||||
|
main('idlelib.idle_test.test_run', verbosity=2)
|
||||||
|
|
||||||
|
capture_warnings(False) # Make sure turned off; see bpo-18081.
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Make idlelib.run runnable; add test clause.
|
Loading…
Reference in New Issue