This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: array.fromfile() fails to insert values when EOFError is raised
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ocean-city, zmedico
Priority: normal Keywords: patch

Created on 2009-02-21 04:07 by zmedico, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fromfile_eof.py zmedico, 2009-02-21 04:21 test case demonstrating array.fromfile() failure
py3k_fix_array_fromfile.patch ocean-city, 2009-02-26 20:43
Messages (5)
msg82558 - (view) Author: Zac Medico (zmedico) Date: 2009-02-21 04:07
With python-3.0, array.fromfile() fails to insert values when EOFError
is raised. I ran the attached test case with python-3.0.1 and got the
same result on both linux and windows. With python-2.x, the values are
properly inserted despite an EOFError, as the documentation states it
should:

array.fromfile(f, n)

Read n items (as machine values) from the file object f and append them
to the end of the array. If less than n items are available, EOFError is
raised, but the items that were available are still inserted into the
array. f must be a real built-in file object; something else with a
read() method won’t do.
msg82775 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-26 20:43
Patch attached.
msg82823 - (view) Author: Zac Medico (zmedico) Date: 2009-02-27 07:52
Thanks for the patch. It works for me.
msg83218 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-03-05 21:24
Patch looks good. Please apply.
msg83235 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-03-06 03:13
Committed in r70203(py3k)
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49584
2010-04-27 20:32:39loewissetpriority: normal
2009-03-06 03:13:25ocean-citysetstatus: open -> closed
resolution: fixed
messages: + msg83235
priority: release blocker -> (no value)
2009-03-05 21:24:42benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg83218
2009-03-03 23:26:28ocean-citysetpriority: release blocker
versions: + Python 3.1
2009-02-27 07:52:27zmedicosetmessages: + msg82823
components: + Library (Lib), - Extension Modules
versions: - Python 3.1
2009-02-26 20:43:45ocean-citysetfiles: + py3k_fix_array_fromfile.patch
versions: + Python 3.1
nosy: + ocean-city
messages: + msg82775
components: + Extension Modules, - Library (Lib)
keywords: + patch
2009-02-21 04:22:03zmedicosetfiles: - fromfile_eof.py
2009-02-21 04:21:57zmedicosetfiles: + fromfile_eof.py
2009-02-21 04:07:57zmedicocreate