[pypy-commit] pypy py3k: cpyext: py3k-ify test_sysmodule.py

amauryfa noreply at buildbot.pypy.org
Fri Sep 21 23:53:29 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r57462:6637d0469f1b
Date: 2012-09-21 00:03 +0200
http://bitbucket.org/pypy/pypy/changeset/6637d0469f1b/

Log:	cpyext: py3k-ify test_sysmodule.py

diff --git a/pypy/module/cpyext/test/test_sysmodule.py b/pypy/module/cpyext/test/test_sysmodule.py
--- a/pypy/module/cpyext/test/test_sysmodule.py
+++ b/pypy/module/cpyext/test/test_sysmodule.py
@@ -7,7 +7,7 @@
         module = self.import_extension('foo', [
             ("get", "METH_VARARGS",
              """
-                 char *name = PyString_AsString(PyTuple_GetItem(args, 0));
+                 char *name = _PyUnicode_AsString(PyTuple_GetItem(args, 0));
                  PyObject *retval = PySys_GetObject(name);
                  return PyBool_FromLong(retval != NULL);
              """)])
@@ -21,9 +21,9 @@
                  PySys_WriteStdout("format: %d\\n", 42);
                  Py_RETURN_NONE;
              """)])
-        import sys, StringIO
+        import sys, io
         prev = sys.stdout
-        sys.stdout = StringIO.StringIO()
+        sys.stdout = io.StringIO()
         try:
             module.writestdout()
             assert sys.stdout.getvalue() == "format: 42\n"


More information about the pypy-commit mailing list