|
From: Kevin D. <kda...@we...> - 2001-07-25 15:27:38
|
We're working on a project involving ExtensionClasses and have written
some code to that end. (The project is open source, but we haven't
"announced" it yet, because we still need to build up some support
infrastructure.)
In order to pickle an ExtensionClass PyMetaClass, I had a couple of
changes...
$ diff PyMetaClass.java ~/jython-20010719/org/python/core/PyMetaClass.java
5d4
< public PyObject __basicnew__();
$ diff cPickle.java ~/jython-20010719/org/python/modules/cPickle.java
996c996
< else if (object instanceof PyClass)
---
> else if (cls == ClassType)
1821,1824c1821
< if (klass instanceof PyMetaClass)
< value = ((PyMetaClass) klass).__basicnew__();
< else
< value = new PyInstance((PyClass)klass);
---
> value = new PyInstance((PyClass)klass);
Basically, this creates a requirement for a __basicnew__ method in a
PyMetaClass. I'm not sure if there would be a cleaner way to designate what
kind of instance object should be created. This seems like a pretty
straightforward interface.
Kevin
|