Urllib thread safe?
Martin v. Loewis
martin at v.loewis.de
Wed Jun 5 22:44:39 CEST 2002
Oleg Broytmann <phd at phd.pp.ru> writes:
> On Wed, Jun 05, 2002 at 07:55:00PM +0200, Martin v. Loewis wrote:
> > Yes, that is thread-safe. urllib does not maintain any per-url state,
> Hah? It maintains global _urlopener...
Sure, but the OP said he uses
which does not make use of _urlopener. However, I believe that even
the global _urlopener is thread-safe, since it does not maintain any
per-url state. About the only thing that changes in this object is
__tempfiles, and that is also thread-safe (since .append is atomic).
More information about the Python-list