LCOV - code coverage report
Current view: | top level - Modules/_ssl - misc.c (source / functions) |  |  | Hit | Total | Coverage
Test: | CPython 3.12 LCOV report [commit 5e6661bce9] |  | Lines: | 0 | 14 | 0.0 %
Date: | 2023-03-20 08:15:36 |  | Functions: | 0 | 2 | 0.0 %
|  |  | Branches: | 0 | 8 | 0.0 %

               Branch data     Line data    Source code
           1                 :            : #include "Python.h"
           2                 :            : #include "../_ssl.h"
           3                 :            :
           4                 :            : #include "openssl/bio.h"
           5                 :            :
           6                 :            : /* BIO_s_mem() to PyBytes
           7                 :            :  */
           8                 :            : static PyObject *
           9                 :          0 : _PySSL_BytesFromBIO(_sslmodulestate *state, BIO *bio)
          10                 :            : {
          11                 :            :     long size;
          12                 :          0 :     char *data = NULL;
          13                 :          0 :     size = BIO_get_mem_data(bio, &data);
          14   [ #  #  #  # ]:          0 :     if (data == NULL || size < 0) {
          15                 :          0 :         PyErr_SetString(PyExc_ValueError, "Not a memory BIO");
          16                 :          0 :         return NULL;
          17                 :            :     }
          18                 :          0 :     return PyBytes_FromStringAndSize(data, size);
          19                 :            : }
          20                 :            :
          21                 :            : /* BIO_s_mem() to PyUnicode
          22                 :            :  */
          23                 :            : static PyObject *
          24                 :          0 : _PySSL_UnicodeFromBIO(_sslmodulestate *state, BIO *bio, const char *error)
          25                 :            : {
          26                 :            :     long size;
          27                 :          0 :     char *data = NULL;
          28                 :          0 :     size = BIO_get_mem_data(bio, &data);
          29   [ #  #  #  # ]:          0 :     if (data == NULL || size < 0) {
          30                 :          0 :         PyErr_SetString(PyExc_ValueError, "Not a memory BIO");
          31                 :          0 :         return NULL;
          32                 :            :     }
          33                 :          0 :     return PyUnicode_DecodeUTF8(data, size, error);
          34                 :            : }

Generated by: LCOV version 1.14