Skip to content

Commit f3e14ea

Browse files
committed
_queue_declare() should return queue name as string not bytes
1 parent 9e1fdb4 commit f3e14ea

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Modules/_librabbitmq/connection.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,8 +1654,7 @@ PyRabbitMQ_Connection_queue_declare(PyRabbitMQ_Connection *self,
16541654
goto bail;
16551655

16561656
if ((ret = PyTuple_New(3)) == NULL) goto bail;
1657-
PyTuple_SET_ITEM(ret, 0, PyBytes_FromStringAndSize(ok->queue.bytes,
1658-
(Py_ssize_t)ok->queue.len));
1657+
PyTuple_SET_ITEM(ret, 0, PySTRING_FROM_AMQBYTES(ok->queue));
16591658
PyTuple_SET_ITEM(ret, 1, PyInt_FromLong((long)ok->message_count));
16601659
PyTuple_SET_ITEM(ret, 2, PyInt_FromLong((long)ok->consumer_count));
16611660
return ret;

Modules/_librabbitmq/connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ buffer_toMemoryView(char *buf, Py_ssize_t buf_len) {
8989

9090
#if PY_MAJOR_VERSION == 2
9191
# define PySTRING_FROM_AMQBYTES(member) \
92-
PyString_FromStringAndSize(member.bytes, (Py_ssize_t)member.len);
92+
PyString_FromStringAndSize((member).bytes, (Py_ssize_t)(member).len)
9393
#else
9494
# define PySTRING_FROM_AMQBYTES(member) \
95-
PyUnicode_FromStringAndSize(member.bytes, (Py_ssize_t)member.len);
95+
PyUnicode_FromStringAndSize((member).bytes, (Py_ssize_t)(member).len)
9696
#endif
9797

9898

0 commit comments

Comments
 (0)