[pypy-commit] pypy winconsoleio: Started implementing winconsoleio

andrewjlawrence pypy.commits at gmail.com
Mon May 27 18:35:47 EDT 2019


Author: andrewjlawrence
Branch: winconsoleio
Changeset: r96703:01c16b67cba4
Date: 2019-05-27 10:27 +0100
http://bitbucket.org/pypy/pypy/changeset/01c16b67cba4/

Log:	Started implementing winconsoleio

diff --git a/pypy/module/_io/interp_win32consoleio.py b/pypy/module/_io/interp_win32consoleio.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/_io/interp_win32consoleio.py
@@ -0,0 +1,19 @@
+import sys
+
+from pypy.module._io.interp_iobase import W_RawIOBase
+
+class W_WinConsoleIO(W_RawIOBase):
+    def __init__(self, space):
+        W_RawIOBase.__init__(self, space)
+
+    def descr_init(self, space, w_nameobj, w_mode="r", w_closefd=True, w_opener=None):
+        #self.fd = -1
+        #self.created = 0
+        #self.readable = 0
+        #self.writable = 0
+        #self.closehandle = 0;
+        #self.blksize = 0
+        fd = space.int_w(w_nameobj)
+        if self.fd < 0:
+            raise oefmt(space.w_ValueError, "negative file descriptor")
+        self.fd = fd
diff --git a/pypy/module/_io/test/test_win32consoleio.py b/pypy/module/_io/test/test_win32consoleio.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/_io/test/test_win32consoleio.py
@@ -0,0 +1,12 @@
+class AppTestWinConsoleIO:
+    spaceconfig = dict(usemodules=['_io', '_locale', 'array'])
+
+    def setup_class(cls):
+        from rpython.rlib.rarithmetic import INT_MAX, UINT_MAX
+        space = cls.space
+        cls.w_INT_MAX = space.wrap(INT_MAX)
+        cls.w_UINT_MAX = space.wrap(UINT_MAX)
+
+    def test_constructor(self):
+        import _io
+        t = _io.WinConsoleIO()


More information about the pypy-commit mailing list