Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2005-11-22 09:49:42


I'm running into problems with Visual C++ 7.1 and
class_<..>::add_property() in Boost.Python. The issue pops up in this
bit o' code:

    class_<Graph> graph(name);
    graph
         .add_property("vertex_properties",
&py_get_vertex_properties<Graph>,
           "A Python dictionary mapping from vertex property names to\n"
           "property maps. These properties are \"attached\" to the
graph\n"
           "and will be pickled or serialized along with the graph.")
         .add_property("edge_properties",
&py_get_edge_properties<Graph>,
           "A Python dictionary mapping from edge property names to\n"
           "property maps. These properties are \"attached\" to the
graph\n"
           "and will be pickled or serialized along with the graph.")

In particular, the compiler chokes when instantiating add_property(),
because it can't tell that the third parameter is a docstring
(instead of a setter). At line 304 of boost/python/class.hpp
(RC_1_33_0 branch), there is a workaround for all Visual C++ versions
prior to 7.1 that avoids this problem: if I switch the "1300" to
"1310" to include VC++ 7.1, everything works fine.

Unfortunately, I wasn't able to create a small test case that
exhibits the problem. If you really, really want to reproduce the
problem, you can grab the BGL-Python bindings that triggered it with:

        svn co https://svn.osl.iu.edu/svn/projects/viz/bgl-python

Should we do the version bump in the workaround, or could that cause
problems?

   Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk