From: <bc...@wo...> - 2001-04-13 18:46:45
|
[D-Man] > >Through a small piece of stupid code, I found a bug in the Jython 2.0 >compiler. > >In a function (in a class, in a module if it matters) I had the >following code : > > del some_var > >Originally some_var existed (a temporary local), but though some >modifications some_var no longer existed. Trying to run the app >yielded the following (partial) result : > >./run.bash Main.py >Traceback (innermost last): > File "Main.py", line 33, in ? > File "SessionTests\__init__.py", line 25, in ? >java.lang.NullPointerException >... The stacktrace is gone in 2.1a1 ... >Obviously the error was on my part (can't del a var that DNE), but the >compiler should give a more informative error message (;-)). Maybe it >should wait and give a NameError during exection, since it is possible >that I created the name through exec() or something. (I didn't use >any fancy dynamism in this case) > >I just checked against CPython and found this: > >>>> def foo( ): >... del dne >... >>>> foo() >Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "<stdin>", line 2, in foo >UnboundLocalError: Local variable 'dne' referenced before assignment .. but 2.1a1 still doesn't work as CPython. I have made a bugreport about this. regards, finn |