diff --git a/rapidjson.cpp b/rapidjson.cpp index 40ce8fa..e0b6b27 100644 --- a/rapidjson.cpp +++ b/rapidjson.cpp @@ -3,7 +3,7 @@ // :Author: Ken Robbins // :License: MIT License // :Copyright: © 2015 Ken Robbins -// :Copyright: © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Lele Gaifax +// :Copyright: © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Lele Gaifax // #include @@ -4117,6 +4117,9 @@ module_exec(PyObject* m) static struct PyModuleDef_Slot slots[] = { {Py_mod_exec, (void*) module_exec}, +#ifdef Py_GIL_DISABLED + {Py_mod_gil, Py_MOD_GIL_NOT_USED}, +#endif {0, NULL} }; diff --git a/tests/test_circular.py b/tests/test_circular.py index 89e15b3..1a64935 100644 --- a/tests/test_circular.py +++ b/tests/test_circular.py @@ -3,7 +3,7 @@ # :Author: John Anderson # :License: MIT License # :Copyright: © 2015 John Anderson -# :Copyright: © 2017, 2018, 2020, 2023, 2024 Lele Gaifax +# :Copyright: © 2017, 2018, 2020, 2023, 2024, 2025 Lele Gaifax # import sys @@ -74,6 +74,10 @@ def test_max_recursion_depth(dumps): sys.setrecursionlimit(rl) +@pytest.mark.skipif( + not sys._is_gil_enabled(), + reason="Crashes under free-threaded variant, perhaps getrecursionlimit() works differently there?" +) def test_parse_respects_recursion_limit(loads): rl = sys.getrecursionlimit() diff --git a/tests/test_memory_leaks.py b/tests/test_memory_leaks.py index 51b5a55..1205fd7 100644 --- a/tests/test_memory_leaks.py +++ b/tests/test_memory_leaks.py @@ -9,10 +9,15 @@ import io import datetime import gc +import sys import pytest import rapidjson as rj +pytestmark = pytest.mark.skipif( + not sys._is_gil_enabled(), + reason="Crashes under free-threaded variant, perhaps tracemalloc does not work there?" +) tracemalloc = pytest.importorskip("tracemalloc")