diff options
author | Matus Valo <matusvalo@gmail.com> | 2017-10-20 05:06:40 -0700 |
---|---|---|
committer | Matus Valo <matusvalo@gmail.com> | 2017-10-20 05:06:40 -0700 |
commit | f3e14ead36ad0cc599236fbe2d99bf7d585054d8 (patch) | |
tree | ad545c51dc93f94c953647c27939c20de5bffbc1 | |
parent | 9e1fdb48c3957dbbb13df2e6a1cc63fe0d55014e (diff) | |
download | librabbitmq-f3e14ead36ad0cc599236fbe2d99bf7d585054d8.tar.gz |
_queue_declare() should return queue name as string not bytes
-rw-r--r-- | Modules/_librabbitmq/connection.c | 3 | ||||
-rw-r--r-- | Modules/_librabbitmq/connection.h | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Modules/_librabbitmq/connection.c b/Modules/_librabbitmq/connection.c index b3979eb..623fdbe 100644 --- a/Modules/_librabbitmq/connection.c +++ b/Modules/_librabbitmq/connection.c @@ -1654,8 +1654,7 @@ PyRabbitMQ_Connection_queue_declare(PyRabbitMQ_Connection *self, goto bail; if ((ret = PyTuple_New(3)) == NULL) goto bail; - PyTuple_SET_ITEM(ret, 0, PyBytes_FromStringAndSize(ok->queue.bytes, - (Py_ssize_t)ok->queue.len)); + PyTuple_SET_ITEM(ret, 0, PySTRING_FROM_AMQBYTES(ok->queue)); PyTuple_SET_ITEM(ret, 1, PyInt_FromLong((long)ok->message_count)); PyTuple_SET_ITEM(ret, 2, PyInt_FromLong((long)ok->consumer_count)); return ret; diff --git a/Modules/_librabbitmq/connection.h b/Modules/_librabbitmq/connection.h index e734e75..273ae75 100644 --- a/Modules/_librabbitmq/connection.h +++ b/Modules/_librabbitmq/connection.h @@ -89,10 +89,10 @@ buffer_toMemoryView(char *buf, Py_ssize_t buf_len) { #if PY_MAJOR_VERSION == 2 # define PySTRING_FROM_AMQBYTES(member) \ - PyString_FromStringAndSize(member.bytes, (Py_ssize_t)member.len); + PyString_FromStringAndSize((member).bytes, (Py_ssize_t)(member).len) #else # define PySTRING_FROM_AMQBYTES(member) \ - PyUnicode_FromStringAndSize(member.bytes, (Py_ssize_t)member.len); + PyUnicode_FromStringAndSize((member).bytes, (Py_ssize_t)(member).len) #endif |