This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: popenN return only text mode pipes
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: bbboyadjiev, loewis, nnorwitz, tim.peters
Priority: normal Keywords:

Created on 2002-08-16 09:25 by bbboyadjiev, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg12021 - (view) Author: Boyan Boyadjiev (bbboyadjiev) Date: 2002-08-16 09:25
The functions popen2, popen3 & popen 4 (module 
win32pipe) will return only text mode pipes even 
if the parameter mode is 'b'.

In the file win32popen.cpp on lines 363 
(popen2&popen4) and 398 (popen3) can be found 
the following code:
if (mode && _O_TEXT)
    {
      m1="r";
      m2="w";
    }
      else
    {
      m1="rb";
      m2="wb";
    }
The following change solves the problem :
if (mode & _O_TEXT)
    { ....

msg12022 - (view) Author: Boyan Boyadjiev (bbboyadjiev) Date: 2002-08-16 11:03
Logged In: YES 
user_id=595971

The same code (if (mode && _O_TEXT) ...) is used also in the function _PyPopen of the posix module 
(posixmodule.c).
msg12023 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-08-17 16:03
Logged In: YES 
user_id=33168

win32popen.cpp is not in python.  The code you mention is in
posixmodule.c:3479 and 3511 in _PyPopen() for current cvs. 
Changing && -> & seems correct to me.  However, I don't
believe this can be tested on Unix.  

Martin, can you add anything?  Assign to me if you want me
to make the change.
msg12024 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-08-17 17:10
Logged In: YES 
user_id=21627

That change looks fine; please implement it.
msg12025 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-08-19 00:44
Logged In: YES 
user_id=31435

I made the obvious changes here and checked them in, to 
the head and in the 2.2 maintenance branch.  Thanks for 
the report!  Neal, of course you're right that you couldn't 
test it on Windows.
History
Date User Action Args
2022-04-10 16:05:36adminsetgithub: 37047
2002-08-16 09:25:39bbboyadjievcreate