From: <bc...@wo...> - 2001-01-16 19:32:30
|
[Rich] >I've been playing with the new python.options.internalTablesImpl option. >I'm noticing some oddities when I set this to "weak". > >Every once in a while I get the following error when I start up the >Jython interpreter: > >Jython 2.0rc1 on java1.3.0_01 (JIT: null) >error importing site >Traceback (innermost last): > File "/home/rseddon/pnp/3rdparty/jython/Lib/site.py", line 68, in ? > File "/home/rseddon/pnp/3rdparty/jython/Lib/javaos.py", line 6, in ? >NameError: OSError > >This doesn't happen very often, and I haven't found any way to >reproduce it consistently. Luckily <wink> it happens fairly often on my 300Mhz win2k & jdk1.3. The situation where it happens for me, seems to be because PyJavaClass(__builtin__) gets booted from the internal tables. When that happens, all the assignments done in Py.setBuiltinExceptions() is lost. The booting is done during PySystemState.initPackages, which is before the default PySystemState instance is create. When that instance is created, it will keep the __builtin__ dict alive. Storing a reference of the PyJavaClass(__builtin__) in Py appears to close the hole. private static PyJavaClass v; public static void setBuiltinExceptions() { v = PyJavaClass.lookup(org.python.core.__builtin__.class); PyObject dict = v.__getattr__("__dict__"); Since the the builtin exceptions are stored in PyJavaClass.__dict__, these bindings are not recreated when the PyJavaClass(__builtin__) is recreated. I think that could explain it. Do you agree Samuele? regards, finn |