> The python I use (win32 2.6.2) does not complain if it cannot read
> from or write to a .pyc; and thus it handles multiple python processes
> trying to create .pyc files at the same time. Is the .zip case really
> any different? Since .pyc files are an optimization, it seems natural
> and correct that .pyc IO errors pass silently (apologies to Tim).
> 
> It's an interesting challenge to write the file in such a way that
> it's safe for a reader and writer to co-exist. 

I grant you that this may actually work for concurrent readers
(although on Windows, you'll have to pick the file share mode
carefully). The reader would have to be fairly robust, as the central
directory may disappear or get garbled while it is reading.

So what would you do for concurrent writers, then? The current
implementation relies on creat(O_EXCL) to be atomic, so a second
writer would just fail. This is but the only IO operation that is
guaranteed to be atomic (along with mkdir(2)), so reusing the current
approach doesn't work.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to