From 4171724228a849959542fcb0b0c1ec10d8e94999 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Fri, 3 Apr 2026 22:56:04 +0200 Subject: [PATCH] [Python] Set `__spec__` attribute and not `__cached__` for ROOT facade The Python documentation [1] says: > It is strongly recommended that you use module.__spec__.cached instead of module.__cached__. So this commit suggests to transfer the full `__spec__` attribute from the ROOT module to the facade, instead of `__cached__`. This also avoids errors when importing ROOT with Python 3.15, where `__cached__` will cease to be set or taken into consideration by the import system or standard library. Closes #21787. [1] https://docs.python.org/3/reference/datamodel.html#module.__cached__ --- bindings/pyroot/pythonizations/python/ROOT/_facade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/pyroot/pythonizations/python/ROOT/_facade.py b/bindings/pyroot/pythonizations/python/ROOT/_facade.py index c22ae40da4c2d..da8b6681ec2f2 100644 --- a/bindings/pyroot/pythonizations/python/ROOT/_facade.py +++ b/bindings/pyroot/pythonizations/python/ROOT/_facade.py @@ -142,7 +142,7 @@ def __init__(self, module, is_ipython): self.__all__ = module.__all__ self.__name__ = module.__name__ self.__file__ = module.__file__ - self.__cached__ = module.__cached__ + self.__spec__ = module.__spec__ self.__path__ = module.__path__ self.__doc__ = module.__doc__ self.__package__ = module.__package__