[Python-Dev] Re: Relaxing Unicode error handling

Aahz aahz at pythoncraft.com
Sat Jan 3 13:39:32 EST 2004


On Sat, Jan 03, 2004, Martin v. Loewis wrote:
> Aahz wrote:
>> 
>>* How does this work for library writers?
> 
> Library writers should avoid using it.  If the application uses it,
> libraries should not notice, since they won't get exceptions that they
> should not have gotten in the first place.

What if a library wants to ensure that it *does* get appropriate
exceptions so that it can handle them?

>>* How does this work with threads?
> 
> It's shared across all threads, and thread-safe (i.e. you can continue
> to not pass error handlers in any thread, and the thread will use
> either the old or the new error handler, not something inbetween -
> thanks to the GIL).

Right, but if different parts of an application are turning this off and
on, you'll get invalid results, such as unexpected exceptions.  The
question isn't whether Python's internal state will be consistent, but
whether applications can ensure a consistent state for themselves.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-Dev mailing list