New submission from Amaury Forgeot d'Arc <[EMAIL PROTECTED]>: The changes following r67300 introduced the .mode and .name attributes on all the file-like objects returned by the open() function.
This also changed the mode returned by a file opened in binary mode: it was "rb", now it is "r". The fact that the mode does not "round-trip" (i.e: open(f, mode).mode != mode) was considered not important. But now it is difficult to see if some opened file was opened in text or binary mode; in test_gzip.py, a test had to be changed, and now it does not test anything at all: the intent of the test is just to verify that a zip file is always opened in binary mode. Benjamin suggested to change the mode returned by FileIO objects, so that they always contain a 'b'. They also accept an extra 'b' on creation: it is just ignored. Now, for a file opened in text mode: >>> f = open('filename') >>> assert f.mode == 'r' >>> assert f.buffer.mode == 'rb' >>> assert f.buffer.raw.mode == 'rb' The mode attribute is now always consistent with the one passed to the open() function. This also avoid gratuitous breakage with python2.x. Patch attached. All tests pass. ---------- assignee: benjamin.peterson files: fileio_mode.patch keywords: needs review, patch messages: 76225 nosy: amaury.forgeotdarc, benjamin.peterson priority: release blocker severity: normal stage: patch review status: open title: A binary file should show "b" in its mode type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file12104/fileio_mode.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4386> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com