From 3a538fc91e3c4fb2ce57ca8608bde75b7c81d0cf Mon Sep 17 00:00:00 2001 From: grindhold Date: Wed, 27 Feb 2019 00:09:21 +0100 Subject: [PATCH] pyext: missing cast to constant char* (#5713) We need to cast to a constant charpointer here. --- python/google/protobuf/pyext/message_factory.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/google/protobuf/pyext/message_factory.cc b/python/google/protobuf/pyext/message_factory.cc index efaa26170..a5ff3184c 100644 --- a/python/google/protobuf/pyext/message_factory.cc +++ b/python/google/protobuf/pyext/message_factory.cc @@ -43,9 +43,11 @@ #error "Python 3.0 - 3.2 are not supported." #endif #define PyString_AsStringAndSize(ob, charpp, sizep) \ - (PyUnicode_Check(ob)? \ - ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \ - PyBytes_AsStringAndSize(ob, (charpp), (sizep))) + (PyUnicode_Check(ob) ? ((*(charpp) = const_cast( \ + PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \ + ? -1 \ + : 0) \ + : PyBytes_AsStringAndSize(ob, (charpp), (sizep))) #endif namespace google {