Message5835

Author matt_brinkley
Recipients adam.spiers, bpedman, matt_brinkley, pjenvey, rkurin, zyasoft
Date 2010-06-24.23:34:34
SpamBayes Score 9.115658e-06
Marked as misclassified No
Message-id <1277422476.65.0.647695252402.issue1522@psf.upfronthosting.co.za>
In-reply-to
Content
Here is the test program I used. One thing to note is that I added an accessor method for PyType.class_to_type so I could print out its size.

-------------------------------------------------------------------------
import org.python.util.PythonInterpreter;
import org.python.core.PySystemState;
import org.python.core.PyType;

public class JythonTestMain
{
    public static void runScript() throws Exception
    {
        PySystemState sys = new PySystemState();
        PythonInterpreter pi = new PythonInterpreter(null, sys);
        pi.execfile("/path/to/test.py"));
        pi.cleanup();
    }

    public static void main(String[] args) throws Exception
    {
        //(have tried this for various sizes of 'n')
        for(int i=0; i<2;i++)
        {
            runScript();
            System.out.println("class_to_type size:" + PyType.getClassToType().size());
            System.gc();
            System.out.println("class_to_type size (post-gc):" + PyType.getClassToType().size());
        }
    }
}

--------------------------------------------------------------------
(Here is the contents of test.py ... the important feature it must have is that it must contain a Python class that implements a Java interface.)

from java.lang import Comparable

class Dog(Comparable):
    def compareTo(self, o):
        return 0
    def bark(self):
        print "woof woof"

print Dog().bark()
History
Date User Action Args
2010-06-24 23:34:36matt_brinkleysetmessageid: <1277422476.65.0.647695252402.issue1522@psf.upfronthosting.co.za>
2010-06-24 23:34:36matt_brinkleysetrecipients: + matt_brinkley, pjenvey, zyasoft, bpedman, rkurin, adam.spiers
2010-06-24 23:34:36matt_brinkleylinkissue1522 messages
2010-06-24 23:34:35matt_brinkleycreate