Copy patch from Bertrand committed in 5.34 to fix mathcore tests