According to this link https://numpy.org/doc/stable/user/basics.rec.html#automatic-byte-offsets-and-alignment, Numpy has code to calculate the offsets of the members of a C structure.
I tried to see if I could find this code in Numpy's repository (https://github.com/numpy/numpy) but couldn't find it. Would it be possible some hints to where to look at?