Skip to content

[Python] Avoid side effects in libROOTPythonizations initialization #21189

Open
guitargeek wants to merge 2 commits intoroot-project:masterfrom
guitargeek:root_cpython_module
Open

[Python] Avoid side effects in libROOTPythonizations initialization #21189
guitargeek wants to merge 2 commits intoroot-project:masterfrom
guitargeek:root_cpython_module

Conversation

@guitargeek
Copy link
Contributor

There are some side effects when importing the ROOT CPython extension
that we should better avoid, so that all active initialization is
centralized in ROOTFacade._finalSetup().

Like this, it will be easier for us and our users to keep track of what
the differences between the base cppyy and the ROOT C++ runtime are.

That should help explaining to our users that they usually don't need to
import cppyy directly,

In particular, the extra reference directly contradicted a comment a few lines
further up:

keep gRootModule, but do not increase its reference count

It's better if the initalization function doesn't get too different from
the default, so that there are no unexpected initialization and garbage
collection effects.

In fact, the extra reference directly contradicted a comment a few lines
further up:

> keep gRootModule, but do not increase its reference count
There are some side effects when importing the ROOT CPython extension
that we should better avoid, so that all active initialization is
centralized in `ROOTFacade._finalSetup()`.

Like this, it will be easier for us and our users to keep track of what
the differences between the base cppyy and the ROOT C++ runtime are.

That should help explaining to our users that they usually don't need to
import cppyy directly,
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Test Results

    22 files      22 suites   3d 11h 13m 17s ⏱️
 3 788 tests  3 788 ✅ 0 💤 0 ❌
75 231 runs  75 231 ✅ 0 💤 0 ❌

Results for commit 3e33c35.

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.

1 participant