Issue1601
Created on 2010-04-18.21:35:18 by tlocke, last changed 2010-04-25.18:04:56 by zyasoft.
msg5737 (view) |
Author: Tony Locke (tlocke) |
Date: 2010-04-18.21:35:17 |
|
The PyCode class implements Serializable, but on attempting to serialize a PyCode object I get java.io.NotSerializableException: org.python.core.CompilerFlags
Here's some code that will reproduce the problem:
PythonInterpreter interp = new PythonInterpreter();
PyCode code = interp.compile("jython_rocks = True");
ObjectOutputStream ow = new ObjectOutputStream(new
FileOutputStream(File.createTempFile("compscript", null)));
ow.writeObject(code);
ow.close();
|
msg5738 (view) |
Author: Tony Locke (tlocke) |
Date: 2010-04-18.21:41:06 |
|
I don't yet know enough about Jython to submit a patch. It could be that the right thing to do is to make the CompilerFlags class serializable, or the right thing could be to mark the compiler flags field transient, or none of the above!
|
msg5741 (view) |
Author: Jim Baker (zyasoft) |
Date: 2010-04-23.23:42:13 |
|
We should make CompilerFlags serializable. This is a simple oversight.
|
msg5742 (view) |
Author: Jim Baker (zyasoft) |
Date: 2010-04-25.18:04:54 |
|
Fixed in r7045
Actually it's a little more complicated - the abstract class PyTableCode also has to be serializable. But (almost) all code objects that extend PyTableCode are going to be in a separate class loader. (Clamp should enable some change of this. Maybe.)
Fortunately, Java provides support for serialization of such classes, through a registration mechanism in subclassed ObjectOutputStream/ObjectInputStream. Take a look at PyJavaType.java for the Java implementation and test_java_integration.py for a Python implementation. Both are based on the blog post in http://weblogs.java.net/blog/emcmanus/archive/2007/04/cloning_java_ob.html
|
|
Date |
User |
Action |
Args |
2010-04-25 18:04:56 | zyasoft | set | status: open -> closed resolution: fixed messages:
+ msg5742 |
2010-04-23 23:42:13 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg5741 |
2010-04-19 20:40:09 | tomstrummer | set | nosy:
+ tomstrummer |
2010-04-18 21:41:06 | tlocke | set | messages:
+ msg5738 |
2010-04-18 21:35:18 | tlocke | create | |
|