[Python-checkins] r83902 - in python/branches/release27-maint: Lib/test/test_ioctl.py Lib/test/test_urllib2_localnet.py Misc/NEWS Objects/stringlib/fastsearch.h Tools/scripts/2to3
florent.xicluna
python-checkins at python.org
Mon Aug 9 22:02:00 CEST 2010
Author: florent.xicluna
Date: Mon Aug 9 22:02:00 2010
New Revision: 83902
Log:
Merged revisions 83833,83838-83839,83859,83878 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83833 | florent.xicluna | 2010-08-08 18:25:27 +0200 (dim., 08 août 2010) | 2 lines
Add test case for the HTTPResponse being an iterable. Follow-up of issue #4608.
........
r83838 | florent.xicluna | 2010-08-08 20:03:44 +0200 (dim., 08 août 2010) | 2 lines
Typo.
........
r83839 | florent.xicluna | 2010-08-08 20:06:13 +0200 (dim., 08 août 2010) | 2 lines
Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
........
r83859 | florent.xicluna | 2010-08-09 00:07:16 +0200 (lun., 09 août 2010) | 2 lines
Fix #8530: Prevent stringlib fastsearch from reading beyond the front of an array.
........
r83878 | florent.xicluna | 2010-08-09 10:29:08 +0200 (lun., 09 août 2010) | 1 line
Merge the 2to3 script from /sandbox/trunk/2to3/2to3, revision 72867 (latest).
........
Modified:
python/branches/release27-maint/Lib/test/test_ioctl.py
python/branches/release27-maint/Lib/test/test_urllib2_localnet.py
python/branches/release27-maint/Misc/NEWS
python/branches/release27-maint/Objects/stringlib/fastsearch.h
python/branches/release27-maint/Tools/scripts/2to3
Modified: python/branches/release27-maint/Lib/test/test_ioctl.py
==============================================================================
--- python/branches/release27-maint/Lib/test/test_ioctl.py (original)
+++ python/branches/release27-maint/Lib/test/test_ioctl.py Mon Aug 9 22:02:00 2010
@@ -7,9 +7,17 @@
try:
tty = open("/dev/tty", "r")
- tty.close()
except IOError:
raise unittest.SkipTest("Unable to open /dev/tty")
+else:
+ # Skip if another process is in foreground
+ r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
+ tty.close()
+ rpgrp = struct.unpack("i", r)[0]
+ if rpgrp not in (os.getpgrp(), os.getsid(0)):
+ raise unittest.SkipTest("Neither the process group nor the session "
+ "are attached to /dev/tty")
+ del tty, r, rpgrp
try:
import pty
Modified: python/branches/release27-maint/Lib/test/test_urllib2_localnet.py
==============================================================================
--- python/branches/release27-maint/Lib/test/test_urllib2_localnet.py (original)
+++ python/branches/release27-maint/Lib/test/test_urllib2_localnet.py Mon Aug 9 22:02:00 2010
@@ -501,6 +501,30 @@
# parameterize the framework with a mock resolver.
urllib2.urlopen, "http://sadflkjsasf.i.nvali.d./")
+ def test_iteration(self):
+ expected_response = "pycon 2008..."
+ handler = self.start_server([(200, [], expected_response)])
+ try:
+ data = urllib2.urlopen("http://localhost:%s" % handler.port)
+ for line in data:
+ self.assertEqual(line, expected_response)
+ finally:
+ self.server.stop()
+
+ def ztest_line_iteration(self):
+ lines = ["We\n", "got\n", "here\n", "verylong " * 8192 + "\n"]
+ expected_response = "".join(lines)
+ handler = self.start_server([(200, [], expected_response)])
+ try:
+ data = urllib2.urlopen("http://localhost:%s" % handler.port)
+ for index, line in enumerate(data):
+ self.assertEqual(line, lines[index],
+ "Fetched line number %s doesn't match expected:\n"
+ " Expected length was %s, got %s" %
+ (index, len(lines[index]), len(line)))
+ finally:
+ self.server.stop()
+ self.assertEqual(index + 1, len(lines))
def test_main():
# We will NOT depend on the network resource flag
Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS (original)
+++ python/branches/release27-maint/Misc/NEWS Mon Aug 9 22:02:00 2010
@@ -12,6 +12,9 @@
Core and Builtins
-----------------
+- Issue #8530: Prevent stringlib fastsearch from reading beyond the front
+ of an array.
+
- Issue #83755: Implicit set-to-frozenset conversion was not thread-safe.
- Issue #9416: Fix some issues with complex formatting where the
@@ -203,6 +206,8 @@
Tests
-----
+- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
+
- Issue #8433: Fix test_curses failure with newer versions of ncurses.
- Issue #9496: Provide a test suite for the rlcompleter module. Patch by
Modified: python/branches/release27-maint/Objects/stringlib/fastsearch.h
==============================================================================
--- python/branches/release27-maint/Objects/stringlib/fastsearch.h (original)
+++ python/branches/release27-maint/Objects/stringlib/fastsearch.h Mon Aug 9 22:02:00 2010
@@ -140,13 +140,13 @@
/* got a match! */
return i;
/* miss: check if previous character is part of pattern */
- if (!STRINGLIB_BLOOM(mask, s[i-1]))
+ if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
i = i - m;
else
i = i - skip;
} else {
/* skip: check if previous character is part of pattern */
- if (!STRINGLIB_BLOOM(mask, s[i-1]))
+ if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
i = i - m;
}
}
Modified: python/branches/release27-maint/Tools/scripts/2to3
==============================================================================
--- python/branches/release27-maint/Tools/scripts/2to3 (original)
+++ python/branches/release27-maint/Tools/scripts/2to3 Mon Aug 9 22:02:00 2010
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-from lib2to3.main import main
import sys
-import os
+from lib2to3.main import main
sys.exit(main("lib2to3.fixes"))
More information about the Python-checkins
mailing list