LCOV - code coverage report
Current view: top level - Include/internal - pycore_pyerrors.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 7 7 100.0 %
Date: 2023-03-20 08:15:36 Functions: 2 2 100.0 %
Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef Py_INTERNAL_PYERRORS_H
       2                 :            : #define Py_INTERNAL_PYERRORS_H
       3                 :            : #ifdef __cplusplus
       4                 :            : extern "C" {
       5                 :            : #endif
       6                 :            : 
       7                 :            : #ifndef Py_BUILD_CORE
       8                 :            : #  error "this header requires Py_BUILD_CORE define"
       9                 :            : #endif
      10                 :            : 
      11                 :            : 
      12                 :            : /* runtime lifecycle */
      13                 :            : 
      14                 :            : extern PyStatus _PyErr_InitTypes(PyInterpreterState *);
      15                 :            : extern void _PyErr_FiniTypes(PyInterpreterState *);
      16                 :            : 
      17                 :            : 
      18                 :            : /* other API */
      19                 :            : 
      20                 :   17771161 : static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
      21                 :            : {
      22                 :            :     assert(tstate != NULL);
      23         [ +  + ]:   17771161 :     if (tstate->current_exception == NULL) {
      24                 :   17634100 :         return NULL;
      25                 :            :     }
      26                 :     137061 :     return (PyObject *)Py_TYPE(tstate->current_exception);
      27                 :            : }
      28                 :            : 
      29                 :     244650 : static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state)
      30                 :            : {
      31         [ +  + ]:     244650 :     Py_CLEAR(exc_state->exc_value);
      32                 :     244650 : }
      33                 :            : 
      34                 :            : PyAPI_FUNC(PyObject*) _PyErr_StackItemToExcInfoTuple(
      35                 :            :     _PyErr_StackItem *err_info);
      36                 :            : 
      37                 :            : PyAPI_FUNC(void) _PyErr_Fetch(
      38                 :            :     PyThreadState *tstate,
      39                 :            :     PyObject **type,
      40                 :            :     PyObject **value,
      41                 :            :     PyObject **traceback);
      42                 :            : 
      43                 :            : extern PyObject *
      44                 :            : _PyErr_GetRaisedException(PyThreadState *tstate);
      45                 :            : 
      46                 :            : PyAPI_FUNC(int) _PyErr_ExceptionMatches(
      47                 :            :     PyThreadState *tstate,
      48                 :            :     PyObject *exc);
      49                 :            : 
      50                 :            : void
      51                 :            : _PyErr_SetRaisedException(PyThreadState *tstate, PyObject *exc);
      52                 :            : 
      53                 :            : PyAPI_FUNC(void) _PyErr_Restore(
      54                 :            :     PyThreadState *tstate,
      55                 :            :     PyObject *type,
      56                 :            :     PyObject *value,
      57                 :            :     PyObject *traceback);
      58                 :            : 
      59                 :            : PyAPI_FUNC(void) _PyErr_SetObject(
      60                 :            :     PyThreadState *tstate,
      61                 :            :     PyObject *type,
      62                 :            :     PyObject *value);
      63                 :            : 
      64                 :            : PyAPI_FUNC(void) _PyErr_ChainStackItem(
      65                 :            :     _PyErr_StackItem *exc_info);
      66                 :            : 
      67                 :            : PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate);
      68                 :            : 
      69                 :            : PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception);
      70                 :            : 
      71                 :            : PyAPI_FUNC(PyObject *) _PyErr_NoMemory(PyThreadState *tstate);
      72                 :            : 
      73                 :            : PyAPI_FUNC(void) _PyErr_SetString(
      74                 :            :     PyThreadState *tstate,
      75                 :            :     PyObject *exception,
      76                 :            :     const char *string);
      77                 :            : 
      78                 :            : PyAPI_FUNC(PyObject *) _PyErr_Format(
      79                 :            :     PyThreadState *tstate,
      80                 :            :     PyObject *exception,
      81                 :            :     const char *format,
      82                 :            :     ...);
      83                 :            : 
      84                 :            : PyAPI_FUNC(void) _PyErr_NormalizeException(
      85                 :            :     PyThreadState *tstate,
      86                 :            :     PyObject **exc,
      87                 :            :     PyObject **val,
      88                 :            :     PyObject **tb);
      89                 :            : 
      90                 :            : PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate(
      91                 :            :     PyThreadState *tstate,
      92                 :            :     PyObject *exception,
      93                 :            :     const char *format,
      94                 :            :     ...);
      95                 :            : 
      96                 :            : PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup(
      97                 :            :     const char *msg,
      98                 :            :     PyObject *excs);
      99                 :            : 
     100                 :            : PyAPI_FUNC(PyObject *) _PyExc_PrepReraiseStar(
     101                 :            :     PyObject *orig,
     102                 :            :     PyObject *excs);
     103                 :            : 
     104                 :            : PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate);
     105                 :            : 
     106                 :            : PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp);
     107                 :            : 
     108                 :            : extern PyObject* _Py_Offer_Suggestions(PyObject* exception);
     109                 :            : PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b,
     110                 :            :                                           Py_ssize_t max_cost);
     111                 :            : 
     112                 :            : #ifdef __cplusplus
     113                 :            : }
     114                 :            : #endif
     115                 :            : #endif /* !Py_INTERNAL_PYERRORS_H */

Generated by: LCOV version 1.14