Message56488
| Author |
gvanrossum |
| Recipients |
brett.cannon, christian.heimes, gvanrossum |
| Date |
2007年10月16日.03:47:59 |
| SpamBayes Score |
0.0020275642 |
| Marked as misclassified |
No |
| Message-id |
<ca471dc20710152047m5083194fjdaf96d959f8977a8@mail.gmail.com> |
| In-reply-to |
<1192500685.39.0.29214068182.issue1267@psf.upfronthosting.co.za> |
| Content |
> 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!!! |
|