Skip to content

Commit 1f87e87

Browse files
committed
Python3 PyObject_CallMethodObjArgs method name should be str not bytes
1 parent 1e6ff46 commit 1f87e87

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Modules/_librabbitmq/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ PyRabbitMQ_ApplyCallback(PyRabbitMQ_Connection *self,
12361236
goto error;
12371237

12381238
/* message = self.Message(channel, properties, delivery_info, body) */
1239-
Message = PyBytes_FromString("Message");
1239+
Message = BUILD_METHOD_NAME("Message");
12401240
message = PyObject_CallMethodObjArgs((PyObject *)self, Message,
12411241
channelobj, propdict, delivery_info, view, NULL);
12421242
if (!message)

Modules/_librabbitmq/connection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717

1818
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 and up */
19+
# define BUILD_METHOD_NAME PyUnicode_FromString
1920
# define FROM_FORMAT PyUnicode_FromFormat
2021
# define PyInt_FromLong PyLong_FromLong
2122
# define PyInt_AS_LONG PyLong_AsLong
2223
# define PyInt_Check PyLong_Check
2324
# define PyInt_FromSsize_t PyLong_FromSsize_t
2425
# define PyString_INTERN_FROM_STRING PyString_FromString
2526
#else /* 2.x */
27+
# define BUILD_METHOD_NAME PyBytes_FromString
2628
# define FROM_FORMAT PyString_FromFormat
2729
# define PyString_INTERN_FROM_STRING PyString_InternFromString
2830
#endif

0 commit comments

Comments
 (0)