From c348d46a9bd2b264bf4155f8a26c3715ca9ea584 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Wed, 29 Mar 2017 15:54:06 -0700 Subject: Use PyUnicode_AsEncodedString() instead of PyUnicode_AsEncodedObject() --- python/google/protobuf/pyext/message.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc index c810b788..85aaa46f 100644 --- a/python/google/protobuf/pyext/message.cc +++ b/python/google/protobuf/pyext/message.cc @@ -779,7 +779,7 @@ PyObject* CheckString(PyObject* arg, const FieldDescriptor* descriptor) { encoded_string = arg; // Already encoded. Py_INCREF(encoded_string); } else { - encoded_string = PyUnicode_AsEncodedObject(arg, "utf-8", NULL); + encoded_string = PyUnicode_AsEncodedString(arg, "utf-8", NULL); } } else { // In this case field type is "bytes". -- cgit v1.2.3