From: Finn B. <bc...@us...> - 2001-02-14 22:21:18
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv11941 Modified Files: PyInstance.java Log Message: makeProxy(): Add some extra validate that the instance and proxy match paired correctly. Cleanup old code comments. Index: PyInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** PyInstance.java 2001/02/07 09:23:52 2.18 --- PyInstance.java 2001/02/14 22:21:58 2.19 *************** *** 58,68 **** public PyInstance(PyClass iclass, PyObject dict) { super(iclass); - //__class__ = iclass; __dict__ = dict; - //Prepare array of proxy classes to be possibly filled in in __init__ - /*if (__class__.proxyClass != null) { - //System.err.println("proxies: "+__class__.__name__); - //javaProxies = new Object[__class__.proxyClasses.length]; - }*/ } --- 58,62 ---- *************** *** 97,110 **** ts.popInitializingProxy(); } ! //proxy._setPyInstance(this); ! //proxy._setPySystemState(Py.getSystemState()); javaProxy = proxy; } - - /*protected void setProxy(PyProxy proxy, int index) { - proxy._setPyInstance(this); - proxy._setPySystemState(Py.getSystemState()); - javaProxies[index] = proxy; - }*/ public Object __tojava__(Class c) { --- 91,107 ---- ts.popInitializingProxy(); } ! ! if (javaProxy != null && javaProxy != proxy) { ! // The javaProxy can be initialized in Py.jfindattr() ! throw Py.TypeError("Proxy instance already initialized"); ! } ! PyInstance proxyInstance = proxy._getPyInstance(); ! if (proxyInstance != null && proxyInstance != this) { ! // The proxy was initialized to another instance!! ! throw Py.TypeError("Proxy initialization conflict"); ! } ! javaProxy = proxy; } public Object __tojava__(Class c) { |