Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#14 Few mistakes in the docs

open-accepted
None
5
2005-08-29
2005-06-02
Anonymous
No

Download and Installation:

Talks about #include "CXX/Object.hxx"
should be #include "CXX/Objects.hxx"

Wrappers for standard objects:

Talks about non-existent file CXX_Objects.h

addvalue() example code, has a prototype:

Object addvalue (Object & self, const Tuple & args)....

I'm sure it shouldn't have the 'self' argument if it's
a method in a class derived from ExtensionModule since
the 'self' is part of the object.

It would be great to suggest the 'recommended' way of
returning NULL from an extension function. return
Null() doesn't seem to work (compiler error).

Finally, I would just like to thank the developers for
what is an excellent piece of work - I'm converting all
my extensions to use it :-).

Discussion

    • status: open --> open-accepted
     
  • Logged In: YES
    user_id=28665

    Do you mean the how to return None?

    Use "return Py::None();" (older versions of PyCXX used
    Py::Nothing() to return None, but the names jsut confusing,
    use None in new code).

     
    • assigned_to: nobody --> barry-scott
     
  • Kevin J Bluck
    Kevin J Bluck
    2006-10-27

    Logged In: YES
    user_id=11142

    Something I noticed.

    *********************
    To initialize the extension, you just instantiate one static
    instance (static so it does not destroy itself!):

    void initexample()
    {
    static example_module* example = new example_module;
    }
    *********************

    It's the module pointer that would be static here, not the
    module instance. This would work just as well if you're
    going to dynamic allocate (which, just like the above
    example, will leave behind an unfreed allocation for your
    memchecker to complain about):

    void initexample()
    {
    new example_module;
    }

    Probably what you meant, though is:

    void initexample()
    {
    static example_module example;
    }

    or perhaps:

    void initexample()
    {
    static std::auto_ptr< example_module > example( new
    example_module );
    }