pycore_pyerrors.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef Py_INTERNAL_PYERRORS_H
  2. #define Py_INTERNAL_PYERRORS_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ifndef Py_BUILD_CORE
  7. # error "this header requires Py_BUILD_CORE define"
  8. #endif
  9. static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
  10. {
  11. return tstate == NULL ? NULL : tstate->curexc_type;
  12. }
  13. PyAPI_FUNC(void) _PyErr_Fetch(
  14. PyThreadState *tstate,
  15. PyObject **type,
  16. PyObject **value,
  17. PyObject **traceback);
  18. PyAPI_FUNC(int) _PyErr_ExceptionMatches(
  19. PyThreadState *tstate,
  20. PyObject *exc);
  21. PyAPI_FUNC(void) _PyErr_Restore(
  22. PyThreadState *tstate,
  23. PyObject *type,
  24. PyObject *value,
  25. PyObject *traceback);
  26. PyAPI_FUNC(void) _PyErr_SetObject(
  27. PyThreadState *tstate,
  28. PyObject *type,
  29. PyObject *value);
  30. PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate);
  31. PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception);
  32. PyAPI_FUNC(void) _PyErr_SetString(
  33. PyThreadState *tstate,
  34. PyObject *exception,
  35. const char *string);
  36. PyAPI_FUNC(PyObject *) _PyErr_Format(
  37. PyThreadState *tstate,
  38. PyObject *exception,
  39. const char *format,
  40. ...);
  41. PyAPI_FUNC(void) _PyErr_NormalizeException(
  42. PyThreadState *tstate,
  43. PyObject **exc,
  44. PyObject **val,
  45. PyObject **tb);
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif /* !Py_INTERNAL_PYERRORS_H */