[Python-Dev] PEP 384 status

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Aug 31 11:56:10 CEST 2010


Hi,

2010/8/31 Antoine Pitrou <solipsis at pitrou.net>:
> David Cournapeau <cournape at gmail.com> wrote:
>> As far as IO is concerned, FILE* is just a special case of a more
>> generic issue, though, so maybe this could be a bit reworded. For
>> example, file descriptor cannot be shared between runtimes either.
>
> Er, really?

Yes, on Windows, file descriptors returned by open() or dup() cannot be shared
between runtimes. What can be safely shared is the underlying "handle",
you can get it with the _get_osfhandle() function.

> So it means that, for example, a FileIO object couldn't be shared
> between runtimes either? How about a socket object?
> Do you want to forbid FileIO and socket objects as part of the API?

Python objects don't have this concern: all methods of FileIO are implemented
in a single file (fileio.c), linked to a single C runtime.

> Again, I propose that FILE* functions are allowed in the API, but their
> use discouraged in the docs (with proper explanations from those who
> know how to word them).

IMO the warnings you'd write there would be similar to the motivations of
PEP 384.

-- 
Amaury Forgeot d'Arc


More information about the Python-Dev mailing list