Make functorch compilable with Py-3.11 (#85054)
By using compatibility wrappers from [python_compat.h](https://github.com/pytorch/pytorch/blob/master/torch/csrc/utils/python_compat.h) and skipping part of `getname` switch
Fixes https://github.com/pytorch/pytorch/issues/85006
Please note that `import torch` right now fails by default on 3.11 with some jit issue, so I think this shouldn't be a really issue for a bit
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85054
Approved by: https://github.com/kit1980, https://github.com/zdevito