[Patches] [ python-Patches-487784 ] Fixes a bug in popen3/4 handling on UNIX
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 01 Dec 2001 16:44:08 -0800
Patches item #487784, was opened at 2001-11-30 23:29
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=487784&group_id=5470
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Quinlan (bquinlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fixes a bug in popen3/4 handling on UNIX
Initial Comment:
Fixes a bug in popen2.popen3/4 bug where
popen3/4 was treating unicode objects like
sequence types, not as strings.
This patch is pretty conservative, it shouldn't break
anything.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2001-12-01 16:44
Message:
Logged In: YES
user_id=21627
I think the isinstance test is more than needed; doing
if type(cmd) in types.StringTypes:
should be sufficient. If some other means for testing for
"string-ness" becomes available, all occurrences of
StringTypes can be inspected easily. That certainly won't
happen for 2.2.
How do you produce the attachments? file(1) says
Macintosh MacBinary data, type " ", creator " "
It would be better if they were plain text.
----------------------------------------------------------------------
Comment By: Brian Quinlan (bquinlan)
Date: 2001-12-01 10:01
Message:
Logged In: YES
user_id=108973
Second patch uses types.StringTypes instead of doing
a hardcoded check for string and unicode objects.
BTW, it would be nice to add a function like this to types
(I would submit a patch but I can't think of a good
name):
def isStringThing(thing):
for stringType in types.StringTypes:
if isinstance(thing, stringType):
return 1
return 0
----------------------------------------------------------------------
Comment By: Brian Quinlan (bquinlan)
Date: 2001-11-30 23:36
Message:
Logged In: YES
user_id=108973
I guess I should note that this patch does not change
the results of test_popen2.py and that it satisfies my
own test suite:
import popen2
testBuffer = 'This is a test\n'
(child_stdout, child_stdin, child_strerr) =
popen2.popen3('cat')
child_stdin.write(testBuffer)
child_stdin.close()
assert child_stdout.read() == testBuffer
(child_stdout, child_stdin, child_strerr) =
popen2.popen3(u'cat')
child_stdin.write(testBuffer)
child_stdin.close()
assert child_stdout.read() == testBuffer # Fails without
this patch
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=487784&group_id=5470