[issue10253] Fix fd leak in fileio.c and test resource warnings

2010-10-30 Thread Brian Brazil
New submission from Brian Brazil brian.bra...@gmail.com: fileio_init will leak a fd if you open a file for append that isn't seekable. We should close this fd before returning the failure. The attached patch fixes this and a resource warning in the tests, but I'm unsure if it'd be better to

[issue10253] Fix fd leak in fileio.c and test resource warnings

2010-10-30 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +amaury.forgeotdarc, benjamin.peterson stage: - patch review type: - resource usage versions: +Python 2.7, Python 3.1, Python 3.2 -Python 3.3 ___ Python tracker rep...@bugs.python.org

[issue10253] Fix fd leak in fileio.c and test resource warnings

2010-10-30 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: It should be closed only if closefd is true. Does it fix a warning in the test suite? Otherwise I think it would need its own test. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org

[issue10253] Fix fd leak in fileio.c and test resource warnings

2010-10-30 Thread Brian Brazil
Brian Brazil brian.bra...@gmail.com added the comment: Version 2 of the patch is attached. This fixes a warning at line 256 in test_fileio.py: f = _FileIO(/dev/tty, a) on my Hardy machine. -- Added file: http://bugs.python.org/file19433/fileio_fd_leak_v2.patch

[issue10253] Fix fd leak in fileio.c and test resource warnings

2010-10-30 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Committed in r85982, thank you. I will backport later. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org