I have a class that inherits from a boost-python class:
class Magnet(CMagnet): # CMagnet is a C++ based boost-python class
def __init__(self):
CMagnet.__init__(self)
def python_method(self):
...
In the C++ implementation of CMagnet I used the code from 1, as posted in 2.
I now have the following problem: When I do the following:
magnet = Magnet()
magnet_2 = copy.deepcopy(magnet)
then magnet is of type Magnet, magnet_2, however, is of type CMagnet. I need it to be also of type Magnet. It lacks all Magnet methods. How do I get deepcopy to copy (and return) the entire Magnet object and not only a copy of the CMagnet part?
__deepcopy__yourself, but I don't know if you're already doing it, or if your implementation have any bug; like @Leon said, it's better if you provide a reproducible example.