[issue5395] array.fromfile not checking I/O errors

2010-07-21 Thread Mark Lawrence
Mark Lawrence breamore...@yahoo.co.uk added the comment: With the latest patch on Windows Vista against 2.7 I got 12 EOFError errors instead of IOError. -- nosy: +BreamoreBoy versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org

[issue5395] array.fromfile not checking I/O errors

2010-07-21 Thread Mark Lawrence
Mark Lawrence breamore...@yahoo.co.uk added the comment: Sorry for the noise, forgot to rebuild the code. The tests run fine 543 tests ok, except I note that all the output is repeated 6 times, I don't understand this at all. -- ___ Python tracker

[issue5395] array.fromfile not checking I/O errors

2010-07-21 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Will polish the patch and commit. -- assignee: - pitrou resolution: - accepted stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5395

[issue5395] array.fromfile not checking I/O errors

2010-07-21 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I've committed the new test in py3k (r83030) and 3.1 (r83033), and the full patch in 2.7 (r83031) and 2.6 (r83032). Thank you! -- resolution: accepted - fixed stage: commit review - committed/rejected status: open - closed versions:

[issue5395] array.fromfile not checking I/O errors

2010-07-21 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Regarding: The tests run fine 543 tests ok, except I note that all the output is repeated 6 times, I don't understand this at all. This is normal, all array tests are run once per array type, and 6 different array types are being tested.

[issue5395] array.fromfile not checking I/O errors

2009-10-06 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: Maybe you could create a file without read permission (000) and try to read from it. I just checked. If I don't have read permissions, I am not able to open the file. When I open a file and change permissions afterwards, I can read the

[issue5395] array.fromfile not checking I/O errors

2009-10-06 Thread Eduardo Aguiar
Eduardo Aguiar agu...@users.sourceforge.net added the comment: Another try. I have opened a file for writing, and have tried to read from it: fp = open ('xxx', 'w') fp.read () Traceback (most recent call last): File stdin, line 1, in module IOError: [Errno 9] Bad file descriptor --

[issue5395] array.fromfile not checking I/O errors

2009-10-06 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: Thanks Aduardo! (I could have sworn I tried that.) I changed the test to reading from a file in 'wb' mode, which raised a EOFError before and now raises IOErrors. -- Added file: http://bugs.python.org/file15055/array_ioerror.patch

[issue5395] array.fromfile not checking I/O errors

2009-10-05 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: 12) I removed the try/except around the import. I have no clue if os might be unavailable. Maybe leave out handling that until we see that breaking. I added the try/except because I saw that in other tests in the same file when importing gc.

[issue5395] array.fromfile not checking I/O errors

2009-10-05 Thread Eduardo Aguiar
Eduardo Aguiar agu...@users.sourceforge.net added the comment: Maybe you could create a file without read permission (000) and try to read from it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5395

[issue5395] array.fromfile not checking I/O errors

2009-10-04 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: Ezio, I moved the test to a separate method. Also I couldn't find something to close the file if I don't care about errors. I thought an assertRises would be wrong, as I am not debugging files here, so I added a function to call a callable I

[issue5395] array.fromfile not checking I/O errors

2009-10-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: There doesn't seem to be any reason to introduce the expect_exception() helper, rather than to use a with statement. Am I mistaken? -- nosy: +pitrou stage: test needed - patch review versions: +Python 2.7, Python 3.2 -Python 2.6

[issue5395] array.fromfile not checking I/O errors

2009-10-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Ok, I get it, you want f.close() to always succeed, even if the underlying file descriptor has already been closed. Well, I so no reason to introduce a helper anyway, the following four lines are much more readable and explicit: try:

[issue5395] array.fromfile not checking I/O errors

2009-10-04 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I tried to apply both the patches on the trunk but the tests don't pass. With the latest patch I get an EOFError instead of IOError in the assertRaises. The function I was talking about was test_support.unlink(), but that just removes the

[issue5395] array.fromfile not checking I/O errors

2009-10-03 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5395 ___ ___ Python-bugs-list

[issue5395] array.fromfile not checking I/O errors

2009-09-24 Thread Jan Hosang
Jan Hosang jan.hos...@gmail.com added the comment: I attached a path for raising IOErrors in fromfile. I also added a testcase which failed before. The test opens a file and closes the file with os.close(fd) without telling the file object, so fromfile doesn't notice it's reading from a file

[issue5395] array.fromfile not checking I/O errors

2009-04-22 Thread Daniel Diniz
Changes by Daniel Diniz aja...@gmail.com: -- keywords: +easy priority: - normal stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5395 ___

[issue5395] array.fromfile not checking I/O errors

2009-02-28 Thread Eduardo Aguiar
New submission from Eduardo Aguiar agu...@users.sourceforge.net: At arraymodule.c (line 1258): nread = fread(item + (Py_SIZE(self) - n) * itemsize, itemsize, n, fp); if (nread (size_t)n) { Py_SIZE(self) -= (n -