Sharon-

I am looking at your issue...sorry for the delay in response.  Looks like your copied object is being treated as a proxy class and I don't think that should be happening.  The PyObject code has been completely overhauled for the 2.5.x release, and therefore it is difficult for me to look through the old code from 2.2.1 and compare...so I cannot tell you the exact cause.

This looks like a bug rather than a feature to me, have you put in a bug report yet (http://bugs.jython.org/)?  Perhaps that is the best first step to take.

Thanks


Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
http://www.jythonpodcast.com
Twitter ID:  javajuneau


On Wed, Feb 3, 2010 at 4:16 PM, Sharon Lucas <lucass@us.ibm.com> wrote:

Hi, we have a Java application that uses Jython and works fine with Jython 2.1.  I'm now porting it to use Jython 2.5.1.  However, I'm getting the following error using Jython 2.5.1:

  SystemError: Automatic proxy initialization should only occur on proxy classes


I see this error after calling copy.copy or copy.deepcopy() to copy a Java type variable (such as one of type java.util.ArrayList for example).  The copy completes without any errors but as soon as the copied variable is accessed in any fashion, this SystemError occurs.  Here's a simple example of this problem after copy.copy() is used to copy a java.util.ArrayList instance, and then the copied variable is accessed.  This example works fine using Jython 2.1.  


C:\jython2.5.1>jython

Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)

[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_13

Type "help", "copyright", "credits" or "license" for more information.

>>> from java.util import ArrayList

>>> gList = ArrayList()

>>> gList

[]

>>> import copy

>>> copyList = copy.copy(gList)

>>> copyList

Traceback (most recent call last):

 File "<stdin>", line 1, in <module>

SystemError: Automatic proxy initialization should only occur on proxy classes

>>> globals()

Traceback (most recent call last):

 File "<stdin>", line 1, in <module>

SystemError: Automatic proxy initialization should only occur on proxy classes

>>>


Note this problem occurs with some other Java classes as well, including some custom  classes we use, not just a Java list.


Does anyone know why this problem occurs with Jython 2.5.1?  Is it a bug in Jython 2.5.1?  Or, if it's supposed to work this way in Jython 2.5.1, does anyone have suggestions for how I can avoid this problem?  It seems to me to be a very "bad" thing as globals() also then fails with this error.  Any suggestions are very appreciated.   Thanks.


--------------------------------------------------------------
Sharon Lucas
IBM Austin,   lucass@us.ibm.com
(512) 286-7313 or Tieline 363-7313

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users