[C++-sig] problem chaning object state using a python class that inherits from c++ class
David Abrahams
dave at boost-consulting.com
Tue Aug 16 21:44:41 CEST 2005
"Alexis H. Rivera-Rios" <ahrivera at yahoo.com> writes:
> David,
>
> Im sending the email again, since I don't remember if
> I have send it or not. Please forgive the formatting
> since I don't know how to control that with yahoo
> mail.
THe formatting is okay, but...
<snip code>
> Here is the pyste script
>
> Class("Data","test.h")
> B = Class("B","test.h")
> use_shared_ptr(B)
>
> Class("C","test.h")
>
> D = Class("D","test.h")
> final(D.Update)
Sorry, but I don't know Jack about pyste, so please show me the code
it generates instead.
> Here is an example of the error:
>
> (test 1) works as expected
And please don't show me anything that works as expected. That's just
a distraction from the problem.
> (test 2) fails when called from C
>>>> class E(B):
> ... def Update(self,data,val):
> ... data.a = 999
> ... data.b = 100
> ...
>>>> e = E()
>>>> cc = C()
>>>> cc.SetBptr(e)
>>>> cc.Update(1)
>>>> print cc.GetData_a()
> 6488163
>>>> print cc.GetData_b()
> 6.95352557184e-308
Please show me the result you were expecting, like I asked you to.
I'm guessing it was 999 and 100.0 ??
> Hope this illustrates the problem better,
Sorta. This example could be smaller, couldn't it? Do you really
need two data members to show it?
I really mean it: if you pare it down to the absolute minimum you'll
probably find the problem yourself.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list