diff options
Diffstat (limited to 'SWIG/_util.i')
-rw-r--r-- | SWIG/_util.i | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/SWIG/_util.i b/SWIG/_util.i index 522b8c8..bc2ee61 100644 --- a/SWIG/_util.i +++ b/SWIG/_util.i @@ -1,12 +1,13 @@ /* Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved. * Copyright (c) 2009-2010 Heikki Toivonen. All rights reserved. */ -/* $Id: _util.i 721 2010-02-13 06:30:33Z heikki $ */ +/* $Id$ */ %{ #include <openssl/x509v3.h> %} +%warnfilter(454) _util_err; %inline %{ static PyObject *_util_err; @@ -26,10 +27,12 @@ PyObject *util_hex_to_string(PyObject *blob) { ret = hex_to_string((unsigned char *)buf, len); if (!ret) { - PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error())); + m2_PyErr_Msg(_util_err); return NULL; } - obj = PyString_FromString(ret); + + obj = PyBytes_FromString(ret); + OPENSSL_free(ret); return obj; } @@ -47,10 +50,10 @@ PyObject *util_string_to_hex(PyObject *blob) { len = len0; ret = string_to_hex((char *)buf, &len); if (ret == NULL) { - PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error())); + m2_PyErr_Msg(_util_err); return NULL; } - obj = PyString_FromStringAndSize((char*)ret, len); + obj = PyBytes_FromStringAndSize((char*)ret, len); OPENSSL_free(ret); return obj; } |