Merged revisions 58742-58816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58745 | georg.brandl | 2007-11-01 10:19:33 -0700 (Thu, 01 Nov 2007) | 2 lines
#1364: os.lstat is available on Windows too, as an alias to os.stat.
........
r58750 | christian.heimes | 2007-11-01 12:48:10 -0700 (Thu, 01 Nov 2007) | 1 line
Backport of import tests for bug http://bugs.python.org/issue1293 and bug http://bugs.python.org/issue1342
........
r58751 | christian.heimes | 2007-11-01 13:11:06 -0700 (Thu, 01 Nov 2007) | 1 line
Removed non ASCII text from test as requested by Guido. Sorry :/
........
r58753 | georg.brandl | 2007-11-01 13:37:02 -0700 (Thu, 01 Nov 2007) | 2 lines
Fix markup glitch.
........
r58757 | gregory.p.smith | 2007-11-01 14:08:14 -0700 (Thu, 01 Nov 2007) | 4 lines
Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them. Replace the errant strdup with a
malloc+memcpy. Adds a unit test for the correct behavior.
........
r58758 | gregory.p.smith | 2007-11-01 14:15:36 -0700 (Thu, 01 Nov 2007) | 3 lines
Undo revision 58533 58534 fixes. Those were a workaround for
a problem introduced by 58385.
........
r58759 | gregory.p.smith | 2007-11-01 14:17:47 -0700 (Thu, 01 Nov 2007) | 2 lines
false "fix" undone as correct problem was found and fixed.
........
r58765 | mark.summerfield | 2007-11-02 01:24:59 -0700 (Fri, 02 Nov 2007) | 3 lines
Added more file-handling related cross-references.
........
r58766 | nick.coghlan | 2007-11-02 03:09:12 -0700 (Fri, 02 Nov 2007) | 1 line
Fix for bug 1705170 - contextmanager swallowing StopIteration (2.5 backport candidate)
........
r58784 | thomas.heller | 2007-11-02 12:10:24 -0700 (Fri, 02 Nov 2007) | 4 lines
Issue #1292: On alpha, arm, ppc, and s390 linux systems the
--with-system-ffi configure option defaults to "yes" because the
bundled libffi sources are too old.
........
r58785 | thomas.heller | 2007-11-02 12:11:23 -0700 (Fri, 02 Nov 2007) | 1 line
Enable the full ctypes c_longdouble tests again.
........
r58796 | georg.brandl | 2007-11-02 13:06:17 -0700 (Fri, 02 Nov 2007) | 4 lines
Make "hashable" a glossary entry and clarify docs on __cmp__, __eq__ and __hash__.
I hope the concept of hashability is better understandable now.
Thanks to Tim Hatch for pointing out the flaws here.
........
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py
index 06fcf8a..56b4e3a 100644
--- a/Lib/bsddb/dbtables.py
+++ b/Lib/bsddb/dbtables.py
@@ -362,7 +362,7 @@
unique = 0
while not unique:
# Generate a random 64-bit row ID string
- # (note: might have <64 bits of randomness
+ # (note: might have <64 bits of true randomness
# but it's plenty for our database id needs!)
blist = []
for x in range(_rowid_str_len):
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index fba4889..aeec40e 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -25,6 +25,10 @@
else:
raise RuntimeError("generator didn't stop")
else:
+ if value is None:
+ # Need to force instantiation so we can reliably
+ # tell if we get the same exception back
+ value = type()
try:
self.gen.throw(type, value, traceback)
raise RuntimeError("generator didn't stop after throw()")
diff --git a/Lib/ctypes/test/test_cfuncs.py b/Lib/ctypes/test/test_cfuncs.py
index e939bc1..8f97fc4 100644
--- a/Lib/ctypes/test/test_cfuncs.py
+++ b/Lib/ctypes/test/test_cfuncs.py
@@ -158,17 +158,17 @@
self.failUnlessEqual(self._dll.tf_bd(0, 42.), 14.)
self.failUnlessEqual(self.S(), 42)
-## def test_longdouble(self):
-## self._dll.tf_D.restype = c_longdouble
-## self._dll.tf_D.argtypes = (c_longdouble,)
-## self.failUnlessEqual(self._dll.tf_D(42.), 14.)
-## self.failUnlessEqual(self.S(), 42)
+ def test_longdouble(self):
+ self._dll.tf_D.restype = c_longdouble
+ self._dll.tf_D.argtypes = (c_longdouble,)
+ self.failUnlessEqual(self._dll.tf_D(42.), 14.)
+ self.failUnlessEqual(self.S(), 42)
-## def test_longdouble_plus(self):
-## self._dll.tf_bD.restype = c_longdouble
-## self._dll.tf_bD.argtypes = (c_byte, c_longdouble)
-## self.failUnlessEqual(self._dll.tf_bD(0, 42.), 14.)
-## self.failUnlessEqual(self.S(), 42)
+ def test_longdouble_plus(self):
+ self._dll.tf_bD.restype = c_longdouble
+ self._dll.tf_bD.argtypes = (c_byte, c_longdouble)
+ self.failUnlessEqual(self._dll.tf_bD(0, 42.), 14.)
+ self.failUnlessEqual(self.S(), 42)
def test_callwithresult(self):
def process_result(result):
diff --git a/Lib/ctypes/test/test_functions.py b/Lib/ctypes/test/test_functions.py
index 626af94..3af11cc 100644
--- a/Lib/ctypes/test/test_functions.py
+++ b/Lib/ctypes/test/test_functions.py
@@ -143,17 +143,17 @@
self.failUnlessEqual(result, -21)
self.failUnlessEqual(type(result), float)
-## def test_longdoubleresult(self):
-## f = dll._testfunc_D_bhilfD
-## f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_longdouble]
-## f.restype = c_longdouble
-## result = f(1, 2, 3, 4, 5.0, 6.0)
-## self.failUnlessEqual(result, 21)
-## self.failUnlessEqual(type(result), float)
+ def test_longdoubleresult(self):
+ f = dll._testfunc_D_bhilfD
+ f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_longdouble]
+ f.restype = c_longdouble
+ result = f(1, 2, 3, 4, 5.0, 6.0)
+ self.failUnlessEqual(result, 21)
+ self.failUnlessEqual(type(result), float)
-## result = f(-1, -2, -3, -4, -5.0, -6.0)
-## self.failUnlessEqual(result, -21)
-## self.failUnlessEqual(type(result), float)
+ result = f(-1, -2, -3, -4, -5.0, -6.0)
+ self.failUnlessEqual(result, -21)
+ self.failUnlessEqual(type(result), float)
def test_longlongresult(self):
try:
diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py
index a7bc206..e778463 100644
--- a/Lib/test/test_with.py
+++ b/Lib/test/test_with.py
@@ -442,6 +442,7 @@
self.assertAfterWithGeneratorInvariantsNoError(self.bar)
def testRaisedStopIteration1(self):
+ # From bug 1462485
@contextmanager
def cm():
yield
@@ -453,6 +454,7 @@
self.assertRaises(StopIteration, shouldThrow)
def testRaisedStopIteration2(self):
+ # From bug 1462485
class cm(object):
def __enter__(self):
pass
@@ -465,7 +467,21 @@
self.assertRaises(StopIteration, shouldThrow)
+ def testRaisedStopIteration3(self):
+ # Another variant where the exception hasn't been instantiated
+ # From bug 1705170
+ @contextmanager
+ def cm():
+ yield
+
+ def shouldThrow():
+ with cm():
+ raise next(iter([]))
+
+ self.assertRaises(StopIteration, shouldThrow)
+
def testRaisedGeneratorExit1(self):
+ # From bug 1462485
@contextmanager
def cm():
yield
@@ -477,6 +493,7 @@
self.assertRaises(GeneratorExit, shouldThrow)
def testRaisedGeneratorExit2(self):
+ # From bug 1462485
class cm (object):
def __enter__(self):
pass