Index: third_party/protobuf/python/google/protobuf/pyext/message.h |
diff --git a/third_party/protobuf/python/google/protobuf/pyext/message.h b/third_party/protobuf/python/google/protobuf/pyext/message.h |
index 3a4bec81c9d504489b81cf34ffb701daaf446366..1550724c8f53e4edfbccac7c4d7fa9257208c54a 100644 |
--- a/third_party/protobuf/python/google/protobuf/pyext/message.h |
+++ b/third_party/protobuf/python/google/protobuf/pyext/message.h |
@@ -54,7 +54,7 @@ class MessageFactory; |
#ifdef _SHARED_PTR_H |
using std::shared_ptr; |
-using ::std::string; |
+using std::string; |
#else |
using internal::shared_ptr; |
#endif |
@@ -62,7 +62,7 @@ using internal::shared_ptr; |
namespace python { |
struct ExtensionDict; |
-struct PyDescriptorPool; |
+struct PyMessageFactory; |
typedef struct CMessage { |
PyObject_HEAD; |
@@ -112,6 +112,9 @@ typedef struct CMessage { |
// Similar to composite_fields, acting as a cache, but also contains the |
// required extension dict logic. |
ExtensionDict* extensions; |
+ |
+ // Implements the "weakref" protocol for this object. |
+ PyObject* weakreflist; |
} CMessage; |
extern PyTypeObject CMessage_Type; |
@@ -132,14 +135,11 @@ struct CMessageClass { |
// Owned reference, used to keep the pointer above alive. |
PyObject* py_message_descriptor; |
- // The Python DescriptorPool used to create the class. It is needed to resolve |
+ // The Python MessageFactory used to create the class. It is needed to resolve |
// fields descriptors, including extensions fields; its C++ MessageFactory is |
// used to instantiate submessages. |
- // This can be different from DESCRIPTOR.file.pool, in the case of a custom |
- // DescriptorPool which defines new extensions. |
- // We own the reference, because it's important to keep the descriptors and |
- // factory alive. |
- PyDescriptorPool* py_descriptor_pool; |
+ // We own the reference, because it's important to keep the factory alive. |
+ PyMessageFactory* py_message_factory; |
PyObject* AsPyObject() { |
return reinterpret_cast<PyObject*>(this); |
@@ -154,14 +154,6 @@ namespace cmessage { |
// The caller must fill self->message, self->owner and eventually self->parent. |
CMessage* NewEmptyMessage(CMessageClass* type); |
-// Release a submessage from its proto tree, making it a new top-level messgae. |
-// A new message will be created if this is a read-only default instance. |
-// |
-// Corresponds to reflection api method ReleaseMessage. |
-int ReleaseSubMessage(CMessage* self, |
- const FieldDescriptor* field_descriptor, |
- CMessage* child_cmessage); |
- |
// Retrieves the C++ descriptor of a Python Extension descriptor. |
// On error, return NULL with an exception set. |
const FieldDescriptor* GetExtensionDescriptor(PyObject* extension); |
@@ -237,7 +229,9 @@ PyObject* HasFieldByDescriptor( |
PyObject* HasField(CMessage* self, PyObject* arg); |
// Initializes values of fields on a newly constructed message. |
-int InitAttributes(CMessage* self, PyObject* kwargs); |
+// Note that positional arguments are disallowed: 'args' must be NULL or the |
+// empty tuple. |
+int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs); |
PyObject* MergeFrom(CMessage* self, PyObject* arg); |
@@ -260,14 +254,15 @@ int SetOwner(CMessage* self, const shared_ptr<Message>& new_owner); |
int AssureWritable(CMessage* self); |
-// Returns the "best" DescriptorPool for the given message. |
-// This is often equivalent to message.DESCRIPTOR.pool, but not always, when |
-// the message class was created from a MessageFactory using a custom pool which |
-// uses the generated pool as an underlay. |
+// Returns the message factory for the given message. |
+// This is equivalent to message.MESSAGE_FACTORY |
// |
-// The returned pool is suitable for finding fields and building submessages, |
+// The returned factory is suitable for finding fields and building submessages, |
// even in the case of extensions. |
-PyDescriptorPool* GetDescriptorPoolForMessage(CMessage* message); |
+// Returns a *borrowed* reference, and never fails because we pass a CMessage. |
+PyMessageFactory* GetFactoryForMessage(CMessage* message); |
+ |
+PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg); |
} // namespace cmessage |
@@ -354,6 +349,8 @@ bool CheckFieldBelongsToMessage(const FieldDescriptor* field_descriptor, |
extern PyObject* PickleError_class; |
+bool InitProto2MessageModule(PyObject *m); |
+ |
} // namespace python |
} // namespace protobuf |