#10510: Fix bug in forward port of 2.7 distutils patch.

Pointed out by Arfrever.

--HG--
branch : 3.4
check that exception messages are not empty (#22379)

Patch by Yongzhi Pan.

--HG--
branch : 3.4
extra : amend_source : e2e37e084880a987d174fa8e565ab8e6bd41ad17