Skip to content

errno not being set #49562

Closed
Closed

Description

@benjaminp
BPO 5312
Nosy @birkenfeld, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/benjaminp'
closed_at = <Date 2009-02-20.03:20:12.472>
created_at = <Date 2009-02-19.04:16:22.822>
labels = []
title = 'errno not being set'
updated_at = <Date 2009-02-20.03:20:12.471>
user = 'https://github.com/benjaminp'

bugs.python.org fields:

activity = <Date 2009-02-20.03:20:12.471>
actor = 'benjamin.peterson'
assignee = 'benjamin.peterson'
closed = True
closed_date = <Date 2009-02-20.03:20:12.472>
closer = 'benjamin.peterson'
components = []
creation = <Date 2009-02-19.04:16:22.822>
creator = 'benjamin.peterson'
dependencies = []
files = []
hgrepos = []
issue_num = 5312
keywords = []
message_count = 3.0
messages = ['82456', '82470', '82512']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'benjamin.peterson']
pr_nums = []
priority = 'high'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue5312'
versions = ['Python 3.0', 'Python 3.1']

Activity

  1. benjaminp commented on Feb 19, 2009

    @benjaminp
    ContributorAuthor
    def test_leaking_fds_on_error(self):
            # see bug python/cpython#49429: 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.

  2. birkenfeld commented on Feb 19, 2009

    @birkenfeld
    Member

    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).

  3. self-assigned this
    on Feb 19, 2009
  4. benjaminp commented on Feb 20, 2009

    @benjaminp
    ContributorAuthor

    Thanks for the diagnostic, Georg! Fixed in r69794.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions