BGL python bindings: copy.copy(g) adds spurious properties
Hi, When a graph is copied via copy.copy(g), extra vertex and edge property maps are added. import boost.graph as bgl g = bgl.Graph() prop = g.add_vertex_property('prop') from copy import copy g_copy = copy(g) print g.vertex_properties.keys() print g_copy.vertex_properties.keys() Output: g's vertex properties: ['prop'] g_copy's vertex properties: ['object', 'prop'] This property named 'object' contains the same values as the 'prop' property. Is this a bug in the pickling support? I have the latest version from SVN. Thanks, John.
On Jun 8, 2007, at 6:48 AM, John Reid wrote:
Hi,
When a graph is copied via copy.copy(g), extra vertex and edge property maps are added.
import boost.graph as bgl g = bgl.Graph() prop = g.add_vertex_property('prop') from copy import copy g_copy = copy(g) print g.vertex_properties.keys() print g_copy.vertex_properties.keys()
Output:
g's vertex properties: ['prop'] g_copy's vertex properties: ['object', 'prop']
This property named 'object' contains the same values as the 'prop' property.
Is this a bug in the pickling support?
Definitely a bug, which was in the "unpickling" routines. I believe I've fixed this in Subversion. - Doug
Ok unfortunately with the now latest SVN version my code belows never returns from the copy(g) call. This is on Windows XP with boost 1.34. I've reverted to version 334 of pickle.cpp and it works again. Any clues? John. Douglas Gregor wrote:
On Jun 8, 2007, at 6:48 AM, John Reid wrote:
Hi,
When a graph is copied via copy.copy(g), extra vertex and edge property maps are added.
import boost.graph as bgl g = bgl.Graph() prop = g.add_vertex_property('prop') from copy import copy g_copy = copy(g) print g.vertex_properties.keys() print g_copy.vertex_properties.keys()
Definitely a bug, which was in the "unpickling" routines. I believe I've fixed this in Subversion.
- Doug
On Jun 18, 2007, at 5:37 AM, John Reid wrote:
Ok unfortunately with the now latest SVN version my code belows never returns from the copy(g) call. This is on Windows XP with boost 1.34. I've reverted to version 334 of pickle.cpp and it works again.
Any clues?
Oh, that's embarrassing. It worked on my Mac at home (x86) but not at work (PowerPC). I've committed yet another fix, and this one's for real. Sorry! (but thanks for keeping me honest <g>) - Doug
Doug Gregor wrote:
Oh, that's embarrassing. It worked on my Mac at home (x86) but not at work (PowerPC). I've committed yet another fix, and this one's for real. Sorry! (but thanks for keeping me honest <g>)
- Doug
That works now - great! I shall keep trying to keep you honest, John.
participants (3)
-
Doug Gregor
-
Douglas Gregor
-
John Reid