Message153911
| Author |
neologix |
| Recipients |
brett.cannon, neologix, pitrou |
| Date |
2012年02月21日.22:51:33 |
| SpamBayes Score |
8.7581054e-11 |
| Marked as misclassified |
No |
| Message-id |
<1329864693.77.0.0470189552052.issue14077@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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 ;-). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年02月21日 22:51:33 | neologix | set | recipients:
+ neologix, brett.cannon, pitrou |
| 2012年02月21日 22:51:33 | neologix | set | messageid: <1329864693.77.0.0470189552052.issue14077@psf.upfronthosting.co.za> |
| 2012年02月21日 22:51:33 | neologix | link | issue14077 messages |
| 2012年02月21日 22:51:33 | neologix | create |
|