Guido van Rossum added the comment:

> I've carefully checked and tested the initstdio() method. I'm sure that
> I've catched every edged case. The unit tests pass w/o complains.
>
> I've also added a PyErr_Display() call to Py_FatalError(). It's still
> hard to understand an error in io.py but at least the dependency on
> site.py is removed.

Very cool!

Some final suggestions:

+               Py_FatalError("Py_Initialize: can't initialize sys standard"
+                               "streams");

Break this differently:

    Py_FatalError(
        "Py_........");

Don't call open() with keyword arg for newline="\r"; open() takes
positional args too. This is done specifically to simplify life for C
code calling it. :-) Perhaps one of the PyFunction_Call(..) variants
makes it easier to call it without having to explicitly construct the
tuple for the argument list. (All this because you're leaking the
value of PyString_FromString("\n"). :-)

I would change the error handling to avoid the 'finally' label, like this:

        if (0) {
  error:
                status = -1;
                Py_XDECREF(args);
        }

I would add a comment "see initstdio() in pythonrun.c" to the
OpenWrapper class, which otherwise looks a bit mysterious (as it's not
used anywhere in the Python code).

Thanks for doing this!!!

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1267>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to