How to break an infinite getWeight() recursion while upgrading Magento from 2.1.x to 2.2.x?

The fix is the same as here: How to break an infinite getSku() recursion while upgrading Magento from 2.1.x to 2.2.x?