Message1498
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'. |
|
Date |
User |
Action |
Args |
2008-02-20 17:17:45 | admin | link | issue1663711 messages |
2008-02-20 17:17:45 | admin | create | |
|