Message6057

Author MrMeanie
Recipients MrMeanie, adam.spiers, amak, colinhevans, fwierzbicki, matt_brinkley, pjenvey, zyasoft
Date 2010-09-09.14:38:25
SpamBayes Score 8.821832e-13
Marked as misclassified No
Message-id <1284043107.08.0.99883893114.issue1327@psf.upfronthosting.co.za>
In-reply-to
Content
My code started breaking under the following conditions:
- Deriving a Python class from a Java interface
- Getting a reference to self in __init__ and:
   - passing self as a parameter to a Java method

Code along the lines of the following will hit this bug:

class MyRunnable (Runnable):
   def __init__(self,x):
      self._x = x
      SwingUtilities.invokeLater( self )



Some debugging led me to the conclusion that it was because the java proxy was not initialised properly.

PyObject#proxyInit was being called.

This lead through some compiled Python class files to invoking Py#initProxy

Where:
the call to ThreadState#getInitializingProxy() returned null.

This was due to the fact that the ThreadState objects were being lost.

This seems to be because ThreadStateMapping#getThreadState determines that there is no cached thread state.
So it creates a new one.
But it does not place it into the single element array in the cache, before returning it.
Resulting in a new ThreadState being returned each time.

The attached patch attempts to address this issue.
History
Date User Action Args
2010-09-09 14:38:27MrMeaniesetmessageid: <1284043107.08.0.99883893114.issue1327@psf.upfronthosting.co.za>
2010-09-09 14:38:27MrMeaniesetrecipients: + MrMeanie, fwierzbicki, amak, pjenvey, zyasoft, colinhevans, matt_brinkley, adam.spiers
2010-09-09 14:38:26MrMeanielinkissue1327 messages
2010-09-09 14:38:25MrMeaniecreate