Index: third_party/protobuf/python/google/protobuf/pyext/map_container.h |
diff --git a/third_party/protobuf/python/google/protobuf/pyext/map_container.h b/third_party/protobuf/python/google/protobuf/pyext/map_container.h |
index 2de611875dab31191f1af7573e0d73d06549090c..fbd6713f7319da73e7c45e79c7940f00bb89526c 100644 |
--- a/third_party/protobuf/python/google/protobuf/pyext/map_container.h |
+++ b/third_party/protobuf/python/google/protobuf/pyext/map_container.h |
@@ -55,6 +55,7 @@ using internal::shared_ptr; |
namespace python { |
struct CMessage; |
+struct CMessageClass; |
// This struct is used directly for ScalarMap, and is the base class of |
// MessageMapContainer, which is used for MessageMap. |
@@ -104,15 +105,23 @@ struct MapContainer { |
}; |
struct MessageMapContainer : public MapContainer { |
- // A callable that is used to create new child messages. |
- PyObject* subclass_init; |
+ // The type used to create new child messages. |
+ CMessageClass* message_class; |
// A dict mapping Message* -> CMessage. |
PyObject* message_dict; |
}; |
-extern PyTypeObject ScalarMapContainer_Type; |
-extern PyTypeObject MessageMapContainer_Type; |
+#if PY_MAJOR_VERSION >= 3 |
+ extern PyObject *MessageMapContainer_Type; |
+ extern PyType_Spec MessageMapContainer_Type_spec; |
+ extern PyObject *ScalarMapContainer_Type; |
+ extern PyType_Spec ScalarMapContainer_Type_spec; |
+#else |
+ extern PyTypeObject MessageMapContainer_Type; |
+ extern PyTypeObject ScalarMapContainer_Type; |
+#endif |
+ |
extern PyTypeObject MapIterator_Type; // Both map types use the same iterator. |
// Builds a MapContainer object, from a parent message and a |
@@ -124,7 +133,7 @@ extern PyObject* NewScalarMapContainer( |
// field descriptor. |
extern PyObject* NewMessageMapContainer( |
CMessage* parent, const FieldDescriptor* parent_field_descriptor, |
- PyObject* concrete_class); |
+ CMessageClass* message_class); |
} // namespace python |
} // namespace protobuf |