mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[BE] Introduce c10::SyntaxError (#144647)
Which will be translated into Python's SyntaxError Pull Request resolved: https://github.com/pytorch/pytorch/pull/144647 Approved by: https://github.com/Skylion007
This commit is contained in:
parent
3541d2a2aa
commit
9ae35b8bb1
2 changed files with 7 additions and 0 deletions
|
|
@ -289,6 +289,12 @@ class C10_API OutOfMemoryError : public Error {
|
|||
using Error::Error;
|
||||
};
|
||||
|
||||
// Used for handling syntacitc erros in input arguments.
|
||||
// They shuld turn into SytnaxError when the cross into Python
|
||||
class C10_API SyntaxError : public Error {
|
||||
using Error::Error;
|
||||
};
|
||||
|
||||
// Base error type for all distributed errors.
|
||||
// These turn into DistError when they cross into Python.
|
||||
class C10_API DistError : public Error {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ inline void PyErr_SetString(PyObject* type, const std::string& message) {
|
|||
_CATCH_GENERIC_ERROR(TypeError, PyExc_TypeError, retstmnt) \
|
||||
_CATCH_GENERIC_ERROR( \
|
||||
NotImplementedError, PyExc_NotImplementedError, retstmnt) \
|
||||
_CATCH_GENERIC_ERROR(SyntaxError, PyExc_SyntaxError, retstmnt) \
|
||||
_CATCH_GENERIC_ERROR(LinAlgError, THPException_LinAlgError, retstmnt) \
|
||||
_CATCH_GENERIC_ERROR( \
|
||||
OutOfMemoryError, THPException_OutOfMemoryError, retstmnt) \
|
||||
|
|
|
|||
Loading…
Reference in a new issue