aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/pyext/extension_dict.cc
diff options
context:
space:
mode:
authorBen Webb <ben@salilab.org>2018-07-12 10:58:10 -0700
committerJie Luo <anandolee@gmail.com>2018-07-12 10:58:10 -0700
commit0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7 (patch)
tree5313bf8ee39f67308032b1cb9343c6dfb1b34be8 /python/google/protobuf/pyext/extension_dict.cc
parent029dbfd714f1dbeb7c60c93d6949f35232e53221 (diff)
downloadprotobuf-0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.tar.gz
protobuf-0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.tar.bz2
protobuf-0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.zip
Add Python 3.7 compatibility (#4862)
Compilation of Python wrappers fails with Python 3.7 because the Python folks changed their C API such that PyUnicode_AsUTF8AndSize() now returns a const char* rather than a char*. Add a patch to work around. Relates #4086.
Diffstat (limited to 'python/google/protobuf/pyext/extension_dict.cc')
-rw-r--r--python/google/protobuf/pyext/extension_dict.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc
index 018b5c2c..174c5470 100644
--- a/python/google/protobuf/pyext/extension_dict.cc
+++ b/python/google/protobuf/pyext/extension_dict.cc
@@ -53,7 +53,7 @@
#endif
#define PyString_AsStringAndSize(ob, charpp, sizep) \
(PyUnicode_Check(ob)? \
- ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
+ ((*(charpp) = const_cast<char*>(PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL? -1: 0): \
PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
#endif