diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-03 23:01:04 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-03 23:01:04 (GMT) |
commit | 072c0f1b7e3d83dec98313bc07ae92ed15fe7e6d (patch) | |
tree | f13fa3a4f9ebd69f276837569c27d65c847a5a01 /Lib | |
parent | 1c9f4373d2fe9ce4f442c8066badb46850a543f3 (diff) | |
download | cpython-072c0f1b7e3d83dec98313bc07ae92ed15fe7e6d.zip cpython-072c0f1b7e3d83dec98313bc07ae92ed15fe7e6d.tar.gz cpython-072c0f1b7e3d83dec98313bc07ae92ed15fe7e6d.tar.bz2 |
Merged revisions 59666-59679 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59666 | christian.heimes | 2008-01-02 19:28:32 +0100 (Wed, 02 Jan 2008) | 1 line
Made vs9to8 Unix compatible
........
r59669 | guido.van.rossum | 2008-01-02 20:00:46 +0100 (Wed, 02 Jan 2008) | 2 lines
Patch #1696. Don't attempt to close None in dry-run mode.
........
r59671 | jeffrey.yasskin | 2008-01-03 03:21:52 +0100 (Thu, 03 Jan 2008) | 6 lines
Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
........
r59672 | christian.heimes | 2008-01-03 16:41:30 +0100 (Thu, 03 Jan 2008) | 1 line
Issue #1726: Remove Python/atof.c from PCBuild/pythoncore.vcproj
........
r59675 | guido.van.rossum | 2008-01-03 20:12:44 +0100 (Thu, 03 Jan 2008) | 4 lines
Issue #1700, reported by Nguyen Quan Son, fix by Fredruk Lundh:
Regular Expression inline flags not handled correctly for some unicode
characters. (Forward port from 2.5.2.)
........
r59676 | christian.heimes | 2008-01-03 21:23:15 +0100 (Thu, 03 Jan 2008) | 1 line
Added math.isinf() and math.isnan()
........
r59677 | christian.heimes | 2008-01-03 22:14:48 +0100 (Thu, 03 Jan 2008) | 1 line
Some build bots don't compile mathmodule. There is an issue with the long definition of pi and euler
........
r59678 | christian.heimes | 2008-01-03 23:16:32 +0100 (Thu, 03 Jan 2008) | 2 lines
Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
........
r59679 | christian.heimes | 2008-01-03 23:32:26 +0100 (Thu, 03 Jan 2008) | 1 line
Added copysign(x, y) function to the math module
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/command/build_scripts.py | 3 | ||||
-rw-r--r-- | Lib/sre_compile.py | 2 | ||||
-rw-r--r-- | Lib/test/test_math.py | 23 | ||||
-rw-r--r-- | Lib/test/test_re.py | 30 |
4 files changed, 56 insertions, 2 deletions
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py index 227bb9c..7b44264 100644 --- a/Lib/distutils/command/build_scripts.py +++ b/Lib/distutils/command/build_scripts.py @@ -110,7 +110,8 @@ class build_scripts(Command): if f: f.close() else: - f.close() + if f: + f.close() self.copy_file(script, outfile) if os.name == 'posix': diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index f9f0736..f3b415d 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -516,7 +516,7 @@ def compile(p, flags=0): indexgroup[i] = k return _sre.compile( - pattern, flags, code, + pattern, flags | p.pattern.flags, code, p.pattern.groups-1, groupindex, indexgroup ) diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 2d15f3a..8449794 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -231,6 +231,29 @@ class MathTests(unittest.TestCase): self.ftest('tanh(0)', math.tanh(0), 0) self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) + def testCopysign(self): + self.assertEqual(math.copysign(1, 42), 1.0) + self.assertEqual(math.copysign(0., 42), 0.0) + self.assertEqual(math.copysign(1., -42), -1.0) + self.assertEqual(math.copysign(3, 0.), 3.0) + self.assertEqual(math.copysign(4., -0.), -4.0) + + def testIsnan(self): + self.assert_(math.isnan(float("nan"))) + self.assert_(math.isnan(float("inf")* 0.)) + self.failIf(math.isnan(float("inf"))) + self.failIf(math.isnan(0.)) + self.failIf(math.isnan(1.)) + + def testIsinf(self): + self.assert_(math.isinf(float("inf"))) + self.assert_(math.isinf(float("-inf"))) + self.assert_(math.isinf(1E400)) + self.assert_(math.isinf(-1E400)) + self.failIf(math.isinf(float("nan"))) + self.failIf(math.isinf(0.)) + self.failIf(math.isinf(1.)) + # RED_FLAG 16-Oct-2000 Tim # While 2.0 is more consistent about exceptions than previous releases, it # still fails this part of the test on some platforms. For now, we only diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 88fecbf..75c016e 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -632,6 +632,36 @@ class ReTests(unittest.TestCase): self.assertEqual(re.compile("bla").match(a), None) self.assertEqual(re.compile("").match(a).groups(), ()) + def test_inline_flags(self): + # Bug #1700 + upper_char = unichr(0x1ea0) # Latin Capital Letter A with Dot Bellow + lower_char = unichr(0x1ea1) # Latin Small Letter A with Dot Bellow + + p = re.compile(upper_char, re.I | re.U) + q = p.match(lower_char) + self.assertNotEqual(q, None) + + p = re.compile(lower_char, re.I | re.U) + q = p.match(upper_char) + self.assertNotEqual(q, None) + + p = re.compile('(?i)' + upper_char, re.U) + q = p.match(lower_char) + self.assertNotEqual(q, None) + + p = re.compile('(?i)' + lower_char, re.U) + q = p.match(upper_char) + self.assertNotEqual(q, None) + + p = re.compile('(?iu)' + upper_char) + q = p.match(lower_char) + self.assertNotEqual(q, None) + + p = re.compile('(?iu)' + lower_char) + q = p.match(upper_char) + self.assertNotEqual(q, None) + + def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR if verbose: |