The real problem with Python 3 - no business case for conversion

Thomas Jollans thomas at jollans.com
Wed Jul 7 05:06:40 EDT 2010


On 07/07/2010 10:58 AM, Paul Rubin wrote:
> Paul McGuire <ptmcg at austin.rr.com> writes:
>> is completely forward and backward incompatible.  The workaround is to
>> rewrite as:
>>
>>     except ExceptionType:
>>         ex = sys.exc_info()[0]
>>
>> which works just fine in 2.x and 3.x.
> 
> Are you sure?  I wonder if there might be some race condition that could
> make it fail.

Luckily, no: (lib. docs on exc_info())

This function returns a tuple of three values that give information
about the exception that is currently being handled. The information
returned is specific both to the current thread and to the current stack
frame.

> 
> I didn't even know about (or forgot) this change.  Yucch.




More information about the Python-list mailing list