Message1498

Author cgroves
Recipients
Date 2007-05-01.09:40:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Just to be clear, Jython can handle any string that fits in memory.  It can't handle a string *literal* longer than 32767 characters.  Because you're putting the string directly into the exec'd code it's turned into a literal and compiled into bytecode.  If you set a PyString in the interpreter, this will work fine. 

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 32768; i++) {
            sb.append('a');
        }
        PythonInterpreter pi = new PythonInterpreter();
        pi.exec("data = {}");

        pi.set("s", new PyString(sb.toString()));
        pi.exec("data[\"stuff\"] = {\"val\" : s}");
        pi.exec("print len(s)");

That prints '32768'.  
History
Date User Action Args
2008-02-20 17:17:45adminlinkissue1663711 messages
2008-02-20 17:17:45admincreate