Is email package thread safe? (fwd)

Antoon Pardon apardon at forel.vub.ac.be
Wed Feb 9 10:04:29 EST 2005


Op 2005-02-09, Roman Suzi schreef <rnd at onego.ru>:
>
> (this is a repost with an addition - probably noone noticed my message first 
> time)
>
> Hi!
>
> Just to be sure, is email package of Python 2.3 thread-safe or not
> (to use, for example, in python-milter?)
>
> P.S. And where can I find information on particular piece of standard library
> if it is thread-safe or need locking? I recall 'random' module is (was?)
> unsafe - which isexplicitly stated in the docs.

Well I guess it was unsafe. The current documentation states:

  The underlying implementation in C is both fast and threadsafe. 

http://www.python.org/doc/2.3.5/lib/module-random.html

There is class for random number generation that is not thread safe
and is included to allow reproducing sequences from previous versions.

> Can I assume that everything 
> else without such notice is thread-safe?

I doubt it. There is no indication that the email package uses any
kind of locking. So multiple thread working on the same message
will probably screw things up.

-- 
Antoon Pardon



More information about the Python-list mailing list