classification
Title: Backport the IO lib to trunk
Type: behavior Stage: resolved
Components: IO Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti, amaury.forgeotdarc, benjamin.peterson, ocean-city, pitrou
Priority: normal Keywords: patch

Created on 2009-06-05 21:29 by pitrou, last changed 2009-06-20 17:35 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
iobackport.patch pitrou, 2009-06-05 21:28
iobackport2.patch pitrou, 2009-06-07 00:08
iobackport3.patch pitrou, 2009-06-12 17:13
self_open.patch ocean-city, 2009-06-15 00:51
Messages (20)
msg88974 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-05 21:28
The new IO lib has undergone deep changes in py3k which have never been
backported to trunk. This patch brings trunk up to date, including tests.
msg88976 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-05 22:08
Please note that test_io leaks references because of #2521. Otherwise
it's fine.
msg89023 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-07 00:08
New patch incorporating the latest py3k changes.
msg89163 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-06-09 20:17
I think the build configuration for _io on Windows is missing.
Modules/Setup.dist probably needs to be updated too.
msg89165 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-09 20:38
> I think the build configuration for _io on Windows is missing.

Yes.

> Modules/Setup.dist probably needs to be updated too.

Not sure, I don't think any of these modules are built-in.
msg89167 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-06-09 20:53
> Not sure, I don't think any of these modules are built-in.

Ah true. Although there are built-in in py3k, you are right that it
doesn't make sense to make the trunk versions built-in.
msg89291 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-12 17:13
Updated patch for recent py3k changes. I will commit soon if nobody objects.
msg89298 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-12 20:17
Done in r73394.
msg89299 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-12 20:18
Someone will probably have to fix the Windows build files, by the way (I
can't do it myself).
msg89300 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-06-12 20:24
Could simply merge the changes in r71185 to the PC/ and PCbuild/
directories?
msg89342 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-14 07:36
I think I could fix windows build issue. (r73423)

It seems some tests are failing. See
http://www.python.org/dev/buildbot/trunk.stable/x86%20XP-4%20trunk/builds/2244/step-test/0
msg89343 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-14 08:13
I found following patch can fix test_invalid_operations error on
windows. Is this correct fix? There are many other places using bare open().

Index: Lib/test/test_io.py
===================================================================
--- Lib/test/test_io.py	(revision 73422)
+++ Lib/test/test_io.py	(working copy)
@@ -298,13 +298,13 @@
     def test_invalid_operations(self):
         # Try writing on a file opened in read mode and vice-versa.
         for mode in ("w", "wb"):
-            with open(support.TESTFN, mode) as fp:
+            with self.open(support.TESTFN, mode) as fp:
                 self.assertRaises(IOError, fp.read)
                 self.assertRaises(IOError, fp.readline)
-        with open(support.TESTFN, "rb") as fp:
+        with self.open(support.TESTFN, "rb") as fp:
             self.assertRaises(IOError, fp.write, b"blah")
             self.assertRaises(IOError, fp.writelines, [b"blah\n"])
-        with open(support.TESTFN, "r") as fp:
+        with self.open(support.TESTFN, "r") as fp:
             self.assertRaises(IOError, fp.write, "blah")
             self.assertRaises(IOError, fp.writelines, ["blah\n"])
msg89361 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-14 18:18
> I found following patch can fix test_invalid_operations error on
> windows. Is this correct fix? There are many other places using bare open().

The fix looks ok. 
test_io should use self.open() instead of open() everywhere, except in
places where it's not used as a test.
msg89381 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-15 00:51
Here is a patch to convert open() and io.open() to self.open().

# I didn't change _default_chunk_size() but maybe should this also use
self.open()?
msg89382 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-15 00:55
> except in places where it's not used as a test.

I couldn't distinguish which one is that case, so I converted all
open(). ;-)
msg89440 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-16 22:28
Well, the patch looks ok, so you can commit it if it fixes things on
Windows. (I honestly haven't tested it, though)
msg89446 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-17 07:07
Committed in r73461.
msg89483 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-17 21:17
Everything looks ok, can you merge the commit to py3k so as to minimize
conflicts when merging stuff? Thanks :)
msg89486 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-06-18 00:38
Done in r73169.
msg89545 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-20 17:35
Everything looks ok, thanks!
History
Date User Action Args
2009-06-20 17:35:13pitrousetstatus: open -> closed

messages: + msg89545
2009-06-18 00:38:24ocean-citysetmessages: + msg89486
2009-06-17 21:17:37pitrousetmessages: + msg89483
2009-06-17 07:07:43ocean-citysetmessages: + msg89446
2009-06-16 22:28:02pitrousetmessages: + msg89440
2009-06-15 00:55:06ocean-citysetmessages: + msg89382
2009-06-15 00:51:58ocean-citysetfiles: + self_open.patch

messages: + msg89381
2009-06-14 18:18:28pitrousetmessages: + msg89361
2009-06-14 08:13:21ocean-citysetmessages: + msg89343
2009-06-14 07:36:42ocean-citysetnosy: + ocean-city
messages: + msg89342
2009-06-12 20:24:54alexandre.vassalottisetmessages: + msg89300
2009-06-12 20:18:21pitrousetstatus: pending -> open

messages: + msg89299
2009-06-12 20:17:19pitrousetstatus: open -> pending
resolution: fixed
messages: + msg89298

stage: patch review -> resolved
2009-06-12 17:14:13pitrousetfiles: + iobackport3.patch

messages: + msg89291
2009-06-09 20:53:15alexandre.vassalottisetmessages: + msg89167
2009-06-09 20:38:24pitrousetmessages: + msg89165
2009-06-09 20:17:34alexandre.vassalottisetmessages: + msg89163
2009-06-07 00:09:48pitrousetfiles: + iobackport2.patch

messages: + msg89023
2009-06-05 22:08:07pitrousetnosy: + amaury.forgeotdarc, alexandre.vassalotti, benjamin.peterson
messages: + msg88976
2009-06-05 21:29:16pitroucreate