[C++-sig] Bugs with Pyste and vector_indexing_suite.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sat Aug 23 05:21:24 CEST 2003


Hi Nicodemus,

>>>>> "N" == nicodemus  <nicodemus at globalite.com.br> writes:

    >> 212 def Exceptions(self): 213 if self.throws is None: 214
    >> return ""
    >> to:
    >> 212 def Exceptions(self): 213 if not hasattr(self, 'throws') or
    >> self.throws is None: 214 return ""

    N> Looking at the sources, I can't figure out how that is
    N> possible, since Method is derived from Function, which in turn
    N> creates a instance attribute named "throws", with the value
    N> None, and Method calls Function constructor. But I think your
    N> problem is related to the cache: you probably pickled an old
    N> instance, without this attribute (the "throw" declaration
    N> support has been recently added, thanks to a patch by
    N> Gottfried! 8) ), and pickled objects are not initialized via
    N> __init__.  Try to rebuild your cache and see if the problem
    N> goes away. 8)

Yes, that did it.  I completely forgot to rebuild the cache when I ran
into this problem.  Perhaps something needs to be done about this?  If
Pyste changes internally then somehow the cache needs to be rebuilt.


    >> 3. Pyste also has problems with Include and Import used
    >>    together.  I
    >> again don't have a small test case but perhaps Nicodemus will
    >> be able to figure this one out.  Essentially if I add an
    >> Include(...) after an Import(...) nothing gets included.
    >> However if I place the Include before the Import, everything
    >> seems to work OK.

    N> Unfortunately, I couldn't reproduce this... placing Include
    N> before or after an Import works fine in my tests. When you have
    N> time, could you please produce a small test case, or perhaps
    N> explain the problem in more detail?

OK, I managed to get a minimal (more or less) example.

// ---- bug0.hpp ----
#include <iostream>
class Base {
public:
    virtual ~Base() {}
    virtual void f() {std::cout << "Base::f()\n";}
    virtual void f(int n) {std::cout << "Base::f(int)\n";}
};
// ---- bug0.hpp ----

// ---- bug.hpp ----
#include "bug0.hpp"
class Derived : public Base {
public:
    ~Derived(){}
    virtual void f() {std::cout << "Derived::f\n";}
};
// ---- bug.hpp ----

// ---- bug0.pyste ----
Base = Class('Base', 'bug0.hpp')
Include('boost/python/suite/indexing/vector_indexing_suite.hpp')
// ---- bug0.pyste ----

// ---- bug.pyste ----
Import('bug0.pyste')
Derived = Class('Derived', 'bug.hpp')
Include('boost/python/suite/indexing/vector_indexing_suite.hpp')
// ---- bug.pyste ----

Note that you must include the same file in both pyste files and in
bug.pyste if the Include goes above the Import it works but as it is
shown above it does not.  The Pyste generated code will compile, but
take a look at the generated headers section and you will see the
problem.

Hope this helps.

Thanks!
prabhu




More information about the Cplusplus-sig mailing list