[Python-bugs-list] [ python-Bugs-481218 ] popen4 fails if cmd is unicode.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 11 Dec 2001 06:16:50 -0800


Bugs item #481218, was opened at 2001-11-13 00:17
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481218&group_id=5470

Category: Python Library
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Michael Hudson (mwh)
Summary: popen4 fails if cmd is unicode.

Initial Comment:
In popen2.py there is a class Popen3. It contains
a method _run_child().

-------
def _run_child(self, cmd):
    if type(cmd) == type(''):
        cmd = ['/bin/sh', '-c', cmd]
-------

I think that this test is attempting to find if the
"cmd" is not a list. Unfortunately <type 'unicode'>
does not get turned into a list. A better test may
be:

-----
def _run_child(self, cmd):
    if repr(type(cmd)) != "<type 'list'>"
        cmd = ['/bin/sh', '-c', cmd] 
-----

This problem shows up when creating commands from XML
files read by "xml.sax". Beta 2.2b1 still has this
code. 

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-11 06:16

Message:
Logged In: YES 
user_id=6380

Ain't a time machine handy? :-)

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2001-12-11 05:44

Message:
Logged In: YES 
user_id=6656

This would seem to have been fixed in revision 1.20 in CVS;
the check-in comment was:

Patch #487784: Support Unicode commands in popen3/4 handling
on UNIX.

Bugs that are already fixed are the easiest to close...

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481218&group_id=5470