CFT: fix OfflineIMAP lockup in single-threaded mode

Nicolas Sebrecht nicolas.s-dev at laposte.net
Mon Jan 28 20:39:46 GMT 2013


On Mon, Jan 28, 2013 at 10:47:22PM +0400, Eygene Ryabinkin wrote:
> Mon, Jan 28, 2013 at 05:15:53PM +0100, X Ryl wrote:

> > I thought the config was read-only already, and read before any
> > thread is spawn, so I don't get why it would require a singleton
> > class ?
> 
> My current implementation doesn't singleton'ize the 'config', it
> applies singleton to 'options' that have read/write access.  But, as
> you can see, 'config' variable from offlineimap/init.py is just a
> class that holds the configuration items and they can be modified,
> e.g. by using config.set() method.
> 
> If we will make, say, 'options' to the global variable, some code can
> unintentionally modify it and this will be very hard to trace, since
> any piece of code can do it: variable is global.

How some code would modify the global variable 'options'?

Might be just a matter of opinions but python expects developpers to
know what they do (e.g. attributes of objects are public). Does safety
justify the resulting complexity of the code? Not sure.

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list