python / cpython

The Python programming language
https://www.python.org
Other
63.04k stars 30.19k forks source link

subprocess module does not accept file twice #56240

Closed e070b1f7-4e7b-4562-9943-c9260e2621bb closed 13 years ago

e070b1f7-4e7b-4562-9943-c9260e2621bb commented 13 years ago
BPO 12031
Superseder
  • bpo-11432: webbrowser.open on unix fails.
  • Files
  • test.py: testcase
  • 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: ```python assignee = None closed_at = created_at = labels = ['library', 'type-crash'] title = 'subprocess module does not accept file twice' updated_at = user = 'https://bugs.python.org/zmk' ``` bugs.python.org fields: ```python activity = actor = 'neologix' assignee = 'none' closed = True closed_date = closer = 'neologix' components = ['Library (Lib)'] creation = creator = 'zmk' dependencies = [] files = ['21935'] hgrepos = [] issue_num = 12031 keywords = [] message_count = 3.0 messages = ['135530', '135532', '135534'] nosy_count = 3.0 nosy_names = ['zmk', 'neologix', 'catalin.iacob'] pr_nums = [] priority = 'normal' resolution = 'out of date' stage = None status = 'closed' superseder = '11432' type = 'crash' url = 'https://bugs.python.org/issue12031' versions = ['Python 3.2'] ```

    e070b1f7-4e7b-4562-9943-c9260e2621bb commented 13 years ago

    I want to pass /dev/null as stdin and stderr.

    This works from python 2.4 .. 3.2a3

    It fails in final 3.2 with 'Bad file descriptor':

    Traceback (most recent call last):
      File "test.py", line 11, in <module>
        Popen(['cat', 'file.txt'], stdout = PIPE, stdin = _in, stderr = _err)
      File "/opt/apps/python320/lib/python3.2/subprocess.py", line 736, in __init__
        restore_signals, start_new_session)
      File "/opt/apps/python320/lib/python3.2/subprocess.py", line 1330, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    OSError: [Errno 9] Bad file descriptor
    5cd58f33-69a6-4482-a1e1-fa5df5a17f40 commented 13 years ago

    I can reproduce this on 3.2 final but not on the tip of the 3.2 branch so it seems to have been fixed.

    79528080-9d85-4d18-8a2a-8b1f07640dd7 commented 13 years ago

    It's a duplicate of issue bpo-11432: http://bugs.python.org/issue11432