This great answer by @AccidentalFourierTransform says that for energy momentum tensors we need locality and Lorentz invariance. The rest of the answer focuses on metric dependence of partition function instead of those locality/Lorentz invariance requirements (or is this dependence related to locality/Lorentz invariance?). Also, what exactly "locality" means here, because "locality" means a thousand different things in physics. So why exactly, mathematically speaking is locality required in defining an energy-momentum tensor?