Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r72704:089c2104902a
Date: 2014-08-06 18:54 +0200
http://bitbucket.org/pypy/pypy/changeset/089c2104902a/

Log:    Convert some classes in rlib away from using _mixin_. These classes
        can either be directly instantiated (and then they are not mixins at
        all), or we can use import_from_mixin(), as done now in
        pypy/module/.

diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -4,12 +4,15 @@
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from rpython.rlib.rStringIO import RStringIO
 from rpython.rlib.rarithmetic import r_longlong
+from rpython.rlib.objectmodel import import_from_mixin
 from pypy.module._io.interp_bufferedio import W_BufferedIOBase
 from pypy.module._io.interp_iobase import convert_size
 import sys
 
 
-class W_BytesIO(RStringIO, W_BufferedIOBase):
+class W_BytesIO(W_BufferedIOBase):
+    import_from_mixin(RStringIO)
+
     def __init__(self, space):
         W_BufferedIOBase.__init__(self, space, add_to_autoflusher=False)
         self.init()
diff --git a/pypy/module/_md5/interp_md5.py b/pypy/module/_md5/interp_md5.py
--- a/pypy/module/_md5/interp_md5.py
+++ b/pypy/module/_md5/interp_md5.py
@@ -1,13 +1,15 @@
 from rpython.rlib import rmd5
+from rpython.rlib.objectmodel import import_from_mixin
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 
 
-class W_MD5(W_Root, rmd5.RMD5):
+class W_MD5(W_Root):
     """
     A subclass of RMD5 that can be exposed to app-level.
     """
+    import_from_mixin(rmd5.RMD5)
 
     def __init__(self, space):
         self.space = space
diff --git a/pypy/module/_sha/interp_sha.py b/pypy/module/_sha/interp_sha.py
--- a/pypy/module/_sha/interp_sha.py
+++ b/pypy/module/_sha/interp_sha.py
@@ -1,13 +1,15 @@
 from rpython.rlib import rsha
+from rpython.rlib.objectmodel import import_from_mixin
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 
 
-class W_SHA(W_Root, rsha.RSHA):
+class W_SHA(W_Root):
     """
     A subclass of RSHA that can be exposed to app-level.
     """
+    import_from_mixin(rsha.RSHA)
 
     def __init__(self, space):
         self.space = space
diff --git a/pypy/module/cStringIO/interp_stringio.py 
b/pypy/module/cStringIO/interp_stringio.py
--- a/pypy/module/cStringIO/interp_stringio.py
+++ b/pypy/module/cStringIO/interp_stringio.py
@@ -3,6 +3,7 @@
 from pypy.interpreter.typedef import TypeDef, GetSetProperty
 from pypy.interpreter.gateway import interp2app, unwrap_spec
 from rpython.rlib.rStringIO import RStringIO
+from rpython.rlib.objectmodel import import_from_mixin
 
 
 class W_InputOutputType(W_Root):
@@ -144,7 +145,9 @@
 
 # ____________________________________________________________
 
-class W_OutputType(RStringIO, W_InputOutputType):
+class W_OutputType(W_InputOutputType):
+    import_from_mixin(RStringIO)
+
     def __init__(self, space):
         self.init()
         self.space = space
diff --git a/rpython/rlib/rStringIO.py b/rpython/rlib/rStringIO.py
--- a/rpython/rlib/rStringIO.py
+++ b/rpython/rlib/rStringIO.py
@@ -8,8 +8,6 @@
     The fastest path through this code is for the case of a bunch of write()
     followed by getvalue().
     """
-    _mixin_ = True        # for interp_stringio.py
-
     def __init__(self):
         self.init()
 
diff --git a/rpython/rlib/rmd5.py b/rpython/rlib/rmd5.py
--- a/rpython/rlib/rmd5.py
+++ b/rpython/rlib/rmd5.py
@@ -132,8 +132,6 @@
 class RMD5(object):
     """RPython-level MD5 object.
     """
-    _mixin_ = True        # for interp_md5.py
-
     def __init__(self, initialdata=''):
         self._init()
         self.update(initialdata)
diff --git a/rpython/rlib/rsha.py b/rpython/rlib/rsha.py
--- a/rpython/rlib/rsha.py
+++ b/rpython/rlib/rsha.py
@@ -95,8 +95,6 @@
 class RSHA(object):
     """RPython-level SHA object.
     """
-    _mixin_ = True        # for interp_sha.py
-
     def __init__(self, initialdata=''):
         self._init()
         self.update(initialdata)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to