Fixed disconnecting before Clear().
diff --git a/python/map.c b/python/map.c
index 0477c59..5f233b5 100644
--- a/python/map.c
+++ b/python/map.c
@@ -105,6 +105,14 @@
 
 void PyUpb_MapContainer_Reify(PyObject* _self, upb_map* map) {
   PyUpb_MapContainer* self = (PyUpb_MapContainer*)_self;
+  if (!map) {
+    const upb_fielddef* f = PyUpb_MapContainer_GetField(self);
+    upb_arena* arena = PyUpb_Arena_Get(self->arena);
+    const upb_msgdef* entry_m = upb_fielddef_msgsubdef(f);
+    const upb_fielddef* key_f = upb_msgdef_field(entry_m, 0);
+    const upb_fielddef* val_f = upb_msgdef_field(entry_m, 1);
+    map = upb_map_new(arena, upb_fielddef_type(key_f), upb_fielddef_type(val_f));
+  }
   PyUpb_ObjCache_Add(map, &self->ob_base);
   Py_DECREF(self->ptr.parent);
   self->ptr.map = map;  // Overwrites self->ptr.parent.
diff --git a/python/message.c b/python/message.c
index 81d5381..46be7bb 100644
--- a/python/message.c
+++ b/python/message.c
@@ -550,6 +550,10 @@
 static void PyUpb_CMessage_Reify(PyUpb_CMessage* self, const upb_fielddef* f,
                                  upb_msg* msg) {
   assert(f == PyUpb_CMessage_GetFieldDef(self));
+  if (!msg) {
+    const upb_msgdef* msgdef = PyUpb_CMessage_GetMsgdef((PyObject*)self);
+    msg = upb_msg_new(msgdef, PyUpb_Arena_Get(self->arena));
+  }
   PyUpb_ObjCache_Add(msg, &self->ob_base);
   Py_DECREF(&self->ptr.parent->ob_base);
   self->ptr.msg = msg;  // Overwrites self->ptr.parent
@@ -585,7 +589,7 @@
   PyObject* obj;
 
   // The last ref to this message could disappear during iteration.
-  // When we call PyUpb_*Container_SwitchToSet() below, the container will drop
+  // When we call PyUpb_*Container_Reify() below, the container will drop
   // its ref on `self`.  If that was the last ref on self, the object will be
   // deleted, and `subobj_map` along with it.  We need it to live until we are
   // done iterating.
@@ -1047,6 +1051,32 @@
 static PyObject* PyUpb_CMessage_Clear(PyUpb_CMessage* self, PyObject* args) {
   PyUpb_CMessage_EnsureReified(self);
   const upb_msgdef* msgdef = _PyUpb_CMessage_GetMsgdef(self);
+  PyUpb_WeakMap* subobj_map = self->unset_subobj_map;
+
+  if (subobj_map) {
+    upb_msg* msg = PyUpb_CMessage_GetMsg(self);
+    intptr_t iter = PYUPB_WEAKMAP_BEGIN;
+    const void* key;
+    PyObject* obj;
+
+    while (PyUpb_WeakMap_Next(subobj_map, &key, &obj, &iter)) {
+      const upb_fielddef* f = key;
+      PyUpb_WeakMap_DeleteIter(subobj_map, &iter);
+      if (upb_fielddef_ismap(f)) {
+        assert(upb_msg_get(msg, f).map_val == NULL);
+        PyUpb_MapContainer_Reify(obj, NULL);
+      } else if (upb_fielddef_isseq(f)) {
+        assert(upb_msg_get(msg, f).array_val == NULL);
+        PyUpb_RepeatedContainer_Reify(obj, NULL);
+      } else {
+        assert(!upb_msg_has(msg, f));
+        PyUpb_CMessage* sub = (void*)obj;
+        assert(self == sub->ptr.parent);
+        PyUpb_CMessage_Reify(sub, f, NULL);
+      }
+    }
+  }
+
   upb_msg_clear(self->ptr.msg, msgdef);
   Py_RETURN_NONE;
 }
diff --git a/python/pb_unit_tests/reflection_test_wrapper.py b/python/pb_unit_tests/reflection_test_wrapper.py
index e8a5d80..83ba3da 100644
--- a/python/pb_unit_tests/reflection_test_wrapper.py
+++ b/python/pb_unit_tests/reflection_test_wrapper.py
@@ -46,8 +46,6 @@
 reflection_test.ReflectionTest.testConstructorTypeError_proto3.__unittest_expecting_failure__ = True
 reflection_test.ReflectionTest.testDeepCopy_proto2.__unittest_expecting_failure__ = True
 reflection_test.ReflectionTest.testDeepCopy_proto3.__unittest_expecting_failure__ = True
-reflection_test.ReflectionTest.testDisconnectingBeforeClear_proto2.__unittest_expecting_failure__ = True
-reflection_test.ReflectionTest.testDisconnectingBeforeClear_proto3.__unittest_expecting_failure__ = True
 reflection_test.ReflectionTest.testEnum_KeysAndValues_proto2.__unittest_expecting_failure__ = True
 reflection_test.ReflectionTest.testEnum_KeysAndValues_proto3.__unittest_expecting_failure__ = True
 reflection_test.ReflectionTest.testEnum_Name_proto2.__unittest_expecting_failure__ = True
diff --git a/python/repeated.c b/python/repeated.c
index ca9182c..1b32fd4 100644
--- a/python/repeated.c
+++ b/python/repeated.c
@@ -106,14 +106,20 @@
   return PyUpb_RepeatedContainer_IsStub(self) ? NULL : self->ptr.arr;
 }
 
-void PyUpb_RepeatedContainer_Reify(PyObject* _self, upb_array* arr) {
+upb_array* PyUpb_RepeatedContainer_Reify(PyObject* _self, upb_array* arr) {
   PyUpb_RepeatedContainer* self = (PyUpb_RepeatedContainer*)_self;
   assert(PyUpb_RepeatedContainer_IsStub(self));
+  if (!arr) {
+    const upb_fielddef* f = PyUpb_RepeatedContainer_GetField(self);
+    upb_arena* arena = PyUpb_Arena_Get(self->arena);
+    arr = upb_array_new(arena, upb_fielddef_type(f));
+  }
   PyUpb_ObjCache_Add(arr, &self->ob_base);
   Py_DECREF(self->ptr.parent);
   self->ptr.arr = arr;  // Overwrites self->ptr.parent.
   self->field &= ~(uintptr_t)1;
   assert(!PyUpb_RepeatedContainer_IsStub(self));
+  return arr;
 }
 
 upb_array* PyUpb_RepeatedContainer_EnsureReified(PyObject* _self) {
diff --git a/python/repeated.h b/python/repeated.h
index 8204afd..ec2ac16 100644
--- a/python/repeated.h
+++ b/python/repeated.h
@@ -48,7 +48,7 @@
                                                      PyObject* arena);
 
 // Reifies a repeated field stub to point to the concrete data in `arr`.
-void PyUpb_RepeatedContainer_Reify(PyObject* self, upb_array* arr);
+upb_array* PyUpb_RepeatedContainer_Reify(PyObject* self, upb_array* arr);
 
 // Reifies this repeated object if it is not already reified.
 upb_array* PyUpb_RepeatedContainer_EnsureReified(PyObject* self);