Lines Matching defs:exception
27 _PyErr_FormatV(PyThreadState *tstate, PyObject *exception,
108 _PyErr_SetObject(PyThreadState *tstate, PyObject *exception, PyObject *value)
113 if (exception != NULL &&
114 !PyExceptionClass_Check(exception)) {
117 "exception %R is not a BaseException subclass",
118 exception);
125 /* Implicit exception chaining */
132 exception set */
135 fixed_value = _PyErr_CreateException(exception, value);
181 Py_XINCREF(exception);
182 _PyErr_Restore(tstate, exception, value, tb);
186 PyErr_SetObject(PyObject *exception, PyObject *value)
189 _PyErr_SetObject(tstate, exception, value);
194 * exception arguments. */
209 _PyErr_SetNone(PyThreadState *tstate, PyObject *exception)
211 _PyErr_SetObject(tstate, exception, (PyObject *)NULL);
216 PyErr_SetNone(PyObject *exception)
219 _PyErr_SetNone(tstate, exception);
224 _PyErr_SetString(PyThreadState *tstate, PyObject *exception,
228 _PyErr_SetObject(tstate, exception, value);
233 PyErr_SetString(PyObject *exception, const char *string)
236 _PyErr_SetString(tstate, exception, string);
302 /* Used in many places to normalize a raised exception, including in
319 /* There was no exception, so nothing to do. */
333 /* Normalize the exception so that if the type is a class, the
382 "while normalizing an exception");
384 /* If the new exception doesn't set a traceback and the old
385 exception had a traceback, use the old traceback for the
386 new exception. It's better than nothing.
408 "of an exception.");
571 /* Like PyErr_Restore(), but if an exception is already set,
575 any cycles in the exception context chain. */
587 "exception %R is not a BaseException subclass",
610 /* Set the currently set exception's context to the given exception.
616 Also, this function won't create any cycles in the exception context
639 _PyErr_SetObject uses for implicit exception chaining. */
659 _PyErr_FormatVFromCause(PyThreadState *tstate, PyObject *exception,
674 _PyErr_FormatV(tstate, exception, format, vargs);
687 _PyErr_FormatFromCauseTstate(PyThreadState *tstate, PyObject *exception,
696 _PyErr_FormatVFromCause(tstate, exception, format, vargs);
702 _PyErr_FormatFromCause(PyObject *exception, const char *format, ...)
711 _PyErr_FormatVFromCause(tstate, exception, format, vargs);
716 /* Convenience functions to set a type error exception and return 0 */
987 PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg,
994 issubclass = PyObject_IsSubclass(exception, PyExc_ImportError);
1028 error = PyObject_VectorcallDict(exception, &msg, 1, kwargs);
1069 _PyErr_FormatV(PyThreadState *tstate, PyObject *exception,
1075 exception set, it calls arbitrary Python code like PyObject_Repr() */
1080 _PyErr_SetObject(tstate, exception, string);
1087 PyErr_FormatV(PyObject *exception, const char *format, va_list vargs)
1090 return _PyErr_FormatV(tstate, exception, format, vargs);
1095 _PyErr_Format(PyThreadState *tstate, PyObject *exception,
1104 _PyErr_FormatV(tstate, exception, format, vargs);
1111 PyErr_Format(PyObject *exception, const char *format, ...)
1120 _PyErr_FormatV(tstate, exception, format, vargs);
1182 /* Create an exception with docstring */
1228 {"object", "Object causing the exception"},
1307 It can be called to log the exception of a custom sys.unraisablehook.
1409 if (PyFile_WriteString("<exception str() failed>", file) < 0) {
1479 This function can be used when an exception has occurred but there is no way
1480 for Python to handle it. For example, when a destructor raises an exception
1487 An exception must be set when calling this function. */
1569 /* err_msg_str and obj have been updated and we have a new exception */
1605 /* Set file and line information for the current exception.
1606 If the exception is not a SyntaxError, also sets additional attributes
1747 /* Attempt to load the line of text that the exception refers to. If it
1748 fails, it will return NULL but will not set an exception.