summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@gmail.com>2017-09-10 12:02:47 -0700
committerMatus Valo <matusvalo@gmail.com>2017-09-10 12:02:47 -0700
commitc8c01a15f46fb6d5535fe95a156d03ce89f4b1f9 (patch)
tree1c3c44e27d5ace9a4c48f0b79d9e94f5ac385fef
parent2e1bce74370ac79459b84eab4cc1c4c41f4fdaf0 (diff)
downloadlibrabbitmq-c8c01a15f46fb6d5535fe95a156d03ce89f4b1f9.tar.gz
Don't use Py_TPFLAGS_HAVE_WEAKREFS tp flag under python3
-rw-r--r--Modules/_librabbitmq/connection.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_librabbitmq/connection.h b/Modules/_librabbitmq/connection.h
index bc9c54e..a0e5d36 100644
--- a/Modules/_librabbitmq/connection.h
+++ b/Modules/_librabbitmq/connection.h
@@ -8,6 +8,12 @@
#include <amqp.h>
#include <amqp_framing.h>
+#if PY_MAJOR_VERSION == 2
+# define TP_FLAGS (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS)
+#else
+# define TP_FLAGS (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE)
+#endif
+
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 and up */
# define FROM_FORMAT PyUnicode_FromFormat
@@ -325,8 +331,7 @@ static PyTypeObject PyRabbitMQ_ConnectionType = {
/* tp_getattro */ 0,
/* tp_setattro */ 0,
/* tp_as_buffer */ 0,
- /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
- Py_TPFLAGS_HAVE_WEAKREFS,
+ /* tp_flags */ TP_FLAGS,
/* tp_doc */ PyRabbitMQ_ConnectionType_doc,
/* tp_traverse */ 0,
/* tp_clear */ 0,