[pypy-svn] rev 2336 - pypy/trunk/src/pypy/appspace

sschwarzer at codespeak.net sschwarzer at codespeak.net
Mon Dec 15 17:25:27 CET 2003


Author: sschwarzer
Date: Mon Dec 15 17:25:27 2003
New Revision: 2336

Modified:
   pypy/trunk/src/pypy/appspace/_types.py
Log:
committed with corrected EOL setting


Modified: pypy/trunk/src/pypy/appspace/_types.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/_types.py	(original)
+++ pypy/trunk/src/pypy/appspace/_types.py	Mon Dec 15 17:25:27 2003
@@ -59,7 +59,7 @@
 _register(pypy.ObjectFactory, object)
 
 
-class bool(object):
+class bool(int):
 
     def __new__(cls, *args):
         if cls is bool:
@@ -176,6 +176,16 @@
     def __repr__(self):
         return str(self)
 
+# add to dict all and only those methods that used to be defined in
+# objspace/std/dicttype.py, but get the implementations from the
+# excellent code in UserDict.DictMixin instead (no inheritance for
+# two reasons: we could not control what methods we get, and we do
+# not want DictMixin among user-visible __bases__).
+import UserDict
+for attribute in 'update popitem get setdefault pop'
+                 'iteritems iterkeys itervalues'.split():
+    setattr(dict, attribute, UserDict.DictMixin.__dict__[attribute])
+
 _register(pypy.DictObjectFactory, dict)
 
 setattr(_types, 'DictionaryType', dict)


More information about the Pypy-commit mailing list