[Python-checkins] cpython (merge 3.3 -> default): Issue #16829: IDLE printing no longer fails if there are spaces or other

serhiy.storchaka python-checkins at python.org
Sat Jan 12 17:20:30 CET 2013


http://hg.python.org/cpython/rev/529b5ced59e0
changeset:   81461:529b5ced59e0
parent:      81457:487ed428f0ba
parent:      81460:778bead39825
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Jan 12 18:17:24 2013 +0200
summary:
  Issue #16829: IDLE printing no longer fails if there are spaces or other
special characters in the file path.

files:
  Lib/idlelib/IOBinding.py |  3 ++-
  Misc/NEWS                |  3 +++
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -1,5 +1,6 @@
 import os
 import types
+import shlex
 import sys
 import codecs
 import tempfile
@@ -458,7 +459,7 @@
         else: #no printing for this platform
             printPlatform = False
         if printPlatform:  #we can try to print for this platform
-            command = command % filename
+            command = command % shlex.quote(filename)
             pipe = os.popen(command, "r")
             # things can get ugly on NT if there is no printer available.
             output = pipe.read().strip()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,9 @@
 Library
 -------
 
+- Issue #16829: IDLE printing no longer fails if there are spaces or other
+  special characters in the file path.
+
 - Issue #15031: Refactor some .pyc management code to cut down on code
   duplication. Thanks to Ronan Lamy for the report and taking an initial stab
   at the problem.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list