From 9ac3ba0da5687f038c9dabc3a3cadb71dc35587d Mon Sep 17 00:00:00 2001 From: David Brochart Date: Mon, 15 Sep 2025 14:39:09 +0200 Subject: [PATCH] Support subinterpreters --- python/pycrdt/__init__.py | 4 ++++ tests/test_subinterpreters.py | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/test_subinterpreters.py diff --git a/python/pycrdt/__init__.py b/python/pycrdt/__init__.py index 6c0d29aa..732c4960 100644 --- a/python/pycrdt/__init__.py +++ b/python/pycrdt/__init__.py @@ -41,3 +41,7 @@ from ._xml import XmlEvent as XmlEvent from ._xml import XmlFragment as XmlFragment from ._xml import XmlText as XmlText + + +def import_pycrdt(): + import pycrdt diff --git a/tests/test_subinterpreters.py b/tests/test_subinterpreters.py new file mode 100644 index 00000000..248a1ed7 --- /dev/null +++ b/tests/test_subinterpreters.py @@ -0,0 +1,11 @@ +import pytest + +from anyio import to_interpreter + +from pycrdt import import_pycrdt + +pytestmark = pytest.mark.anyio + + +async def test_subinterpreter(): + await to_interpreter.run_sync(import_pycrdt)