[issue1329] Different 3.0a1 exit behavior

Christian Heimes report at bugs.python.org
Tue Oct 30 07:33:20 CET 2007


Christian Heimes added the comment:

Guido van Rossum wrote:
> Shouldn't closefd be passed as 1 in import.c?
> 
> I don't see the point of distinguishing between -1 and +1.  The block
> "if (closefd < 0) { closefd = 1; }" looks rather silly.

I used -1 as default to keep it consistent with buffer=-1. I figured out
that I can go with "closefd != 0 means close it".

> In io.py, you should document that closefd must not be False when a
> filename is given.

Done

> I think in _fileio.c, you can insist that the closefd argument is an int
> (a bool will work anyway, as bool is a subclass of int).

Thanks, it makes the code a bit easier.

> I don't think we should warn when trying to close an unclosable fd; it
> should really just be a no-op.  Also, if you are going to call
> PyErr_WarnEx(), you should test its return value (it can raise an
> exception!).

I think we should keep the warning. The warning made me aware of a minor
bug in quopri.

> Please don't add trailing whitespace.

I've reconfigured my editor to remove trailing spaces.

I've attached a combined patch for closefd and preliminary stderr.

Christian

Added file: http://bugs.python.org/file8662/py3k_combined_preliminary_closefd.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1329>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py3k_combined_preliminary_closefd.patch
Type: text/x-patch
Size: 13242 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20071030/ca99d724/attachment-0001.bin 


More information about the Python-bugs-list mailing list