IronPython 1.0 - Bugs or Features?

Claudio Grondi claudio.grondi at freenet.de
Wed Sep 6 14:05:00 EDT 2006


Marc 'BlackJack' Rintsch wrote:
> In <edmlbv$a9h$1 at newsreader2.netcologne.de>, Claudio Grondi wrote:
> 
> 
>>The context:
>>   C:\IronPython> ipy.exe
>>   IronPython 1.0.60816 on .NET 2.0.50727.42
>>   Copyright (c) Microsoft Corporation. All rights reserved.
>>vs.
>>   C:\Python24> python.exe
>>   Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] 
>>on win32
>>
>>IronPython raises "UnboundLocalError: local variable 'strData' 
>>referenced before assignment" error in following case:
>><code>
>>     while(someCondition):
>>       try:
>>         strData = strSomeValue()
>>       except:
>>         pass
>>       if( type(strData) == str ) : ### <<< HERE THE ERROR
>>         doSomething()
>></code>
>>CPython 2.4.2 doesn't raise an error with same code.
> 
> 
> Well I get a `NameError`  for `someCondition`.  Please post a minimal
> *working* example that produced the error.
I can't as after constructing one according to what I have thought was 
the cause of it I detected that the error was caused by the exception in 
the line
   strData = strSomeValue()
(see also my other posting)
I have just misinterpreted the origin of the "UnboundLocalError:" as 
raised while parsing and was wondering how it comes, that the parser is 
able to detect such things ...
Sorry for the eventually caused confusion.

Claudio Grondi



More information about the Python-list mailing list