Add some assertions to python_variable and check for resurrection in tp_clear
Fixes https://github.com/pytorch/pytorch/issues/75932
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75933
Approved by: https://github.com/ezyang, https://github.com/albanD