Message10835

Author flungo
Recipients flungo
Date 2016-04-13.15:00:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460559615.35.0.490933758868.issue2492@psf.upfronthosting.co.za>
In-reply-to
Content
I am sure there are probably other objects that cause this, but if you instantiate a `PyInteger` before any other call within the jython library, it will then cause the instantiation of a `PythonInterpreter` to always throw a NullPointerException.

This is very easy to reproduce:

```
public class NPETest {
    
    public static void main(String[] args) {
        new PyInteger(0);
        new PythonInterpreter();
    }

}
```

When the above code is run, the following warning message is printed:

```
init: Bootstrapping class not in BootstrapTypesSingleton.getInstance()[class=class org.python.core.PyInteger]
```

This can be avoided by getting the class loader to load the `PyObject` class before instantiating the new `PyInteger` even indirectly through loading `PyInteger`: adding `System.out.println(PyInteger.gcMonitorGlobal);` before instantiating the PyInteger works. This seems to only works because `PyInteger.gcMonitorGlobal` is inherited from `PyObject`.

I am not sure if adding a static code block that forces initialisation in `PyInteger` will help, or even be the best way to resolve this but it might work as a temporary fix.

This may be related to #1671 or the fix introduced for it.
History
Date User Action Args
2016-04-13 15:00:15flungosetrecipients: + flungo
2016-04-13 15:00:15flungosetmessageid: <1460559615.35.0.490933758868.issue2492@psf.upfronthosting.co.za>
2016-04-13 15:00:15flungolinkissue2492 messages
2016-04-13 15:00:14flungocreate