New submission from David Wood <dwoodjunkm...@gmail.com>:

I have a c function to encrypt values which returns an array of bytes.  The 
function returns proper values outside of python.  When used as a python 
function, the result is incomplete usually 10-20% of the time.  If I add a 
sleep(1) call before returning from the function, my success rate goes to 100%. 
 While this works, it is unacceptable as it will create enormous latency in my 
application.

static PyObject *method_encrypt(PyObject *self, PyObject *args) {
        char *keyval, *str = NULL, output[512];
        Py_ssize_t count=0;
        PyObject *retval;

        if(!PyArg_ParseTuple(args, "ss", &str, &keyval)) {
                return NULL;
        }

        encryptBlowfishCfb(str, &count, output, keyval);

        retval = Py_BuildValue("y#", output, count);
        //sleep(1);
        return retval;
}

----------
components: C API
messages: 388268
nosy: dwoodjunkmail
priority: normal
severity: normal
status: open
title: Py_BuildValue("y#".... returns incomplete result
type: performance
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43435>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to