400 static PyObject *
401 crypto_dump_certificate_request(PyObject *spam, PyObject *args)
402 {
403 int type, ret, buf_len;
404 char *temp;
405 PyObject *buffer;
406 BIO *bio;
407 crypto_X509ReqObj *req;
408
409 if (!PyArg_ParseTuple(args, "iO!:dump_certificate_request", &type,
when PyArg_ParseTuple() succeeds
taking False path
410 &crypto_X509Req_Type, &req))
411 return NULL;
412
413 bio = BIO_new(BIO_s_mem());
414 switch (type)
when following case 1
415 {
416 case X509_FILETYPE_PEM:
417 ret = PEM_write_bio_X509_REQ(bio, req->x509_req);
418 break;
419
420 case X509_FILETYPE_ASN1:
421 ret = i2d_X509_REQ_bio(bio, req->x509_req);
422 break;
423
424 case X509_FILETYPE_TEXT:
425 ret = X509_REQ_print_ex(bio, req->x509_req, 0, 0);
426 break;
427
428 default:
429 PyErr_SetString(PyExc_ValueError, "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT");
430 BIO_free(bio);
431 return NULL;
432 }
433
434 if (ret == 0)
when considering value == (int)0 from OpenSSL/crypto/crypto.c:417
taking True path
435 {
436 BIO_free(bio);
437 exception_from_error_queue(crypto_Error);
438 return NULL;
439 }
440
441 buf_len = BIO_get_mem_data(bio, &temp);
442 buffer = PyBytes_FromStringAndSize(temp, buf_len);
443 BIO_free(bio);
444
445 return buffer;
446 }
returning (PyObject*)NULL without setting an exception
found 2 similar trace(s) to this