Remove unused PyIntXXX, THPUtils_newReal_BOOL, THPQXXX macros (#164056)

The removed macros are not used in other places of the `pytorch` GitHub org.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164056
Approved by: https://github.com/albanD
This commit is contained in:
Yuanyuan Chen
2025-09-30 13:48:25 +00:00
committed by PyTorch MergeBot
parent 410ed3006b
commit 46ec0664e3
5 changed files with 8 additions and 41 deletions

View File

@ -1228,7 +1228,7 @@ static PyObject* THPVariable_get_version(THPVariable* self, void* unused) {
return handle_torch_function_getter(self, "_version");
}
const auto& var = THPVariable_Unpack(self);
return PyInt_FromLong(var._version());
return THPUtils_packInt64(var._version());
END_HANDLE_TH_ERRORS
}
@ -1383,9 +1383,8 @@ static PyObject* THPVariable_get_output_nr(THPVariable* self, void* unused) {
if (check_has_torch_function((PyObject*)self)) {
return handle_torch_function_getter(self, "output_nr");
}
const auto output_nr =
static_cast<long>(THPVariable_Unpack(self).output_nr());
return PyInt_FromLong(output_nr);
const auto output_nr = THPVariable_Unpack(self).output_nr();
return THPUtils_packInt64(output_nr);
END_HANDLE_TH_ERRORS
}
@ -1422,7 +1421,7 @@ static PyObject* THPVariable_get_ndim(THPVariable* self, void* unused) {
if (check_has_torch_function((PyObject*)self)) {
return handle_torch_function_getter(self, "ndim");
}
return PyInt_FromLong(THPVariable_Unpack(self).dim());
return THPUtils_packInt64(THPVariable_Unpack(self).dim());
END_HANDLE_TH_ERRORS
}