Skip to content

subprocess.communicate() doesn't close pipes on Windows #54972

Closed

Description

@vstinner
BPO 10763
Nosy @amauryfa, @pitrou, @vstinner
Files
  • subprocess_close_pipes.patch
  • 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 = None
    closed_at = <Date 2010-12-25.22:43:41.873>
    created_at = <Date 2010-12-23.11:59:26.308>
    labels = ['library', 'OS-windows']
    title = "subprocess.communicate() doesn't close pipes on Windows"
    updated_at = <Date 2010-12-25.22:43:41.871>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2010-12-25.22:43:41.871>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-12-25.22:43:41.873>
    closer = 'vstinner'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2010-12-23.11:59:26.308>
    creator = 'vstinner'
    dependencies = []
    files = ['20146']
    hgrepos = []
    issue_num = 10763
    keywords = ['patch']
    message_count = 2.0
    messages = ['124547', '124649']
    nosy_count = 4.0
    nosy_names = ['amaury.forgeotdarc', 'pitrou', 'vstinner', 'gps']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue10763'
    versions = ['Python 3.2']

    Linked PRs

    Activity

    1. vstinner commented on Dec 23, 2010

      @vstinner
      MemberAuthor

      If more than one file (stdin, stdout and stderr) are pipes, Popen.communicate() uses threads calling _readerthread() on each pipe. But this method doesn't close the pipes, whereas all other communicate implementations (select, poll and the optimization if there is only one pipe) do close all pipes.

      Attached patch fixes this issue.

      Thanks Antoine for your nice ResourceWarning patch!

    2. vstinner commented on Dec 25, 2010

      @vstinner
      MemberAuthor

      Fixed by r87485 (Python 3.2).

      I don't want to fix it in 2.7 or 3.1, because maybe someone relies on this bug and it's a minor bug :-) Reopen the issue if you would like a backport.

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

    No one assigned

      Labels

      OS-windowsstdlibStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions