[pypy-svn] pypy default: Set __module__ on StringIO (probably should happen for all the types).

alex_gaynor commits-noreply at bitbucket.org
Sat Jan 29 20:09:29 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r41464:aa4c664ce636
Date: 2011-01-29 14:09 -0500
http://bitbucket.org/pypy/pypy/changeset/aa4c664ce636/

Log:	Set __module__ on StringIO (probably should happen for all the
	types).

diff --git a/pypy/module/_io/interp_stringio.py b/pypy/module/_io/interp_stringio.py
--- a/pypy/module/_io/interp_stringio.py
+++ b/pypy/module/_io/interp_stringio.py
@@ -144,6 +144,7 @@
 
 W_StringIO.typedef = TypeDef(
     'StringIO', W_TextIOBase.typedef,
+    __module__ = "_io",
     __new__  = generic_new_descr(W_StringIO),
     __init__ = interp2app(W_StringIO.descr_init),
     write = interp2app(W_StringIO.write_w),

diff --git a/pypy/module/_io/test/test_stringio.py b/pypy/module/_io/test/test_stringio.py
--- a/pypy/module/_io/test/test_stringio.py
+++ b/pypy/module/_io/test/test_stringio.py
@@ -112,3 +112,8 @@
         sio = io.StringIO(u"")
         exc_info = raises(TypeError, sio.write, 3)
         assert "int" in exc_info.value.args[0]
+
+    def test_module(self):
+        import io
+
+        assert io.StringIO.__module__ == "_io"

diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -270,7 +270,7 @@
     readline = interp2app(W_IOBase.readline_w),
     readlines = interp2app(W_IOBase.readlines_w),
     writelines = interp2app(W_IOBase.writelines_w),
-    )
+)
 
 class W_RawIOBase(W_IOBase):
     # ________________________________________________________________
@@ -311,5 +311,4 @@
 
     read = interp2app(W_RawIOBase.read_w),
     readall = interp2app(W_RawIOBase.readall_w),
-    )
-
+)


More information about the Pypy-commit mailing list