Charles-François Natali <neolo...@free.fr> added the comment:

> But that will also fail if id(path) happens to be fairly
> deterministic

Well, if you always get the same id(path), then yes, but I really doubt it, 
especially with CPython where it's the object's address (I guess there's the 
same chance of having varying IDs in other implementations):
"""
$ ./python -c "import io; print(id(io.__file__))"
3073909832
$ ./python -c "import io; print(id(io.__file__))"
3073963080
"""

In case of multiprocessing there was a collision because the import is done 
just after fork(), but the id() will likely change eventually.

If we wanted to be 100% bullet-proof, then we'll need something like 
mkstemp()/NamedTemporaryFile(), which we can't use because of bootstraping 
issues.
Of course, adding the PID won't hurt (except that it's a syscall, and will 
pollute strace's output ;-).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to