summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@gmail.com>2017-09-10 12:15:39 -0700
committerMatus Valo <matusvalo@gmail.com>2017-09-10 12:15:39 -0700
commit1f87e8797a4163e145a5794ddab2f4c4754d5fa2 (patch)
tree340fb917253e016ba1ad5c22e0bb23e5a4d473f6
parent1e6ff462520dd0ceb9c55887e0e1bb81b562af84 (diff)
downloadlibrabbitmq-1f87e8797a4163e145a5794ddab2f4c4754d5fa2.tar.gz
Python3 PyObject_CallMethodObjArgs method name should be str not bytes
-rw-r--r--Modules/_librabbitmq/connection.c2
-rw-r--r--Modules/_librabbitmq/connection.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_librabbitmq/connection.c b/Modules/_librabbitmq/connection.c
index 2000d85..a77a976 100644
--- a/Modules/_librabbitmq/connection.c
+++ b/Modules/_librabbitmq/connection.c
@@ -1236,7 +1236,7 @@ PyRabbitMQ_ApplyCallback(PyRabbitMQ_Connection *self,
goto error;
/* message = self.Message(channel, properties, delivery_info, body) */
- Message = PyBytes_FromString("Message");
+ Message = BUILD_METHOD_NAME("Message");
message = PyObject_CallMethodObjArgs((PyObject *)self, Message,
channelobj, propdict, delivery_info, view, NULL);
if (!message)
diff --git a/Modules/_librabbitmq/connection.h b/Modules/_librabbitmq/connection.h
index 972b781..c709d37 100644
--- a/Modules/_librabbitmq/connection.h
+++ b/Modules/_librabbitmq/connection.h
@@ -16,6 +16,7 @@
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 and up */
+# define BUILD_METHOD_NAME PyUnicode_FromString
# define FROM_FORMAT PyUnicode_FromFormat
# define PyInt_FromLong PyLong_FromLong
# define PyInt_AS_LONG PyLong_AsLong
@@ -23,6 +24,7 @@
# define PyInt_FromSsize_t PyLong_FromSsize_t
# define PyString_INTERN_FROM_STRING PyString_FromString
#else /* 2.x */
+# define BUILD_METHOD_NAME PyBytes_FromString
# define FROM_FORMAT PyString_FromFormat
# define PyString_INTERN_FROM_STRING PyString_InternFromString
#endif