Open cjdoris opened 3 years ago
We can support memos by including the Julia memo dict at a special key in the Python memo dict, and vice versa.
Note that you'll probably want to define Base.deepcopy_internal
to at minimum increment the reference count, since otherwise calling deepcopy(::Py)
in Julia will use the default implementation (that will just copy the pointer, which might lead to crashes since then the refcount will be wrong).
See https://github.com/JuliaPy/PyCall.jl/pull/1039 for how PyCall.jl does it.
juliacall.AnyValue.__copy__
and__deepcopy__
could call Julia'scopy
anddeepcopy
.Conversely,
copy(::Py)
anddeepcopy_internal(::Py, ::IdDict)
could call Python'scopy.copy
andcopy.deepcopy
.https://docs.python.org/3/library/copy.html