It's already solved (partially), as you can read here the culprit is ulimit settings, and the partial solution allows at least for emerging debian-sources.
It's already solved.
It's turned out -DNDEBUG -DG_DISABLE_ASSERT flags were the culprit why
=dev-python/pygobject-3.16.2:3::gentoo
didn't want to compile,
in the file /etc/portage/make.conf
CXXFLAGS="-Os -s -march=native -pipe -DNDEBUG -DG_DISABLE_ASSERT"
CFLAGS=" -Os -march=native -pipe -DNDEBUG -DG_DISABLE_ASSERT"
CPPFLAGS=" -DNDEBUG -DG_DISABLE_ASSERT"
and commenting them out allows this ebuild to emerge.