mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[Exception] [5/N] Remove torch::IndexError (#117713)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/117713 Approved by: https://github.com/ezyang
This commit is contained in:
@ -224,13 +224,6 @@ void translate_exception_to_python(const std::exception_ptr& e_ptr) {
|
|||||||
CATCH_ALL_ERRORS(return)
|
CATCH_ALL_ERRORS(return)
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexError::IndexError(const char* format, ...) {
|
|
||||||
va_list fmt_args{};
|
|
||||||
va_start(fmt_args, format);
|
|
||||||
msg = formatMessage(format, fmt_args);
|
|
||||||
va_end(fmt_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
TypeError::TypeError(const char* format, ...) {
|
TypeError::TypeError(const char* format, ...) {
|
||||||
va_list fmt_args{};
|
va_list fmt_args{};
|
||||||
va_start(fmt_args, format);
|
va_start(fmt_args, format);
|
||||||
|
@ -279,15 +279,6 @@ struct PyTorchError : public std::exception {
|
|||||||
#define TORCH_FORMAT_FUNC(FORMAT_INDEX, VA_ARGS_INDEX)
|
#define TORCH_FORMAT_FUNC(FORMAT_INDEX, VA_ARGS_INDEX)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Translates to Python IndexError
|
|
||||||
struct IndexError : public PyTorchError {
|
|
||||||
using PyTorchError::PyTorchError;
|
|
||||||
IndexError(const char* format, ...) TORCH_FORMAT_FUNC(2, 3);
|
|
||||||
PyObject* python_type() override {
|
|
||||||
return PyExc_IndexError;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Translates to Python TypeError
|
// Translates to Python TypeError
|
||||||
struct TypeError : public PyTorchError {
|
struct TypeError : public PyTorchError {
|
||||||
using PyTorchError::PyTorchError;
|
using PyTorchError::PyTorchError;
|
||||||
|
Reference in New Issue
Block a user