Dear all,
There was a typo in the clone function for AutoLinker (god knows where I
pasted the code from ...)
def clone(self, obj):
return deepcopy(obj)
Best regards
Daniel
On Wed, Oct 27, 2010 at 21:01, Daniel Rodriguez <danjrod(a)gmail.com> wrote:
Dear all,
I think, let me stress that I think , that I have nailed the problem down.
It is actually an issue that was discussed previously in the list.
Cloning a suds.client.Client in different threads generated messages about
infinite recursion under (at least) Python 2.6. It seems that the Windows
and Linux implementations do simply discard the exception and carry on,
whereas the MacOS implementation, for whatever the reason, dies with a Bus
Error. Possibly the operating system does not allow the same level of
"infinity" (smaller stack may be a reason) and Python doesn't even have a
chance to raise an exception.
The problem lies in the "deepcopy" statement pointed out in the original
message. The "network of options" that suds uses has circular references and
many functions within the Properties class are prepared to deal with this
fact. But there is no __deepcopy__, so actually executing a deepcopy ends up
in infinite recursion.
After hitting the wall several times, I have come up with changes to suds
(possibly not the smartest thing ever) that overcome this recursion problem
and things are working (also in MacOS)
In file suds.properties, add the following method to class AutoLinker
def clone(self):
pass
In file suds.properties add the following method to class Properties
def __deepcopy__(self, memo={}):
defined = {}
for name, value in self.defined.iteritems():
linker = self.definitions[name].linker
clonedValue = linker.clone(value)
defined[name] = clonedValue
clone = self.__class__(self.domain, self.definitions.itervalues(), defined)
return clone
In file suds.options, add the following method to class TPLinker
def clone(self, obj):
cloneobj = deepcopy(obj)
tp = Unskin(cloneobj.options)
tp.links = []
return cloneobj
In file suds.client replace the following lines in the Client.clone method
cp = Unskin(clone.options)
mp = Unskin(self.options)
cp.update(deepcopy(mp))
with this:
mp = Unskin(self.options)
clone.options.__pts__ = deepcopy(mp)
Comments (specially from Jeff, who surely understand the Properties
implementation a lot better than any of us) are welcome
Best regards
Daniel
On Fri, Oct 22, 2010 at 07:45, Daniel Rodriguez <danjrod(a)gmail.com> wrote:
> Hi Joshua,
>
> That's the major problem. The only error produced by the Mac version of
> Python is: "Bus Error". It took me several "print" statements to
get down to
> that line of code.
>
> The only "option" in suds which has a __deepcopy__ is the transport. And
> the code is really simple:
>
> def __deepcopy__(self, memo={}):
> clone = self.__class__()
> p = Unskin(self.options)
> cp = Unskin(clone.options)
> cp.update(p)
> return clone
>
> That's why I got stuck at that line of code.
>
> Best regards
>
>
> On Fri, Oct 22, 2010 at 00:27, Joshua J. Kugler <joshua(a)eeinternet.com>wrote:
>
>> On Thursday 21 October 2010, Daniel Rodriguez elucidated thus:
>> > Python 2.6.1-2.6.6
>> >
>> > In the "clone" function of suds.client.Client.
>> >
>> > -
>> > - cp.update(deepcopy(mp))
>> >
>> > which is the moment the unskinned options of the clone are updated
>> > with a deepcopy of the unskinned options of the cloned object.
>> >
>> > I really don't have much experience with MacOS and just tried it
>> > because someone wanted to try my application.
>> >
>> > My guess is that the error is generated due to some sort of infinite
>> > recursion, given that if I substitute the "deepcopy" with a
"copy",
>> > at least the clone doesn't die. (Of course the options are no longer
>> > independent but linked, which in my case should be no problem)
>> >
>> > I wonder if anyone is using suds on Mac as has faced something
>> > similar.
>> >
>> > Best regards
>>
>> Can you post a full traceback?
>>
>> j
>>
>> --
>> Joshua Kugler
>> Part-Time System Admin/Programmer
>>
http://www.eeinternet.com - Fairbanks, AK
>> PGP Key:
http://pgp.mit.edu/ ID 0x73B13B6A
>> _______________________________________________
>> suds mailing list
>> suds(a)lists.fedoraproject.org
>>
https://admin.fedoraproject.org/mailman/listinfo/suds
>>
>
>