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: errno not being set
Type: Stage:
Components: Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, georg.brandl
Priority: high Keywords:

Created on 2009-02-19 04:16 by benjamin.peterson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg82456 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-19 04:16
def test_leaking_fds_on_error(self):
        # see bug #5179: Popen leaks file descriptors to PIPEs if
        # the child fails to execute; this will eventually exhaust
        # the maximum number of open fds. 1024 seems a very common
        # value for that limit, but Windows has 2048, so we loop
        # 1024 times (each call leaked two fds).
        for i in range(1024):
            try:
                subprocess.Popen(['nonexisting_i_hope'],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            # Windows raises IOError
            except (IOError, OSError) as err:
                self.assertEqual(err.errno, 2) 


This test is failing in py3k because errno is not being set on the
exception and is None. I don't have time to investigate more at the moment.
msg82470 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-02-19 10:31
The problem is in os.py. This patch fixes it:

Index: Lib/os.py
===================================================================
--- Lib/os.py   (Revision 69769)
+++ Lib/os.py   (Arbeitskopie)
@@ -372,8 +372,8 @@
                 saved_exc = e
                 saved_tb = tb
     if saved_exc:
-        raise error(saved_exc).with_traceback(saved_tb)
-    raise error(last_exc).with_traceback(tb)
+        raise saved_exc.with_traceback(saved_tb)
+    raise last_exc.with_traceback(tb)


I suspect there may be other instances of this problem (I guess 2to3
converted that).
msg82512 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-20 03:20
Thanks for the diagnostic, Georg! Fixed in r69794.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49562
2009-02-20 03:20:12benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg82512
2009-02-19 19:52:57benjamin.petersonsetassignee: benjamin.peterson
2009-02-19 10:31:14georg.brandlsetmessages: + msg82470
2009-02-19 04:16:22benjamin.petersoncreate