New submission from Sridhar Ratnakumar <sridh...@activestate.com>:

I noticed that despite ActivePerl being installed, `os.popen(...).close()` 
returned 1 (see find_working_perl in build_ssl.py), while in actuality that 
command executed successfully with return code 0; I verified this by using the 
subprocess module.

Here's a patch:

--- python/PCbuild/build_ssl.py.orig
+++ python/PCbuild/build_ssl.py
@@ -45,11 +45,11 @@
 # Being a Perl dummy, the simplest way I can check is if the "Win32" package
 # is available.
 def find_working_perl(perls):
+    import subprocess
     for perl in perls:
-        fh = os.popen('"%s" -e "use Win32;"' % perl)
-        fh.read()
-        rc = fh.close()
-        if rc:
+        try:
+            subprocess.check_call('"%s" -e "use Win32;"' % perl, shell=True)
+        except subprocess.CalledProcessError:
             continue
         return perl
     print("Can not find a suitable PERL:")

----------
components: Build, Windows
messages: 124467
nosy: srid
priority: normal
severity: normal
status: open
title: build_ssl.py is relying on unreliable behaviour of os.popen
type: compile error
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10752>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to