Fix for SF bug #642358: only provide a new with a __dict__ or
__weaklist__ descriptor if we added __dict__ or __weaklist__,
respectively.  With unit test.
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 974fd25..023fcc8 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3686,6 +3686,19 @@
     vereq(E(1) / C(1), "C.__div__")
     vereq(C(1) / E(1), "C.__div__") # This one would fail
 
+def dict_type_with_metaclass():
+    if verbose:
+        print "Testing type of __dict__ when __metaclass__ set..."
+
+    class B(object):
+        pass
+    class M(type):
+        pass
+    class C:
+        # In 2.3a1, C.__dict__ was a real dict rather than a dict proxy
+        __metaclass__ = M
+    veris(type(C.__dict__), type(B.__dict__))
+
 
 def test_main():
     do_this_first()
@@ -3771,6 +3784,7 @@
     test_mutable_bases_catch_mro_conflict()
     mutable_names()
     subclass_right_op()
+    dict_type_with_metaclass()
 
     if verbose: print "All OK"