Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the PEP 446: non-inheritable file descriptors #62771

Closed
vstinner opened this issue Jul 27, 2013 · 8 comments
Closed

Implementation of the PEP 446: non-inheritable file descriptors #62771

vstinner opened this issue Jul 27, 2013 · 8 comments
Labels
type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

BPO 18571
Nosy @vstinner
Files
  • 17211acb65b1.diff
  • ca6217fbec85.diff
  • 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 2013-08-27.23:21:14.989>
    created_at = <Date 2013-07-27.15:28:51.525>
    labels = ['type-feature']
    title = 'Implementation of the PEP 446: non-inheritable file descriptors'
    updated_at = <Date 2013-09-01.08:22:51.489>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2013-09-01.08:22:51.489>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-08-27.23:21:14.989>
    closer = 'vstinner'
    components = []
    creation = <Date 2013-07-27.15:28:51.525>
    creator = 'vstinner'
    dependencies = []
    files = ['31427', '31488']
    hgrepos = ['205']
    issue_num = 18571
    keywords = ['patch']
    message_count = 8.0
    messages = ['193786', '194917', '195674', '195930', '196329', '196349', '196355', '196715']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'neologix', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue18571'
    versions = ['Python 3.4']

    @vstinner vstinner added the type-feature A feature request or enhancement label Jul 27, 2013
    @vstinner
    Copy link
    Member Author

    Implementation of the PEP-446.

    @vstinner vstinner changed the title Implementation of the PEP 446: non-inheriable file descriptors Implementation of the PEP 446: non-inheritable file descriptors Aug 9, 2013
    @vstinner
    Copy link
    Member Author

    + if (make_inheritable(py_fds_to_keep) < 0)
    + goto error;
    + /* errpipe_write is part of py_fds_to_keep. It must be closed at
    + exec(), but kept open in the child process until exec() is called. */
    + if (_Py_set_inheritable((int)errpipe_write, 0, NULL) < 0)
    + goto error;

    make_inheritable() should ignore errpipe_write, instead of changing twice the inheritable flag of errpipe_write.

    @vstinner
    Copy link
    Member Author

    make_inheritable() should ignore errpipe_write, instead of changing twice the inheritable flag of errpipe_write.

    Done in the last patch (00df7fc6d2ef.diff).

    @vstinner
    Copy link
    Member Author

    I tested 17211acb65b1.diff on my x86_64 VMs:

    Linux: Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow
    => 358 tests OK.

    OpenIndiana: Solaris-2.11-i86pc-i386-32bit-ELF
    => 3 tests failed: test_locale test_tcl test_uuid -- none of these failures are related to the PEP and also occurs in default

    Mac OS X: Darwin-10.8.0-i386-64bit
    => 352 tests OK.

    FreeBSD: FreeBSD-9.1-RELEASE-amd64-64bit-ELF
    => 351 tests OK.

    Windows: Windows-7-6.1.7601-SP1
    => 329 tests OK

    So it works on all (tested) platforms ;-)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 27, 2013

    New changeset ef889c3d5dc6 by Victor Stinner in branch 'default':
    Issue bpo-18571: Implementation of the PEP-446: file descriptors and file handles
    http://hg.python.org/cpython/rev/ef889c3d5dc6

    @neologix
    Copy link
    Mannequin

    neologix mannequin commented Aug 28, 2013

    14.1 --- a/Lib/multiprocessing/util.py
    14.2 +++ b/Lib/multiprocessing/util.py

    14.13 #
    14.14 # Return pipe with CLOEXEC set on fds
    14.15 #
    14.16 +# Deprecated: os.pipe() creates non-inheritable file descriptors
    14.17 +# since Python 3.4
    14.18 +#
    14.19
    14.20 def pipe():
    14.21 - import _posixsubprocess
    14.22 - return _posixsubprocess.cloexec_pipe()
    14.23 + return os.pipe()

    I guess you could remove util.pipe() altogether: it wasn't part of the public API.

    @vstinner
    Copy link
    Member Author

    I guess you could remove util.pipe() altogether: it wasn't part of the public API.

    Ah yes, I wanted to create an issue for that but I forgot. Here you
    have: issue bpo-18865.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 1, 2013

    New changeset c27527dce71e by Victor Stinner in branch 'default':
    Issue bpo-18571: Merge duplicate test code
    http://hg.python.org/cpython/rev/c27527dce71e

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant