Skip to content

[Python] Set __spec__ attribute and not __cached__ for ROOT facade#21790

Open
guitargeek wants to merge 1 commit intoroot-project:masterfrom
guitargeek:issue-21787
Open

[Python] Set __spec__ attribute and not __cached__ for ROOT facade#21790
guitargeek wants to merge 1 commit intoroot-project:masterfrom
guitargeek:issue-21787

Conversation

@guitargeek
Copy link
Copy Markdown
Contributor

@guitargeek guitargeek commented Apr 3, 2026

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__

Thanks @ellert for reporting the problem!

To be backported to 6.36 and 6.38.

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 root-project#21787.

[1] https://docs.python.org/3/reference/datamodel.html#module.__cached__
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Test Results

    22 files      22 suites   3d 6h 23m 13s ⏱️
 3 833 tests  3 832 ✅  1 💤 0 ❌
76 576 runs  76 558 ✅ 18 💤 0 ❌

Results for commit 4171724.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ROOT and Python 3.15

1 participant