[C++-sig] Re: value_holder_back_reference::holds()

David Abrahams dave at boost-consulting.com
Mon Nov 3 07:19:49 CET 2003


"Niall Douglas" <s_sourceforge at nedprod.com> writes:

> On 2 Nov 2003 at 9:37, David Abrahams wrote:
>
>> Instead of trying to describe it in English, please just show a small
>> code example.
>
> Like as follows:
>
> class MainWindow(FXMainWindow):
>     def __init__(self, app):
>         FXMainWindow.__init__(self, app)
>
>     def setup(self):
>         self.text=FXText(self)
>
> myapp=FXApp()
> main=MainWindow(myapp)
> main.setup()
>
> The point it fails at is the self.text=FXText(self) 

Which has seemingly nothing at all to do with most of what you
described before (the "class constructor" business), leaving me at a
loss.  Is self.text a property of FXMainWindow (e.g. exposed with
def_readwrite)?

> claiming that a MainWindow does not match C++ signature FXText(self,
> FXComposite *) despite that FXMainWindow inherits off FXComposite.


  "does not match C++ signature FXText(self, FXComposite *)"

??

<sigh>
I don't believe you copied the first part of the message correctly.
In particular, "self" would probably not show up in the first slot
unless you had a class self defined in the global namespace.

Can't you bring yourself to post the exact error message instead of
making me guess?  I'm sorry to lose my patience again, but this is
typical of your requests for help.  By now you should know that casual
description is more frustrating than helpful.  Posting the exact error
message and sample code works better.

Regardless of what goes in place of "self",  the error message clearly
indicates that the signature requires two arguments, and you're only
passing one.

> Q: What's in cache() precisely? 

If there was a chance it would solve your problem, I might try to
describe it for you, but there is no such chance AFAICT.  You're
barking up the wrong tree.

> I understand that it's used to determine the offsets of base class
> instance data within a derived class. But does it contain every
> instance of every class within it, or just one representative
> instance?

It contains no instances.

<snip>

> I should add that my small repeatable example has the wrapper too, 
> yet it oddly enough works fine. 

Thus, it doesn't repeatably show the bug.

> So it can't be as simple as that.

My advice:

a. Stop hunting for bugs in Boost.Python and assume you've made an
   error until you prove otherwise

b. Reduce your failing example to a small case until it stops failing.
   Then you'll know what you're doing wrong.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list