Like in summary. The installation failed due to bug in python. I found solution in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980906 and apply it and after that python-3.9.5 has been installed. This bug applied to version since 3.9.2. I was trying build versions 3.9.4-3.9.5. A bug can be easily applied by simple change in some line in _collections_abc.py file: class _CallableGenericAlias(GenericAlias): to: class _CallableGenericAlias(list[int]): It will be good, when that patch will be added to this package.
Please attach the complete build log and 'emerge --info'. I have serious doubts about applying a workaround from a Debian bug that was closed invalid.
Unsure what this error is about, but I did see someone run into this on the forums: https://forums.gentoo.org/viewtopic-t-1137450.html