diff options
author | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
commit | 0400cca3236de1ca303af38bf81eab332d042b7c (patch) | |
tree | a8a9b19853f64567c96750a1c7d253926471daa5 /python/google/protobuf/pyext/message_factory.cc | |
parent | 96b535cc2f4f7b7e22a1b8622149f7c26a5a3f63 (diff) |
Integrated internal changes from Google
Diffstat (limited to 'python/google/protobuf/pyext/message_factory.cc')
-rw-r--r-- | python/google/protobuf/pyext/message_factory.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/google/protobuf/pyext/message_factory.cc b/python/google/protobuf/pyext/message_factory.cc index 571bae2b..bacc76a6 100644 --- a/python/google/protobuf/pyext/message_factory.cc +++ b/python/google/protobuf/pyext/message_factory.cc @@ -100,7 +100,9 @@ PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) { NewMessageFactory(type, reinterpret_cast<PyDescriptorPool*>(pool))); } -static void Dealloc(PyMessageFactory* self) { +static void Dealloc(PyObject* pself) { + PyMessageFactory* self = reinterpret_cast<PyMessageFactory*>(pself); + // TODO(amauryfa): When the MessageFactory is not created from the // DescriptorPool this reference should be owned, not borrowed. // Py_CLEAR(self->pool); @@ -111,7 +113,7 @@ static void Dealloc(PyMessageFactory* self) { } delete self->classes_by_descriptor; delete self->message_factory; - Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self)); + Py_TYPE(self)->tp_free(pself); } // Add a message class to our database. @@ -231,7 +233,7 @@ PyTypeObject PyMessageFactory_Type = { ".MessageFactory", // tp_name sizeof(PyMessageFactory), // tp_basicsize 0, // tp_itemsize - (destructor)message_factory::Dealloc, // tp_dealloc + message_factory::Dealloc, // tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr |