y-crdt / ypy

Python bindings to y-crdt

Home Page:https://ypy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultipleIntegrationError

davidbrochart opened this issue · comments

With y-py v0.6.0, the following code:

import y_py as Y

doc = Y.YDoc()
a = doc.get_array("a")
d = Y.YMap({})
with doc.begin_transaction() as t:
    a.extend(t, [d])

errors out with:

Err(PyErr { type: <class 'y_py.MultipleIntegrationError'>, value: MultipleIntegrationError('Cannot integrate a nested Ypy object because is already integrated into a YDoc: {}'), traceback: None })

See jupyter-server/jupyter_ydoc#146.

@Waidhoferj it used to work with v0.5.5, is it a regression or is it not allowed anymore?

It seems to be an issue with extend, because append works fine:

import y_py as Y

d = Y.YDoc()
a = d.get_array("a")
m = Y.YMap({"foo": "bar"})
d.transact(lambda t: a.append(t, m))

This appears to be a regression. If the type you are inserting is preliminary, then it should be integratabtle.