I can’t reproduce your problem, I’m on Fedora with ROOT installed from anaconda in an environment with Python 3.11
Python 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:27:40) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>
>>> x = 5
>>> ROOT.gInterpreter.Declare("""
... const double x = double(TPython::Exec("x"));
... """)
True
>>>
>>>
Also same thing when executing the script, no error shown
$: python repro.py
$:
Small update:
I tried with different environments, one with ROOT 6.28 and one with ROOT 6.26, no error in either case.