[Python-checkins] cpython (merge 3.3 -> default): Issue #18270: merge from 3.3
ned.deily
python-checkins at python.org
Wed Dec 11 01:33:48 CET 2013
http://hg.python.org/cpython/rev/9d1fb265b88a
changeset: 87894:9d1fb265b88a
parent: 87890:eb0622dc8376
parent: 87893:016c64e66a9e
user: Ned Deily <nad at acm.org>
date: Tue Dec 10 16:32:57 2013 -0800
summary:
Issue #18270: merge from 3.3
files:
Lib/idlelib/PyShell.py | 25 ++++++++++++++-----------
Misc/NEWS | 5 ++++-
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
old mode 100644
new mode 100755
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1540,20 +1540,22 @@
args.remove(filename)
if not args:
flist.new()
+
if enable_shell:
shell = flist.open_shell()
if not shell:
return # couldn't open shell
-
if macosxSupport.runningAsOSXApp() and flist.dict:
# On OSX: when the user has double-clicked on a file that causes
# IDLE to be launched the shell window will open just in front of
# the file she wants to see. Lower the interpreter window when
# there are open files.
shell.top.lower()
+ else:
+ shell = flist.pyshell
- shell = flist.pyshell
- # handle remaining options:
+ # Handle remaining options. If any of these are set, enable_shell
+ # was set also, so shell must be true to reach here.
if debug:
shell.open_debugger()
if startup:
@@ -1561,7 +1563,7 @@
os.environ.get("PYTHONSTARTUP")
if filename and os.path.isfile(filename):
shell.interp.execfile(filename)
- if shell and cmd or script:
+ if cmd or script:
shell.interp.runcommand("""if 1:
import sys as _sys
_sys.argv = %r
@@ -1572,13 +1574,14 @@
elif script:
shell.interp.prepend_syspath(script)
shell.interp.execfile(script)
-
- # Check for problematic OS X Tk versions and print a warning message
- # in the IDLE shell window; this is less intrusive than always opening
- # a separate window.
- tkversionwarning = macosxSupport.tkVersionWarning(root)
- if tkversionwarning:
- shell.interp.runcommand(''.join(("print('", tkversionwarning, "')")))
+ elif shell:
+ # If there is a shell window and no cmd or script in progress,
+ # check for problematic OS X Tk versions and print a warning
+ # message in the IDLE shell window; this is less intrusive
+ # than always opening a separate window.
+ tkversionwarning = macosxSupport.tkVersionWarning(root)
+ if tkversionwarning:
+ shell.interp.runcommand("print('%s')" % tkversionwarning)
while flist.inversedict: # keep IDLE running while files are open.
root.mainloop()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -131,7 +131,10 @@
IDLE
----
-- Issue #19481: print() of string subclass instance in IDLE no more hangs.
+- Issue #19481: print() of string subclass instance in IDLE no longer hangs.
+
+- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial
+ shell window is present.
Tests
-----
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list