This package does not support Python 3.11. Please test it with Python 3.11 as a matter of urgency as the default will change in early June, as per message on gentoo-dev: https://archives.gentoo.org/gentoo-dev/message/abb5788ea81c7bbf4d40a2995b682eb9. Please check the information provided in the tracker. Ask in #gentoo-python on IRC if need any help.
The first version of sci-physics/root that supports Python3.11 upstream is 6.28 (and the ebuild marks it as such). If it's really a problem that 6.26 doesn't support Python3.11, the old version could/should just be dropped. That said, users have asked me to keep at least two versions in the tree in the past, so I'm reluctant to drop the old version even if it only supports up to Python 3.10. Anyone wanting support for Python3.11 should just use ROOT 6.28.
I've filed the bug for the old slot because I didn't know whether it's going to stay for a long time or not. I suppose it's not a big deal, assuming that the majority of users will use the new version anyway, and so won't be affected by this.
Created attachment 854834 [details, diff] root python fix this fixes the compilation for python 3.10 for me, should also be backward compatible
Created attachment 854836 [details, diff] correct root python fix correct fix, sorry, previous one had a typo...
If Python3.11 support is really needed with ROOT 6.26, the best way to go is to backport the upstream changes, they should apply cleanly, but I really recommend to just use the latest version of ROOT, as the new version has lots of other improvements as well, like the llvm upgrade, debugging/profiling support fot JITTed code, etc.
Closing, please just use ROOT 6.28 if you want to use it with Python 3.11.