[Python-Dev] cpython: Issue #18571: Implementation of the PEP 446: file descriptors and file handles (original) (raw)
Victor Stinner victor.stinner at gmail.com
Sun Sep 15 16:04:45 CEST 2013
- Previous message: [Python-Dev] cpython: Issue #18571: Implementation of the PEP 446: file descriptors and file handles
- Next message: [Python-Dev] PEP 428: Pathlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yes, but I'm not interested to write such doc.
Victor Le 15 sept. 2013 10:34, "Georg Brandl" <g.brandl at gmx.net> a écrit :
On 08/28/2013 01:20 AM, victor.stinner wrote: > http://hg.python.org/cpython/rev/ef889c3d5dc6 > changeset: 85420:ef889c3d5dc6 > user: Victor Stinner <victor.stinner at gmail.com> > date: Wed Aug 28 00:53:59 2013 +0200 > summary: > Issue #18571: Implementation of the PEP 446: file descriptors and file handles > are now created non-inheritable; add functions os.get/setinheritable(), > os.get/sethandleinheritable() and socket.socket.get/setinheritable().
> +.. fdinheritance: > + > +Inheritance of File Descriptors > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +A file descriptor has a inheritable flag which indicates if the file descriptor > +can be inherited or not in child processes. Since Python 3.4, file descriptors > +created by Python are non-inheritable by default. > + > +On UNIX, non-inheritable file descriptors are closed in child processes at the > +execution of a new program, other file descriptors are inherited. > + > +On Windows, non-inheritable handles and file descriptors are closed in child > +processes, except standard streams (file descriptors 0, 1 and 2: stdin, stdout > +and stderr) which are always inherited. Using :func:
os.spawn*
functions, > +all inheritable handles and all inheritable file descriptors are inherited. > +Using the :mod:subprocess
module, all file descriptors except standard > +streams are closed, inheritable handles are only inherited if the closefds > +parameter isFalse
. > + > +.. versionadded:: 3.4 > + > +.. function:: getinheritable(fd) > + > + Get theinheritable flag <fdinheritance>
of the specified file > + descriptor. Return a :class:bool
. > + > +.. function:: setinheritable(fd, inheritable) > + > + Set theinheritable flag <fdinheritance>
of the specified file descriptor. > + > +.. function:: gethandleinheritable(handle) > + > + Get theinheritable flag <fdinheritance>
of the specified handle. Return a :class:bool
. > + > + Availability: Windows. > + > +.. function:: sethandleinheritable(handle, inheritable) > + > + Set theinheritable flag <fdinheritance>
of the specified handle. > + > + Availability: Windows. > + "Handle" is used nowhere else in the os module documentation. Do you think it would make sense to have a brief paragraph on what are possible handles under Windows (and that file descriptors aren't handles)? Georg
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130915/62cb1131/attachment.html>
- Previous message: [Python-Dev] cpython: Issue #18571: Implementation of the PEP 446: file descriptors and file handles
- Next message: [Python-Dev] PEP 428: Pathlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]