From python-checkins at python.org Fri Jul 1 03:06:32 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 03:06:32 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogdGVzdF9vczogYWRk?= =?utf8?q?_TemporaryFileTests_to_the_testcase_list?= Message-ID: http://hg.python.org/cpython/rev/00a874ad4fc9 changeset: 71104:00a874ad4fc9 branch: 3.2 parent: 71101:7c60c1b41da9 user: Victor Stinner date: Fri Jul 01 02:56:15 2011 +0200 summary: test_os: add TemporaryFileTests to the testcase list The testcase was never executed, it's now fixed. files: Lib/test/test_os.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1344,6 +1344,7 @@ PidTests, LoginTests, LinkTests, + TemporaryFileTests, ) if __name__ == "__main__": -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 03:06:33 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 03:06:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_test=5Fos=3A_add_TemporaryFileTests_to_the?= =?utf8?q?_testcase_list?= Message-ID: http://hg.python.org/cpython/rev/588fe0fc7160 changeset: 71105:588fe0fc7160 parent: 71103:0c49260e85a0 parent: 71104:00a874ad4fc9 user: Victor Stinner date: Fri Jul 01 02:57:33 2011 +0200 summary: (merge 3.2) test_os: add TemporaryFileTests to the testcase list The testcase was never executed, it's now fixed. files: Lib/test/test_os.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1632,6 +1632,7 @@ LinkTests, TestSendfile, ProgramPriorityTests, + TemporaryFileTests, ) if __name__ == "__main__": -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jul 1 05:09:12 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 01 Jul 2011 05:09:12 +0200 Subject: [Python-checkins] Daily reference leaks (588fe0fc7160): sum=300 Message-ID: results for 588fe0fc7160 on branch "default" -------------------------------------------- test_packaging leaked [100, 100, 100] references, sum=300 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog8iQK0e', '-x'] From python-checkins at python.org Fri Jul 1 12:59:35 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 12:59:35 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_libpython=2Epy_?= =?utf8?q?=28gdb=29_now_catchs_IOError_in_py-list_and_py-bt_commands?= Message-ID: http://hg.python.org/cpython/rev/316764e64b0a changeset: 71106:316764e64b0a branch: 3.2 parent: 71104:00a874ad4fc9 user: Victor Stinner date: Fri Jul 01 12:57:44 2011 +0200 summary: libpython.py (gdb) now catchs IOError in py-list and py-bt commands py-list displays the error. py-bt ignores the error (the filename and line number is already displayed). files: Tools/gdb/libpython.py | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -905,7 +905,11 @@ if self.is_optimized_out(): return '(frame information optimized out)' filename = self.filename() - with open(os_fsencode(filename), 'r') as f: + try: + f = open(os_fsencode(filename), 'r') + except IOError: + return None + with f: all_lines = f.readlines() # Convert from 1-based current_line_num to 0-based list offset: return all_lines[self.current_line_num()-1] @@ -1430,7 +1434,9 @@ if pyop: line = pyop.get_truncated_repr(MAX_OUTPUT_LEN) write_unicode(sys.stdout, '#%i %s\n' % (self.get_index(), line)) - sys.stdout.write(pyop.current_line()) + line = pyop.current_line() + if line is not None: + sys.stdout.write(line) else: sys.stdout.write('#%i (unable to read python frame information)\n' % self.get_index()) else: @@ -1441,7 +1447,9 @@ pyop = self.get_pyop() if pyop: pyop.print_traceback() - sys.stdout.write(' %s\n' % pyop.current_line().strip()) + line = pyop.current_line() + if line is not None: + sys.stdout.write(' %s\n' % line.strip()) else: sys.stdout.write(' (unable to read python frame information)\n') else: @@ -1501,7 +1509,13 @@ if start<1: start = 1 - with open(os_fsencode(filename), 'r') as f: + try: + f = open(os_fsencode(filename), 'r') + except IOError as err: + sys.stdout.write('Unable to open %s: %s\n' + % (filename, err)) + return + with f: all_lines = f.readlines() # start and end are 1-based, all_lines is 0-based; # so [start-1:end] as a python slice gives us [start, end] as a -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 12:59:36 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 12:59:36 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_libpython=2Epy_=28gdb=29_now_catchs_IOErro?= =?utf8?q?r_in_py-list_and_py-bt_commands?= Message-ID: http://hg.python.org/cpython/rev/2aa2a7c25f2c changeset: 71107:2aa2a7c25f2c parent: 71105:588fe0fc7160 parent: 71106:316764e64b0a user: Victor Stinner date: Fri Jul 01 12:59:30 2011 +0200 summary: (merge 3.2) libpython.py (gdb) now catchs IOError in py-list and py-bt commands py-list displays the error. py-bt ignores the error (the filename and line number is already displayed). files: Tools/gdb/libpython.py | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -905,7 +905,11 @@ if self.is_optimized_out(): return '(frame information optimized out)' filename = self.filename() - with open(os_fsencode(filename), 'r') as f: + try: + f = open(os_fsencode(filename), 'r') + except IOError: + return None + with f: all_lines = f.readlines() # Convert from 1-based current_line_num to 0-based list offset: return all_lines[self.current_line_num()-1] @@ -1430,7 +1434,9 @@ if pyop: line = pyop.get_truncated_repr(MAX_OUTPUT_LEN) write_unicode(sys.stdout, '#%i %s\n' % (self.get_index(), line)) - sys.stdout.write(pyop.current_line()) + line = pyop.current_line() + if line is not None: + sys.stdout.write(line) else: sys.stdout.write('#%i (unable to read python frame information)\n' % self.get_index()) else: @@ -1441,7 +1447,9 @@ pyop = self.get_pyop() if pyop: pyop.print_traceback() - sys.stdout.write(' %s\n' % pyop.current_line().strip()) + line = pyop.current_line() + if line is not None: + sys.stdout.write(' %s\n' % line.strip()) else: sys.stdout.write(' (unable to read python frame information)\n') else: @@ -1501,7 +1509,13 @@ if start<1: start = 1 - with open(os_fsencode(filename), 'r') as f: + try: + f = open(os_fsencode(filename), 'r') + except IOError as err: + sys.stdout.write('Unable to open %s: %s\n' + % (filename, err)) + return + with f: all_lines = f.readlines() # start and end are 1-based, all_lines is 0-based; # so [start-1:end] as a python slice gives us [start, end] as a -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 13:47:08 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 13:47:08 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogdGVzdF9vczogcmVt?= =?utf8?q?ove_now_useless_TemporaryFileTests_testcase?= Message-ID: http://hg.python.org/cpython/rev/aa3a4614a6f3 changeset: 71108:aa3a4614a6f3 branch: 3.2 parent: 71106:316764e64b0a user: Victor Stinner date: Fri Jul 01 13:45:30 2011 +0200 summary: test_os: remove now useless TemporaryFileTests testcase TemporaryFileTests has tests for os.tempnam() and os.tmpfile(), functions removed from Python 3. Move fdopen() tests to the FileTests testcase to test fdopen() on a file descriptor, not on a directory descriptor (which raises an error on Windows). files: Lib/test/test_os.py | 117 +------------------------------ 1 files changed, 6 insertions(+), 111 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -109,124 +109,20 @@ self.write_windows_console(sys.executable, "-c", code) self.write_windows_console(sys.executable, "-u", "-c", code) - -class TemporaryFileTests(unittest.TestCase): - def setUp(self): - self.files = [] - os.mkdir(support.TESTFN) - - def tearDown(self): - for name in self.files: - os.unlink(name) - os.rmdir(support.TESTFN) - - def check_tempfile(self, name): - # make sure it doesn't already exist: - self.assertFalse(os.path.exists(name), - "file already exists for temporary file") - # make sure we can create the file - open(name, "w") - self.files.append(name) - - def test_tempnam(self): - if not hasattr(os, "tempnam"): - return - warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, - r"test_os$") - self.check_tempfile(os.tempnam()) - - name = os.tempnam(support.TESTFN) - self.check_tempfile(name) - - name = os.tempnam(support.TESTFN, "pfx") - self.assertTrue(os.path.basename(name)[:3] == "pfx") - self.check_tempfile(name) - - def test_tmpfile(self): - if not hasattr(os, "tmpfile"): - return - # As with test_tmpnam() below, the Windows implementation of tmpfile() - # attempts to create a file in the root directory of the current drive. - # On Vista and Server 2008, this test will always fail for normal users - # as writing to the root directory requires elevated privileges. With - # XP and below, the semantics of tmpfile() are the same, but the user - # running the test is more likely to have administrative privileges on - # their account already. If that's the case, then os.tmpfile() should - # work. In order to make this test as useful as possible, rather than - # trying to detect Windows versions or whether or not the user has the - # right permissions, just try and create a file in the root directory - # and see if it raises a 'Permission denied' OSError. If it does, then - # test that a subsequent call to os.tmpfile() raises the same error. If - # it doesn't, assume we're on XP or below and the user running the test - # has administrative privileges, and proceed with the test as normal. - if sys.platform == 'win32': - name = '\\python_test_os_test_tmpfile.txt' - if os.path.exists(name): - os.remove(name) - try: - fp = open(name, 'w') - except IOError as first: - # open() failed, assert tmpfile() fails in the same way. - # Although open() raises an IOError and os.tmpfile() raises an - # OSError(), 'args' will be (13, 'Permission denied') in both - # cases. - try: - fp = os.tmpfile() - except OSError as second: - self.assertEqual(first.args, second.args) - else: - self.fail("expected os.tmpfile() to raise OSError") - return - else: - # open() worked, therefore, tmpfile() should work. Close our - # dummy file and proceed with the test as normal. - fp.close() - os.remove(name) - - fp = os.tmpfile() - fp.write("foobar") - fp.seek(0,0) - s = fp.read() - fp.close() - self.assertTrue(s == "foobar") - - def test_tmpnam(self): - if not hasattr(os, "tmpnam"): - return - warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, - r"test_os$") - name = os.tmpnam() - if sys.platform in ("win32",): - # The Windows tmpnam() seems useless. From the MS docs: - # - # The character string that tmpnam creates consists of - # the path prefix, defined by the entry P_tmpdir in the - # file STDIO.H, followed by a sequence consisting of the - # digit characters '0' through '9'; the numerical value - # of this string is in the range 1 - 65,535. Changing the - # definitions of L_tmpnam or P_tmpdir in STDIO.H does not - # change the operation of tmpnam. - # - # The really bizarre part is that, at least under MSVC6, - # P_tmpdir is "\\". That is, the path returned refers to - # the root of the current drive. That's a terrible place to - # put temp files, and, depending on privileges, the user - # may not even be able to open a file in the root directory. - self.assertFalse(os.path.exists(name), - "file already exists for temporary file") - else: - self.check_tempfile(name) - def fdopen_helper(self, *args): fd = os.open(support.TESTFN, os.O_RDONLY) - fp2 = os.fdopen(fd, *args) - fp2.close() + f = os.fdopen(fd, *args) + f.close() def test_fdopen(self): + fd = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) + os.close(fd) + self.fdopen_helper() self.fdopen_helper('r') self.fdopen_helper('r', 100) + # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): def setUp(self): @@ -1344,7 +1240,6 @@ PidTests, LoginTests, LinkTests, - TemporaryFileTests, ) if __name__ == "__main__": -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 13:47:09 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 13:47:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_test=5Fos=3A_remove_now_useless_TemporaryF?= =?utf8?q?ileTests_testcase?= Message-ID: http://hg.python.org/cpython/rev/23dc2be031ef changeset: 71109:23dc2be031ef parent: 71107:2aa2a7c25f2c parent: 71108:aa3a4614a6f3 user: Victor Stinner date: Fri Jul 01 13:47:03 2011 +0200 summary: (merge 3.2) test_os: remove now useless TemporaryFileTests testcase TemporaryFileTests has tests for os.tempnam() and os.tmpfile(), functions removed from Python 3. Move fdopen() tests to the FileTests testcase to test fdopen() on a file descriptor, not on a directory descriptor (which raises an error on Windows). files: Lib/test/test_os.py | 117 +------------------------------ 1 files changed, 6 insertions(+), 111 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -114,124 +114,20 @@ self.write_windows_console(sys.executable, "-c", code) self.write_windows_console(sys.executable, "-u", "-c", code) - -class TemporaryFileTests(unittest.TestCase): - def setUp(self): - self.files = [] - os.mkdir(support.TESTFN) - - def tearDown(self): - for name in self.files: - os.unlink(name) - os.rmdir(support.TESTFN) - - def check_tempfile(self, name): - # make sure it doesn't already exist: - self.assertFalse(os.path.exists(name), - "file already exists for temporary file") - # make sure we can create the file - open(name, "w") - self.files.append(name) - - def test_tempnam(self): - if not hasattr(os, "tempnam"): - return - warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, - r"test_os$") - self.check_tempfile(os.tempnam()) - - name = os.tempnam(support.TESTFN) - self.check_tempfile(name) - - name = os.tempnam(support.TESTFN, "pfx") - self.assertTrue(os.path.basename(name)[:3] == "pfx") - self.check_tempfile(name) - - def test_tmpfile(self): - if not hasattr(os, "tmpfile"): - return - # As with test_tmpnam() below, the Windows implementation of tmpfile() - # attempts to create a file in the root directory of the current drive. - # On Vista and Server 2008, this test will always fail for normal users - # as writing to the root directory requires elevated privileges. With - # XP and below, the semantics of tmpfile() are the same, but the user - # running the test is more likely to have administrative privileges on - # their account already. If that's the case, then os.tmpfile() should - # work. In order to make this test as useful as possible, rather than - # trying to detect Windows versions or whether or not the user has the - # right permissions, just try and create a file in the root directory - # and see if it raises a 'Permission denied' OSError. If it does, then - # test that a subsequent call to os.tmpfile() raises the same error. If - # it doesn't, assume we're on XP or below and the user running the test - # has administrative privileges, and proceed with the test as normal. - if sys.platform == 'win32': - name = '\\python_test_os_test_tmpfile.txt' - if os.path.exists(name): - os.remove(name) - try: - fp = open(name, 'w') - except IOError as first: - # open() failed, assert tmpfile() fails in the same way. - # Although open() raises an IOError and os.tmpfile() raises an - # OSError(), 'args' will be (13, 'Permission denied') in both - # cases. - try: - fp = os.tmpfile() - except OSError as second: - self.assertEqual(first.args, second.args) - else: - self.fail("expected os.tmpfile() to raise OSError") - return - else: - # open() worked, therefore, tmpfile() should work. Close our - # dummy file and proceed with the test as normal. - fp.close() - os.remove(name) - - fp = os.tmpfile() - fp.write("foobar") - fp.seek(0,0) - s = fp.read() - fp.close() - self.assertTrue(s == "foobar") - - def test_tmpnam(self): - if not hasattr(os, "tmpnam"): - return - warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, - r"test_os$") - name = os.tmpnam() - if sys.platform in ("win32",): - # The Windows tmpnam() seems useless. From the MS docs: - # - # The character string that tmpnam creates consists of - # the path prefix, defined by the entry P_tmpdir in the - # file STDIO.H, followed by a sequence consisting of the - # digit characters '0' through '9'; the numerical value - # of this string is in the range 1 - 65,535. Changing the - # definitions of L_tmpnam or P_tmpdir in STDIO.H does not - # change the operation of tmpnam. - # - # The really bizarre part is that, at least under MSVC6, - # P_tmpdir is "\\". That is, the path returned refers to - # the root of the current drive. That's a terrible place to - # put temp files, and, depending on privileges, the user - # may not even be able to open a file in the root directory. - self.assertFalse(os.path.exists(name), - "file already exists for temporary file") - else: - self.check_tempfile(name) - def fdopen_helper(self, *args): fd = os.open(support.TESTFN, os.O_RDONLY) - fp2 = os.fdopen(fd, *args) - fp2.close() + f = os.fdopen(fd, *args) + f.close() def test_fdopen(self): + fd = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) + os.close(fd) + self.fdopen_helper() self.fdopen_helper('r') self.fdopen_helper('r', 100) + # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): def setUp(self): @@ -1632,7 +1528,6 @@ LinkTests, TestSendfile, ProgramPriorityTests, - TemporaryFileTests, ) if __name__ == "__main__": -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 13:55:42 2011 From: python-checkins at python.org (giampaolo.rodola) Date: Fri, 01 Jul 2011 13:55:42 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312442=3A_add_shuti?= =?utf8?b?bC5kaXNrX3VzYWdlKCk=?= Message-ID: http://hg.python.org/cpython/rev/2fc102ebaf73 changeset: 71110:2fc102ebaf73 user: Giampaolo Rodola' date: Fri Jul 01 13:55:36 2011 +0200 summary: Issue #12442: add shutil.disk_usage() files: Doc/library/shutil.rst | 8 ++++++++ Doc/whatsnew/3.3.rst | 11 ++++++++++- Lib/shutil.py | 19 +++++++++++++++++++ Lib/test/test_shutil.py | 10 ++++++++++ Misc/NEWS | 3 +++ Modules/posixmodule.c | 27 +++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 1 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -164,6 +164,14 @@ If the destination is on the current filesystem, then simply use rename. Otherwise, copy src (with :func:`copy2`) to the dst and then remove src. +.. function:: disk_usage(path) + + Return disk usage statistics about the given path as a namedtuple including + total, used and free space expressed in bytes. + + .. versionadded:: 3.3 + + Availability: Unix, Windows. .. exception:: Error diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -200,7 +200,16 @@ plaintex. This can be useful to take advantage of firewalls that know how to handle NAT with non-secure FTP without opening fixed ports. -(Patch submitted by Giampaolo Rodol? in :issue:`12139`.) +(Contributed by Giampaolo Rodol? in :issue:`12139`) + + +shutil +------ + +The :mod:`shutil` module has a new :func:`~shutil.disk_usage` providing total, +used and free disk space statistics. + +(Contributed by Giampaolo Rodol? in :issue:`12442`) Optimizations diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -12,6 +12,7 @@ import collections import errno import tarfile +from collections import namedtuple try: import bz2 @@ -754,3 +755,21 @@ func = _UNPACK_FORMATS[format][1] kwargs = dict(_UNPACK_FORMATS[format][2]) func(filename, extract_dir, **kwargs) + +if hasattr(os, "statvfs") or os.name == 'nt': + _ntuple_diskusage = namedtuple('usage', 'total used free') + + def disk_usage(path): + """Return disk usage statistics about the given path as a namedtuple + including total, used and free space expressed in bytes. + """ + if hasattr(os, "statvfs"): + st = os.statvfs(path) + free = (st.f_bavail * st.f_frsize) + total = (st.f_blocks * st.f_frsize) + used = (st.f_blocks - st.f_bfree) * st.f_frsize + else: + import nt + total, free = nt._getdiskusage(path) + used = total - free + return _ntuple_diskusage(total, used, free) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -728,6 +728,16 @@ unregister_unpack_format('Boo2') self.assertEqual(get_unpack_formats(), formats) + @unittest.skipUnless(hasattr(shutil, 'disk_usage'), + "disk_usage not available on this platform") + def test_disk_usage(self): + usage = shutil.disk_usage(os.getcwd()) + self.assertTrue(usage.total > 0) + self.assertTrue(usage.used > 0) + self.assertTrue(usage.free >= 0) + self.assertTrue(usage.total >= usage.used) + self.assertTrue(usage.total > usage.free) + class TestMove(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,9 @@ Library ------- +- Issue #12442: new shutil.disk_usage function, providing total, used and free + disk space statistics. + - Issue #12451: The XInclude default loader of xml.etree now decodes files from UTF-8 instead of the locale encoding if the encoding is not specified. It now also opens XML files for the parser in binary mode instead of the text mode diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7451,6 +7451,32 @@ } #endif /* HAVE_STATVFS */ +#ifdef MS_WINDOWS +PyDoc_STRVAR(win32__getdiskusage__doc__, +"_getdiskusage(path) -> (total, free)\n\n\ +Return disk usage statistics about the given path as (total, free) tuple."); + +static PyObject * +win32__getdiskusage(PyObject *self, PyObject *args) +{ + BOOL retval; + ULARGE_INTEGER _, total, free; + LPCTSTR path; + + if (! PyArg_ParseTuple(args, "s", &path)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + retval = GetDiskFreeSpaceEx(path, &_, &total, &free); + Py_END_ALLOW_THREADS + if (retval == 0) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue("(LL)", total.QuadPart, free.QuadPart); +} +#endif + + /* This is used for fpathconf(), pathconf(), confstr() and sysconf(). * It maps strings representing configuration variable names to * integer values, allowing those functions to be called with the @@ -9716,6 +9742,7 @@ {"_getfinalpathname", posix__getfinalpathname, METH_VARARGS, NULL}, {"_getfileinformation", posix__getfileinformation, METH_VARARGS, NULL}, {"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__}, + {"_getdiskusage", win32__getdiskusage, METH_VARARGS, win32__getdiskusage__doc__}, #endif #ifdef HAVE_GETLOADAVG {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 14:19:30 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 14:19:30 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312462=3A_time=2Esl?= =?utf8?q?eep=28=29_now_calls_immediatly_the_=28Python=29_signal_handler_i?= =?utf8?q?f?= Message-ID: http://hg.python.org/cpython/rev/583be15e22ca changeset: 71111:583be15e22ca user: Victor Stinner date: Fri Jul 01 13:50:09 2011 +0200 summary: Issue #12462: time.sleep() now calls immediatly the (Python) signal handler if it is interrupted by a signal, instead of having to wait until the next instruction. Patch reviewed by Antoine Pitrou. files: Misc/NEWS | 4 ++++ Modules/timemodule.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,10 @@ Library ------- +- Issue #12462: time.sleep() now calls immediatly the (Python) signal handler + if it is interrupted by a signal, instead of having to wait until the next + instruction. + - Issue #12442: new shutil.disk_usage function, providing total, used and free disk space statistics. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -915,23 +915,28 @@ #if defined(HAVE_SELECT) && !defined(__EMX__) struct timeval t; double frac; + int err; + frac = fmod(secs, 1.0); secs = floor(secs); t.tv_sec = (long)secs; t.tv_usec = (long)(frac*1000000.0); Py_BEGIN_ALLOW_THREADS - if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) { + err = select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t); + Py_END_ALLOW_THREADS + if (err != 0) { #ifdef EINTR - if (errno != EINTR) { -#else - if (1) { + if (errno == EINTR) { + if (PyErr_CheckSignals()) + return -1; + } + else #endif - Py_BLOCK_THREADS + { PyErr_SetFromErrno(PyExc_IOError); return -1; } } - Py_END_ALLOW_THREADS #elif defined(__WATCOMC__) && !defined(__QNX__) /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 14:53:41 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 14:53:41 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExODcw?= =?utf8?q?=3A_Skip_test=5Fthreading=2Etest=5F2=5Fjoin=5Fin=5Fforked=5Fproc?= =?utf8?q?ess=28=29_on_platforms?= Message-ID: http://hg.python.org/cpython/rev/0ed5e6ff10f8 changeset: 71112:0ed5e6ff10f8 branch: 3.2 parent: 71108:aa3a4614a6f3 user: Victor Stinner date: Fri Jul 01 14:26:24 2011 +0200 summary: Issue #11870: Skip test_threading.test_2_join_in_forked_process() on platforms with known OS bugs Share the list of platforms with known OS bugs with other tests. Patch written by Charles-Fran?ois Natali. files: Lib/test/test_threading.py | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -410,6 +410,13 @@ class ThreadJoinOnShutdown(BaseTestCase): + # Between fork() and exec(), only async-safe functions are allowed (issues + # #12316 and #11870), and fork() from a worker thread is known to trigger + # problems with some operating systems (issue #3863): skip problematic tests + # on platforms known to behave badly. + platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', + 'os2emx') + def _run_and_join(self, script): script = """if 1: import sys, os, time, threading @@ -440,6 +447,7 @@ self._run_and_join(script) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_2_join_in_forked_process(self): # Like the test above, but from a forked interpreter script = """if 1: @@ -456,15 +464,11 @@ self._run_and_join(script) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_3_join_in_forked_from_thread(self): # Like the test above, but fork() was called from a worker thread # In the forked process, the main Thread object must be marked as stopped. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', - 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) script = """if 1: main_thread = threading.current_thread() def worker(): @@ -490,15 +494,11 @@ self.assertEqual(data, expected_output) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_4_joining_across_fork_in_worker_thread(self): # There used to be a possible deadlock when forking from a child # thread. See http://bugs.python.org/issue6643. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) - # The script takes the following steps: # - The main thread in the parent process starts a new thread and then # tries to join it. @@ -567,6 +567,7 @@ self.assertScriptHasOutput(script, "end of main\n") @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_5_clear_waiter_locks_to_avoid_crash(self): # Check that a spawned thread that forks doesn't segfault on certain # platforms, namely OS X. This used to happen if there was a waiter @@ -579,10 +580,6 @@ # lock will be acquired, we can't know if the internal mutex will be # acquired at the time of the fork. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) script = """if True: import os, time, threading -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 14:53:42 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 14:53:42 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2311870=3A_Skip_test=5Fthreading=2E?= =?utf8?b?dGVzdF8yX2pvaW5faW5fZm9ya2VkX3Byb2Nlc3MoKQ==?= Message-ID: http://hg.python.org/cpython/rev/f43dee86fffd changeset: 71113:f43dee86fffd parent: 71111:583be15e22ca parent: 71112:0ed5e6ff10f8 user: Victor Stinner date: Fri Jul 01 14:53:07 2011 +0200 summary: (merge 3.2) Issue #11870: Skip test_threading.test_2_join_in_forked_process() on platforms with known OS bugs Share the list of platforms with known OS bugs with other tests. Patch written by Charles-Fran?ois Natali. files: Lib/test/test_threading.py | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -418,6 +418,13 @@ class ThreadJoinOnShutdown(BaseTestCase): + # Between fork() and exec(), only async-safe functions are allowed (issues + # #12316 and #11870), and fork() from a worker thread is known to trigger + # problems with some operating systems (issue #3863): skip problematic tests + # on platforms known to behave badly. + platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', + 'os2emx') + def _run_and_join(self, script): script = """if 1: import sys, os, time, threading @@ -448,6 +455,7 @@ self._run_and_join(script) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_2_join_in_forked_process(self): # Like the test above, but from a forked interpreter script = """if 1: @@ -464,15 +472,11 @@ self._run_and_join(script) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_3_join_in_forked_from_thread(self): # Like the test above, but fork() was called from a worker thread # In the forked process, the main Thread object must be marked as stopped. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', - 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) script = """if 1: main_thread = threading.current_thread() def worker(): @@ -498,15 +502,11 @@ self.assertEqual(data, expected_output) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_4_joining_across_fork_in_worker_thread(self): # There used to be a possible deadlock when forking from a child # thread. See http://bugs.python.org/issue6643. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) - # The script takes the following steps: # - The main thread in the parent process starts a new thread and then # tries to join it. @@ -575,6 +575,7 @@ self.assertScriptHasOutput(script, "end of main\n") @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_5_clear_waiter_locks_to_avoid_crash(self): # Check that a spawned thread that forks doesn't segfault on certain # platforms, namely OS X. This used to happen if there was a waiter @@ -587,10 +588,6 @@ # lock will be acquired, we can't know if the internal mutex will be # acquired at the time of the fork. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) script = """if True: import os, time, threading -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 15:05:01 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 15:05:01 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExODcw?= =?utf8?q?=3A_Skip_test=5Fthreading=2Etest=5F2=5Fjoin=5Fin=5Fforked=5Fproc?= =?utf8?q?ess=28=29_on_platforms?= Message-ID: http://hg.python.org/cpython/rev/ff36b8cadfd6 changeset: 71114:ff36b8cadfd6 branch: 2.7 parent: 71086:9a0b6c07b488 user: Victor Stinner date: Fri Jul 01 15:04:03 2011 +0200 summary: Issue #11870: Skip test_threading.test_2_join_in_forked_process() on platforms with known OS bugs Share the list of platforms with known OS bugs with other tests. Patch written by Charles-Fran?ois Natali. files: Lib/test/test_threading.py | 35 +++++++++---------------- 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -417,6 +417,13 @@ class ThreadJoinOnShutdown(BaseTestCase): + # Between fork() and exec(), only async-safe functions are allowed (issues + # #12316 and #11870), and fork() from a worker thread is known to trigger + # problems with some operating systems (issue #3863): skip problematic tests + # on platforms known to behave badly. + platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', + 'os2emx') + def _run_and_join(self, script): script = """if 1: import sys, os, time, threading @@ -448,11 +455,10 @@ self._run_and_join(script) + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_2_join_in_forked_process(self): # Like the test above, but from a forked interpreter - import os - if not hasattr(os, 'fork'): - return script = """if 1: childpid = os.fork() if childpid != 0: @@ -466,19 +472,11 @@ """ self._run_and_join(script) + @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_3_join_in_forked_from_thread(self): # Like the test above, but fork() was called from a worker thread # In the forked process, the main Thread object must be marked as stopped. - import os - if not hasattr(os, 'fork'): - return - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5', - 'os2emx'): - print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread' - ' due to known OS bugs on'), sys.platform - return script = """if 1: main_thread = threading.current_thread() def worker(): @@ -507,15 +505,11 @@ self.assertEqual(data, expected_output) @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_4_joining_across_fork_in_worker_thread(self): # There used to be a possible deadlock when forking from a child # thread. See http://bugs.python.org/issue6643. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) - # The script takes the following steps: # - The main thread in the parent process starts a new thread and then # tries to join it. @@ -584,6 +578,7 @@ self.assertScriptHasOutput(script, "end of main\n") @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()") + @unittest.skipIf(sys.platform in platforms_to_skip, "due to known OS bug") def test_5_clear_waiter_locks_to_avoid_crash(self): # Check that a spawned thread that forks doesn't segfault on certain # platforms, namely OS X. This used to happen if there was a waiter @@ -596,10 +591,6 @@ # lock will be acquired, we can't know if the internal mutex will be # acquired at the time of the fork. - # Skip platforms with known problems forking from a worker thread. - # See http://bugs.python.org/issue3863. - if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): - raise unittest.SkipTest('due to known OS bugs on ' + sys.platform) script = """if True: import os, time, threading -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 15:26:02 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 15:26:02 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzYz?= =?utf8?q?=3A_improve_siginterrupt=28=29_tests?= Message-ID: http://hg.python.org/cpython/rev/8250f04d5a41 changeset: 71115:8250f04d5a41 branch: 3.2 parent: 71112:0ed5e6ff10f8 user: Victor Stinner date: Fri Jul 01 15:24:50 2011 +0200 summary: Issue #12363: improve siginterrupt() tests Backport commits 968b9ff9a059 and aff0a7b0cb12 from the default branch to 3.2 branch. Extract of the changelog messages: "The previous tests used time.sleep() to synchronize two processes. If the host was too slow, the test could fail. The new tests only use one process, but they use a subprocess to: - have only one thread - have a timeout on the blocking read (select cannot be used in the test, select always fail with EINTR, the kernel doesn't restart it) - not touch signal handling of the parent process" and "Add a basic synchronization code between the child and the parent processes: the child writes "ready" to stdout." I replaced .communicate(timeout=3.0) by an explicit waiting loop using Popen.poll(). files: Lib/test/test_signal.py | 167 +++++++++++++-------------- 1 files changed, 82 insertions(+), 85 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1,13 +1,17 @@ -import unittest -from test import support -from contextlib import closing +import errno import gc +import os import pickle import select import signal import subprocess +import sys +import time import traceback -import sys, os, time, errno +import unittest +from test import support +from contextlib import closing +from test.script_helper import spawn_python if sys.platform in ('os2', 'riscos'): raise unittest.SkipTest("Can't test signal on %s" % sys.platform) @@ -276,103 +280,96 @@ @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") class SiginterruptTest(unittest.TestCase): - def setUp(self): - """Install a no-op signal handler that can be set to allow - interrupts or not, and arrange for the original signal handler to be - re-installed when the test is finished. - """ - self.signum = signal.SIGUSR1 - oldhandler = signal.signal(self.signum, lambda x,y: None) - self.addCleanup(signal.signal, self.signum, oldhandler) - - def readpipe_interrupted(self): + def readpipe_interrupted(self, interrupt): """Perform a read during which a signal will arrive. Return True if the read is interrupted by the signal and raises an exception. Return False if it returns normally. """ - # Create a pipe that can be used for the read. Also clean it up - # when the test is over, since nothing else will (but see below for - # the write end). - r, w = os.pipe() - self.addCleanup(os.close, r) + class Timeout(Exception): + pass - # Create another process which can send a signal to this one to try - # to interrupt the read. - ppid = os.getpid() - pid = os.fork() + # use a subprocess to have only one thread, to have a timeout on the + # blocking read and to not touch signal handling in this process + code = """if 1: + import errno + import os + import signal + import sys - if pid == 0: - # Child code: sleep to give the parent enough time to enter the - # read() call (there's a race here, but it's really tricky to - # eliminate it); then signal the parent process. Also, sleep - # again to make it likely that the signal is delivered to the - # parent process before the child exits. If the child exits - # first, the write end of the pipe will be closed and the test - # is invalid. + interrupt = %r + r, w = os.pipe() + + def handler(signum, frame): + pass + + print("ready") + sys.stdout.flush() + + signal.signal(signal.SIGALRM, handler) + if interrupt is not None: + signal.siginterrupt(signal.SIGALRM, interrupt) + + # run the test twice + for loop in range(2): + # send a SIGALRM in a second (during the read) + signal.alarm(1) + try: + # blocking call: read from a pipe without data + os.read(r, 1) + except OSError as err: + if err.errno != errno.EINTR: + raise + else: + sys.exit(2) + sys.exit(3) + """ % (interrupt,) + with spawn_python('-c', code) as process: try: - time.sleep(0.2) - os.kill(ppid, self.signum) - time.sleep(0.2) - finally: - # No matter what, just exit as fast as possible now. - exit_subprocess() - else: - # Parent code. - # Make sure the child is eventually reaped, else it'll be a - # zombie for the rest of the test suite run. - self.addCleanup(os.waitpid, pid, 0) + # wait until the child process is loaded and has started + first_line = process.stdout.readline() - # Close the write end of the pipe. The child has a copy, so - # it's not really closed until the child exits. We need it to - # close when the child exits so that in the non-interrupt case - # the read eventually completes, otherwise we could just close - # it *after* the test. - os.close(w) + # Wait the process with a timeout of 3 seconds + timeout = time.time() + 3.0 + while True: + if timeout < time.time(): + raise Timeout() + status = process.poll() + if status is not None: + break + time.sleep(0.1) - # Try the read and report whether it is interrupted or not to - # the caller. - try: - d = os.read(r, 1) + stdout, stderr = process.communicate() + except Timeout: + process.kill() return False - except OSError as err: - if err.errno != errno.EINTR: - raise - return True + else: + stdout = first_line + stdout + exitcode = process.wait() + if exitcode not in (2, 3): + raise Exception("Child error (exit code %s): %s" + % (exitcode, stdout)) + return (exitcode == 3) def test_without_siginterrupt(self): - """If a signal handler is installed and siginterrupt is not called - at all, when that signal arrives, it interrupts a syscall that's in - progress. - """ - i = self.readpipe_interrupted() - self.assertTrue(i) - # Arrival of the signal shouldn't have changed anything. - i = self.readpipe_interrupted() - self.assertTrue(i) + # If a signal handler is installed and siginterrupt is not called + # at all, when that signal arrives, it interrupts a syscall that's in + # progress. + interrupted = self.readpipe_interrupted(None) + self.assertTrue(interrupted) def test_siginterrupt_on(self): - """If a signal handler is installed and siginterrupt is called with - a true value for the second argument, when that signal arrives, it - interrupts a syscall that's in progress. - """ - signal.siginterrupt(self.signum, 1) - i = self.readpipe_interrupted() - self.assertTrue(i) - # Arrival of the signal shouldn't have changed anything. - i = self.readpipe_interrupted() - self.assertTrue(i) + # If a signal handler is installed and siginterrupt is called with + # a true value for the second argument, when that signal arrives, it + # interrupts a syscall that's in progress. + interrupted = self.readpipe_interrupted(True) + self.assertTrue(interrupted) def test_siginterrupt_off(self): - """If a signal handler is installed and siginterrupt is called with - a false value for the second argument, when that signal arrives, it - does not interrupt a syscall that's in progress. - """ - signal.siginterrupt(self.signum, 0) - i = self.readpipe_interrupted() - self.assertFalse(i) - # Arrival of the signal shouldn't have changed anything. - i = self.readpipe_interrupted() - self.assertFalse(i) + # If a signal handler is installed and siginterrupt is called with + # a false value for the second argument, when that signal arrives, it + # does not interrupt a syscall that's in progress. + interrupted = self.readpipe_interrupted(False) + self.assertFalse(interrupted) @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 15:26:03 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 15:26:03 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28null_merge_3=2E2=2C_patch_already_applied_to_3=2E3=29?= Message-ID: http://hg.python.org/cpython/rev/7feb11a8acc4 changeset: 71116:7feb11a8acc4 parent: 71113:f43dee86fffd parent: 71115:8250f04d5a41 user: Victor Stinner date: Fri Jul 01 15:25:58 2011 +0200 summary: (null merge 3.2, patch already applied to 3.3) files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 16:00:00 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 16:00:00 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzYz?= =?utf8?q?=3A_increase_the_timeout_of_siginterrupt=28=29_tests?= Message-ID: http://hg.python.org/cpython/rev/3f30cfe51315 changeset: 71117:3f30cfe51315 branch: 3.2 parent: 71115:8250f04d5a41 user: Victor Stinner date: Fri Jul 01 15:58:39 2011 +0200 summary: Issue #12363: increase the timeout of siginterrupt() tests Move also the "ready" trigger after the installation of the signal handler and the call to siginterrupt(). Use a timeout of 5 seconds instead of 3. Two seconds are supposed to be enough, but some of our buildbots are really slow (especially the FreeBSD 6 VM). files: Lib/test/test_signal.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -302,13 +302,13 @@ def handler(signum, frame): pass - print("ready") - sys.stdout.flush() - signal.signal(signal.SIGALRM, handler) if interrupt is not None: signal.siginterrupt(signal.SIGALRM, interrupt) + print("ready") + sys.stdout.flush() + # run the test twice for loop in range(2): # send a SIGALRM in a second (during the read) @@ -328,8 +328,8 @@ # wait until the child process is loaded and has started first_line = process.stdout.readline() - # Wait the process with a timeout of 3 seconds - timeout = time.time() + 3.0 + # Wait the process with a timeout of 5 seconds + timeout = time.time() + 5.0 while True: if timeout < time.time(): raise Timeout() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 16:00:00 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 01 Jul 2011 16:00:00 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312363=3A_increase_the_timeout_of_?= =?utf8?q?siginterrupt=28=29_tests?= Message-ID: http://hg.python.org/cpython/rev/423268537083 changeset: 71118:423268537083 parent: 71116:7feb11a8acc4 parent: 71117:3f30cfe51315 user: Victor Stinner date: Fri Jul 01 15:59:54 2011 +0200 summary: (merge 3.2) Issue #12363: increase the timeout of siginterrupt() tests Move also the "ready" trigger after the installation of the signal handler and the call to siginterrupt(). Use a timeout of 5 seconds instead of 3. Two seconds are supposed to be enough, but some of our buildbots are really slow (especially the FreeBSD 6 VM). files: Lib/test/test_signal.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -358,13 +358,13 @@ def handler(signum, frame): pass - print("ready") - sys.stdout.flush() - signal.signal(signal.SIGALRM, handler) if interrupt is not None: signal.siginterrupt(signal.SIGALRM, interrupt) + print("ready") + sys.stdout.flush() + # run the test twice for loop in range(2): # send a SIGALRM in a second (during the read) @@ -384,7 +384,7 @@ # wait until the child process is loaded and has started first_line = process.stdout.readline() - stdout, stderr = process.communicate(timeout=3.0) + stdout, stderr = process.communicate(timeout=5.0) except subprocess.TimeoutExpired: process.kill() return False -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 17:54:02 2011 From: python-checkins at python.org (r.david.murray) Date: Fri, 01 Jul 2011 17:54:02 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzExODczOiBmaXgg?= =?utf8?q?test_regex_so_it_covers_windows_os=2Esep_as_well=2E?= Message-ID: http://hg.python.org/cpython/rev/f8ece8c93918 changeset: 71119:f8ece8c93918 branch: 3.2 parent: 71117:3f30cfe51315 user: R David Murray date: Fri Jul 01 11:51:50 2011 -0400 summary: #11873: fix test regex so it covers windows os.sep as well. files: Lib/test/test_compileall.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -248,7 +248,7 @@ self.assertEqual(b'', quiet) def test_regexp(self): - self.assertRunOK('-q', '-x', 'ba[^\/]*$', self.pkgdir) + self.assertRunOK('-q', '-x', r'ba[^\/]*$', self.pkgdir) self.assertNotCompiled(self.barfn) self.assertCompiled(self.initfn) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 17:54:07 2011 From: python-checkins at python.org (r.david.murray) Date: Fri, 01 Jul 2011 17:54:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_=2311873=3A_fix_test_regex_so_it_covers_windows_os=2Es?= =?utf8?q?ep_as_well=2E?= Message-ID: http://hg.python.org/cpython/rev/e543c0ddec63 changeset: 71120:e543c0ddec63 parent: 71118:423268537083 parent: 71119:f8ece8c93918 user: R David Murray date: Fri Jul 01 11:53:19 2011 -0400 summary: merge #11873: fix test regex so it covers windows os.sep as well. files: Lib/test/test_compileall.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -248,7 +248,7 @@ self.assertEqual(b'', quiet) def test_regexp(self): - self.assertRunOK('-q', '-x', 'ba[^\/]*$', self.pkgdir) + self.assertRunOK('-q', '-x', r'ba[^\/]*$', self.pkgdir) self.assertNotCompiled(self.barfn) self.assertCompiled(self.initfn) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 20:57:37 2011 From: python-checkins at python.org (r.david.murray) Date: Fri, 01 Jul 2011 20:57:37 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzExODczOiBhbm90?= =?utf8?q?her_try_at_fixing_the_regex=2C_courtesy_of_Victor_Stinner?= Message-ID: http://hg.python.org/cpython/rev/6fdb1f000d36 changeset: 71121:6fdb1f000d36 branch: 3.2 parent: 71119:f8ece8c93918 user: R David Murray date: Fri Jul 01 14:55:43 2011 -0400 summary: #11873: another try at fixing the regex, courtesy of Victor Stinner files: Lib/test/test_compileall.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -248,7 +248,7 @@ self.assertEqual(b'', quiet) def test_regexp(self): - self.assertRunOK('-q', '-x', r'ba[^\/]*$', self.pkgdir) + self.assertRunOK('-q', '-x', r'ba[^\\/]*$', self.pkgdir) self.assertNotCompiled(self.barfn) self.assertCompiled(self.initfn) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 20:57:37 2011 From: python-checkins at python.org (r.david.murray) Date: Fri, 01 Jul 2011 20:57:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_=2311873=3A_another_try_at_fixing_the_regex=2C_courtes?= =?utf8?q?y_of_Victor_Stinner?= Message-ID: http://hg.python.org/cpython/rev/775356b583d1 changeset: 71122:775356b583d1 parent: 71120:e543c0ddec63 parent: 71121:6fdb1f000d36 user: R David Murray date: Fri Jul 01 14:57:00 2011 -0400 summary: merge #11873: another try at fixing the regex, courtesy of Victor Stinner files: Lib/test/test_compileall.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -248,7 +248,7 @@ self.assertEqual(b'', quiet) def test_regexp(self): - self.assertRunOK('-q', '-x', r'ba[^\/]*$', self.pkgdir) + self.assertRunOK('-q', '-x', r'ba[^\\/]*$', self.pkgdir) self.assertNotCompiled(self.barfn) self.assertCompiled(self.initfn) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 1 22:56:47 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 01 Jul 2011 22:56:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Really_fix_issu?= =?utf8?q?e_=2310898=3A_posixmodule=2Ec_redefines_FSTAT?= Message-ID: http://hg.python.org/cpython/rev/45b27448f95c changeset: 71123:45b27448f95c branch: 2.7 parent: 71114:ff36b8cadfd6 user: Antoine Pitrou date: Fri Jul 01 22:56:03 2011 +0200 summary: Really fix issue #10898: posixmodule.c redefines FSTAT files: Modules/posixmodule.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -338,20 +338,6 @@ #define USE_TMPNAM_R #endif -/* choose the appropriate stat and fstat functions and return structs */ -#undef STAT -#undef FSTAT -#undef STRUCT_STAT -#if defined(MS_WIN64) || defined(MS_WINDOWS) -# define STAT win32_stat -# define FSTAT win32_fstat -# define STRUCT_STAT struct win32_stat -#else -# define STAT stat -# define FSTAT fstat -# define STRUCT_STAT struct stat -#endif - #if defined(MAJOR_IN_MKDEV) #include #else @@ -842,6 +828,20 @@ } #endif +/* choose the appropriate stat and fstat functions and return structs */ +#undef STAT +#undef FSTAT +#undef STRUCT_STAT +#if defined(MS_WIN64) || defined(MS_WINDOWS) +# define STAT win32_stat +# define FSTAT win32_fstat +# define STRUCT_STAT struct win32_stat +#else +# define STAT stat +# define FSTAT fstat +# define STRUCT_STAT struct stat +#endif + #ifdef MS_WINDOWS /* The CRT of Windows has a number of flaws wrt. its stat() implementation: - time stamps are restricted to second resolution -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jul 2 05:12:35 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 02 Jul 2011 05:12:35 +0200 Subject: [Python-checkins] Daily reference leaks (775356b583d1): sum=244 Message-ID: results for 775356b583d1 on branch "default" -------------------------------------------- test_packaging leaked [100, 100, 100] references, sum=300 test_pyexpat leaked [0, 0, -56] references, sum=-56 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogBVSJOX', '-x'] From python-checkins at python.org Sat Jul 2 13:57:40 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 02 Jul 2011 13:57:40 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMzUy?= =?utf8?q?=3A_Fix_a_deadlock_in_multiprocessing=2EHeap_when_a_block_is_fre?= =?utf8?q?ed_by?= Message-ID: http://hg.python.org/cpython/rev/96a0788583c6 changeset: 71124:96a0788583c6 branch: 2.7 user: Charles-Fran?ois Natali date: Sat Jul 02 13:56:19 2011 +0200 summary: Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. files: Lib/multiprocessing/heap.py | 39 ++++++++++++++++--- Lib/test/test_multiprocessing.py | 25 ++++++++++++ Misc/NEWS | 3 + 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py --- a/Lib/multiprocessing/heap.py +++ b/Lib/multiprocessing/heap.py @@ -101,6 +101,8 @@ self._stop_to_block = {} self._allocated_blocks = set() self._arenas = [] + # list of pending blocks to free - see free() comment below + self._pending_free_blocks = [] @staticmethod def _roundup(n, alignment): @@ -175,15 +177,39 @@ return start, stop + def _free_pending_blocks(self): + # Free all the blocks in the pending list - called with the lock held. + while True: + try: + block = self._pending_free_blocks.pop() + except IndexError: + break + self._allocated_blocks.remove(block) + self._free(block) + def free(self, block): # free a block returned by malloc() + # Since free() can be called asynchronously by the GC, it could happen + # that it's called while self._lock is held: in that case, + # self._lock.acquire() would deadlock (issue #12352). To avoid that, a + # trylock is used instead, and if the lock can't be acquired + # immediately, the block is added to a list of blocks to be freed + # synchronously sometimes later from malloc() or free(), by calling + # _free_pending_blocks() (appending and retrieving from a list is not + # strictly thread-safe but under cPython it's atomic thanks to the GIL). assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() + if not self._lock.acquire(False): + # can't acquire the lock right now, add the block to the list of + # pending blocks to free + self._pending_free_blocks.append(block) + else: + # we hold the lock + try: + self._free_pending_blocks() + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() def malloc(self, size): # return a block of right size (possibly rounded up) @@ -191,6 +217,7 @@ if os.getpid() != self._lastpid: self.__init__() # reinitialize after fork self._lock.acquire() + self._free_pending_blocks() try: size = self._roundup(max(size,1), self._alignment) (arena, start, stop) = self._malloc(size) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1615,6 +1615,8 @@ # verify the state of the heap all = [] occupied = 0 + heap._lock.acquire() + self.addCleanup(heap._lock.release) for L in heap._len_to_seq.values(): for arena, start, stop in L: all.append((heap._arenas.index(arena), start, stop, @@ -1632,6 +1634,29 @@ self.assertTrue((arena != narena and nstart == 0) or (stop == nstart)) + def test_free_from_gc(self): + # Check that freeing of blocks by the garbage collector doesn't deadlock + # (issue #12352). + # Make sure the GC is enabled, and set lower collection thresholds to + # make collections more frequent (and increase the probability of + # deadlock). + if gc.isenabled(): + thresholds = gc.get_threshold() + self.addCleanup(gc.set_threshold, *thresholds) + else: + gc.enable() + self.addCleanup(gc.disable) + gc.set_threshold(10) + + # perform numerous block allocations, with cyclic references to make + # sure objects are collected asynchronously by the gc + for i in range(5000): + a = multiprocessing.heap.BufferWrapper(1) + b = multiprocessing.heap.BufferWrapper(1) + # circular references + a.buddy = b + b.buddy = a + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,6 +18,9 @@ Library ------- +- Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by + the garbage collector while the Heap lock is held. + - Issue #9516: On Mac OS X, change Distutils to no longer globally attempt to check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the interpreter process. This could cause failures in non-Distutils subprocesses -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 14:09:48 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 02 Jul 2011 14:09:48 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMzUy?= =?utf8?q?=3A_In_test=5Ffree=5Ffrom=5Fgc=28=29=2C_restore_the_GC_threshold?= =?utf8?q?s_even_if_the_GC?= Message-ID: http://hg.python.org/cpython/rev/874143242d79 changeset: 71125:874143242d79 branch: 2.7 user: Charles-Fran?ois Natali date: Sat Jul 02 14:08:27 2011 +0200 summary: Issue #12352: In test_free_from_gc(), restore the GC thresholds even if the GC wasn't enabled at first. files: Lib/test/test_multiprocessing.py | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1640,12 +1640,11 @@ # Make sure the GC is enabled, and set lower collection thresholds to # make collections more frequent (and increase the probability of # deadlock). - if gc.isenabled(): - thresholds = gc.get_threshold() - self.addCleanup(gc.set_threshold, *thresholds) - else: + if not gc.isenabled(): gc.enable() self.addCleanup(gc.disable) + thresholds = gc.get_threshold() + self.addCleanup(gc.set_threshold, *thresholds) gc.set_threshold(10) # perform numerous block allocations, with cyclic references to make -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 14:36:24 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 02 Jul 2011 14:36:24 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4xKTogSXNzdWUgIzEyMzUy?= =?utf8?q?=3A_Fix_a_deadlock_in_multiprocessing=2EHeap_when_a_block_is_fre?= =?utf8?q?ed_by?= Message-ID: http://hg.python.org/cpython/rev/0d4ca1e77205 changeset: 71126:0d4ca1e77205 branch: 3.1 parent: 71040:633597815463 user: Charles-Fran?ois Natali date: Sat Jul 02 14:35:49 2011 +0200 summary: Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. files: Lib/multiprocessing/heap.py | 39 ++++++++++++++++--- Lib/test/test_multiprocessing.py | 24 ++++++++++++ Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py --- a/Lib/multiprocessing/heap.py +++ b/Lib/multiprocessing/heap.py @@ -101,6 +101,8 @@ self._stop_to_block = {} self._allocated_blocks = set() self._arenas = [] + # list of pending blocks to free - see free() comment below + self._pending_free_blocks = [] @staticmethod def _roundup(n, alignment): @@ -175,15 +177,39 @@ return start, stop + def _free_pending_blocks(self): + # Free all the blocks in the pending list - called with the lock held. + while True: + try: + block = self._pending_free_blocks.pop() + except IndexError: + break + self._allocated_blocks.remove(block) + self._free(block) + def free(self, block): # free a block returned by malloc() + # Since free() can be called asynchronously by the GC, it could happen + # that it's called while self._lock is held: in that case, + # self._lock.acquire() would deadlock (issue #12352). To avoid that, a + # trylock is used instead, and if the lock can't be acquired + # immediately, the block is added to a list of blocks to be freed + # synchronously sometimes later from malloc() or free(), by calling + # _free_pending_blocks() (appending and retrieving from a list is not + # strictly thread-safe but under cPython it's atomic thanks to the GIL). assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() + if not self._lock.acquire(False): + # can't acquire the lock right now, add the block to the list of + # pending blocks to free + self._pending_free_blocks.append(block) + else: + # we hold the lock + try: + self._free_pending_blocks() + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() def malloc(self, size): # return a block of right size (possibly rounded up) @@ -191,6 +217,7 @@ if os.getpid() != self._lastpid: self.__init__() # reinitialize after fork self._lock.acquire() + self._free_pending_blocks() try: size = self._roundup(max(size,1), self._alignment) (arena, start, stop) = self._malloc(size) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1580,6 +1580,8 @@ # verify the state of the heap all = [] occupied = 0 + heap._lock.acquire() + self.addCleanup(heap._lock.release) for L in list(heap._len_to_seq.values()): for arena, start, stop in L: all.append((heap._arenas.index(arena), start, stop, @@ -1597,6 +1599,28 @@ self.assertTrue((arena != narena and nstart == 0) or (stop == nstart)) + def test_free_from_gc(self): + # Check that freeing of blocks by the garbage collector doesn't deadlock + # (issue #12352). + # Make sure the GC is enabled, and set lower collection thresholds to + # make collections more frequent (and increase the probability of + # deadlock). + if not gc.isenabled(): + gc.enable() + self.addCleanup(gc.disable) + thresholds = gc.get_threshold() + self.addCleanup(gc.set_threshold, *thresholds) + gc.set_threshold(10) + + # perform numerous block allocations, with cyclic references to make + # sure objects are collected asynchronously by the gc + for i in range(5000): + a = multiprocessing.heap.BufferWrapper(1) + b = multiprocessing.heap.BufferWrapper(1) + # circular references + a.buddy = b + b.buddy = a + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -107,6 +107,9 @@ Library ------- +- Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by + the garbage collector while the Heap lock is held. + - Issue #985064: Make plistlib more resilient to faulty input plists. Patch by Mher Movsisyan. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 14:40:21 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 02 Jul 2011 14:40:21 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4xIC0+IDMuMik6?= =?utf8?q?_Merge_issue_=2312352=3A_Fix_a_deadlock_in_multiprocessing=2EHea?= =?utf8?q?p_when_a_block_is?= Message-ID: http://hg.python.org/cpython/rev/37606505b227 changeset: 71127:37606505b227 branch: 3.2 parent: 71121:6fdb1f000d36 parent: 71126:0d4ca1e77205 user: Charles-Fran?ois Natali date: Sat Jul 02 14:39:53 2011 +0200 summary: Merge issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. files: Lib/multiprocessing/heap.py | 39 ++++++++++++++++--- Lib/test/test_multiprocessing.py | 24 ++++++++++++ Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py --- a/Lib/multiprocessing/heap.py +++ b/Lib/multiprocessing/heap.py @@ -101,6 +101,8 @@ self._stop_to_block = {} self._allocated_blocks = set() self._arenas = [] + # list of pending blocks to free - see free() comment below + self._pending_free_blocks = [] @staticmethod def _roundup(n, alignment): @@ -175,15 +177,39 @@ return start, stop + def _free_pending_blocks(self): + # Free all the blocks in the pending list - called with the lock held. + while True: + try: + block = self._pending_free_blocks.pop() + except IndexError: + break + self._allocated_blocks.remove(block) + self._free(block) + def free(self, block): # free a block returned by malloc() + # Since free() can be called asynchronously by the GC, it could happen + # that it's called while self._lock is held: in that case, + # self._lock.acquire() would deadlock (issue #12352). To avoid that, a + # trylock is used instead, and if the lock can't be acquired + # immediately, the block is added to a list of blocks to be freed + # synchronously sometimes later from malloc() or free(), by calling + # _free_pending_blocks() (appending and retrieving from a list is not + # strictly thread-safe but under cPython it's atomic thanks to the GIL). assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() + if not self._lock.acquire(False): + # can't acquire the lock right now, add the block to the list of + # pending blocks to free + self._pending_free_blocks.append(block) + else: + # we hold the lock + try: + self._free_pending_blocks() + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() def malloc(self, size): # return a block of right size (possibly rounded up) @@ -191,6 +217,7 @@ if os.getpid() != self._lastpid: self.__init__() # reinitialize after fork self._lock.acquire() + self._free_pending_blocks() try: size = self._roundup(max(size,1), self._alignment) (arena, start, stop) = self._malloc(size) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1672,6 +1672,8 @@ # verify the state of the heap all = [] occupied = 0 + heap._lock.acquire() + self.addCleanup(heap._lock.release) for L in list(heap._len_to_seq.values()): for arena, start, stop in L: all.append((heap._arenas.index(arena), start, stop, @@ -1689,6 +1691,28 @@ self.assertTrue((arena != narena and nstart == 0) or (stop == nstart)) + def test_free_from_gc(self): + # Check that freeing of blocks by the garbage collector doesn't deadlock + # (issue #12352). + # Make sure the GC is enabled, and set lower collection thresholds to + # make collections more frequent (and increase the probability of + # deadlock). + if not gc.isenabled(): + gc.enable() + self.addCleanup(gc.disable) + thresholds = gc.get_threshold() + self.addCleanup(gc.set_threshold, *thresholds) + gc.set_threshold(10) + + # perform numerous block allocations, with cyclic references to make + # sure objects are collected asynchronously by the gc + for i in range(5000): + a = multiprocessing.heap.BufferWrapper(1) + b = multiprocessing.heap.BufferWrapper(1) + # circular references + a.buddy = b + b.buddy = a + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -25,6 +25,9 @@ Library ------- +- Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by + the garbage collector while the Heap lock is held. + - Issue #12451: The XInclude default loader of xml.etree now decodes files from UTF-8 instead of the locale encoding if the encoding is not specified. It now also opens XML files for the parser in binary mode instead of the text mode -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 14:43:41 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 02 Jul 2011 14:43:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_issue_=2312352=3A_Fix_a_deadlock_in_multiprocessing=2E?= =?utf8?q?Heap_when_a_block_is?= Message-ID: http://hg.python.org/cpython/rev/fd8dc3746992 changeset: 71128:fd8dc3746992 parent: 71122:775356b583d1 parent: 71127:37606505b227 user: Charles-Fran?ois Natali date: Sat Jul 02 14:43:11 2011 +0200 summary: Merge issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. files: Lib/multiprocessing/heap.py | 39 ++++++++++++++++--- Lib/test/test_multiprocessing.py | 24 ++++++++++++ Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py --- a/Lib/multiprocessing/heap.py +++ b/Lib/multiprocessing/heap.py @@ -101,6 +101,8 @@ self._stop_to_block = {} self._allocated_blocks = set() self._arenas = [] + # list of pending blocks to free - see free() comment below + self._pending_free_blocks = [] @staticmethod def _roundup(n, alignment): @@ -175,15 +177,39 @@ return start, stop + def _free_pending_blocks(self): + # Free all the blocks in the pending list - called with the lock held. + while True: + try: + block = self._pending_free_blocks.pop() + except IndexError: + break + self._allocated_blocks.remove(block) + self._free(block) + def free(self, block): # free a block returned by malloc() + # Since free() can be called asynchronously by the GC, it could happen + # that it's called while self._lock is held: in that case, + # self._lock.acquire() would deadlock (issue #12352). To avoid that, a + # trylock is used instead, and if the lock can't be acquired + # immediately, the block is added to a list of blocks to be freed + # synchronously sometimes later from malloc() or free(), by calling + # _free_pending_blocks() (appending and retrieving from a list is not + # strictly thread-safe but under cPython it's atomic thanks to the GIL). assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() + if not self._lock.acquire(False): + # can't acquire the lock right now, add the block to the list of + # pending blocks to free + self._pending_free_blocks.append(block) + else: + # we hold the lock + try: + self._free_pending_blocks() + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() def malloc(self, size): # return a block of right size (possibly rounded up) @@ -191,6 +217,7 @@ if os.getpid() != self._lastpid: self.__init__() # reinitialize after fork self._lock.acquire() + self._free_pending_blocks() try: size = self._roundup(max(size,1), self._alignment) (arena, start, stop) = self._malloc(size) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1721,6 +1721,8 @@ # verify the state of the heap all = [] occupied = 0 + heap._lock.acquire() + self.addCleanup(heap._lock.release) for L in list(heap._len_to_seq.values()): for arena, start, stop in L: all.append((heap._arenas.index(arena), start, stop, @@ -1738,6 +1740,28 @@ self.assertTrue((arena != narena and nstart == 0) or (stop == nstart)) + def test_free_from_gc(self): + # Check that freeing of blocks by the garbage collector doesn't deadlock + # (issue #12352). + # Make sure the GC is enabled, and set lower collection thresholds to + # make collections more frequent (and increase the probability of + # deadlock). + if not gc.isenabled(): + gc.enable() + self.addCleanup(gc.disable) + thresholds = gc.get_threshold() + self.addCleanup(gc.set_threshold, *thresholds) + gc.set_threshold(10) + + # perform numerous block allocations, with cyclic references to make + # sure objects are collected asynchronously by the gc + for i in range(5000): + a = multiprocessing.heap.BufferWrapper(1) + b = multiprocessing.heap.BufferWrapper(1) + # circular references + a.buddy = b + b.buddy = a + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,9 @@ Library ------- +- Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by + the garbage collector while the Heap lock is held. + - Issue #12462: time.sleep() now calls immediatly the (Python) signal handler if it is interrupted by a signal, instead of having to wait until the next instruction. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 16:18:05 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 02 Jul 2011 16:18:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_possibily_uninitialized?= =?utf8?q?_memory_usage_=28closes_=2312474=29?= Message-ID: http://hg.python.org/cpython/rev/6b3872a11299 changeset: 71129:6b3872a11299 user: Benjamin Peterson date: Sat Jul 02 09:22:13 2011 -0500 summary: fix possibily uninitialized memory usage (closes #12474) files: Python/symtable.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -904,10 +904,10 @@ st->st_cur = NULL; size = PyList_GET_SIZE(st->st_stack); if (size) { - st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, - size - 2); if (PyList_SetSlice(st->st_stack, size - 1, size, NULL) < 0) return 0; + if (--size) + st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, size - 1); } return 1; } -- Repository URL: http://hg.python.org/cpython From merwok at netwok.org Sat Jul 2 16:23:48 2011 From: merwok at netwok.org (=?UTF-8?B?w4lyaWMgQXJhdWpv?=) Date: Sat, 02 Jul 2011 16:23:48 +0200 Subject: [Python-checkins] cpython: Issue #12451: Add support.create_empty_file() In-Reply-To: References: Message-ID: <4E0F29F4.9010100@netwok.org> > changeset: 71103:0c49260e85a0 > user: Victor Stinner > summary: > Issue #12451: Add support.create_empty_file() > > files: > Lib/distutils/tests/test_build_py.py | 6 ++-- Please don?t make cosmetic changes in distutils, especially in tests: It?s not worth the time. This can also make future merges of bugfixes a bit less easy. If you don?t back out the whole changeset (following Antoine?s comment about uselessness, with which I agree), I?ll back out the changes in this distutils test file. Regards From python-checkins at python.org Sat Jul 2 16:47:40 2011 From: python-checkins at python.org (eric.araujo) Date: Sat, 02 Jul 2011 16:47:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Clean_up_NEWS_entry_and_tes?= =?utf8?q?ts_for_shutil=2Edisk=5Fusage_=28=2312442=29?= Message-ID: http://hg.python.org/cpython/rev/479973c6aa03 changeset: 71130:479973c6aa03 user: ?ric Araujo date: Sat Jul 02 16:45:45 2011 +0200 summary: Clean up NEWS entry and tests for shutil.disk_usage (#12442) files: Doc/whatsnew/3.3.rst | 2 +- Lib/test/test_shutil.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -206,7 +206,7 @@ shutil ------ -The :mod:`shutil` module has a new :func:`~shutil.disk_usage` providing total, +The :mod:`shutil` module has a new :func:`~shutil.disk_usage` function providing total, used and free disk space statistics. (Contributed by Giampaolo Rodol? in :issue:`12442`) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -732,11 +732,11 @@ "disk_usage not available on this platform") def test_disk_usage(self): usage = shutil.disk_usage(os.getcwd()) - self.assertTrue(usage.total > 0) - self.assertTrue(usage.used > 0) - self.assertTrue(usage.free >= 0) - self.assertTrue(usage.total >= usage.used) - self.assertTrue(usage.total > usage.free) + self.assertGreater(usage.total, 0) + self.assertGreater(usage.used, 0) + self.assertGreaterEqual(usage.free, 0) + self.assertGreaterEqual(usage.total, usage.used) + self.assertGreater(usage.total, usage.free) class TestMove(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 17:43:17 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 17:43:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2312291?= =?utf8?q?=3A_Fixed_bug_which_was_found_when_doing__multiple_loads_from_on?= =?utf8?q?e?= Message-ID: http://hg.python.org/cpython/rev/edba722f3b02 changeset: 71131:edba722f3b02 branch: 3.2 parent: 71127:37606505b227 user: Vinay Sajip date: Sat Jul 02 16:42:47 2011 +0100 summary: Closes #12291: Fixed bug which was found when doing multiple loads from one stream. files: Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/test/test_marshal.py | 24 + Misc/NEWS | 3 + Python/marshal.c | 215 +++++++-- 4 files changed, 183 insertions(+), 61 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -214,7 +214,7 @@ lambda bc: bc[:8] + b'', del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path - with self.assertRaises(ValueError): + with self.assertRaises(EOFError): self.import_(file_path, '_temp') def _test_bad_magic(self, test, *, del_source=False): diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -211,6 +211,30 @@ invalid_string = b'l\x02\x00\x00\x00\x00\x00\x00\x00' self.assertRaises(ValueError, marshal.loads, invalid_string) + def test_multiple_dumps_and_loads(self): + # Issue 12291: marshal.load() should be callable multiple times + # with interleaved data written by non-marshal code + # Adapted from a patch by Engelbert Gruber. + data = (1, 'abc', b'def', 1.0, (2, 'a', ['b', b'c'])) + for interleaved in (b'', b'0123'): + ilen = len(interleaved) + positions = [] + try: + with open(support.TESTFN, 'wb') as f: + for d in data: + marshal.dump(d, f) + if ilen: + f.write(interleaved) + positions.append(f.tell()) + with open(support.TESTFN, 'rb') as f: + for i, d in enumerate(data): + self.assertEqual(d, marshal.load(f)) + if ilen: + f.read(ilen) + self.assertEqual(positions[i], f.tell()) + finally: + support.unlink(support.TESTFN) + def test_main(): support.run_unittest(IntTestCase, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12291: You can now load multiple marshalled objects from a stream, + with other data interleaved between marshalled objects. + - Issue #12084: os.stat on Windows now works properly with relative symbolic links when called from any directory. diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -57,6 +57,7 @@ int error; /* see WFERR_* values */ int depth; /* If fp == NULL, the following are valid: */ + PyObject * readable; /* Stream-like object being read from */ PyObject *str; char *ptr; char *end; @@ -466,27 +467,75 @@ #define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) -#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) - static int r_string(char *s, int n, RFILE *p) { - if (p->fp != NULL) - /* The result fits into int because it must be <=n. */ - return (int)fread(s, 1, n, p->fp); - if (p->end - p->ptr < n) - n = (int)(p->end - p->ptr); - memcpy(s, p->ptr, n); - p->ptr += n; - return n; + char * ptr; + int read, left; + + if (!p->readable) { + if (p->fp != NULL) + /* The result fits into int because it must be <=n. */ + read = (int) fread(s, 1, n, p->fp); + else { + left = (int)(p->end - p->ptr); + read = (left < n) ? left : n; + memcpy(s, p->ptr, read); + p->ptr += read; + } + } + else { + PyObject *data = PyObject_CallMethod(p->readable, "read", "i", n); + read = 0; + if (data != NULL) { + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + } + else { + read = PyBytes_GET_SIZE(data); + if (read > 0) { + ptr = PyBytes_AS_STRING(data); + memcpy(s, ptr, read); + } + } + Py_DECREF(data); + } + } + if (!PyErr_Occurred() && (read < n)) { + PyErr_SetString(PyExc_EOFError, "EOF read where not expected"); + } + return read; +} + + +static int +r_byte(RFILE *p) +{ + int c = EOF; + unsigned char ch; + int n; + + if (!p->readable) + c = p->fp ? getc(p->fp) : rs_byte(p); + else { + n = r_string((char *) &ch, 1, p); + if (n > 0) + c = ch; + } + return c; } static int r_short(RFILE *p) { register short x; - x = r_byte(p); - x |= r_byte(p) << 8; + unsigned char buffer[2]; + + r_string((char *) buffer, 2, p); + x = buffer[0]; + x |= buffer[1] << 8; /* Sign-extension, in case short greater than 16 bits */ x |= -(x & 0x8000); return x; @@ -496,19 +545,13 @@ r_long(RFILE *p) { register long x; - register FILE *fp = p->fp; - if (fp) { - x = getc(fp); - x |= (long)getc(fp) << 8; - x |= (long)getc(fp) << 16; - x |= (long)getc(fp) << 24; - } - else { - x = rs_byte(p); - x |= (long)rs_byte(p) << 8; - x |= (long)rs_byte(p) << 16; - x |= (long)rs_byte(p) << 24; - } + unsigned char buffer[4]; + + r_string((char *) buffer, 4, p); + x = buffer[0]; + x |= (long)buffer[1] << 8; + x |= (long)buffer[2] << 16; + x |= (long)buffer[3] << 24; #if SIZEOF_LONG > 4 /* Sign extension for 64-bit machines */ x |= -(x & 0x80000000L); @@ -526,25 +569,30 @@ static PyObject * r_long64(RFILE *p) { + PyObject * result = NULL; long lo4 = r_long(p); long hi4 = r_long(p); + + if (!PyErr_Occurred()) { #if SIZEOF_LONG > 4 - long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyLong_FromLong(x); + long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); + result = PyLong_FromLong(x); #else - unsigned char buf[8]; - int one = 1; - int is_little_endian = (int)*(char*)&one; - if (is_little_endian) { - memcpy(buf, &lo4, 4); - memcpy(buf+4, &hi4, 4); + unsigned char buf[8]; + int one = 1; + int is_little_endian = (int)*(char*)&one; + if (is_little_endian) { + memcpy(buf, &lo4, 4); + memcpy(buf+4, &hi4, 4); + } + else { + memcpy(buf, &hi4, 4); + memcpy(buf+4, &lo4, 4); + } + result = _PyLong_FromByteArray(buf, 8, is_little_endian, 1); +#endif } - else { - memcpy(buf, &hi4, 4); - memcpy(buf+4, &lo4, 4); - } - return _PyLong_FromByteArray(buf, 8, is_little_endian, 1); -#endif + return result; } static PyObject * @@ -556,6 +604,8 @@ digit d; n = r_long(p); + if (PyErr_Occurred()) + return NULL; if (n == 0) return (PyObject *)_PyLong_New(0); if (n < -INT_MAX || n > INT_MAX) { @@ -575,6 +625,8 @@ d = 0; for (j=0; j < PyLong_MARSHAL_RATIO; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; d += (digit)md << j*PyLong_MARSHAL_SHIFT; @@ -584,6 +636,8 @@ d = 0; for (j=0; j < shorts_in_top_digit; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; /* topmost marshal digit should be nonzero */ @@ -595,6 +649,10 @@ } d += (digit)md << j*PyLong_MARSHAL_SHIFT; } + if (PyErr_Occurred()) { + Py_DECREF(ob); + return NULL; + } /* top digit should be nonzero, else the resulting PyLong won't be normalized */ ob->ob_digit[size-1] = d; @@ -663,7 +721,8 @@ break; case TYPE_INT: - retval = PyLong_FromLong(r_long(p)); + n = r_long(p); + retval = PyErr_Occurred() ? NULL : PyLong_FromLong(n); break; case TYPE_INT64: @@ -773,6 +832,10 @@ case TYPE_STRING: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); retval = NULL; @@ -798,6 +861,10 @@ char *buffer; n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); retval = NULL; @@ -823,6 +890,10 @@ case TYPE_TUPLE: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (tuple size out of range)"); retval = NULL; @@ -850,6 +921,10 @@ case TYPE_LIST: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (list size out of range)"); retval = NULL; @@ -902,6 +977,10 @@ case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (set size out of range)"); retval = NULL; @@ -955,10 +1034,20 @@ /* XXX ignore long->int overflows for now */ argcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; kwonlyargcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; nlocals = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; stacksize = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; flags = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; code = r_object(p); if (code == NULL) goto code_error; @@ -1040,6 +1129,7 @@ { RFILE rf; assert(fp); + rf.readable = NULL; rf.fp = fp; rf.strings = NULL; rf.end = rf.ptr = NULL; @@ -1051,6 +1141,7 @@ { RFILE rf; rf.fp = fp; + rf.readable = NULL; rf.strings = NULL; rf.ptr = rf.end = NULL; return r_long(&rf); @@ -1112,6 +1203,7 @@ RFILE rf; PyObject *result; rf.fp = fp; + rf.readable = NULL; rf.strings = PyList_New(0); rf.depth = 0; rf.ptr = rf.end = NULL; @@ -1126,6 +1218,7 @@ RFILE rf; PyObject *result; rf.fp = NULL; + rf.readable = NULL; rf.ptr = str; rf.end = str + len; rf.strings = PyList_New(0); @@ -1142,6 +1235,7 @@ PyObject *res = NULL; wf.fp = NULL; + wf.readable = NULL; wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; @@ -1219,33 +1313,33 @@ static PyObject * marshal_load(PyObject *self, PyObject *f) { - /* XXX Quick hack -- need to do this differently */ PyObject *data, *result; RFILE rf; - data = PyObject_CallMethod(f, "read", ""); + char *p; + int n; + + /* + * Make a call to the read method, but read zero bytes. + * This is to ensure that the object passed in at least + * has a read method which returns bytes. + */ + data = PyObject_CallMethod(f, "read", "i", 0); if (data == NULL) return NULL; - rf.fp = NULL; - if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); - } - else if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + result = NULL; } else { - PyErr_Format(PyExc_TypeError, - "f.read() returned neither string " - "nor bytes but %.100s", - data->ob_type->tp_name); - Py_DECREF(data); - return NULL; + rf.strings = PyList_New(0); + rf.depth = 0; + rf.fp = NULL; + rf.readable = f; + result = read_object(&rf); + Py_DECREF(rf.strings); } - rf.strings = PyList_New(0); - rf.depth = 0; - result = read_object(&rf); - Py_DECREF(rf.strings); Py_DECREF(data); return result; } @@ -1296,6 +1390,7 @@ s = p.buf; n = p.len; rf.fp = NULL; + rf.readable = NULL; rf.ptr = s; rf.end = s + n; rf.strings = PyList_New(0); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 18:16:10 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 18:16:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Closes_=2312291_for_3=2E3_-_merged_fix_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/42dd11028e94 changeset: 71132:42dd11028e94 parent: 71130:479973c6aa03 parent: 71131:edba722f3b02 user: Vinay Sajip date: Sat Jul 02 17:16:02 2011 +0100 summary: Closes #12291 for 3.3 - merged fix from 3.2. files: Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/test/test_marshal.py | 24 + Misc/NEWS | 3 + Python/marshal.c | 214 +++++++-- 4 files changed, 183 insertions(+), 60 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -214,7 +214,7 @@ lambda bc: bc[:8] + b'', del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path - with self.assertRaises(ValueError): + with self.assertRaises(EOFError): self.import_(file_path, '_temp') def _test_bad_magic(self, test, *, del_source=False): diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -228,6 +228,30 @@ invalid_string = b'l\x02\x00\x00\x00\x00\x00\x00\x00' self.assertRaises(ValueError, marshal.loads, invalid_string) + def test_multiple_dumps_and_loads(self): + # Issue 12291: marshal.load() should be callable multiple times + # with interleaved data written by non-marshal code + # Adapted from a patch by Engelbert Gruber. + data = (1, 'abc', b'def', 1.0, (2, 'a', ['b', b'c'])) + for interleaved in (b'', b'0123'): + ilen = len(interleaved) + positions = [] + try: + with open(support.TESTFN, 'wb') as f: + for d in data: + marshal.dump(d, f) + if ilen: + f.write(interleaved) + positions.append(f.tell()) + with open(support.TESTFN, 'rb') as f: + for i, d in enumerate(data): + self.assertEqual(d, marshal.load(f)) + if ilen: + f.read(ilen) + self.assertEqual(positions[i], f.tell()) + finally: + support.unlink(support.TESTFN) + def test_main(): support.run_unittest(IntTestCase, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12291: You can now load multiple marshalled objects from a stream, + with other data interleaved between marshalled objects. + - Issue #12356: When required positional or keyword-only arguments are not given, produce a informative error message which includes the name(s) of the missing arguments. diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -57,6 +57,7 @@ int error; /* see WFERR_* values */ int depth; /* If fp == NULL, the following are valid: */ + PyObject * readable; /* Stream-like object being read from */ PyObject *str; PyObject *current_filename; char *ptr; @@ -463,27 +464,75 @@ #define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) -#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) - static int r_string(char *s, int n, RFILE *p) { - if (p->fp != NULL) - /* The result fits into int because it must be <=n. */ - return (int)fread(s, 1, n, p->fp); - if (p->end - p->ptr < n) - n = (int)(p->end - p->ptr); - memcpy(s, p->ptr, n); - p->ptr += n; - return n; + char * ptr; + int read, left; + + if (!p->readable) { + if (p->fp != NULL) + /* The result fits into int because it must be <=n. */ + read = (int) fread(s, 1, n, p->fp); + else { + left = (int)(p->end - p->ptr); + read = (left < n) ? left : n; + memcpy(s, p->ptr, read); + p->ptr += read; + } + } + else { + PyObject *data = PyObject_CallMethod(p->readable, "read", "i", n); + read = 0; + if (data != NULL) { + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + } + else { + read = PyBytes_GET_SIZE(data); + if (read > 0) { + ptr = PyBytes_AS_STRING(data); + memcpy(s, ptr, read); + } + } + Py_DECREF(data); + } + } + if (!PyErr_Occurred() && (read < n)) { + PyErr_SetString(PyExc_EOFError, "EOF read where not expected"); + } + return read; +} + + +static int +r_byte(RFILE *p) +{ + int c = EOF; + unsigned char ch; + int n; + + if (!p->readable) + c = p->fp ? getc(p->fp) : rs_byte(p); + else { + n = r_string((char *) &ch, 1, p); + if (n > 0) + c = ch; + } + return c; } static int r_short(RFILE *p) { register short x; - x = r_byte(p); - x |= r_byte(p) << 8; + unsigned char buffer[2]; + + r_string((char *) buffer, 2, p); + x = buffer[0]; + x |= buffer[1] << 8; /* Sign-extension, in case short greater than 16 bits */ x |= -(x & 0x8000); return x; @@ -493,19 +542,13 @@ r_long(RFILE *p) { register long x; - register FILE *fp = p->fp; - if (fp) { - x = getc(fp); - x |= (long)getc(fp) << 8; - x |= (long)getc(fp) << 16; - x |= (long)getc(fp) << 24; - } - else { - x = rs_byte(p); - x |= (long)rs_byte(p) << 8; - x |= (long)rs_byte(p) << 16; - x |= (long)rs_byte(p) << 24; - } + unsigned char buffer[4]; + + r_string((char *) buffer, 4, p); + x = buffer[0]; + x |= (long)buffer[1] << 8; + x |= (long)buffer[2] << 16; + x |= (long)buffer[3] << 24; #if SIZEOF_LONG > 4 /* Sign extension for 64-bit machines */ x |= -(x & 0x80000000L); @@ -523,25 +566,30 @@ static PyObject * r_long64(RFILE *p) { + PyObject * result = NULL; long lo4 = r_long(p); long hi4 = r_long(p); + + if (!PyErr_Occurred()) { #if SIZEOF_LONG > 4 - long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyLong_FromLong(x); + long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); + result = PyLong_FromLong(x); #else - unsigned char buf[8]; - int one = 1; - int is_little_endian = (int)*(char*)&one; - if (is_little_endian) { - memcpy(buf, &lo4, 4); - memcpy(buf+4, &hi4, 4); + unsigned char buf[8]; + int one = 1; + int is_little_endian = (int)*(char*)&one; + if (is_little_endian) { + memcpy(buf, &lo4, 4); + memcpy(buf+4, &hi4, 4); + } + else { + memcpy(buf, &hi4, 4); + memcpy(buf+4, &lo4, 4); + } + result = _PyLong_FromByteArray(buf, 8, is_little_endian, 1); +#endif } - else { - memcpy(buf, &hi4, 4); - memcpy(buf+4, &lo4, 4); - } - return _PyLong_FromByteArray(buf, 8, is_little_endian, 1); -#endif + return result; } static PyObject * @@ -553,6 +601,8 @@ digit d; n = r_long(p); + if (PyErr_Occurred()) + return NULL; if (n == 0) return (PyObject *)_PyLong_New(0); if (n < -INT_MAX || n > INT_MAX) { @@ -572,6 +622,8 @@ d = 0; for (j=0; j < PyLong_MARSHAL_RATIO; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; d += (digit)md << j*PyLong_MARSHAL_SHIFT; @@ -581,6 +633,8 @@ d = 0; for (j=0; j < shorts_in_top_digit; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; /* topmost marshal digit should be nonzero */ @@ -592,6 +646,10 @@ } d += (digit)md << j*PyLong_MARSHAL_SHIFT; } + if (PyErr_Occurred()) { + Py_DECREF(ob); + return NULL; + } /* top digit should be nonzero, else the resulting PyLong won't be normalized */ ob->ob_digit[size-1] = d; @@ -660,7 +718,8 @@ break; case TYPE_INT: - retval = PyLong_FromLong(r_long(p)); + n = r_long(p); + retval = PyErr_Occurred() ? NULL : PyLong_FromLong(n); break; case TYPE_INT64: @@ -770,6 +829,10 @@ case TYPE_STRING: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); retval = NULL; @@ -795,6 +858,10 @@ char *buffer; n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); retval = NULL; @@ -820,6 +887,10 @@ case TYPE_TUPLE: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (tuple size out of range)"); retval = NULL; @@ -847,6 +918,10 @@ case TYPE_LIST: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (list size out of range)"); retval = NULL; @@ -899,6 +974,10 @@ case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (set size out of range)"); retval = NULL; @@ -952,10 +1031,20 @@ /* XXX ignore long->int overflows for now */ argcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; kwonlyargcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; nlocals = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; stacksize = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; flags = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; code = r_object(p); if (code == NULL) goto code_error; @@ -1049,6 +1138,7 @@ { RFILE rf; assert(fp); + rf.readable = NULL; rf.fp = fp; rf.current_filename = NULL; rf.end = rf.ptr = NULL; @@ -1060,6 +1150,7 @@ { RFILE rf; rf.fp = fp; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = rf.end = NULL; return r_long(&rf); @@ -1121,6 +1212,7 @@ RFILE rf; PyObject *result; rf.fp = fp; + rf.readable = NULL; rf.current_filename = NULL; rf.depth = 0; rf.ptr = rf.end = NULL; @@ -1134,6 +1226,7 @@ RFILE rf; PyObject *result; rf.fp = NULL; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = str; rf.end = str + len; @@ -1149,6 +1242,7 @@ PyObject *res = NULL; wf.fp = NULL; + wf.readable = NULL; wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; @@ -1224,32 +1318,33 @@ static PyObject * marshal_load(PyObject *self, PyObject *f) { - /* XXX Quick hack -- need to do this differently */ PyObject *data, *result; RFILE rf; - data = PyObject_CallMethod(f, "read", ""); + char *p; + int n; + + /* + * Make a call to the read method, but read zero bytes. + * This is to ensure that the object passed in at least + * has a read method which returns bytes. + */ + data = PyObject_CallMethod(f, "read", "i", 0); if (data == NULL) return NULL; - rf.fp = NULL; - rf.current_filename = NULL; - if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); - } - else if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + result = NULL; } else { - PyErr_Format(PyExc_TypeError, - "f.read() returned neither string " - "nor bytes but %.100s", - data->ob_type->tp_name); - Py_DECREF(data); - return NULL; + rf.strings = PyList_New(0); + rf.depth = 0; + rf.fp = NULL; + rf.readable = f; + result = read_object(&rf); + Py_DECREF(rf.strings); } - rf.depth = 0; - result = read_object(&rf); Py_DECREF(data); return result; } @@ -1300,6 +1395,7 @@ s = p.buf; n = p.len; rf.fp = NULL; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = s; rf.end = s + n; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 18:20:00 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 18:20:00 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Removed_breaking_typo_accid?= =?utf8?q?entally_introduced_during_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/a7978d73ef2f changeset: 71133:a7978d73ef2f user: Vinay Sajip date: Sat Jul 02 17:19:51 2011 +0100 summary: Removed breaking typo accidentally introduced during merge with 3.2. files: Python/marshal.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1320,8 +1320,6 @@ { PyObject *data, *result; RFILE rf; - char *p; - int n; /* * Make a call to the read method, but read zero bytes. @@ -1338,12 +1336,10 @@ result = NULL; } else { - rf.strings = PyList_New(0); rf.depth = 0; rf.fp = NULL; rf.readable = f; result = read_object(&rf); - Py_DECREF(rf.strings); } Py_DECREF(data); return result; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 18:23:05 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 18:23:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Removed_some_un?= =?utf8?q?used_local_variables=2E?= Message-ID: http://hg.python.org/cpython/rev/14efcccc70e6 changeset: 71134:14efcccc70e6 branch: 3.2 parent: 71131:edba722f3b02 user: Vinay Sajip date: Sat Jul 02 17:21:37 2011 +0100 summary: Removed some unused local variables. files: Python/marshal.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1315,8 +1315,6 @@ { PyObject *data, *result; RFILE rf; - char *p; - int n; /* * Make a call to the read method, but read zero bytes. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 18:23:06 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 18:23:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merged_unused_variable_removal_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/abb6b2363418 changeset: 71135:abb6b2363418 parent: 71133:a7978d73ef2f parent: 71134:14efcccc70e6 user: Vinay Sajip date: Sat Jul 02 17:22:58 2011 +0100 summary: Merged unused variable removal from 3.2. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 19:42:31 2011 From: python-checkins at python.org (vinay.sajip) Date: Sat, 02 Jul 2011 19:42:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Correct_uninitialized_data_?= =?utf8?q?problem_in_marshal_code=2E?= Message-ID: http://hg.python.org/cpython/rev/42193f3ffc94 changeset: 71136:42193f3ffc94 user: Vinay Sajip date: Sat Jul 02 18:42:21 2011 +0100 summary: Correct uninitialized data problem in marshal code. files: Python/marshal.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1339,6 +1339,7 @@ rf.depth = 0; rf.fp = NULL; rf.readable = f; + rf.current_filename = NULL; result = read_object(&rf); } Py_DECREF(data); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 2 21:21:14 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 02 Jul 2011 21:21:14 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312456=3A_fix_a_pos?= =?utf8?q?sible_hang_on_shutdown_of_a?= Message-ID: http://hg.python.org/cpython/rev/51c1f2cedb96 changeset: 71137:51c1f2cedb96 user: Antoine Pitrou date: Sat Jul 02 21:20:25 2011 +0200 summary: Issue #12456: fix a possible hang on shutdown of a concurrent.futures.ProcessPoolExecutor. files: Lib/concurrent/futures/process.py | 30 +++++++++++----- Lib/test/test_concurrent_futures.py | 7 +++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -50,7 +50,7 @@ from concurrent.futures import _base import queue import multiprocessing -from multiprocessing.queues import SimpleQueue, SentinelReady +from multiprocessing.queues import SimpleQueue, SentinelReady, Full import threading import weakref @@ -195,6 +195,10 @@ result_queue: A multiprocessing.Queue of _ResultItems generated by the process workers. """ + executor = None + + def shutting_down(): + return _shutdown or executor is None or executor._shutdown_thread def shutdown_worker(): # This is an upper bound @@ -202,8 +206,7 @@ for i in range(0, nb_children_alive): call_queue.put(None) # If .join() is not called on the created processes then - # some multiprocessing.Queue methods may deadlock on Mac OS - # X. + # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): p.join() @@ -222,7 +225,7 @@ if executor is not None: executor._broken = True executor._shutdown_thread = True - del executor + executor = None # All futures in flight must be marked failed for work_id, work_item in pending_work_items.items(): work_item.future.set_exception( @@ -242,7 +245,11 @@ if isinstance(result_item, int): # Clean shutdown of a worker using its PID # (avoids marking the executor broken) + assert shutting_down() del processes[result_item] + if not processes: + shutdown_worker() + return elif result_item is not None: work_item = pending_work_items.pop(result_item.work_id, None) # work_item can be None if another process terminated (see above) @@ -257,16 +264,21 @@ # - The interpreter is shutting down OR # - The executor that owns this worker has been collected OR # - The executor that owns this worker has been shutdown. - if _shutdown or executor is None or executor._shutdown_thread: + if shutting_down(): # Since no new work items can be added, it is safe to shutdown # this thread if there are no pending work items. - if not pending_work_items: + if not pending_work_items and call_queue.qsize() == 0: shutdown_worker() return - else: + try: # Start shutting down by telling a process it can exit. - call_queue.put(None) - del executor + call_queue.put_nowait(None) + except Full: + # This is not a problem: we will eventually be woken up (in + # result_queue.get()) and be able to send a sentinel again, + # if necessary. + pass + executor = None _system_limits_checked = False _system_limited = None diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -367,6 +367,13 @@ self.assertEqual([None, None], results) + def test_shutdown_race_issue12456(self): + # Issue #12456: race condition at shutdown where trying to post a + # sentinel in the call queue blocks (the queue is full while processes + # have exited). + self.executor.map(str, [2] * (self.worker_count + 1)) + self.executor.shutdown() + class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest): def test_map_submits_without_iteration(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 03:14:31 2011 From: python-checkins at python.org (r.david.murray) Date: Sun, 03 Jul 2011 03:14:31 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEyMTQ3OiBtYWtl?= =?utf8?q?_send=5Fmessage_correctly_handle_Sender_and_Resent-_headers=2E?= Message-ID: http://hg.python.org/cpython/rev/0f5ea42fb46c changeset: 71138:0f5ea42fb46c branch: 3.2 parent: 71134:14efcccc70e6 user: R David Murray date: Sat Jul 02 21:03:19 2011 -0400 summary: #12147: make send_message correctly handle Sender and Resent- headers. Original patch by Nicolas Estibals. My tweaks to the patch were mostly style/cosmetic, and adding more tests. files: Doc/library/smtplib.rst | 27 ++++- Lib/smtplib.py | 52 +++++++++--- Lib/test/test_smtplib.py | 111 ++++++++++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 3 + 5 files changed, 172 insertions(+), 22 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -323,21 +323,32 @@ .. versionchanged:: 3.2 *msg* may be a byte string. -.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=[], rcpt_options=[]) +.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \ + mail_options=[], rcpt_options=[]) This is a convenience method for calling :meth:`sendmail` with the message represented by an :class:`email.message.Message` object. The arguments have the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` object. - If *from_addr* is ``None``, ``send_message`` sets its value to the value of - the :mailheader:`From` header from *msg*. If *to_addrs* is ``None``, - ``send_message`` combines the values (if any) of the :mailheader:`To`, - :mailheader:`CC`, and :mailheader:`Bcc` fields from *msg*. Regardless of - the values of *from_addr* and *to_addrs*, ``send_message`` deletes any Bcc - field from *msg*. It then serializes *msg* using + If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills + those arguments with addresses extracted from the headers of *msg* as + specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` + field if it is present, and otherwise to the :mailheader:`From` field. + *to_adresses* combines the values (if any) of the :mailheader:`To`, + :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one + set of :mailheader:`Resent-*` headers appear in the message, the regular + headers are ignored and the :mailheader:`Resent-*` headers are used instead. + If the message contains more than one set of :mailheader:`Resent-*` headers, + a :exc:`ValueError` is raised, since there is no way to unambiguously detect + the most recent set of :mailheader:`Resent-` headers. + + ``send_message`` serializes *msg* using :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and - calls :meth:`sendmail` to transmit the resulting message. + calls :meth:`sendmail` to transmit the resulting message. Regardless of the + values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any + :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear + in *msg*. .. versionadded:: 3.2 diff --git a/Lib/smtplib.py b/Lib/smtplib.py old mode 100755 new mode 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -49,6 +49,7 @@ import email.generator import base64 import hmac +import copy from email.base64mime import body_encode as encode_base64 from sys import stderr @@ -674,7 +675,7 @@ msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone - \r and \n characters are converted to \r\n characters. + \\r and \\n characters are converted to \\r\\n characters. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size @@ -757,24 +758,49 @@ """Converts message to a bytestring and passes it to sendmail. The arguments are as for sendmail, except that msg is an - email.message.Message object. If from_addr is None, the from_addr is - taken from the 'From' header of the Message. If to_addrs is None, its - value is composed from the addresses listed in the 'To', 'CC', and - 'Bcc' fields. Regardless of the values of from_addr and to_addr, any - Bcc field in the Message object is deleted. The Message object is then - serialized using email.generator.BytesGenerator and sendmail is called - to transmit the message. + email.message.Message object. If from_addr is None or to_addrs is + None, these arguments are taken from the headers of the Message as + described in RFC 2822 (a ValueError is raised if there is more than + one set of 'Resent-' headers). Regardless of the values of from_addr and + to_addr, any Bcc field (or Resent-Bcc field, when the Message is a + resent) of the Message object won't be transmitted. The Message + object is then serialized using email.generator.BytesGenerator and + sendmail is called to transmit the message. + """ + # 'Resent-Date' is a mandatory field if the Message is resent (RFC 2822 + # Section 3.6.6). In such a case, we use the 'Resent-*' fields. However, + # if there is more than one 'Resent-' block there's no way to + # unambiguously determine which one is the most recent in all cases, + # so rather than guess we raise a ValueError in that case. + # + # TODO implement heuristics to guess the correct Resent-* block with an + # option allowing the user to enable the heuristics. (It should be + # possible to guess correctly almost all of the time.) + resent =msg.get_all('Resent-Date') + if resent is None: + header_prefix = '' + elif len(resent) == 1: + header_prefix = 'Resent-' + else: + raise ValueError("message has more than one 'Resent-' header block") if from_addr is None: - from_addr = msg['From'] + # Prefer the sender field per RFC 2822:3.6.2. + from_addr = (msg[header_prefix+'Sender'] + if (header_prefix+'Sender') in msg + else msg[header_prefix+'From']) if to_addrs is None: - addr_fields = [f for f in (msg['To'], msg['Bcc'], msg['CC']) - if f is not None] + addr_fields = [f for f in (msg[header_prefix+'To'], + msg[header_prefix+'Bcc'], + msg[header_prefix+'Cc']) if f is not None] to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)] - del msg['Bcc'] + # Make a local copy so we can delete the bcc headers. + msg_copy = copy.copy(msg) + del msg_copy['Bcc'] + del msg_copy['Resent-Bcc'] with io.BytesIO() as bytesmsg: g = email.generator.BytesGenerator(bytesmsg) - g.flatten(msg, linesep='\r\n') + g.flatten(msg_copy, linesep='\r\n') flatmsg = bytesmsg.getvalue() return self.sendmail(from_addr, to_addrs, flatmsg, mail_options, rcpt_options) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -320,13 +320,16 @@ # XXX (see comment in testSend) time.sleep(0.01) smtp.quit() + # make sure the Bcc header is still in the message. + self.assertEqual(m['Bcc'], 'John Root , "Dinsdale" ' + '') self.client_evt.set() self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds m['X-Peer'] = socket.gethostbyname('localhost') - # The Bcc header is deleted before serialization. + # The Bcc header should not be transmitted. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) @@ -365,6 +368,112 @@ re.MULTILINE) self.assertRegex(debugout, to_addr) + def testSendMessageWithSpecifiedAddresses(self): + # Make sure addresses specified in call override those in message. + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m, from_addr='joe at example.com', to_addrs='foo at example.net') + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: joe at example.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertNotRegex(debugout, to_addr) + recip = re.compile(r"^recips: .*'foo at example.net'.*$", re.MULTILINE) + self.assertRegex(debugout, recip) + + def testSendMessageWithMultipleFrom(self): + # Sender overrides To + m = email.mime.text.MIMEText('A test message') + m['From'] = 'Bernard, Bianca' + m['Sender'] = 'the_rescuers at Rescue-Aid-Society.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: the_rescuers at Rescue-Aid-Society.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageResent(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # The Resent-Bcc headers are deleted before serialization. + del m['Bcc'] + del m['Resent-Bcc'] + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: holy at grail.net$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('my_mom at great.cooker.com', 'Jeff', 'doe at losthope.net'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageMultipleResentRaises(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + m['Resent-Date'] = 'Thu, 2 Jan 1970 17:42:00 +0000' + m['Resent-To'] = 'holy at grail.net' + m['Resent-From'] = 'Martha , Jeff' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + with self.assertRaises(ValueError): + smtp.send_message(m) + smtp.close() class NonConnectingTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -265,6 +265,7 @@ Ben Escoto Andy Eskilsson Stefan Esser +Nicolas Estibals Stephen D Evans Carey Evans Tim Everett diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -28,6 +28,9 @@ Library ------- +- Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better + conformance to the RFCs: correctly handle Sender and Resent- headers. + - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 03:14:31 2011 From: python-checkins at python.org (r.david.murray) Date: Sun, 03 Jul 2011 03:14:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_=2312147=3A_make_send=5Fmessage_correctly_handle_Sende?= =?utf8?q?r_and_Resent-_headers=2E?= Message-ID: http://hg.python.org/cpython/rev/b8cec4f3faaa changeset: 71139:b8cec4f3faaa parent: 71137:51c1f2cedb96 parent: 71138:0f5ea42fb46c user: R David Murray date: Sat Jul 02 21:10:44 2011 -0400 summary: merge #12147: make send_message correctly handle Sender and Resent- headers. files: Doc/library/smtplib.rst | 27 ++++- Lib/smtplib.py | 52 +++++++++--- Lib/test/test_smtplib.py | 111 ++++++++++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 3 + 5 files changed, 172 insertions(+), 22 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -348,21 +348,32 @@ .. versionchanged:: 3.2 *msg* may be a byte string. -.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=[], rcpt_options=[]) +.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \ + mail_options=[], rcpt_options=[]) This is a convenience method for calling :meth:`sendmail` with the message represented by an :class:`email.message.Message` object. The arguments have the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` object. - If *from_addr* is ``None``, ``send_message`` sets its value to the value of - the :mailheader:`From` header from *msg*. If *to_addrs* is ``None``, - ``send_message`` combines the values (if any) of the :mailheader:`To`, - :mailheader:`CC`, and :mailheader:`Bcc` fields from *msg*. Regardless of - the values of *from_addr* and *to_addrs*, ``send_message`` deletes any Bcc - field from *msg*. It then serializes *msg* using + If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills + those arguments with addresses extracted from the headers of *msg* as + specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` + field if it is present, and otherwise to the :mailheader:`From` field. + *to_adresses* combines the values (if any) of the :mailheader:`To`, + :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one + set of :mailheader:`Resent-*` headers appear in the message, the regular + headers are ignored and the :mailheader:`Resent-*` headers are used instead. + If the message contains more than one set of :mailheader:`Resent-*` headers, + a :exc:`ValueError` is raised, since there is no way to unambiguously detect + the most recent set of :mailheader:`Resent-` headers. + + ``send_message`` serializes *msg* using :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and - calls :meth:`sendmail` to transmit the resulting message. + calls :meth:`sendmail` to transmit the resulting message. Regardless of the + values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any + :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear + in *msg*. .. versionadded:: 3.2 diff --git a/Lib/smtplib.py b/Lib/smtplib.py old mode 100755 new mode 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -49,6 +49,7 @@ import email.generator import base64 import hmac +import copy from email.base64mime import body_encode as encode_base64 from sys import stderr @@ -676,7 +677,7 @@ msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone - \r and \n characters are converted to \r\n characters. + \\r and \\n characters are converted to \\r\\n characters. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size @@ -759,24 +760,49 @@ """Converts message to a bytestring and passes it to sendmail. The arguments are as for sendmail, except that msg is an - email.message.Message object. If from_addr is None, the from_addr is - taken from the 'From' header of the Message. If to_addrs is None, its - value is composed from the addresses listed in the 'To', 'CC', and - 'Bcc' fields. Regardless of the values of from_addr and to_addr, any - Bcc field in the Message object is deleted. The Message object is then - serialized using email.generator.BytesGenerator and sendmail is called - to transmit the message. + email.message.Message object. If from_addr is None or to_addrs is + None, these arguments are taken from the headers of the Message as + described in RFC 2822 (a ValueError is raised if there is more than + one set of 'Resent-' headers). Regardless of the values of from_addr and + to_addr, any Bcc field (or Resent-Bcc field, when the Message is a + resent) of the Message object won't be transmitted. The Message + object is then serialized using email.generator.BytesGenerator and + sendmail is called to transmit the message. + """ + # 'Resent-Date' is a mandatory field if the Message is resent (RFC 2822 + # Section 3.6.6). In such a case, we use the 'Resent-*' fields. However, + # if there is more than one 'Resent-' block there's no way to + # unambiguously determine which one is the most recent in all cases, + # so rather than guess we raise a ValueError in that case. + # + # TODO implement heuristics to guess the correct Resent-* block with an + # option allowing the user to enable the heuristics. (It should be + # possible to guess correctly almost all of the time.) + resent =msg.get_all('Resent-Date') + if resent is None: + header_prefix = '' + elif len(resent) == 1: + header_prefix = 'Resent-' + else: + raise ValueError("message has more than one 'Resent-' header block") if from_addr is None: - from_addr = msg['From'] + # Prefer the sender field per RFC 2822:3.6.2. + from_addr = (msg[header_prefix+'Sender'] + if (header_prefix+'Sender') in msg + else msg[header_prefix+'From']) if to_addrs is None: - addr_fields = [f for f in (msg['To'], msg['Bcc'], msg['CC']) - if f is not None] + addr_fields = [f for f in (msg[header_prefix+'To'], + msg[header_prefix+'Bcc'], + msg[header_prefix+'Cc']) if f is not None] to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)] - del msg['Bcc'] + # Make a local copy so we can delete the bcc headers. + msg_copy = copy.copy(msg) + del msg_copy['Bcc'] + del msg_copy['Resent-Bcc'] with io.BytesIO() as bytesmsg: g = email.generator.BytesGenerator(bytesmsg) - g.flatten(msg, linesep='\r\n') + g.flatten(msg_copy, linesep='\r\n') flatmsg = bytesmsg.getvalue() return self.sendmail(from_addr, to_addrs, flatmsg, mail_options, rcpt_options) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -320,13 +320,16 @@ # XXX (see comment in testSend) time.sleep(0.01) smtp.quit() + # make sure the Bcc header is still in the message. + self.assertEqual(m['Bcc'], 'John Root , "Dinsdale" ' + '') self.client_evt.set() self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds m['X-Peer'] = socket.gethostbyname('localhost') - # The Bcc header is deleted before serialization. + # The Bcc header should not be transmitted. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) @@ -365,6 +368,112 @@ re.MULTILINE) self.assertRegex(debugout, to_addr) + def testSendMessageWithSpecifiedAddresses(self): + # Make sure addresses specified in call override those in message. + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m, from_addr='joe at example.com', to_addrs='foo at example.net') + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: joe at example.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertNotRegex(debugout, to_addr) + recip = re.compile(r"^recips: .*'foo at example.net'.*$", re.MULTILINE) + self.assertRegex(debugout, recip) + + def testSendMessageWithMultipleFrom(self): + # Sender overrides To + m = email.mime.text.MIMEText('A test message') + m['From'] = 'Bernard, Bianca' + m['Sender'] = 'the_rescuers at Rescue-Aid-Society.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: the_rescuers at Rescue-Aid-Society.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageResent(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # The Resent-Bcc headers are deleted before serialization. + del m['Bcc'] + del m['Resent-Bcc'] + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: holy at grail.net$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('my_mom at great.cooker.com', 'Jeff', 'doe at losthope.net'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageMultipleResentRaises(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + m['Resent-Date'] = 'Thu, 2 Jan 1970 17:42:00 +0000' + m['Resent-To'] = 'holy at grail.net' + m['Resent-From'] = 'Martha , Jeff' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + with self.assertRaises(ValueError): + smtp.send_message(m) + smtp.close() class NonConnectingTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -278,6 +278,7 @@ Andy Eskilsson Andr? Espaze Stefan Esser +Nicolas Estibals Stephen D Evans Carey Evans Tim Everett diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -203,6 +203,9 @@ Library ------- +- Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better + conformance to the RFCs: correctly handle Sender and Resent- headers. + - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jul 3 05:09:01 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 03 Jul 2011 05:09:01 +0200 Subject: [Python-checkins] Daily reference leaks (b8cec4f3faaa): sum=-393 Message-ID: results for b8cec4f3faaa on branch "default" -------------------------------------------- test_concurrent_futures leaked [0, 0, -693] references, sum=-693 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [0, -323, 323] references, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog4pW5vH', '-x'] From python-checkins at python.org Sun Jul 3 09:22:48 2011 From: python-checkins at python.org (georg.brandl) Date: Sun, 03 Jul 2011 09:22:48 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_disable_ASDLGEN?= =?utf8?q?_if_hg_won=27t_work=2C_or_if_python_is_not_installed=2E?= Message-ID: http://hg.python.org/cpython/rev/4e0c1128cda2 changeset: 71140:4e0c1128cda2 branch: 3.2 parent: 71138:0f5ea42fb46c user: Ralf Schmitt date: Tue May 31 17:10:03 2011 -0500 summary: disable ASDLGEN if hg won't work, or if python is not installed. This change makes configure check for - the existence of a hg repository - the hg executable itself - the python executable Running $(srcdir)/Parser/asdl_c.py (i.e. ASDLGEN) will fail if any of the above prerequisites is missing, so we now disable it instead. closes #12225 files: Makefile.pre.in | 2 +- configure.in | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -274,7 +274,7 @@ ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py # XXX Note that a build now requires Python exist before the build starts -ASDLGEN= $(srcdir)/Parser/asdl_c.py +ASDLGEN= @DISABLE_ASDLGEN@ $(srcdir)/Parser/asdl_c.py ########################################################################## # Python diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -832,7 +832,13 @@ AC_SUBST(HGVERSION) AC_SUBST(HGTAG) AC_SUBST(HGBRANCH) + +if test -e $srcdir/.hg/00changelog.i +then AC_CHECK_PROG(HAS_HG, hg, found, not-found) +else +HAS_HG=no-repository +fi if test $HAS_HG = found then HGVERSION="hg id -i \$(srcdir)" @@ -844,6 +850,15 @@ HGBRANCH="" fi +AC_SUBST(DISABLE_ASDLGEN) +DISABLE_ASDLGEN="" +AC_CHECK_PROG(HAS_PYTHON, python, found, not-found) +if test $HAS_HG != found -o $HAS_PYTHON != found +then + DISABLE_ASDLGEN="@echo hg: $HAS_HG, python: $HAS_PYTHON! cannot run \$(srcdir)/Parser/asdl_c.py #" +fi + + case $MACHDEP in bsdos*|hp*|HP*) # install -d does not work on BSDI or HP-UX -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 09:22:49 2011 From: python-checkins at python.org (georg.brandl) Date: Sun, 03 Jul 2011 09:22:49 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Regenerate_conf?= =?utf8?q?igure=2E?= Message-ID: http://hg.python.org/cpython/rev/2a3563bc9fcb changeset: 71141:2a3563bc9fcb branch: 3.2 user: Georg Brandl date: Sun Jul 03 09:23:20 2011 +0200 summary: Regenerate configure. files: configure | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -644,6 +644,8 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +HAS_PYTHON +DISABLE_ASDLGEN HAS_HG HGBRANCH HGTAG @@ -5204,6 +5206,9 @@ + +if test -e $srcdir/.hg/00changelog.i +then # Extract the first word of "hg", so it can be a program name with args. set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -5242,6 +5247,9 @@ fi +else +HAS_HG=no-repository +fi if test $HAS_HG = found then HGVERSION="hg id -i \$(srcdir)" @@ -5253,6 +5261,52 @@ HGBRANCH="" fi + +DISABLE_ASDLGEN="" +# Extract the first word of "python", so it can be a program name with args. +set dummy python; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAS_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAS_PYTHON"; then + ac_cv_prog_HAS_PYTHON="$HAS_PYTHON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAS_PYTHON="found" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAS_PYTHON" && ac_cv_prog_HAS_PYTHON="not-found" +fi +fi +HAS_PYTHON=$ac_cv_prog_HAS_PYTHON +if test -n "$HAS_PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_PYTHON" >&5 +$as_echo "$HAS_PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test $HAS_HG != found -o $HAS_PYTHON != found +then + DISABLE_ASDLGEN="@echo hg: $HAS_HG, python: $HAS_PYTHON! cannot run \$(srcdir)/Parser/asdl_c.py #" +fi + + case $MACHDEP in bsdos*|hp*|HP*) # install -d does not work on BSDI or HP-UX -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 09:25:01 2011 From: python-checkins at python.org (georg.brandl) Date: Sun, 03 Jul 2011 09:25:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Dummy-merge_configure_change_from_3=2E2_that_is_already_in_d?= =?utf8?q?efault=2E?= Message-ID: http://hg.python.org/cpython/rev/6395a901c380 changeset: 71142:6395a901c380 parent: 71139:b8cec4f3faaa parent: 71141:2a3563bc9fcb user: Georg Brandl date: Sun Jul 03 09:25:32 2011 +0200 summary: Dummy-merge configure change from 3.2 that is already in default. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 11:35:47 2011 From: python-checkins at python.org (vinay.sajip) Date: Sun, 03 Jul 2011 11:35:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312406=3A_Added_upa?= =?utf8?q?tes_for_packaging=27s_=2Eexe_files=2C_command=5Ftemplate=2C_and?= Message-ID: http://hg.python.org/cpython/rev/3ce11ddc9ec3 changeset: 71143:3ce11ddc9ec3 user: Vinay Sajip date: Sun Jul 03 10:35:41 2011 +0100 summary: Issue #12406: Added upates for packaging's .exe files, command_template, and sysconfig.cfg. files: Tools/msi/msi.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -119,6 +119,7 @@ "30":"{6953bc3b-6768-4291-8410-7914ce6e2ca8}", "31":"{4afcba0b-13e4-47c3-bebe-477428b46913}", "32":"{3ff95315-1096-4d31-bd86-601d5438ad5e}", + "33":"{f7581ca4-d368-4eea-8f82-d48c64c4f047}", } [major+minor] # Compute the name that Sphinx gives to the docfile @@ -1010,6 +1011,8 @@ lib.remove_pyc() # package READMEs if present lib.glob("README") + if dir=='Lib': + lib.add_file("sysconfig.cfg") if dir=='test' and parent.physical=='Lib': lib.add_file("185test.db") lib.add_file("audiotest.au") @@ -1045,7 +1048,7 @@ if dir=="Icons": lib.glob("*.gif") lib.add_file("idle.icns") - if dir=="command" and parent.physical=="distutils": + if dir=="command" and parent.physical in ("distutils", "packaging"): lib.glob("wininst*.exe") lib.add_file("command_template") if dir=="lib2to3": @@ -1156,6 +1159,8 @@ lib.add_file("README.txt", src="README") if f == 'Scripts': lib.add_file("2to3.py", src="2to3") + lib.add_file("pydoc3.py", src="pydoc3") + lib.add_file("pysetup3.py", src="pysetup3") if have_tcl: lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") lib.add_file("pydocgui.pyw") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 13:17:52 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 03 Jul 2011 13:17:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Followup_to_51c1f2cedb96_?= =?utf8?q?=28and_issue_=2312456=29=3A?= Message-ID: http://hg.python.org/cpython/rev/ce52310f61a0 changeset: 71144:ce52310f61a0 user: Antoine Pitrou date: Sun Jul 03 13:17:06 2011 +0200 summary: Followup to 51c1f2cedb96 (and issue #12456): qsize() raises NotImplementedError on OS X, don't use it. files: Lib/concurrent/futures/process.py | 20 +++++++++--------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -204,7 +204,7 @@ # This is an upper bound nb_children_alive = sum(p.is_alive() for p in processes.values()) for i in range(0, nb_children_alive): - call_queue.put(None) + call_queue.put_nowait(None) # If .join() is not called on the created processes then # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): @@ -265,18 +265,18 @@ # - The executor that owns this worker has been collected OR # - The executor that owns this worker has been shutdown. if shutting_down(): - # Since no new work items can be added, it is safe to shutdown - # this thread if there are no pending work items. - if not pending_work_items and call_queue.qsize() == 0: - shutdown_worker() - return try: - # Start shutting down by telling a process it can exit. - call_queue.put_nowait(None) + # Since no new work items can be added, it is safe to shutdown + # this thread if there are no pending work items. + if not pending_work_items: + shutdown_worker() + return + else: + # Start shutting down by telling a process it can exit. + call_queue.put_nowait(None) except Full: # This is not a problem: we will eventually be woken up (in - # result_queue.get()) and be able to send a sentinel again, - # if necessary. + # result_queue.get()) and be able to send a sentinel again. pass executor = None -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 19:13:19 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 03 Jul 2011 19:13:19 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_reST_indentatio?= =?utf8?q?n_fix_in_sqlite3_docs=2E_rst_uses_3_space_indentation=2E?= Message-ID: http://hg.python.org/cpython/rev/08400969067e changeset: 71145:08400969067e branch: 2.7 parent: 71125:874143242d79 user: Senthil Kumaran date: Sun Jul 03 10:12:59 2011 -0700 summary: reST indentation fix in sqlite3 docs. rst uses 3 space indentation. files: Doc/library/sqlite3.rst | 73 ++++++++++++++-------------- 1 files changed, 37 insertions(+), 36 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -604,42 +604,42 @@ Let's assume we initialize a table as in the example given above:: - conn = sqlite3.connect(":memory:") - c = conn.cursor() - c.execute('''create table stocks - (date text, trans text, symbol text, - qty real, price real)''') - c.execute("""insert into stocks - values ('2006-01-05','BUY','RHAT',100,35.14)""") - conn.commit() - c.close() + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() Now we plug :class:`Row` in:: - >>> conn.row_factory = sqlite3.Row - >>> c = conn.cursor() - >>> c.execute('select * from stocks') - - >>> r = c.fetchone() - >>> type(r) - - >>> r - (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14) - >>> len(r) - 5 - >>> r[2] - u'RHAT' - >>> r.keys() - ['date', 'trans', 'symbol', 'qty', 'price'] - >>> r['qty'] - 100.0 - >>> for member in r: print member - ... - 2006-01-05 - BUY - RHAT - 100.0 - 35.14 + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> r + (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14) + >>> len(r) + 5 + >>> r[2] + u'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: print member + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 .. _sqlite3-types: @@ -901,7 +901,8 @@ .. rubric:: Footnotes .. [#f1] The sqlite3 module is not built with loadable extension support by - default, because some platforms (notably Mac OS X) have SQLite libraries which - are compiled without this feature. To get loadable extension support, you must - modify setup.py and remove the line that sets SQLITE_OMIT_LOAD_EXTENSION. + default, because some platforms (notably Mac OS X) have SQLite libraries + which are compiled without this feature. To get loadable extension support, + you must modify setup.py and remove the line that sets + SQLITE_OMIT_LOAD_EXTENSION. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 19:22:47 2011 From: python-checkins at python.org (georg.brandl) Date: Sun, 03 Jul 2011 19:22:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_mention_of_medical_c?= =?utf8?q?ondition_from_the_test_suite=2E?= Message-ID: http://hg.python.org/cpython/rev/76452b892838 changeset: 71146:76452b892838 parent: 71144:ce52310f61a0 user: Georg Brandl date: Sun Jul 03 19:22:42 2011 +0200 summary: Remove mention of medical condition from the test suite. files: Lib/test/test_csv.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -459,20 +459,20 @@ '5', '6']]) def test_quoted_quote(self): - self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', + self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he picked up his hammer and saw"', [['1', '2', '3', - '"I see," said the blind man', + '"I see," said the happy man', 'as he picked up his hammer and saw']]) def test_quoted_nl(self): input = '''\ 1,2,3,"""I see,"" -said the blind man","as he picked up his +said the happy man","as he picked up his hammer and saw" 9,8,7,6''' self.readerAssertEqual(input, [['1', '2', '3', - '"I see,"\nsaid the blind man', + '"I see,"\nsaid the happy man', 'as he picked up his\nhammer and saw'], ['9','8','7','6']]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 19:24:01 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 03 Jul 2011 19:24:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_reST_indentatio?= =?utf8?q?n_fix_in_sqlite3_docs=2E_rst_uses_3_space_indentation=2E?= Message-ID: http://hg.python.org/cpython/rev/5d1a2b8f508c changeset: 71147:5d1a2b8f508c branch: 3.2 parent: 71141:2a3563bc9fcb user: Senthil Kumaran date: Sun Jul 03 10:17:22 2011 -0700 summary: reST indentation fix in sqlite3 docs. rst uses 3 space indentation. files: Doc/library/sqlite3.rst | 75 ++++++++++++++-------------- 1 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -599,43 +599,43 @@ Let's assume we initialize a table as in the example given above:: - conn = sqlite3.connect(":memory:") - c = conn.cursor() - c.execute('''create table stocks - (date text, trans text, symbol text, - qty real, price real)''') - c.execute("""insert into stocks - values ('2006-01-05','BUY','RHAT',100,35.14)""") - conn.commit() - c.close() + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() Now we plug :class:`Row` in:: - >>> conn.row_factory = sqlite3.Row - >>> c = conn.cursor() - >>> c.execute('select * from stocks') - - >>> r = c.fetchone() - >>> type(r) - - >>> tuple(r) - ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) - >>> len(r) - 5 - >>> r[2] - 'RHAT' - >>> r.keys() - ['date', 'trans', 'symbol', 'qty', 'price'] - >>> r['qty'] - 100.0 - >>> for member in r: - ... print(member) - ... - 2006-01-05 - BUY - RHAT - 100.0 - 35.14 + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> tuple(r) + ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) + >>> len(r) + 5 + >>> r[2] + 'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: + ... print(member) + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 .. _sqlite3-types: @@ -886,6 +886,7 @@ .. rubric:: Footnotes .. [#f1] The sqlite3 module is not built with loadable extension support by - default, because some platforms (notably Mac OS X) have SQLite libraries which - are compiled without this feature. To get loadable extension support, you must - pass --enable-loadable-sqlite-extensions to configure. + default, because some platforms (notably Mac OS X) have SQLite + libraries which are compiled without this feature. To get loadable + extension support, you must pass --enable-loadable-sqlite-extensions to + configure. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 19:24:02 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 03 Jul 2011 19:24:02 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/a085e755c892 changeset: 71148:a085e755c892 parent: 71146:76452b892838 parent: 71147:5d1a2b8f508c user: Senthil Kumaran date: Sun Jul 03 10:23:43 2011 -0700 summary: merge from 3.2 files: Doc/library/sqlite3.rst | 75 ++++++++++++++-------------- 1 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -615,43 +615,43 @@ Let's assume we initialize a table as in the example given above:: - conn = sqlite3.connect(":memory:") - c = conn.cursor() - c.execute('''create table stocks - (date text, trans text, symbol text, - qty real, price real)''') - c.execute("""insert into stocks - values ('2006-01-05','BUY','RHAT',100,35.14)""") - conn.commit() - c.close() + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() Now we plug :class:`Row` in:: - >>> conn.row_factory = sqlite3.Row - >>> c = conn.cursor() - >>> c.execute('select * from stocks') - - >>> r = c.fetchone() - >>> type(r) - - >>> tuple(r) - ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) - >>> len(r) - 5 - >>> r[2] - 'RHAT' - >>> r.keys() - ['date', 'trans', 'symbol', 'qty', 'price'] - >>> r['qty'] - 100.0 - >>> for member in r: - ... print(member) - ... - 2006-01-05 - BUY - RHAT - 100.0 - 35.14 + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> tuple(r) + ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) + >>> len(r) + 5 + >>> r[2] + 'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: + ... print(member) + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 .. _sqlite3-types: @@ -902,6 +902,7 @@ .. rubric:: Footnotes .. [#f1] The sqlite3 module is not built with loadable extension support by - default, because some platforms (notably Mac OS X) have SQLite libraries which - are compiled without this feature. To get loadable extension support, you must - pass --enable-loadable-sqlite-extensions to configure. + default, because some platforms (notably Mac OS X) have SQLite + libraries which are compiled without this feature. To get loadable + extension support, you must pass --enable-loadable-sqlite-extensions to + configure. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:32 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:32 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogYWRkIDMuMi4yIGhl?= =?utf8?q?ading?= Message-ID: http://hg.python.org/cpython/rev/60cc7eb9816e changeset: 71149:60cc7eb9816e branch: 3.2 parent: 71127:37606505b227 user: Benjamin Peterson date: Sun Jul 03 13:31:34 2011 -0500 summary: add 3.2.2 heading files: Misc/NEWS | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,20 @@ Python News +++++++++++ +What's New in Python 3.2.2? +=========================== + +*Release date: XX-XX-2011* + +Core and Builtins +----------------- + +Library +------- + +C-API +----- + What's New in Python 3.2.1 release candidate 2? =============================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:33 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/6c955e38daa5 changeset: 71150:6c955e38daa5 parent: 71129:6b3872a11299 parent: 71149:60cc7eb9816e user: Benjamin Peterson date: Sun Jul 03 13:32:17 2011 -0500 summary: merge 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:34 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:34 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_restore_a_gener?= =?utf8?q?ator=27s_caller=27s_exception_state_both_on_yield_and_=28last=29?= =?utf8?q?_return?= Message-ID: http://hg.python.org/cpython/rev/cc7ae81cfe91 changeset: 71151:cc7ae81cfe91 branch: 3.2 parent: 71149:60cc7eb9816e user: Benjamin Peterson date: Sun Jul 03 13:44:00 2011 -0500 summary: restore a generator's caller's exception state both on yield and (last) return This prevents generator exception state from leaking into the caller. Closes #12475. files: Lib/test/test_exceptions.py | 15 +++++++++++++++ Misc/NEWS | 3 +++ Python/ceval.c | 9 +++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -566,6 +566,21 @@ del g self.assertEqual(sys.exc_info()[0], TypeError) + def test_generator_leaking2(self): + # See issue 12475. + def g(): + yield + try: + raise RuntimeError + except RuntimeError: + it = g() + next(it) + try: + next(it) + except StopIteration: + pass + self.assertEqual(sys.exc_info(), (None, None, None)) + def test_generator_finalizing_and_exc_info(self): # See #7173 def simple_gen(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12475: Prevent generators from leaking their exception state into the + callers frame as they return for the last time. + Library ------- diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1881,10 +1881,6 @@ retval = POP(); f->f_stacktop = stack_pointer; why = WHY_YIELD; - /* Put aside the current exception state and restore - that of the calling frame. This only serves when - "yield" is used inside an except handler. */ - SWAP_EXC_STATE(); goto fast_yield; TARGET(POP_EXCEPT) @@ -3021,6 +3017,11 @@ retval = NULL; fast_yield: + if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) + /* Put aside the current exception state and restore that of the + calling frame. */ + SWAP_EXC_STATE(); + if (tstate->use_tracing) { if (tstate->c_tracefunc) { if (why == WHY_RETURN || why == WHY_YIELD) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:35 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:35 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/36bc49565281 changeset: 71152:36bc49565281 branch: 3.2 parent: 71151:cc7ae81cfe91 parent: 71147:5d1a2b8f508c user: Benjamin Peterson date: Sun Jul 03 13:44:56 2011 -0500 summary: merge heads files: Doc/library/smtplib.rst | 27 +- Doc/library/sqlite3.rst | 75 +- Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/smtplib.py | 52 +- Lib/test/test_marshal.py | 24 + Lib/test/test_smtplib.py | 111 +++++- Makefile.pre.in | 2 +- Misc/ACKS | 1 + Misc/NEWS | 6 + Python/marshal.c | 213 +++++++-- configure | 54 ++ configure.in | 15 + 12 files changed, 461 insertions(+), 121 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -323,21 +323,32 @@ .. versionchanged:: 3.2 *msg* may be a byte string. -.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=[], rcpt_options=[]) +.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \ + mail_options=[], rcpt_options=[]) This is a convenience method for calling :meth:`sendmail` with the message represented by an :class:`email.message.Message` object. The arguments have the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` object. - If *from_addr* is ``None``, ``send_message`` sets its value to the value of - the :mailheader:`From` header from *msg*. If *to_addrs* is ``None``, - ``send_message`` combines the values (if any) of the :mailheader:`To`, - :mailheader:`CC`, and :mailheader:`Bcc` fields from *msg*. Regardless of - the values of *from_addr* and *to_addrs*, ``send_message`` deletes any Bcc - field from *msg*. It then serializes *msg* using + If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills + those arguments with addresses extracted from the headers of *msg* as + specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` + field if it is present, and otherwise to the :mailheader:`From` field. + *to_adresses* combines the values (if any) of the :mailheader:`To`, + :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one + set of :mailheader:`Resent-*` headers appear in the message, the regular + headers are ignored and the :mailheader:`Resent-*` headers are used instead. + If the message contains more than one set of :mailheader:`Resent-*` headers, + a :exc:`ValueError` is raised, since there is no way to unambiguously detect + the most recent set of :mailheader:`Resent-` headers. + + ``send_message`` serializes *msg* using :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and - calls :meth:`sendmail` to transmit the resulting message. + calls :meth:`sendmail` to transmit the resulting message. Regardless of the + values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any + :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear + in *msg*. .. versionadded:: 3.2 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -599,43 +599,43 @@ Let's assume we initialize a table as in the example given above:: - conn = sqlite3.connect(":memory:") - c = conn.cursor() - c.execute('''create table stocks - (date text, trans text, symbol text, - qty real, price real)''') - c.execute("""insert into stocks - values ('2006-01-05','BUY','RHAT',100,35.14)""") - conn.commit() - c.close() + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() Now we plug :class:`Row` in:: - >>> conn.row_factory = sqlite3.Row - >>> c = conn.cursor() - >>> c.execute('select * from stocks') - - >>> r = c.fetchone() - >>> type(r) - - >>> tuple(r) - ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) - >>> len(r) - 5 - >>> r[2] - 'RHAT' - >>> r.keys() - ['date', 'trans', 'symbol', 'qty', 'price'] - >>> r['qty'] - 100.0 - >>> for member in r: - ... print(member) - ... - 2006-01-05 - BUY - RHAT - 100.0 - 35.14 + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> tuple(r) + ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) + >>> len(r) + 5 + >>> r[2] + 'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: + ... print(member) + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 .. _sqlite3-types: @@ -886,6 +886,7 @@ .. rubric:: Footnotes .. [#f1] The sqlite3 module is not built with loadable extension support by - default, because some platforms (notably Mac OS X) have SQLite libraries which - are compiled without this feature. To get loadable extension support, you must - pass --enable-loadable-sqlite-extensions to configure. + default, because some platforms (notably Mac OS X) have SQLite + libraries which are compiled without this feature. To get loadable + extension support, you must pass --enable-loadable-sqlite-extensions to + configure. diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -214,7 +214,7 @@ lambda bc: bc[:8] + b'', del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path - with self.assertRaises(ValueError): + with self.assertRaises(EOFError): self.import_(file_path, '_temp') def _test_bad_magic(self, test, *, del_source=False): diff --git a/Lib/smtplib.py b/Lib/smtplib.py old mode 100755 new mode 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -49,6 +49,7 @@ import email.generator import base64 import hmac +import copy from email.base64mime import body_encode as encode_base64 from sys import stderr @@ -674,7 +675,7 @@ msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone - \r and \n characters are converted to \r\n characters. + \\r and \\n characters are converted to \\r\\n characters. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size @@ -757,24 +758,49 @@ """Converts message to a bytestring and passes it to sendmail. The arguments are as for sendmail, except that msg is an - email.message.Message object. If from_addr is None, the from_addr is - taken from the 'From' header of the Message. If to_addrs is None, its - value is composed from the addresses listed in the 'To', 'CC', and - 'Bcc' fields. Regardless of the values of from_addr and to_addr, any - Bcc field in the Message object is deleted. The Message object is then - serialized using email.generator.BytesGenerator and sendmail is called - to transmit the message. + email.message.Message object. If from_addr is None or to_addrs is + None, these arguments are taken from the headers of the Message as + described in RFC 2822 (a ValueError is raised if there is more than + one set of 'Resent-' headers). Regardless of the values of from_addr and + to_addr, any Bcc field (or Resent-Bcc field, when the Message is a + resent) of the Message object won't be transmitted. The Message + object is then serialized using email.generator.BytesGenerator and + sendmail is called to transmit the message. + """ + # 'Resent-Date' is a mandatory field if the Message is resent (RFC 2822 + # Section 3.6.6). In such a case, we use the 'Resent-*' fields. However, + # if there is more than one 'Resent-' block there's no way to + # unambiguously determine which one is the most recent in all cases, + # so rather than guess we raise a ValueError in that case. + # + # TODO implement heuristics to guess the correct Resent-* block with an + # option allowing the user to enable the heuristics. (It should be + # possible to guess correctly almost all of the time.) + resent =msg.get_all('Resent-Date') + if resent is None: + header_prefix = '' + elif len(resent) == 1: + header_prefix = 'Resent-' + else: + raise ValueError("message has more than one 'Resent-' header block") if from_addr is None: - from_addr = msg['From'] + # Prefer the sender field per RFC 2822:3.6.2. + from_addr = (msg[header_prefix+'Sender'] + if (header_prefix+'Sender') in msg + else msg[header_prefix+'From']) if to_addrs is None: - addr_fields = [f for f in (msg['To'], msg['Bcc'], msg['CC']) - if f is not None] + addr_fields = [f for f in (msg[header_prefix+'To'], + msg[header_prefix+'Bcc'], + msg[header_prefix+'Cc']) if f is not None] to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)] - del msg['Bcc'] + # Make a local copy so we can delete the bcc headers. + msg_copy = copy.copy(msg) + del msg_copy['Bcc'] + del msg_copy['Resent-Bcc'] with io.BytesIO() as bytesmsg: g = email.generator.BytesGenerator(bytesmsg) - g.flatten(msg, linesep='\r\n') + g.flatten(msg_copy, linesep='\r\n') flatmsg = bytesmsg.getvalue() return self.sendmail(from_addr, to_addrs, flatmsg, mail_options, rcpt_options) diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -211,6 +211,30 @@ invalid_string = b'l\x02\x00\x00\x00\x00\x00\x00\x00' self.assertRaises(ValueError, marshal.loads, invalid_string) + def test_multiple_dumps_and_loads(self): + # Issue 12291: marshal.load() should be callable multiple times + # with interleaved data written by non-marshal code + # Adapted from a patch by Engelbert Gruber. + data = (1, 'abc', b'def', 1.0, (2, 'a', ['b', b'c'])) + for interleaved in (b'', b'0123'): + ilen = len(interleaved) + positions = [] + try: + with open(support.TESTFN, 'wb') as f: + for d in data: + marshal.dump(d, f) + if ilen: + f.write(interleaved) + positions.append(f.tell()) + with open(support.TESTFN, 'rb') as f: + for i, d in enumerate(data): + self.assertEqual(d, marshal.load(f)) + if ilen: + f.read(ilen) + self.assertEqual(positions[i], f.tell()) + finally: + support.unlink(support.TESTFN) + def test_main(): support.run_unittest(IntTestCase, diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -320,13 +320,16 @@ # XXX (see comment in testSend) time.sleep(0.01) smtp.quit() + # make sure the Bcc header is still in the message. + self.assertEqual(m['Bcc'], 'John Root , "Dinsdale" ' + '') self.client_evt.set() self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds m['X-Peer'] = socket.gethostbyname('localhost') - # The Bcc header is deleted before serialization. + # The Bcc header should not be transmitted. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) @@ -365,6 +368,112 @@ re.MULTILINE) self.assertRegex(debugout, to_addr) + def testSendMessageWithSpecifiedAddresses(self): + # Make sure addresses specified in call override those in message. + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m, from_addr='joe at example.com', to_addrs='foo at example.net') + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: joe at example.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertNotRegex(debugout, to_addr) + recip = re.compile(r"^recips: .*'foo at example.net'.*$", re.MULTILINE) + self.assertRegex(debugout, recip) + + def testSendMessageWithMultipleFrom(self): + # Sender overrides To + m = email.mime.text.MIMEText('A test message') + m['From'] = 'Bernard, Bianca' + m['Sender'] = 'the_rescuers at Rescue-Aid-Society.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: the_rescuers at Rescue-Aid-Society.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageResent(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # The Resent-Bcc headers are deleted before serialization. + del m['Bcc'] + del m['Resent-Bcc'] + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: holy at grail.net$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('my_mom at great.cooker.com', 'Jeff', 'doe at losthope.net'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageMultipleResentRaises(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + m['Resent-Date'] = 'Thu, 2 Jan 1970 17:42:00 +0000' + m['Resent-To'] = 'holy at grail.net' + m['Resent-From'] = 'Martha , Jeff' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + with self.assertRaises(ValueError): + smtp.send_message(m) + smtp.close() class NonConnectingTests(unittest.TestCase): diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -274,7 +274,7 @@ ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py # XXX Note that a build now requires Python exist before the build starts -ASDLGEN= $(srcdir)/Parser/asdl_c.py +ASDLGEN= @DISABLE_ASDLGEN@ $(srcdir)/Parser/asdl_c.py ########################################################################## # Python diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -265,6 +265,7 @@ Ben Escoto Andy Eskilsson Stefan Esser +Nicolas Estibals Stephen D Evans Carey Evans Tim Everett diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Core and Builtins ----------------- +- Issue #12291: You can now load multiple marshalled objects from a stream, + with other data interleaved between marshalled objects. + - Issue #12084: os.stat on Windows now works properly with relative symbolic links when called from any directory. @@ -42,6 +45,9 @@ Library ------- +- Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better + conformance to the RFCs: correctly handle Sender and Resent- headers. + - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -57,6 +57,7 @@ int error; /* see WFERR_* values */ int depth; /* If fp == NULL, the following are valid: */ + PyObject * readable; /* Stream-like object being read from */ PyObject *str; char *ptr; char *end; @@ -466,27 +467,75 @@ #define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) -#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) - static int r_string(char *s, int n, RFILE *p) { - if (p->fp != NULL) - /* The result fits into int because it must be <=n. */ - return (int)fread(s, 1, n, p->fp); - if (p->end - p->ptr < n) - n = (int)(p->end - p->ptr); - memcpy(s, p->ptr, n); - p->ptr += n; - return n; + char * ptr; + int read, left; + + if (!p->readable) { + if (p->fp != NULL) + /* The result fits into int because it must be <=n. */ + read = (int) fread(s, 1, n, p->fp); + else { + left = (int)(p->end - p->ptr); + read = (left < n) ? left : n; + memcpy(s, p->ptr, read); + p->ptr += read; + } + } + else { + PyObject *data = PyObject_CallMethod(p->readable, "read", "i", n); + read = 0; + if (data != NULL) { + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + } + else { + read = PyBytes_GET_SIZE(data); + if (read > 0) { + ptr = PyBytes_AS_STRING(data); + memcpy(s, ptr, read); + } + } + Py_DECREF(data); + } + } + if (!PyErr_Occurred() && (read < n)) { + PyErr_SetString(PyExc_EOFError, "EOF read where not expected"); + } + return read; +} + + +static int +r_byte(RFILE *p) +{ + int c = EOF; + unsigned char ch; + int n; + + if (!p->readable) + c = p->fp ? getc(p->fp) : rs_byte(p); + else { + n = r_string((char *) &ch, 1, p); + if (n > 0) + c = ch; + } + return c; } static int r_short(RFILE *p) { register short x; - x = r_byte(p); - x |= r_byte(p) << 8; + unsigned char buffer[2]; + + r_string((char *) buffer, 2, p); + x = buffer[0]; + x |= buffer[1] << 8; /* Sign-extension, in case short greater than 16 bits */ x |= -(x & 0x8000); return x; @@ -496,19 +545,13 @@ r_long(RFILE *p) { register long x; - register FILE *fp = p->fp; - if (fp) { - x = getc(fp); - x |= (long)getc(fp) << 8; - x |= (long)getc(fp) << 16; - x |= (long)getc(fp) << 24; - } - else { - x = rs_byte(p); - x |= (long)rs_byte(p) << 8; - x |= (long)rs_byte(p) << 16; - x |= (long)rs_byte(p) << 24; - } + unsigned char buffer[4]; + + r_string((char *) buffer, 4, p); + x = buffer[0]; + x |= (long)buffer[1] << 8; + x |= (long)buffer[2] << 16; + x |= (long)buffer[3] << 24; #if SIZEOF_LONG > 4 /* Sign extension for 64-bit machines */ x |= -(x & 0x80000000L); @@ -526,25 +569,30 @@ static PyObject * r_long64(RFILE *p) { + PyObject * result = NULL; long lo4 = r_long(p); long hi4 = r_long(p); + + if (!PyErr_Occurred()) { #if SIZEOF_LONG > 4 - long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyLong_FromLong(x); + long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); + result = PyLong_FromLong(x); #else - unsigned char buf[8]; - int one = 1; - int is_little_endian = (int)*(char*)&one; - if (is_little_endian) { - memcpy(buf, &lo4, 4); - memcpy(buf+4, &hi4, 4); + unsigned char buf[8]; + int one = 1; + int is_little_endian = (int)*(char*)&one; + if (is_little_endian) { + memcpy(buf, &lo4, 4); + memcpy(buf+4, &hi4, 4); + } + else { + memcpy(buf, &hi4, 4); + memcpy(buf+4, &lo4, 4); + } + result = _PyLong_FromByteArray(buf, 8, is_little_endian, 1); +#endif } - else { - memcpy(buf, &hi4, 4); - memcpy(buf+4, &lo4, 4); - } - return _PyLong_FromByteArray(buf, 8, is_little_endian, 1); -#endif + return result; } static PyObject * @@ -556,6 +604,8 @@ digit d; n = r_long(p); + if (PyErr_Occurred()) + return NULL; if (n == 0) return (PyObject *)_PyLong_New(0); if (n < -INT_MAX || n > INT_MAX) { @@ -575,6 +625,8 @@ d = 0; for (j=0; j < PyLong_MARSHAL_RATIO; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; d += (digit)md << j*PyLong_MARSHAL_SHIFT; @@ -584,6 +636,8 @@ d = 0; for (j=0; j < shorts_in_top_digit; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; /* topmost marshal digit should be nonzero */ @@ -595,6 +649,10 @@ } d += (digit)md << j*PyLong_MARSHAL_SHIFT; } + if (PyErr_Occurred()) { + Py_DECREF(ob); + return NULL; + } /* top digit should be nonzero, else the resulting PyLong won't be normalized */ ob->ob_digit[size-1] = d; @@ -663,7 +721,8 @@ break; case TYPE_INT: - retval = PyLong_FromLong(r_long(p)); + n = r_long(p); + retval = PyErr_Occurred() ? NULL : PyLong_FromLong(n); break; case TYPE_INT64: @@ -773,6 +832,10 @@ case TYPE_STRING: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); retval = NULL; @@ -798,6 +861,10 @@ char *buffer; n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); retval = NULL; @@ -823,6 +890,10 @@ case TYPE_TUPLE: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (tuple size out of range)"); retval = NULL; @@ -850,6 +921,10 @@ case TYPE_LIST: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (list size out of range)"); retval = NULL; @@ -902,6 +977,10 @@ case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (set size out of range)"); retval = NULL; @@ -955,10 +1034,20 @@ /* XXX ignore long->int overflows for now */ argcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; kwonlyargcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; nlocals = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; stacksize = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; flags = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; code = r_object(p); if (code == NULL) goto code_error; @@ -1040,6 +1129,7 @@ { RFILE rf; assert(fp); + rf.readable = NULL; rf.fp = fp; rf.strings = NULL; rf.end = rf.ptr = NULL; @@ -1051,6 +1141,7 @@ { RFILE rf; rf.fp = fp; + rf.readable = NULL; rf.strings = NULL; rf.ptr = rf.end = NULL; return r_long(&rf); @@ -1112,6 +1203,7 @@ RFILE rf; PyObject *result; rf.fp = fp; + rf.readable = NULL; rf.strings = PyList_New(0); rf.depth = 0; rf.ptr = rf.end = NULL; @@ -1126,6 +1218,7 @@ RFILE rf; PyObject *result; rf.fp = NULL; + rf.readable = NULL; rf.ptr = str; rf.end = str + len; rf.strings = PyList_New(0); @@ -1142,6 +1235,7 @@ PyObject *res = NULL; wf.fp = NULL; + wf.readable = NULL; wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; @@ -1219,33 +1313,31 @@ static PyObject * marshal_load(PyObject *self, PyObject *f) { - /* XXX Quick hack -- need to do this differently */ PyObject *data, *result; RFILE rf; - data = PyObject_CallMethod(f, "read", ""); + + /* + * Make a call to the read method, but read zero bytes. + * This is to ensure that the object passed in at least + * has a read method which returns bytes. + */ + data = PyObject_CallMethod(f, "read", "i", 0); if (data == NULL) return NULL; - rf.fp = NULL; - if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); - } - else if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + result = NULL; } else { - PyErr_Format(PyExc_TypeError, - "f.read() returned neither string " - "nor bytes but %.100s", - data->ob_type->tp_name); - Py_DECREF(data); - return NULL; + rf.strings = PyList_New(0); + rf.depth = 0; + rf.fp = NULL; + rf.readable = f; + result = read_object(&rf); + Py_DECREF(rf.strings); } - rf.strings = PyList_New(0); - rf.depth = 0; - result = read_object(&rf); - Py_DECREF(rf.strings); Py_DECREF(data); return result; } @@ -1296,6 +1388,7 @@ s = p.buf; n = p.len; rf.fp = NULL; + rf.readable = NULL; rf.ptr = s; rf.end = s + n; rf.strings = PyList_New(0); diff --git a/configure b/configure --- a/configure +++ b/configure @@ -644,6 +644,8 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +HAS_PYTHON +DISABLE_ASDLGEN HAS_HG HGBRANCH HGTAG @@ -5204,6 +5206,9 @@ + +if test -e $srcdir/.hg/00changelog.i +then # Extract the first word of "hg", so it can be a program name with args. set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -5242,6 +5247,9 @@ fi +else +HAS_HG=no-repository +fi if test $HAS_HG = found then HGVERSION="hg id -i \$(srcdir)" @@ -5253,6 +5261,52 @@ HGBRANCH="" fi + +DISABLE_ASDLGEN="" +# Extract the first word of "python", so it can be a program name with args. +set dummy python; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAS_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAS_PYTHON"; then + ac_cv_prog_HAS_PYTHON="$HAS_PYTHON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAS_PYTHON="found" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAS_PYTHON" && ac_cv_prog_HAS_PYTHON="not-found" +fi +fi +HAS_PYTHON=$ac_cv_prog_HAS_PYTHON +if test -n "$HAS_PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_PYTHON" >&5 +$as_echo "$HAS_PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test $HAS_HG != found -o $HAS_PYTHON != found +then + DISABLE_ASDLGEN="@echo hg: $HAS_HG, python: $HAS_PYTHON! cannot run \$(srcdir)/Parser/asdl_c.py #" +fi + + case $MACHDEP in bsdos*|hp*|HP*) # install -d does not work on BSDI or HP-UX diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -832,7 +832,13 @@ AC_SUBST(HGVERSION) AC_SUBST(HGTAG) AC_SUBST(HGBRANCH) + +if test -e $srcdir/.hg/00changelog.i +then AC_CHECK_PROG(HAS_HG, hg, found, not-found) +else +HAS_HG=no-repository +fi if test $HAS_HG = found then HGVERSION="hg id -i \$(srcdir)" @@ -844,6 +850,15 @@ HGBRANCH="" fi +AC_SUBST(DISABLE_ASDLGEN) +DISABLE_ASDLGEN="" +AC_CHECK_PROG(HAS_PYTHON, python, found, not-found) +if test $HAS_HG != found -o $HAS_PYTHON != found +then + DISABLE_ASDLGEN="@echo hg: $HAS_HG, python: $HAS_PYTHON! cannot run \$(srcdir)/Parser/asdl_c.py #" +fi + + case $MACHDEP in bsdos*|hp*|HP*) # install -d does not work on BSDI or HP-UX -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:36 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:36 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/65e57bead934 changeset: 71153:65e57bead934 parent: 71150:6c955e38daa5 parent: 71148:a085e755c892 user: Benjamin Peterson date: Sun Jul 03 13:45:33 2011 -0500 summary: merge heads files: Doc/library/smtplib.rst | 27 +- Doc/library/sqlite3.rst | 75 +- Doc/whatsnew/3.3.rst | 2 +- Lib/concurrent/futures/process.py | 42 +- Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/smtplib.py | 52 +- Lib/test/test_concurrent_futures.py | 7 + Lib/test/test_csv.py | 8 +- Lib/test/test_marshal.py | 24 + Lib/test/test_shutil.py | 10 +- Lib/test/test_smtplib.py | 111 +++++- Misc/ACKS | 1 + Misc/NEWS | 6 + Python/marshal.c | 211 +++++++-- Tools/msi/msi.py | 7 +- 15 files changed, 440 insertions(+), 145 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -348,21 +348,32 @@ .. versionchanged:: 3.2 *msg* may be a byte string. -.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=[], rcpt_options=[]) +.. method:: SMTP.send_message(msg, from_addr=None, to_addrs=None, \ + mail_options=[], rcpt_options=[]) This is a convenience method for calling :meth:`sendmail` with the message represented by an :class:`email.message.Message` object. The arguments have the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` object. - If *from_addr* is ``None``, ``send_message`` sets its value to the value of - the :mailheader:`From` header from *msg*. If *to_addrs* is ``None``, - ``send_message`` combines the values (if any) of the :mailheader:`To`, - :mailheader:`CC`, and :mailheader:`Bcc` fields from *msg*. Regardless of - the values of *from_addr* and *to_addrs*, ``send_message`` deletes any Bcc - field from *msg*. It then serializes *msg* using + If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills + those arguments with addresses extracted from the headers of *msg* as + specified in :rfc:`2822`\: *from_addr* is set to the :mailheader:`Sender` + field if it is present, and otherwise to the :mailheader:`From` field. + *to_adresses* combines the values (if any) of the :mailheader:`To`, + :mailheader:`Cc`, and :mailheader:`Bcc` fields from *msg*. If exactly one + set of :mailheader:`Resent-*` headers appear in the message, the regular + headers are ignored and the :mailheader:`Resent-*` headers are used instead. + If the message contains more than one set of :mailheader:`Resent-*` headers, + a :exc:`ValueError` is raised, since there is no way to unambiguously detect + the most recent set of :mailheader:`Resent-` headers. + + ``send_message`` serializes *msg* using :class:`~email.generator.BytesGenerator` with ``\r\n`` as the *linesep*, and - calls :meth:`sendmail` to transmit the resulting message. + calls :meth:`sendmail` to transmit the resulting message. Regardless of the + values of *from_addr* and *to_addrs*, ``send_message`` does not transmit any + :mailheader:`Bcc` or :mailheader:`Resent-Bcc` headers that may appear + in *msg*. .. versionadded:: 3.2 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -615,43 +615,43 @@ Let's assume we initialize a table as in the example given above:: - conn = sqlite3.connect(":memory:") - c = conn.cursor() - c.execute('''create table stocks - (date text, trans text, symbol text, - qty real, price real)''') - c.execute("""insert into stocks - values ('2006-01-05','BUY','RHAT',100,35.14)""") - conn.commit() - c.close() + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() Now we plug :class:`Row` in:: - >>> conn.row_factory = sqlite3.Row - >>> c = conn.cursor() - >>> c.execute('select * from stocks') - - >>> r = c.fetchone() - >>> type(r) - - >>> tuple(r) - ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) - >>> len(r) - 5 - >>> r[2] - 'RHAT' - >>> r.keys() - ['date', 'trans', 'symbol', 'qty', 'price'] - >>> r['qty'] - 100.0 - >>> for member in r: - ... print(member) - ... - 2006-01-05 - BUY - RHAT - 100.0 - 35.14 + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> tuple(r) + ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) + >>> len(r) + 5 + >>> r[2] + 'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: + ... print(member) + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 .. _sqlite3-types: @@ -902,6 +902,7 @@ .. rubric:: Footnotes .. [#f1] The sqlite3 module is not built with loadable extension support by - default, because some platforms (notably Mac OS X) have SQLite libraries which - are compiled without this feature. To get loadable extension support, you must - pass --enable-loadable-sqlite-extensions to configure. + default, because some platforms (notably Mac OS X) have SQLite + libraries which are compiled without this feature. To get loadable + extension support, you must pass --enable-loadable-sqlite-extensions to + configure. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -206,7 +206,7 @@ shutil ------ -The :mod:`shutil` module has a new :func:`~shutil.disk_usage` providing total, +The :mod:`shutil` module has a new :func:`~shutil.disk_usage` function providing total, used and free disk space statistics. (Contributed by Giampaolo Rodol? in :issue:`12442`) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -50,7 +50,7 @@ from concurrent.futures import _base import queue import multiprocessing -from multiprocessing.queues import SimpleQueue, SentinelReady +from multiprocessing.queues import SimpleQueue, SentinelReady, Full import threading import weakref @@ -195,15 +195,18 @@ result_queue: A multiprocessing.Queue of _ResultItems generated by the process workers. """ + executor = None + + def shutting_down(): + return _shutdown or executor is None or executor._shutdown_thread def shutdown_worker(): # This is an upper bound nb_children_alive = sum(p.is_alive() for p in processes.values()) for i in range(0, nb_children_alive): - call_queue.put(None) + call_queue.put_nowait(None) # If .join() is not called on the created processes then - # some multiprocessing.Queue methods may deadlock on Mac OS - # X. + # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): p.join() @@ -222,7 +225,7 @@ if executor is not None: executor._broken = True executor._shutdown_thread = True - del executor + executor = None # All futures in flight must be marked failed for work_id, work_item in pending_work_items.items(): work_item.future.set_exception( @@ -242,7 +245,11 @@ if isinstance(result_item, int): # Clean shutdown of a worker using its PID # (avoids marking the executor broken) + assert shutting_down() del processes[result_item] + if not processes: + shutdown_worker() + return elif result_item is not None: work_item = pending_work_items.pop(result_item.work_id, None) # work_item can be None if another process terminated (see above) @@ -257,16 +264,21 @@ # - The interpreter is shutting down OR # - The executor that owns this worker has been collected OR # - The executor that owns this worker has been shutdown. - if _shutdown or executor is None or executor._shutdown_thread: - # Since no new work items can be added, it is safe to shutdown - # this thread if there are no pending work items. - if not pending_work_items: - shutdown_worker() - return - else: - # Start shutting down by telling a process it can exit. - call_queue.put(None) - del executor + if shutting_down(): + try: + # Since no new work items can be added, it is safe to shutdown + # this thread if there are no pending work items. + if not pending_work_items: + shutdown_worker() + return + else: + # Start shutting down by telling a process it can exit. + call_queue.put_nowait(None) + except Full: + # This is not a problem: we will eventually be woken up (in + # result_queue.get()) and be able to send a sentinel again. + pass + executor = None _system_limits_checked = False _system_limited = None diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -214,7 +214,7 @@ lambda bc: bc[:8] + b'', del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path - with self.assertRaises(ValueError): + with self.assertRaises(EOFError): self.import_(file_path, '_temp') def _test_bad_magic(self, test, *, del_source=False): diff --git a/Lib/smtplib.py b/Lib/smtplib.py old mode 100755 new mode 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -49,6 +49,7 @@ import email.generator import base64 import hmac +import copy from email.base64mime import body_encode as encode_base64 from sys import stderr @@ -676,7 +677,7 @@ msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone - \r and \n characters are converted to \r\n characters. + \\r and \\n characters are converted to \\r\\n characters. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. If the server does ESMTP, message size @@ -759,24 +760,49 @@ """Converts message to a bytestring and passes it to sendmail. The arguments are as for sendmail, except that msg is an - email.message.Message object. If from_addr is None, the from_addr is - taken from the 'From' header of the Message. If to_addrs is None, its - value is composed from the addresses listed in the 'To', 'CC', and - 'Bcc' fields. Regardless of the values of from_addr and to_addr, any - Bcc field in the Message object is deleted. The Message object is then - serialized using email.generator.BytesGenerator and sendmail is called - to transmit the message. + email.message.Message object. If from_addr is None or to_addrs is + None, these arguments are taken from the headers of the Message as + described in RFC 2822 (a ValueError is raised if there is more than + one set of 'Resent-' headers). Regardless of the values of from_addr and + to_addr, any Bcc field (or Resent-Bcc field, when the Message is a + resent) of the Message object won't be transmitted. The Message + object is then serialized using email.generator.BytesGenerator and + sendmail is called to transmit the message. + """ + # 'Resent-Date' is a mandatory field if the Message is resent (RFC 2822 + # Section 3.6.6). In such a case, we use the 'Resent-*' fields. However, + # if there is more than one 'Resent-' block there's no way to + # unambiguously determine which one is the most recent in all cases, + # so rather than guess we raise a ValueError in that case. + # + # TODO implement heuristics to guess the correct Resent-* block with an + # option allowing the user to enable the heuristics. (It should be + # possible to guess correctly almost all of the time.) + resent =msg.get_all('Resent-Date') + if resent is None: + header_prefix = '' + elif len(resent) == 1: + header_prefix = 'Resent-' + else: + raise ValueError("message has more than one 'Resent-' header block") if from_addr is None: - from_addr = msg['From'] + # Prefer the sender field per RFC 2822:3.6.2. + from_addr = (msg[header_prefix+'Sender'] + if (header_prefix+'Sender') in msg + else msg[header_prefix+'From']) if to_addrs is None: - addr_fields = [f for f in (msg['To'], msg['Bcc'], msg['CC']) - if f is not None] + addr_fields = [f for f in (msg[header_prefix+'To'], + msg[header_prefix+'Bcc'], + msg[header_prefix+'Cc']) if f is not None] to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)] - del msg['Bcc'] + # Make a local copy so we can delete the bcc headers. + msg_copy = copy.copy(msg) + del msg_copy['Bcc'] + del msg_copy['Resent-Bcc'] with io.BytesIO() as bytesmsg: g = email.generator.BytesGenerator(bytesmsg) - g.flatten(msg, linesep='\r\n') + g.flatten(msg_copy, linesep='\r\n') flatmsg = bytesmsg.getvalue() return self.sendmail(from_addr, to_addrs, flatmsg, mail_options, rcpt_options) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -367,6 +367,13 @@ self.assertEqual([None, None], results) + def test_shutdown_race_issue12456(self): + # Issue #12456: race condition at shutdown where trying to post a + # sentinel in the call queue blocks (the queue is full while processes + # have exited). + self.executor.map(str, [2] * (self.worker_count + 1)) + self.executor.shutdown() + class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest): def test_map_submits_without_iteration(self): diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -459,20 +459,20 @@ '5', '6']]) def test_quoted_quote(self): - self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', + self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he picked up his hammer and saw"', [['1', '2', '3', - '"I see," said the blind man', + '"I see," said the happy man', 'as he picked up his hammer and saw']]) def test_quoted_nl(self): input = '''\ 1,2,3,"""I see,"" -said the blind man","as he picked up his +said the happy man","as he picked up his hammer and saw" 9,8,7,6''' self.readerAssertEqual(input, [['1', '2', '3', - '"I see,"\nsaid the blind man', + '"I see,"\nsaid the happy man', 'as he picked up his\nhammer and saw'], ['9','8','7','6']]) diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -228,6 +228,30 @@ invalid_string = b'l\x02\x00\x00\x00\x00\x00\x00\x00' self.assertRaises(ValueError, marshal.loads, invalid_string) + def test_multiple_dumps_and_loads(self): + # Issue 12291: marshal.load() should be callable multiple times + # with interleaved data written by non-marshal code + # Adapted from a patch by Engelbert Gruber. + data = (1, 'abc', b'def', 1.0, (2, 'a', ['b', b'c'])) + for interleaved in (b'', b'0123'): + ilen = len(interleaved) + positions = [] + try: + with open(support.TESTFN, 'wb') as f: + for d in data: + marshal.dump(d, f) + if ilen: + f.write(interleaved) + positions.append(f.tell()) + with open(support.TESTFN, 'rb') as f: + for i, d in enumerate(data): + self.assertEqual(d, marshal.load(f)) + if ilen: + f.read(ilen) + self.assertEqual(positions[i], f.tell()) + finally: + support.unlink(support.TESTFN) + def test_main(): support.run_unittest(IntTestCase, diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -732,11 +732,11 @@ "disk_usage not available on this platform") def test_disk_usage(self): usage = shutil.disk_usage(os.getcwd()) - self.assertTrue(usage.total > 0) - self.assertTrue(usage.used > 0) - self.assertTrue(usage.free >= 0) - self.assertTrue(usage.total >= usage.used) - self.assertTrue(usage.total > usage.free) + self.assertGreater(usage.total, 0) + self.assertGreater(usage.used, 0) + self.assertGreaterEqual(usage.free, 0) + self.assertGreaterEqual(usage.total, usage.used) + self.assertGreater(usage.total, usage.free) class TestMove(unittest.TestCase): diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -320,13 +320,16 @@ # XXX (see comment in testSend) time.sleep(0.01) smtp.quit() + # make sure the Bcc header is still in the message. + self.assertEqual(m['Bcc'], 'John Root , "Dinsdale" ' + '') self.client_evt.set() self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds m['X-Peer'] = socket.gethostbyname('localhost') - # The Bcc header is deleted before serialization. + # The Bcc header should not be transmitted. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) @@ -365,6 +368,112 @@ re.MULTILINE) self.assertRegex(debugout, to_addr) + def testSendMessageWithSpecifiedAddresses(self): + # Make sure addresses specified in call override those in message. + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m, from_addr='joe at example.com', to_addrs='foo at example.net') + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: joe at example.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertNotRegex(debugout, to_addr) + recip = re.compile(r"^recips: .*'foo at example.net'.*$", re.MULTILINE) + self.assertRegex(debugout, recip) + + def testSendMessageWithMultipleFrom(self): + # Sender overrides To + m = email.mime.text.MIMEText('A test message') + m['From'] = 'Bernard, Bianca' + m['Sender'] = 'the_rescuers at Rescue-Aid-Society.com' + m['To'] = 'John, Dinsdale' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: the_rescuers at Rescue-Aid-Society.com$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('John', 'Dinsdale'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageResent(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.send_message(m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + # The Resent-Bcc headers are deleted before serialization. + del m['Bcc'] + del m['Resent-Bcc'] + # Add the X-Peer header that DebuggingServer adds + m['X-Peer'] = socket.gethostbyname('localhost') + mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: holy at grail.net$", re.MULTILINE) + self.assertRegex(debugout, sender) + for addr in ('my_mom at great.cooker.com', 'Jeff', 'doe at losthope.net'): + to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), + re.MULTILINE) + self.assertRegex(debugout, to_addr) + + def testSendMessageMultipleResentRaises(self): + m = email.mime.text.MIMEText('A test message') + m['From'] = 'foo at bar.com' + m['To'] = 'John' + m['CC'] = 'Sally, Fred' + m['Bcc'] = 'John Root , "Dinsdale" ' + m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' + m['Resent-From'] = 'holy at grail.net' + m['Resent-To'] = 'Martha , Jeff' + m['Resent-Bcc'] = 'doe at losthope.net' + m['Resent-Date'] = 'Thu, 2 Jan 1970 17:42:00 +0000' + m['Resent-To'] = 'holy at grail.net' + m['Resent-From'] = 'Martha , Jeff' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + with self.assertRaises(ValueError): + smtp.send_message(m) + smtp.close() class NonConnectingTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -278,6 +278,7 @@ Andy Eskilsson Andr? Espaze Stefan Esser +Nicolas Estibals Stephen D Evans Carey Evans Tim Everett diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12291: You can now load multiple marshalled objects from a stream, + with other data interleaved between marshalled objects. + - Issue #12356: When required positional or keyword-only arguments are not given, produce a informative error message which includes the name(s) of the missing arguments. @@ -200,6 +203,9 @@ Library ------- +- Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better + conformance to the RFCs: correctly handle Sender and Resent- headers. + - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -57,6 +57,7 @@ int error; /* see WFERR_* values */ int depth; /* If fp == NULL, the following are valid: */ + PyObject * readable; /* Stream-like object being read from */ PyObject *str; PyObject *current_filename; char *ptr; @@ -463,27 +464,75 @@ #define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) -#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) - static int r_string(char *s, int n, RFILE *p) { - if (p->fp != NULL) - /* The result fits into int because it must be <=n. */ - return (int)fread(s, 1, n, p->fp); - if (p->end - p->ptr < n) - n = (int)(p->end - p->ptr); - memcpy(s, p->ptr, n); - p->ptr += n; - return n; + char * ptr; + int read, left; + + if (!p->readable) { + if (p->fp != NULL) + /* The result fits into int because it must be <=n. */ + read = (int) fread(s, 1, n, p->fp); + else { + left = (int)(p->end - p->ptr); + read = (left < n) ? left : n; + memcpy(s, p->ptr, read); + p->ptr += read; + } + } + else { + PyObject *data = PyObject_CallMethod(p->readable, "read", "i", n); + read = 0; + if (data != NULL) { + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + } + else { + read = PyBytes_GET_SIZE(data); + if (read > 0) { + ptr = PyBytes_AS_STRING(data); + memcpy(s, ptr, read); + } + } + Py_DECREF(data); + } + } + if (!PyErr_Occurred() && (read < n)) { + PyErr_SetString(PyExc_EOFError, "EOF read where not expected"); + } + return read; +} + + +static int +r_byte(RFILE *p) +{ + int c = EOF; + unsigned char ch; + int n; + + if (!p->readable) + c = p->fp ? getc(p->fp) : rs_byte(p); + else { + n = r_string((char *) &ch, 1, p); + if (n > 0) + c = ch; + } + return c; } static int r_short(RFILE *p) { register short x; - x = r_byte(p); - x |= r_byte(p) << 8; + unsigned char buffer[2]; + + r_string((char *) buffer, 2, p); + x = buffer[0]; + x |= buffer[1] << 8; /* Sign-extension, in case short greater than 16 bits */ x |= -(x & 0x8000); return x; @@ -493,19 +542,13 @@ r_long(RFILE *p) { register long x; - register FILE *fp = p->fp; - if (fp) { - x = getc(fp); - x |= (long)getc(fp) << 8; - x |= (long)getc(fp) << 16; - x |= (long)getc(fp) << 24; - } - else { - x = rs_byte(p); - x |= (long)rs_byte(p) << 8; - x |= (long)rs_byte(p) << 16; - x |= (long)rs_byte(p) << 24; - } + unsigned char buffer[4]; + + r_string((char *) buffer, 4, p); + x = buffer[0]; + x |= (long)buffer[1] << 8; + x |= (long)buffer[2] << 16; + x |= (long)buffer[3] << 24; #if SIZEOF_LONG > 4 /* Sign extension for 64-bit machines */ x |= -(x & 0x80000000L); @@ -523,25 +566,30 @@ static PyObject * r_long64(RFILE *p) { + PyObject * result = NULL; long lo4 = r_long(p); long hi4 = r_long(p); + + if (!PyErr_Occurred()) { #if SIZEOF_LONG > 4 - long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyLong_FromLong(x); + long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); + result = PyLong_FromLong(x); #else - unsigned char buf[8]; - int one = 1; - int is_little_endian = (int)*(char*)&one; - if (is_little_endian) { - memcpy(buf, &lo4, 4); - memcpy(buf+4, &hi4, 4); + unsigned char buf[8]; + int one = 1; + int is_little_endian = (int)*(char*)&one; + if (is_little_endian) { + memcpy(buf, &lo4, 4); + memcpy(buf+4, &hi4, 4); + } + else { + memcpy(buf, &hi4, 4); + memcpy(buf+4, &lo4, 4); + } + result = _PyLong_FromByteArray(buf, 8, is_little_endian, 1); +#endif } - else { - memcpy(buf, &hi4, 4); - memcpy(buf+4, &lo4, 4); - } - return _PyLong_FromByteArray(buf, 8, is_little_endian, 1); -#endif + return result; } static PyObject * @@ -553,6 +601,8 @@ digit d; n = r_long(p); + if (PyErr_Occurred()) + return NULL; if (n == 0) return (PyObject *)_PyLong_New(0); if (n < -INT_MAX || n > INT_MAX) { @@ -572,6 +622,8 @@ d = 0; for (j=0; j < PyLong_MARSHAL_RATIO; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; d += (digit)md << j*PyLong_MARSHAL_SHIFT; @@ -581,6 +633,8 @@ d = 0; for (j=0; j < shorts_in_top_digit; j++) { md = r_short(p); + if (PyErr_Occurred()) + break; if (md < 0 || md > PyLong_MARSHAL_BASE) goto bad_digit; /* topmost marshal digit should be nonzero */ @@ -592,6 +646,10 @@ } d += (digit)md << j*PyLong_MARSHAL_SHIFT; } + if (PyErr_Occurred()) { + Py_DECREF(ob); + return NULL; + } /* top digit should be nonzero, else the resulting PyLong won't be normalized */ ob->ob_digit[size-1] = d; @@ -660,7 +718,8 @@ break; case TYPE_INT: - retval = PyLong_FromLong(r_long(p)); + n = r_long(p); + retval = PyErr_Occurred() ? NULL : PyLong_FromLong(n); break; case TYPE_INT64: @@ -770,6 +829,10 @@ case TYPE_STRING: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); retval = NULL; @@ -795,6 +858,10 @@ char *buffer; n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); retval = NULL; @@ -820,6 +887,10 @@ case TYPE_TUPLE: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (tuple size out of range)"); retval = NULL; @@ -847,6 +918,10 @@ case TYPE_LIST: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (list size out of range)"); retval = NULL; @@ -899,6 +974,10 @@ case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); + if (PyErr_Occurred()) { + retval = NULL; + break; + } if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data (set size out of range)"); retval = NULL; @@ -952,10 +1031,20 @@ /* XXX ignore long->int overflows for now */ argcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; kwonlyargcount = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; nlocals = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; stacksize = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; flags = (int)r_long(p); + if (PyErr_Occurred()) + goto code_error; code = r_object(p); if (code == NULL) goto code_error; @@ -1049,6 +1138,7 @@ { RFILE rf; assert(fp); + rf.readable = NULL; rf.fp = fp; rf.current_filename = NULL; rf.end = rf.ptr = NULL; @@ -1060,6 +1150,7 @@ { RFILE rf; rf.fp = fp; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = rf.end = NULL; return r_long(&rf); @@ -1121,6 +1212,7 @@ RFILE rf; PyObject *result; rf.fp = fp; + rf.readable = NULL; rf.current_filename = NULL; rf.depth = 0; rf.ptr = rf.end = NULL; @@ -1134,6 +1226,7 @@ RFILE rf; PyObject *result; rf.fp = NULL; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = str; rf.end = str + len; @@ -1149,6 +1242,7 @@ PyObject *res = NULL; wf.fp = NULL; + wf.readable = NULL; wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; @@ -1224,32 +1318,30 @@ static PyObject * marshal_load(PyObject *self, PyObject *f) { - /* XXX Quick hack -- need to do this differently */ PyObject *data, *result; RFILE rf; - data = PyObject_CallMethod(f, "read", ""); + + /* + * Make a call to the read method, but read zero bytes. + * This is to ensure that the object passed in at least + * has a read method which returns bytes. + */ + data = PyObject_CallMethod(f, "read", "i", 0); if (data == NULL) return NULL; - rf.fp = NULL; - rf.current_filename = NULL; - if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); - } - else if (PyBytes_Check(data)) { - rf.ptr = PyBytes_AS_STRING(data); - rf.end = rf.ptr + PyBytes_GET_SIZE(data); + if (!PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "f.read() returned not bytes but %.100s", + data->ob_type->tp_name); + result = NULL; } else { - PyErr_Format(PyExc_TypeError, - "f.read() returned neither string " - "nor bytes but %.100s", - data->ob_type->tp_name); - Py_DECREF(data); - return NULL; + rf.depth = 0; + rf.fp = NULL; + rf.readable = f; + rf.current_filename = NULL; + result = read_object(&rf); } - rf.depth = 0; - result = read_object(&rf); Py_DECREF(data); return result; } @@ -1300,6 +1392,7 @@ s = p.buf; n = p.len; rf.fp = NULL; + rf.readable = NULL; rf.current_filename = NULL; rf.ptr = s; rf.end = s + n; diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -119,6 +119,7 @@ "30":"{6953bc3b-6768-4291-8410-7914ce6e2ca8}", "31":"{4afcba0b-13e4-47c3-bebe-477428b46913}", "32":"{3ff95315-1096-4d31-bd86-601d5438ad5e}", + "33":"{f7581ca4-d368-4eea-8f82-d48c64c4f047}", } [major+minor] # Compute the name that Sphinx gives to the docfile @@ -1010,6 +1011,8 @@ lib.remove_pyc() # package READMEs if present lib.glob("README") + if dir=='Lib': + lib.add_file("sysconfig.cfg") if dir=='test' and parent.physical=='Lib': lib.add_file("185test.db") lib.add_file("audiotest.au") @@ -1045,7 +1048,7 @@ if dir=="Icons": lib.glob("*.gif") lib.add_file("idle.icns") - if dir=="command" and parent.physical=="distutils": + if dir=="command" and parent.physical in ("distutils", "packaging"): lib.glob("wininst*.exe") lib.add_file("command_template") if dir=="lib2to3": @@ -1156,6 +1159,8 @@ lib.add_file("README.txt", src="README") if f == 'Scripts': lib.add_file("2to3.py", src="2to3") + lib.add_file("pydoc3.py", src="pydoc3") + lib.add_file("pysetup3.py", src="pysetup3") if have_tcl: lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") lib.add_file("pydocgui.pyw") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:44:36 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:44:36 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKCMxMjQ3NSk=?= Message-ID: http://hg.python.org/cpython/rev/33dca840938d changeset: 71154:33dca840938d parent: 71153:65e57bead934 parent: 71152:36bc49565281 user: Benjamin Peterson date: Sun Jul 03 13:48:36 2011 -0500 summary: merge 3.2 (#12475) files: Lib/test/test_exceptions.py | 15 +++++++++++++++ Misc/NEWS | 3 +++ Python/ceval.c | 9 +++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -567,6 +567,21 @@ del g self.assertEqual(sys.exc_info()[0], TypeError) + def test_generator_leaking2(self): + # See issue 12475. + def g(): + yield + try: + raise RuntimeError + except RuntimeError: + it = g() + next(it) + try: + next(it) + except StopIteration: + pass + self.assertEqual(sys.exc_info(), (None, None, None)) + def test_generator_finalizing_and_exc_info(self): # See #7173 def simple_gen(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12475: Prevent generators from leaking their exception state into the + callers frame as they return for the last time. + - Issue #12291: You can now load multiple marshalled objects from a stream, with other data interleaved between marshalled objects. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1865,10 +1865,6 @@ retval = POP(); f->f_stacktop = stack_pointer; why = WHY_YIELD; - /* Put aside the current exception state and restore - that of the calling frame. This only serves when - "yield" is used inside an except handler. */ - SWAP_EXC_STATE(); goto fast_yield; TARGET(POP_EXCEPT) @@ -3005,6 +3001,11 @@ retval = NULL; fast_yield: + if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) + /* Put aside the current exception state and restore that of the + calling frame. */ + SWAP_EXC_STATE(); + if (tstate->use_tracing) { if (tstate->c_tracefunc) { if (why == WHY_RETURN || why == WHY_YIELD) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:46:08 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:46:08 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogYWRkICc=?= Message-ID: http://hg.python.org/cpython/rev/733cb6f42217 changeset: 71155:733cb6f42217 branch: 3.2 parent: 71152:36bc49565281 user: Benjamin Peterson date: Sun Jul 03 13:49:59 2011 -0500 summary: add ' files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -11,7 +11,7 @@ ----------------- - Issue #12475: Prevent generators from leaking their exception state into the - callers frame as they return for the last time. + caller's frame as they return for the last time. Library ------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 20:46:09 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 20:46:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/ff74d3e238ea changeset: 71156:ff74d3e238ea parent: 71154:33dca840938d parent: 71155:733cb6f42217 user: Benjamin Peterson date: Sun Jul 03 13:50:16 2011 -0500 summary: merge 3.2 files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -11,7 +11,7 @@ ----------------- - Issue #12475: Prevent generators from leaking their exception state into the - callers frame as they return for the last time. + caller's frame as they return for the last time. - Issue #12291: You can now load multiple marshalled objects from a stream, with other data interleaved between marshalled objects. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 23:23:34 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 23:23:34 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_never_retain_a_?= =?utf8?q?generator=27s_caller=27s_exception_state_on_the_generator_after_?= =?utf8?q?a?= Message-ID: http://hg.python.org/cpython/rev/419871c62bb3 changeset: 71157:419871c62bb3 branch: 3.2 parent: 71155:733cb6f42217 user: Benjamin Peterson date: Sun Jul 03 16:25:11 2011 -0500 summary: never retain a generator's caller's exception state on the generator after a yield/return This requires some trickery to properly save the exception state if the generator creates its own exception state. files: Lib/test/test_exceptions.py | 12 +++++++ Misc/NEWS | 3 + Python/ceval.c | 40 ++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -581,6 +581,18 @@ pass self.assertEqual(sys.exc_info(), (None, None, None)) + def test_generator_doesnt_retain_old_exc(self): + def g(): + self.assertIsInstance(sys.exc_info()[1], RuntimeError) + yield + self.assertEqual(sys.exc_info(), (None, None, None)) + it = g() + try: + raise RuntimeError + except RuntimeError: + next(it) + self.assertRaises(StopIteration, next, it) + def test_generator_finalizing_and_exc_info(self): # See #7173 def simple_gen(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- When a generator yields, do not retain the caller's exception state on the + generator. + - Issue #12475: Prevent generators from leaking their exception state into the caller's frame as they return for the last time. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1145,6 +1145,23 @@ f->f_exc_traceback = tmp; \ } +#define RESTORE_AND_CLEAR_EXC_STATE() \ + { \ + PyObject *type, *value, *tb; \ + type = tstate->exc_type; \ + value = tstate->exc_value; \ + tb = tstate->exc_traceback; \ + tstate->exc_type = f->f_exc_type; \ + tstate->exc_value = f->f_exc_value; \ + tstate->exc_traceback = f->f_exc_traceback; \ + f->f_exc_type = NULL; \ + f->f_exc_value = NULL; \ + f->f_exc_traceback = NULL; \ + Py_XDECREF(type); \ + Py_XDECREF(value); \ + Py_XDECREF(tb); \ + } + /* Start of code */ if (f == NULL) @@ -3017,10 +3034,25 @@ retval = NULL; fast_yield: - if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) - /* Put aside the current exception state and restore that of the - calling frame. */ - SWAP_EXC_STATE(); + if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) { + /* The purpose of this block is to put aside the generator's exception + state and restore that of the calling frame. If the current + exception state is from the caller, we clear the exception values + on the generator frame, so they are not swapped back in latter. The + origin of the current exception state is determined by checking for + except handler blocks, which we must be in iff a new exception + state came into existence in this frame. (An uncaught exception + would have why == WHY_EXCEPTION, and we wouldn't be here). */ + int i; + for (i = 0; i < f->f_iblock; i++) + if (f->f_blockstack[i].b_type == EXCEPT_HANDLER) + break; + if (i == f->f_iblock) + /* We did not create this exception. */ + RESTORE_AND_CLEAR_EXC_STATE() + else + SWAP_EXC_STATE() + } if (tstate->use_tracing) { if (tstate->c_tracefunc) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 3 23:23:35 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 03 Jul 2011 23:23:35 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/2613b8d32149 changeset: 71158:2613b8d32149 parent: 71156:ff74d3e238ea parent: 71157:419871c62bb3 user: Benjamin Peterson date: Sun Jul 03 16:27:41 2011 -0500 summary: merge 3.2 files: Lib/test/test_exceptions.py | 12 +++++++ Misc/NEWS | 3 + Python/ceval.c | 40 ++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -582,6 +582,18 @@ pass self.assertEqual(sys.exc_info(), (None, None, None)) + def test_generator_doesnt_retain_old_exc(self): + def g(): + self.assertIsInstance(sys.exc_info()[1], RuntimeError) + yield + self.assertEqual(sys.exc_info(), (None, None, None)) + it = g() + try: + raise RuntimeError + except RuntimeError: + next(it) + self.assertRaises(StopIteration, next, it) + def test_generator_finalizing_and_exc_info(self): # See #7173 def simple_gen(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- When a generator yields, do not retain the caller's exception state on the + generator. + - Issue #12475: Prevent generators from leaking their exception state into the caller's frame as they return for the last time. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1141,6 +1141,23 @@ f->f_exc_traceback = tmp; \ } +#define RESTORE_AND_CLEAR_EXC_STATE() \ + { \ + PyObject *type, *value, *tb; \ + type = tstate->exc_type; \ + value = tstate->exc_value; \ + tb = tstate->exc_traceback; \ + tstate->exc_type = f->f_exc_type; \ + tstate->exc_value = f->f_exc_value; \ + tstate->exc_traceback = f->f_exc_traceback; \ + f->f_exc_type = NULL; \ + f->f_exc_value = NULL; \ + f->f_exc_traceback = NULL; \ + Py_XDECREF(type); \ + Py_XDECREF(value); \ + Py_XDECREF(tb); \ + } + /* Start of code */ if (f == NULL) @@ -3001,10 +3018,25 @@ retval = NULL; fast_yield: - if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) - /* Put aside the current exception state and restore that of the - calling frame. */ - SWAP_EXC_STATE(); + if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) { + /* The purpose of this block is to put aside the generator's exception + state and restore that of the calling frame. If the current + exception state is from the caller, we clear the exception values + on the generator frame, so they are not swapped back in latter. The + origin of the current exception state is determined by checking for + except handler blocks, which we must be in iff a new exception + state came into existence in this frame. (An uncaught exception + would have why == WHY_EXCEPTION, and we wouldn't be here). */ + int i; + for (i = 0; i < f->f_iblock; i++) + if (f->f_blockstack[i].b_type == EXCEPT_HANDLER) + break; + if (i == f->f_iblock) + /* We did not create this exception. */ + RESTORE_AND_CLEAR_EXC_STATE() + else + SWAP_EXC_STATE() + } if (tstate->use_tracing) { if (tstate->c_tracefunc) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 00:02:33 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 00:02:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_convert_generator_exc_state?= =?utf8?q?_functions_into_static_functions?= Message-ID: http://hg.python.org/cpython/rev/95784a617d05 changeset: 71159:95784a617d05 user: Benjamin Peterson date: Sun Jul 03 16:48:31 2011 -0500 summary: convert generator exc state functions into static functions files: Python/ceval.c | 116 +++++++++++++++++++----------------- 1 files changed, 62 insertions(+), 54 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -749,6 +749,9 @@ WHY_SILENCED = 0x0080 /* Exception silenced by 'with' */ }; +static void save_exc_state(PyThreadState *, PyFrameObject *); +static void swap_exc_state(PyThreadState *, PyFrameObject *); +static void restore_and_clear_exc_state(PyThreadState *, PyFrameObject *); static enum why_code do_raise(PyObject *, PyObject *); static int unpack_iterable(PyObject *, int, int, PyObject **); @@ -1110,54 +1113,6 @@ Py_XDECREF(traceback); \ } -#define SAVE_EXC_STATE() \ - { \ - PyObject *type, *value, *traceback; \ - Py_XINCREF(tstate->exc_type); \ - Py_XINCREF(tstate->exc_value); \ - Py_XINCREF(tstate->exc_traceback); \ - type = f->f_exc_type; \ - value = f->f_exc_value; \ - traceback = f->f_exc_traceback; \ - f->f_exc_type = tstate->exc_type; \ - f->f_exc_value = tstate->exc_value; \ - f->f_exc_traceback = tstate->exc_traceback; \ - Py_XDECREF(type); \ - Py_XDECREF(value); \ - Py_XDECREF(traceback); \ - } - -#define SWAP_EXC_STATE() \ - { \ - PyObject *tmp; \ - tmp = tstate->exc_type; \ - tstate->exc_type = f->f_exc_type; \ - f->f_exc_type = tmp; \ - tmp = tstate->exc_value; \ - tstate->exc_value = f->f_exc_value; \ - f->f_exc_value = tmp; \ - tmp = tstate->exc_traceback; \ - tstate->exc_traceback = f->f_exc_traceback; \ - f->f_exc_traceback = tmp; \ - } - -#define RESTORE_AND_CLEAR_EXC_STATE() \ - { \ - PyObject *type, *value, *tb; \ - type = tstate->exc_type; \ - value = tstate->exc_value; \ - tb = tstate->exc_traceback; \ - tstate->exc_type = f->f_exc_type; \ - tstate->exc_value = f->f_exc_value; \ - tstate->exc_traceback = f->f_exc_traceback; \ - f->f_exc_type = NULL; \ - f->f_exc_value = NULL; \ - f->f_exc_traceback = NULL; \ - Py_XDECREF(type); \ - Py_XDECREF(value); \ - Py_XDECREF(tb); \ - } - /* Start of code */ if (f == NULL) @@ -1236,11 +1191,10 @@ /* We were in an except handler when we left, restore the exception state which was put aside (see YIELD_VALUE). */ - SWAP_EXC_STATE(); + swap_exc_state(tstate, f); } - else { - SAVE_EXC_STATE(); - } + else + save_exc_state(tstate, f); } #ifdef LLTRACE @@ -3033,9 +2987,9 @@ break; if (i == f->f_iblock) /* We did not create this exception. */ - RESTORE_AND_CLEAR_EXC_STATE() + restore_and_clear_exc_state(tstate, f); else - SWAP_EXC_STATE() + swap_exc_state(tstate, f); } if (tstate->use_tracing) { @@ -3453,6 +3407,60 @@ } +/* These 3 functions deal with the exception state of generators. */ + +static void +save_exc_state(PyThreadState *tstate, PyFrameObject *f) +{ + PyObject *type, *value, *traceback; + Py_XINCREF(tstate->exc_type); + Py_XINCREF(tstate->exc_value); + Py_XINCREF(tstate->exc_traceback); + type = f->f_exc_type; + value = f->f_exc_value; + traceback = f->f_exc_traceback; + f->f_exc_type = tstate->exc_type; + f->f_exc_value = tstate->exc_value; + f->f_exc_traceback = tstate->exc_traceback; + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(traceback); +} + +static void +swap_exc_state(PyThreadState *tstate, PyFrameObject *f) +{ + PyObject *tmp; + tmp = tstate->exc_type; + tstate->exc_type = f->f_exc_type; + f->f_exc_type = tmp; + tmp = tstate->exc_value; + tstate->exc_value = f->f_exc_value; + f->f_exc_value = tmp; + tmp = tstate->exc_traceback; + tstate->exc_traceback = f->f_exc_traceback; + f->f_exc_traceback = tmp; +} + +static void +restore_and_clear_exc_state(PyThreadState *tstate, PyFrameObject *f) +{ + PyObject *type, *value, *tb; + type = tstate->exc_type; + value = tstate->exc_value; + tb = tstate->exc_traceback; + tstate->exc_type = f->f_exc_type; + tstate->exc_value = f->f_exc_value; + tstate->exc_traceback = f->f_exc_traceback; + f->f_exc_type = NULL; + f->f_exc_value = NULL; + f->f_exc_traceback = NULL; + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(tb); +} + + /* Logic for the raise statement (too complicated for inlining). This *consumes* a reference count to each of its arguments. */ static enum why_code -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 00:02:33 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 00:02:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_no_one_passes_NULL_here_=28?= =?utf8?q?or_should_anyway=29?= Message-ID: http://hg.python.org/cpython/rev/bbbeddafeec0 changeset: 71160:bbbeddafeec0 user: Benjamin Peterson date: Sun Jul 03 17:06:32 2011 -0500 summary: no one passes NULL here (or should anyway) files: Python/ceval.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1115,9 +1115,6 @@ /* Start of code */ - if (f == NULL) - return NULL; - /* push frame */ if (Py_EnterRecursiveCall("")) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 00:19:15 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 00:19:15 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_this_is_expressed_better_as?= =?utf8?q?_a_for_loop?= Message-ID: http://hg.python.org/cpython/rev/36df19f9e94b changeset: 71161:36df19f9e94b user: Benjamin Peterson date: Sun Jul 03 17:23:22 2011 -0500 summary: this is expressed better as a for loop files: Objects/genobject.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -395,15 +395,13 @@ int i; PyFrameObject *f = gen->gi_frame; - if (f == NULL || f->f_stacktop == NULL || f->f_iblock <= 0) + if (f == NULL || f->f_stacktop == NULL) return 0; /* no frame or empty blockstack == no finalization */ /* Any block type besides a loop requires cleanup. */ - i = f->f_iblock; - while (--i >= 0) { + for (i = 0; i < f->f_iblock; i++) if (f->f_blockstack[i].b_type != SETUP_LOOP) return 1; - } /* No blocks except loops, it's safe to skip finalization. */ return 0; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 01:29:12 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 01:29:12 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDUx?= =?utf8?q?=3A_xml=2Edom=2Epulldom=3A_parse=28=29_now_opens_files_in_binary?= =?utf8?q?_mode_instead?= Message-ID: http://hg.python.org/cpython/rev/81424281ee59 changeset: 71162:81424281ee59 branch: 3.2 parent: 71157:419871c62bb3 user: Victor Stinner date: Mon Jul 04 01:25:55 2011 +0200 summary: Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. files: Lib/xml/dom/pulldom.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py --- a/Lib/xml/dom/pulldom.py +++ b/Lib/xml/dom/pulldom.py @@ -326,7 +326,7 @@ if bufsize is None: bufsize = default_bufsize if isinstance(stream_or_string, str): - stream = open(stream_or_string) + stream = open(stream_or_string, 'rb') else: stream = stream_or_string if not parser: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Library ------- +- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead + of the text mode (using the locale encoding) to avoid encoding issues. + C-API ----- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 01:29:13 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 01:29:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjMTI0NTE6IHhtbC5kb20ucHVsbGRvbTogcGFy?= =?utf8?q?se=28=29_now_opens_files_in_binary?= Message-ID: http://hg.python.org/cpython/rev/c039c6b58907 changeset: 71163:c039c6b58907 parent: 71161:36df19f9e94b parent: 71162:81424281ee59 user: Victor Stinner date: Mon Jul 04 01:27:37 2011 +0200 summary: (merge 3.2) Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. files: Lib/xml/dom/pulldom.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py --- a/Lib/xml/dom/pulldom.py +++ b/Lib/xml/dom/pulldom.py @@ -326,7 +326,7 @@ if bufsize is None: bufsize = default_bufsize if isinstance(stream_or_string, str): - stream = open(stream_or_string) + stream = open(stream_or_string, 'rb') else: stream = stream_or_string if not parser: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -209,6 +209,9 @@ Library ------- +- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead + of the text mode (using the locale encoding) to avoid encoding issues. + - Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better conformance to the RFCs: correctly handle Sender and Resent- headers. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 01:47:59 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 01:47:59 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDUx?= =?utf8?q?=3A_runpy=3A_run=5Fpath=28=29_now_opens_the_Python_script_in_bin?= =?utf8?q?ary_mode=2C?= Message-ID: http://hg.python.org/cpython/rev/cd1759711357 changeset: 71164:cd1759711357 branch: 3.2 parent: 71162:81424281ee59 user: Victor Stinner date: Mon Jul 04 01:45:39 2011 +0200 summary: Issue #12451: runpy: run_path() now opens the Python script in binary mode, instead of text mode using the locale encoding, to support other encodings than UTF-8 (scripts using the coding cookie). files: Lib/runpy.py | 2 +- Lib/test/test_runpy.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Lib/runpy.py b/Lib/runpy.py --- a/Lib/runpy.py +++ b/Lib/runpy.py @@ -226,7 +226,7 @@ code = read_code(f) if code is None: # That didn't work, so try it as normal source code - with open(fname, "rU") as f: + with open(fname, "rb") as f: code = compile(f.read(), fname, 'exec') return code diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -405,6 +405,16 @@ msg = "recursion depth exceeded" self.assertRaisesRegex(RuntimeError, msg, run_path, zip_name) + def test_encoding(self): + with temp_dir() as script_dir: + filename = os.path.join(script_dir, 'script.py') + with open(filename, 'w', encoding='latin1') as f: + f.write(""" +#coding:latin1 +"non-ASCII: h\xe9" +""") + result = run_path(filename) + self.assertEqual(result['__doc__'], "non-ASCII: h\xe9") def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,10 @@ Library ------- +- Issue #12451: runpy: run_path() now opens the Python script in binary mode, + instead of text mode using the locale encoding, to support other encodings + than UTF-8 (scripts using the coding cookie). + - Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 01:47:59 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 01:47:59 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjMTI0NTE6IHJ1bnB5OiBydW5fcGF0aCgpIG5v?= =?utf8?q?w_opens_the_Python_script_in?= Message-ID: http://hg.python.org/cpython/rev/e240af1f0ae1 changeset: 71165:e240af1f0ae1 parent: 71163:c039c6b58907 parent: 71164:cd1759711357 user: Victor Stinner date: Mon Jul 04 01:47:40 2011 +0200 summary: (merge 3.2) Issue #12451: runpy: run_path() now opens the Python script in binary mode, instead of text mode using the locale encoding, to support other encodings than UTF-8 (scripts using the coding cookie). files: Lib/runpy.py | 2 +- Lib/test/test_runpy.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Lib/runpy.py b/Lib/runpy.py --- a/Lib/runpy.py +++ b/Lib/runpy.py @@ -226,7 +226,7 @@ code = read_code(f) if code is None: # That didn't work, so try it as normal source code - with open(fname, "r") as f: + with open(fname, "rb") as f: code = compile(f.read(), fname, 'exec') return code diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -405,6 +405,16 @@ msg = "recursion depth exceeded" self.assertRaisesRegex(RuntimeError, msg, run_path, zip_name) + def test_encoding(self): + with temp_dir() as script_dir: + filename = os.path.join(script_dir, 'script.py') + with open(filename, 'w', encoding='latin1') as f: + f.write(""" +#coding:latin1 +"non-ASCII: h\xe9" +""") + result = run_path(filename) + self.assertEqual(result['__doc__'], "non-ASCII: h\xe9") def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -209,6 +209,10 @@ Library ------- +- Issue #12451: runpy: run_path() now opens the Python script in binary mode, + instead of text mode using the locale encoding, to support other encodings + than UTF-8 (scripts using the coding cookie). + - Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:14:56 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 02:14:56 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDUx?= =?utf8?q?=3A_pydoc=3A_importfile=28=29_now_opens_the_Python_script_in_bin?= =?utf8?q?ary_mode=2C?= Message-ID: http://hg.python.org/cpython/rev/a1b4f1716b73 changeset: 71166:a1b4f1716b73 branch: 3.2 parent: 71164:cd1759711357 user: Victor Stinner date: Mon Jul 04 02:08:50 2011 +0200 summary: Issue #12451: pydoc: importfile() now opens the Python script in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. files: Lib/pydoc.py | 26 ++++++++++++-------------- Misc/NEWS | 3 +++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -256,20 +256,18 @@ def importfile(path): """Import a Python source file or compiled file given its path.""" magic = imp.get_magic() - file = open(path, 'r') - if file.read(len(magic)) == magic: - kind = imp.PY_COMPILED - else: - kind = imp.PY_SOURCE - file.close() - filename = os.path.basename(path) - name, ext = os.path.splitext(filename) - file = open(path, 'r') - try: - module = imp.load_module(name, file, path, (ext, 'r', kind)) - except: - raise ErrorDuringImport(path, sys.exc_info()) - file.close() + with open(path, 'rb') as file: + if file.read(len(magic)) == magic: + kind = imp.PY_COMPILED + else: + kind = imp.PY_SOURCE + file.seek(0) + filename = os.path.basename(path) + name, ext = os.path.splitext(filename) + try: + module = imp.load_module(name, file, path, (ext, 'r', kind)) + except: + raise ErrorDuringImport(path, sys.exc_info()) return module def safeimport(path, forceload=0, cache={}): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Library ------- +- Issue #12451: pydoc: importfile() now opens the Python script in binary mode, + instead of text mode using the locale encoding, to avoid encoding issues. + - Issue #12451: runpy: run_path() now opens the Python script in binary mode, instead of text mode using the locale encoding, to support other encodings than UTF-8 (scripts using the coding cookie). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:14:56 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 02:14:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjMTI0NTE6IHB5ZG9jOiBpbXBvcnRmaWxlKCkg?= =?utf8?q?now_opens_the_Python_script_in?= Message-ID: http://hg.python.org/cpython/rev/5ca136dccbf7 changeset: 71167:5ca136dccbf7 parent: 71165:e240af1f0ae1 parent: 71166:a1b4f1716b73 user: Victor Stinner date: Mon Jul 04 02:09:44 2011 +0200 summary: (merge 3.2) Issue #12451: pydoc: importfile() now opens the Python script in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. files: Lib/pydoc.py | 26 ++++++++++++-------------- Misc/NEWS | 3 +++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -250,20 +250,18 @@ def importfile(path): """Import a Python source file or compiled file given its path.""" magic = imp.get_magic() - file = open(path, 'r') - if file.read(len(magic)) == magic: - kind = imp.PY_COMPILED - else: - kind = imp.PY_SOURCE - file.close() - filename = os.path.basename(path) - name, ext = os.path.splitext(filename) - file = open(path, 'r') - try: - module = imp.load_module(name, file, path, (ext, 'r', kind)) - except: - raise ErrorDuringImport(path, sys.exc_info()) - file.close() + with open(path, 'rb') as file: + if file.read(len(magic)) == magic: + kind = imp.PY_COMPILED + else: + kind = imp.PY_SOURCE + file.seek(0) + filename = os.path.basename(path) + name, ext = os.path.splitext(filename) + try: + module = imp.load_module(name, file, path, (ext, 'r', kind)) + except: + raise ErrorDuringImport(path, sys.exc_info()) return module def safeimport(path, forceload=0, cache={}): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -209,6 +209,9 @@ Library ------- +- Issue #12451: pydoc: importfile() now opens the Python script in binary mode, + instead of text mode using the locale encoding, to avoid encoding issues. + - Issue #12451: runpy: run_path() now opens the Python script in binary mode, instead of text mode using the locale encoding, to support other encodings than UTF-8 (scripts using the coding cookie). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:21:57 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 02:21:57 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12432_-_remove_the_unused_sys_from_glob=2Epy?= Message-ID: http://hg.python.org/cpython/rev/6886e0bf29bc changeset: 71168:6886e0bf29bc branch: 3.2 parent: 71166:a1b4f1716b73 user: Senthil Kumaran date: Sun Jul 03 17:21:05 2011 -0700 summary: Fix closes issue12432 - remove the unused sys from glob.py files: Lib/glob.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/glob.py b/Lib/glob.py --- a/Lib/glob.py +++ b/Lib/glob.py @@ -1,6 +1,5 @@ """Filename globbing utility.""" -import sys import os import re import fnmatch -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:21:57 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 02:21:57 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/fbb1504a9275 changeset: 71169:fbb1504a9275 parent: 71167:5ca136dccbf7 parent: 71168:6886e0bf29bc user: Senthil Kumaran date: Sun Jul 03 17:21:44 2011 -0700 summary: merge from 3.2 files: Lib/glob.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/glob.py b/Lib/glob.py --- a/Lib/glob.py +++ b/Lib/glob.py @@ -1,6 +1,5 @@ """Filename globbing utility.""" -import sys import os import re import fnmatch -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:40:56 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 02:40:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_closes_issu?= =?utf8?q?e12438__-_idlelib=2EPyShell=27s_showformatwarning_method_was_pas?= =?utf8?q?sing?= Message-ID: http://hg.python.org/cpython/rev/c9f69b28c4d1 changeset: 71170:c9f69b28c4d1 branch: 2.7 parent: 71145:08400969067e user: Senthil Kumaran date: Sun Jul 03 17:38:53 2011 -0700 summary: Fix closes issue12438 - idlelib.PyShell's showformatwarning method was passing an incorrect arg. files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -61,7 +61,7 @@ file = warning_stream try: file.write(warnings.formatwarning(message, category, filename, - lineno, file=file, line=line)) + lineno, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:40:56 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 02:40:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12438__-_idlelib=2EPyShell=27s_showformatwarning_method_was_pas?= =?utf8?q?sing?= Message-ID: http://hg.python.org/cpython/rev/e9c406a53972 changeset: 71171:e9c406a53972 branch: 3.2 parent: 71168:6886e0bf29bc user: Senthil Kumaran date: Sun Jul 03 17:39:20 2011 -0700 summary: Fix closes issue12438 - idlelib.PyShell's showformatwarning method was passing an incorrect arg. files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -59,7 +59,7 @@ file = warning_stream try: file.write(warnings.formatwarning(message, category, filename, - lineno, file=file, line=line)) + lineno, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:40:57 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 02:40:57 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2=2E__=27idle=5Fformatwarning=27_is_the_corre?= =?utf8?q?ct_method_name=2E?= Message-ID: http://hg.python.org/cpython/rev/0159624b1824 changeset: 71172:0159624b1824 parent: 71169:fbb1504a9275 parent: 71171:e9c406a53972 user: Senthil Kumaran date: Sun Jul 03 17:40:39 2011 -0700 summary: Merge from 3.2. 'idle_formatwarning' is the correct method name. files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -59,7 +59,7 @@ file = warning_stream try: file.write(warnings.formatwarning(message, category, filename, - lineno, file=file, line=line)) + lineno, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:57:06 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 02:57:06 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDY3?= =?utf8?q?=3A_warnings=3A_fix_a_race_condition_if_a_warning_is_emitted_at?= Message-ID: http://hg.python.org/cpython/rev/ac18e70cbe7e changeset: 71173:ac18e70cbe7e branch: 3.2 parent: 71171:e9c406a53972 user: Victor Stinner date: Mon Jul 04 02:43:09 2011 +0200 summary: Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. files: Lib/test/test_warnings.py | 12 ++++++++++++ Misc/NEWS | 3 +++ Python/_warnings.c | 2 +- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -542,6 +542,18 @@ assert expected_line self.assertEqual(second_line, expected_line) + def test_filename_none(self): + # issue #12467: race condition if a warning is emitted at shutdown + globals_dict = globals() + oldfile = globals_dict['__file__'] + try: + with original_warnings.catch_warnings(module=self.module) as w: + self.module.filterwarnings("always", category=UserWarning) + globals_dict['__file__'] = None + original_warnings.warn('test', UserWarning) + finally: + globals_dict['__file__'] = oldfile + class WarningsDisplayTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Library ------- +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + - Issue #12451: pydoc: importfile() now opens the Python script in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -496,7 +496,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyUnicode_Check(*filename)) { Py_ssize_t len = PyUnicode_GetSize(*filename); Py_UNICODE *unicode = PyUnicode_AS_UNICODE(*filename); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 02:57:06 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 02:57:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312467=3A_warnings=3A_fix_a_race_c?= =?utf8?q?ondition_if_a_warning_is?= Message-ID: http://hg.python.org/cpython/rev/5133fee2433e changeset: 71174:5133fee2433e parent: 71172:0159624b1824 parent: 71173:ac18e70cbe7e user: Victor Stinner date: Mon Jul 04 02:56:10 2011 +0200 summary: (merge 3.2) Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. files: Lib/test/test_warnings.py | 12 ++++++++++++ Misc/NEWS | 3 +++ Python/_warnings.c | 2 +- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -542,6 +542,18 @@ assert expected_line self.assertEqual(second_line, expected_line) + def test_filename_none(self): + # issue #12467: race condition if a warning is emitted at shutdown + globals_dict = globals() + oldfile = globals_dict['__file__'] + try: + with original_warnings.catch_warnings(module=self.module) as w: + self.module.filterwarnings("always", category=UserWarning) + globals_dict['__file__'] = None + original_warnings.warn('test', UserWarning) + finally: + globals_dict['__file__'] = oldfile + class WarningsDisplayTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -209,6 +209,9 @@ Library ------- +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + - Issue #12451: pydoc: importfile() now opens the Python script in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -496,7 +496,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyUnicode_Check(*filename)) { Py_ssize_t len = PyUnicode_GetSize(*filename); Py_UNICODE *unicode = PyUnicode_AS_UNICODE(*filename); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 03:05:45 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 03:05:45 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDY3?= =?utf8?q?=3A_warnings=3A_fix_a_race_condition_if_a_warning_is_emitted_at?= Message-ID: http://hg.python.org/cpython/rev/fc46acf7a645 changeset: 71175:fc46acf7a645 branch: 2.7 parent: 71170:c9f69b28c4d1 user: Victor Stinner date: Mon Jul 04 03:05:37 2011 +0200 summary: Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. files: Lib/test/test_warnings.py | 12 ++++++++++++ Misc/NEWS | 3 +++ Python/_warnings.c | 2 +- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -530,6 +530,18 @@ assert expected_line self.assertEqual(second_line, expected_line) + def test_filename_none(self): + # issue #12467: race condition if a warning is emitted at shutdown + globals_dict = globals() + oldfile = globals_dict['__file__'] + try: + with original_warnings.catch_warnings(module=self.module) as w: + self.module.filterwarnings("always", category=UserWarning) + globals_dict['__file__'] = None + self.module.warn('test', UserWarning) + finally: + globals_dict['__file__'] = oldfile + class WarningsDisplayTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,6 +18,9 @@ Library ------- +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -491,7 +491,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyString_Check(*filename)) { Py_ssize_t len = PyString_Size(*filename); const char *file_str = PyString_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Mon Jul 4 03:20:03 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 4 Jul 2011 11:20:03 +1000 Subject: [Python-checkins] cpython: no one passes NULL here (or should anyway) In-Reply-To: References: Message-ID: On Mon, Jul 4, 2011 at 8:02 AM, benjamin.peterson wrote: > http://hg.python.org/cpython/rev/bbbeddafeec0 > changeset: ? 71160:bbbeddafeec0 > user: ? ? ? ?Benjamin Peterson > date: ? ? ? ?Sun Jul 03 17:06:32 2011 -0500 > summary: > ?no one passes NULL here (or should anyway) > > files: > ?Python/ceval.c | ?3 --- > ?1 files changed, 0 insertions(+), 3 deletions(-) > > > diff --git a/Python/ceval.c b/Python/ceval.c > --- a/Python/ceval.c > +++ b/Python/ceval.c > @@ -1115,9 +1115,6 @@ > > ?/* Start of code */ > > - ? ?if (f == NULL) > - ? ? ? ?return NULL; > - May need to replace that with an assert(f != NULL) to keep static analysers happy. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Mon Jul 4 03:22:24 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 03:22:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e_issue12470_-_check_for_utime_for_the_skipUnless_condition=2E?= Message-ID: http://hg.python.org/cpython/rev/301c008dd58d changeset: 71176:301c008dd58d branch: 3.2 parent: 71173:ac18e70cbe7e user: Senthil Kumaran date: Sun Jul 03 18:21:38 2011 -0700 summary: Fix closes issue issue12470 - check for utime for the skipUnless condition. files: Lib/test/test_shutil.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -427,7 +427,7 @@ self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode) @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.chmod') - @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.utime') + @unittest.skipUnless(hasattr(os, 'utime'), 'requires os.utime') def test_copy2(self): # Ensure that the copied file exists and has the same mode and # modification time bits. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 03:22:25 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 03:22:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/53fc0c475260 changeset: 71177:53fc0c475260 parent: 71174:5133fee2433e parent: 71176:301c008dd58d user: Senthil Kumaran date: Sun Jul 03 18:22:14 2011 -0700 summary: merge from 3.2 files: Lib/test/test_shutil.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -421,7 +421,7 @@ self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode) @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.chmod') - @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.utime') + @unittest.skipUnless(hasattr(os, 'utime'), 'requires os.utime') def test_copy2(self): # Ensure that the copied file exists and has the same mode and # modification time bits. -- Repository URL: http://hg.python.org/cpython From benjamin at python.org Mon Jul 4 04:54:23 2011 From: benjamin at python.org (Benjamin Peterson) Date: Sun, 3 Jul 2011 21:54:23 -0500 Subject: [Python-checkins] cpython: no one passes NULL here (or should anyway) In-Reply-To: References: Message-ID: 2011/7/3 Nick Coghlan : > On Mon, Jul 4, 2011 at 8:02 AM, benjamin.peterson > wrote: >> http://hg.python.org/cpython/rev/bbbeddafeec0 >> changeset: ? 71160:bbbeddafeec0 >> user: ? ? ? ?Benjamin Peterson >> date: ? ? ? ?Sun Jul 03 17:06:32 2011 -0500 >> summary: >> ?no one passes NULL here (or should anyway) >> >> files: >> ?Python/ceval.c | ?3 --- >> ?1 files changed, 0 insertions(+), 3 deletions(-) >> >> >> diff --git a/Python/ceval.c b/Python/ceval.c >> --- a/Python/ceval.c >> +++ b/Python/ceval.c >> @@ -1115,9 +1115,6 @@ >> >> ?/* Start of code */ >> >> - ? ?if (f == NULL) >> - ? ? ? ?return NULL; >> - > > May need to replace that with an assert(f != NULL) to keep static > analysers happy. Surely static analyzers don't assume every argument passed in is NULL? -- Regards, Benjamin From solipsis at pitrou.net Mon Jul 4 05:08:26 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 04 Jul 2011 05:08:26 +0200 Subject: [Python-checkins] Daily reference leaks (53fc0c475260): sum=-288 Message-ID: results for 53fc0c475260 on branch "default" -------------------------------------------- test_concurrent_futures leaked [-108, 108, -585] references, sum=-585 test_packaging leaked [100, 100, 100] references, sum=300 test_warnings leaked [-1, -1, -1] references, sum=-3 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogGUTzjX', '-x'] From python-checkins at python.org Mon Jul 4 05:15:22 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 05:15:22 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_plug_refleak?= Message-ID: http://hg.python.org/cpython/rev/f0382acebfe6 changeset: 71178:f0382acebfe6 branch: 3.2 parent: 71176:301c008dd58d user: Benjamin Peterson date: Sun Jul 03 22:18:34 2011 -0500 summary: plug refleak files: Python/_warnings.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -517,6 +517,7 @@ } else { const char *module_str = _PyUnicode_AsString(*module); + Py_XDECREF(*filename); if (module_str == NULL) goto handle_error; if (strcmp(module_str, "__main__") == 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 05:15:23 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 05:15:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_plug_refleak?= Message-ID: http://hg.python.org/cpython/rev/a2944dd4ba7b changeset: 71179:a2944dd4ba7b branch: 2.7 parent: 71175:fc46acf7a645 user: Benjamin Peterson date: Sun Jul 03 22:18:34 2011 -0500 summary: plug refleak files: Python/_warnings.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -514,6 +514,7 @@ } else { const char *module_str = PyString_AsString(*module); + Py_XDECREF(*filename); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 05:15:23 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 04 Jul 2011 05:15:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/078d91fc6b3b changeset: 71180:078d91fc6b3b parent: 71177:53fc0c475260 parent: 71178:f0382acebfe6 user: Benjamin Peterson date: Sun Jul 03 22:19:29 2011 -0500 summary: merge 3.2 files: Python/_warnings.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -517,6 +517,7 @@ } else { const char *module_str = _PyUnicode_AsString(*module); + Py_XDECREF(*filename); if (module_str == NULL) goto handle_error; if (strcmp(module_str, "__main__") == 0) { -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Mon Jul 4 05:44:59 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 4 Jul 2011 13:44:59 +1000 Subject: [Python-checkins] cpython: no one passes NULL here (or should anyway) In-Reply-To: References: Message-ID: On Mon, Jul 4, 2011 at 12:54 PM, Benjamin Peterson wrote: > 2011/7/3 Nick Coghlan : >> May need to replace that with an assert(f != NULL) to keep static >> analysers happy. > > Surely static analyzers don't assume every argument passed in is NULL? I didn't check - was this change in a static function? For those, I think they can figure it out. For functions exposed to the linker, I think they demand an explicit check for a non-NULL pointer (which may be in the form of an assertion). Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Mon Jul 4 06:05:36 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 06:05:36 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12471_-_wrong_TypeError_message_when_=27=25i=27_format_spec_was?= =?utf8?q?_used=2E?= Message-ID: http://hg.python.org/cpython/rev/97707459bb5a changeset: 71181:97707459bb5a branch: 3.2 parent: 71178:f0382acebfe6 user: Senthil Kumaran date: Sun Jul 03 21:03:16 2011 -0700 summary: Fix closes issue12471 - wrong TypeError message when '%i' format spec was used. files: Lib/test/test_unicode.py | 1 + Objects/unicodeobject.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -788,6 +788,7 @@ self.assertEqual('%c' % '\U00021483', '\U00021483') self.assertRaises(TypeError, "%c".__mod__, "aa") self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3)) + self.assertRaises(TypeError, "%i".__mod__, "aa") # formatting jobs delegated from the string implementation: self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9689,8 +9689,6 @@ case 'o': case 'x': case 'X': - if (c == 'i') - c = 'd'; isnumok = 0; if (PyNumber_Check(v)) { PyObject *iobj=NULL; @@ -9705,7 +9703,7 @@ if (iobj!=NULL) { if (PyLong_Check(iobj)) { isnumok = 1; - temp = formatlong(iobj, flags, prec, c); + temp = formatlong(iobj, flags, prec, (c == 'i'? 'd': c)); Py_DECREF(iobj); if (!temp) goto onError; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 06:05:37 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 06:05:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/7ac6397a6308 changeset: 71182:7ac6397a6308 parent: 71180:078d91fc6b3b parent: 71181:97707459bb5a user: Senthil Kumaran date: Sun Jul 03 21:05:25 2011 -0700 summary: merge from 3.2 files: Lib/test/test_unicode.py | 1 + Objects/unicodeobject.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -788,6 +788,7 @@ self.assertEqual('%c' % '\U00021483', '\U00021483') self.assertRaises(TypeError, "%c".__mod__, "aa") self.assertRaises(ValueError, "%.1\u1032f".__mod__, (1.0/3)) + self.assertRaises(TypeError, "%i".__mod__, "aa") # formatting jobs delegated from the string implementation: self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9761,8 +9761,6 @@ case 'o': case 'x': case 'X': - if (c == 'i') - c = 'd'; isnumok = 0; if (PyNumber_Check(v)) { PyObject *iobj=NULL; @@ -9777,7 +9775,7 @@ if (iobj!=NULL) { if (PyLong_Check(iobj)) { isnumok = 1; - temp = formatlong(iobj, flags, prec, c); + temp = formatlong(iobj, flags, prec, (c == 'i'? 'd': c)); Py_DECREF(iobj); if (!temp) goto onError; -- Repository URL: http://hg.python.org/cpython From benjamin at python.org Mon Jul 4 06:15:53 2011 From: benjamin at python.org (Benjamin Peterson) Date: Sun, 3 Jul 2011 23:15:53 -0500 Subject: [Python-checkins] cpython: no one passes NULL here (or should anyway) In-Reply-To: References: Message-ID: 2011/7/3 Nick Coghlan : > On Mon, Jul 4, 2011 at 12:54 PM, Benjamin Peterson wrote: >> 2011/7/3 Nick Coghlan : >>> May need to replace that with an assert(f != NULL) to keep static >>> analysers happy. >> >> Surely static analyzers don't assume every argument passed in is NULL? > > I didn't check - was this change in a static function? For those, I > think they can figure it out. For functions exposed to the linker, I > think they demand an explicit check for a non-NULL pointer (which may > be in the form of an assertion). If someone's static analysis tool starts complaining about it, I'd be happy to consider adding an assert... -- Regards, Benjamin From python-checkins at python.org Mon Jul 4 06:38:26 2011 From: python-checkins at python.org (ned.deily) Date: Mon, 04 Jul 2011 06:38:26 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwNzM0?= =?utf8?q?=3A_Temporarily_disable_test=5Fttk_test=5Fheading=5Fcallback_on_?= =?utf8?q?2=2E7_as_well=2E?= Message-ID: http://hg.python.org/cpython/rev/8dde71899733 changeset: 71183:8dde71899733 branch: 2.7 parent: 71179:a2944dd4ba7b user: Ned Deily date: Sun Jul 03 21:37:03 2011 -0700 summary: Issue #10734: Temporarily disable test_ttk test_heading_callback on 2.7 as well. files: Lib/lib-tk/test/test_ttk/test_widgets.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/lib-tk/test/test_ttk/test_widgets.py b/Lib/lib-tk/test/test_ttk/test_widgets.py --- a/Lib/lib-tk/test/test_ttk/test_widgets.py +++ b/Lib/lib-tk/test/test_ttk/test_widgets.py @@ -937,7 +937,8 @@ self.assertRaises(Tkinter.TclError, self.tv.heading, '#0', anchor=1) - + # XXX skipping for now; should be fixed to work with newer ttk + @unittest.skip("skipping pending resolution of Issue #10734") def test_heading_callback(self): def simulate_heading_click(x, y): support.simulate_mouse_click(self.tv, x, y) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 07:31:29 2011 From: python-checkins at python.org (ned.deily) Date: Mon, 04 Jul 2011 07:31:29 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Avoid_crashes_caused_by_Aqua_Tk_on_OSX_when_attempting_to_run?= Message-ID: http://hg.python.org/cpython/rev/ea02eca122b5 changeset: 71184:ea02eca122b5 branch: 2.7 user: Ned Deily date: Sun Jul 03 21:52:35 2011 -0700 summary: Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). files: Lib/lib-tk/test/runtktests.py | 32 +++++++++++++++++++++++ Lib/test/test_tk.py | 12 ++------ Lib/test/test_ttk_guionly.py | 17 +++++++----- Misc/NEWS | 4 ++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -10,10 +10,42 @@ import sys import unittest import importlib +import subprocess import test.test_support this_dir_path = os.path.abspath(os.path.dirname(__file__)) +_tk_available = None + +def check_tk_availability(): + """Check that Tk is installed and available.""" + global _tk_available + + if _tk_available is not None: + return + + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. Instead, try to initialize Tk under a subprocess. + p = subprocess.Popen( + [sys.executable, '-c', 'import Tkinter; Tkinter.Button()'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stderr = test.test_support.strip_python_stderr(p.communicate()[1]) + if stderr or p.returncode: + raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) + else: + try: + Tkinter.Button() + except tkinter.TclError as msg: + # assuming tk is not available + raise unittest.SkipTest("tk not available: %s" % msg) + + _tk_available = True + return + def is_package(path): for name in os.listdir(path): if name in ('__init__.py', '__init__.pyc', '__init.pyo'): diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -1,18 +1,9 @@ import os -import unittest from test import test_support # Skip test if _tkinter wasn't built. test_support.import_module('_tkinter') -import Tkinter - -try: - Tkinter.Button() -except Tkinter.TclError, msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) - this_dir = os.path.dirname(os.path.abspath(__file__)) lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, 'lib-tk', 'test')) @@ -20,6 +11,9 @@ with test_support.DirsOnSysPath(lib_tk_test): import runtktests +# Skip test if tk cannot be initialized. +runtktests.check_tk_availability() + def test_main(enable_gui=False): if enable_gui: if test_support.use_resources is None: diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,16 @@ # Skip this test if _tkinter wasn't built. test_support.import_module('_tkinter') +this_dir = os.path.dirname(os.path.abspath(__file__)) +lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, + 'lib-tk', 'test')) + +with test_support.DirsOnSysPath(lib_tk_test): + import runtktests + +# Skip test if tk cannot be initialized. +runtktests.check_tk_availability() + import ttk from _tkinter import TclError @@ -14,13 +24,6 @@ # assuming ttk is not available raise unittest.SkipTest("ttk not available: %s" % msg) -this_dir = os.path.dirname(os.path.abspath(__file__)) -lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, - 'lib-tk', 'test')) - -with test_support.DirsOnSysPath(lib_tk_test): - import runtktests - def test_main(enable_gui=False): if enable_gui: if test_support.use_resources is None: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -83,6 +83,10 @@ Tests ----- +- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run + test_tk or test_ttk_guionly under a username that is not currently logged + in to the console windowserver (as may be the case under buildbot or ssh). + - Issue #12141: Install a copy of template C module file so that test_build_ext of test_distutils is no longer silently skipped when run outside of a build directory. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 07:31:30 2011 From: python-checkins at python.org (ned.deily) Date: Mon, 04 Jul 2011 07:31:30 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Avoid_crashes_caused_by_Aqua_Tk_on_OSX_when_attempting_to_run?= Message-ID: http://hg.python.org/cpython/rev/279488f5a171 changeset: 71185:279488f5a171 branch: 3.2 parent: 71181:97707459bb5a user: Ned Deily date: Sun Jul 03 21:56:48 2011 -0700 summary: Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). files: Lib/test/test_tk.py | 12 ++----- Lib/test/test_ttk_guionly.py | 4 ++ Lib/tkinter/test/support.py | 36 ++++++++++++++++++++++++ Misc/NEWS | 8 +++++ 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -2,15 +2,11 @@ # Skip test if _tkinter wasn't built. support.import_module('_tkinter') -import tkinter +# Skip test if tk cannot be initialized. +from tkinter.test.support import check_tk_availability +check_tk_availability() + from tkinter.test import runtktests -import unittest - -try: - tkinter.Button() -except tkinter.TclError as msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) def test_main(enable_gui=False): if enable_gui: diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,10 @@ # Skip this test if _tkinter wasn't built. support.import_module('_tkinter') +# Skip test if tk cannot be initialized. +from tkinter.test.support import check_tk_availability +check_tk_availability() + from _tkinter import TclError from tkinter import ttk from tkinter.test import runtktests diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py --- a/Lib/tkinter/test/support.py +++ b/Lib/tkinter/test/support.py @@ -1,6 +1,42 @@ +import subprocess +import sys +from test import support import tkinter +import unittest + +_tk_available = None + +def check_tk_availability(): + """Check that Tk is installed and available.""" + global _tk_available + + if _tk_available is not None: + return + + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. Instead, try to initialize Tk under a subprocess. + p = subprocess.Popen( + [sys.executable, '-c', 'import tkinter; tkinter.Button()'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stderr = support.strip_python_stderr(p.communicate()[1]) + if stderr or p.returncode: + raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) + else: + try: + tkinter.Button() + except tkinter.TclError as msg: + # assuming tk is not available + raise unittest.SkipTest("tk not available: %s" % msg) + + _tk_available = True + return def get_tk_root(): + check_tk_availability() # raise exception if tk unavailable try: root = tkinter._default_root except AttributeError: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -35,6 +35,14 @@ C-API ----- +Tests +----- + +- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run + test_tk or test_ttk_guionly under a username that is not currently logged + in to the console windowserver (as may be the case under buildbot or ssh). + + What's New in Python 3.2.1 release candidate 2? =============================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 07:31:31 2011 From: python-checkins at python.org (ned.deily) Date: Mon, 04 Jul 2011 07:31:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=238716=3A_Avoid_crashes_caused_by_Aqua_Tk_on_OSX_when?= =?utf8?q?_attempting_to_run?= Message-ID: http://hg.python.org/cpython/rev/5b5a33196916 changeset: 71186:5b5a33196916 parent: 71182:7ac6397a6308 parent: 71185:279488f5a171 user: Ned Deily date: Sun Jul 03 22:27:16 2011 -0700 summary: Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). files: Lib/test/test_tk.py | 12 ++----- Lib/test/test_ttk_guionly.py | 4 ++ Lib/tkinter/test/support.py | 36 ++++++++++++++++++++++++ Misc/NEWS | 4 ++ 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py --- a/Lib/test/test_tk.py +++ b/Lib/test/test_tk.py @@ -2,15 +2,11 @@ # Skip test if _tkinter wasn't built. support.import_module('_tkinter') -import tkinter +# Skip test if tk cannot be initialized. +from tkinter.test.support import check_tk_availability +check_tk_availability() + from tkinter.test import runtktests -import unittest - -try: - tkinter.Button() -except tkinter.TclError as msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) def test_main(enable_gui=False): if enable_gui: diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk_guionly.py @@ -5,6 +5,10 @@ # Skip this test if _tkinter wasn't built. support.import_module('_tkinter') +# Skip test if tk cannot be initialized. +from tkinter.test.support import check_tk_availability +check_tk_availability() + from _tkinter import TclError from tkinter import ttk from tkinter.test import runtktests diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py --- a/Lib/tkinter/test/support.py +++ b/Lib/tkinter/test/support.py @@ -1,6 +1,42 @@ +import subprocess +import sys +from test import support import tkinter +import unittest + +_tk_available = None + +def check_tk_availability(): + """Check that Tk is installed and available.""" + global _tk_available + + if _tk_available is not None: + return + + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. Instead, try to initialize Tk under a subprocess. + p = subprocess.Popen( + [sys.executable, '-c', 'import tkinter; tkinter.Button()'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stderr = support.strip_python_stderr(p.communicate()[1]) + if stderr or p.returncode: + raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) + else: + try: + tkinter.Button() + except tkinter.TclError as msg: + # assuming tk is not available + raise unittest.SkipTest("tk not available: %s" % msg) + + _tk_available = True + return def get_tk_root(): + check_tk_availability() # raise exception if tk unavailable try: root = tkinter._default_root except AttributeError: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -973,6 +973,10 @@ Tests ----- +- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run + test_tk or test_ttk_guionly under a username that is not currently logged + in to the console windowserver (as may be the case under buildbot or ssh). + - Issue #12407: Explicitly skip test_capi.EmbeddingTest under Windows. - Issue #12400: regrtest -W doesn't rerun the tests twice anymore, but captures -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 08:17:38 2011 From: python-checkins at python.org (ned.deily) Date: Mon, 04 Jul 2011 08:17:38 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Fix_errors_in_the_non-OS_X_path_of_the_27_backport=2E?= Message-ID: http://hg.python.org/cpython/rev/06cb0d602468 changeset: 71187:06cb0d602468 branch: 2.7 parent: 71184:ea02eca122b5 user: Ned Deily date: Sun Jul 03 23:16:49 2011 -0700 summary: Issue #8716: Fix errors in the non-OS X path of the 27 backport. files: Lib/lib-tk/test/runtktests.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -37,9 +37,10 @@ if stderr or p.returncode: raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) else: + import Tkinter try: Tkinter.Button() - except tkinter.TclError as msg: + except Tkinter.TclError as msg: # assuming tk is not available raise unittest.SkipTest("tk not available: %s" % msg) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 11:52:29 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 11:52:29 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDI5?= =?utf8?q?=3A_Skip_interrupted_write_tests_on_FreeBSD_=3C=3D_7?= Message-ID: http://hg.python.org/cpython/rev/a624b86264a4 changeset: 71188:a624b86264a4 branch: 2.7 user: Victor Stinner date: Mon Jul 04 11:44:46 2011 +0200 summary: Issue #12429: Skip interrupted write tests on FreeBSD <= 7 On FreeBSD, the SIGALRM signal is sometimes received by the reader thread. files: Lib/test/test_io.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2557,6 +2557,8 @@ 1 // 0 @unittest.skipUnless(threading, 'Threading required for this test.') + @unittest.skipIf(sys.platform in ('freebsd5', 'freebsd6', 'freebsd7'), + 'issue #12429: skip test on FreeBSD <= 7') def check_interrupted_write(self, item, bytes, **fdopen_kwargs): """Check that a partial write, when it gets interrupted, properly invokes the signal handler, and bubbles up the exception raised -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 11:52:31 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 11:52:31 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDI5?= =?utf8?q?=3A_Skip_interrupted_write_tests_on_FreeBSD_=3C=3D_7?= Message-ID: http://hg.python.org/cpython/rev/e924e51e9447 changeset: 71189:e924e51e9447 branch: 3.2 parent: 71185:279488f5a171 user: Victor Stinner date: Mon Jul 04 11:48:17 2011 +0200 summary: Issue #12429: Skip interrupted write tests on FreeBSD <= 7 On FreeBSD, the SIGALRM signal is sometimes received by the reader thread. files: Lib/test/test_io.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2651,6 +2651,8 @@ 1/0 @unittest.skipUnless(threading, 'Threading required for this test.') + @unittest.skipIf(sys.platform in ('freebsd5', 'freebsd6', 'freebsd7'), + 'issue #12429: skip test on FreeBSD <= 7') def check_interrupted_write(self, item, bytes, **fdopen_kwargs): """Check that a partial write, when it gets interrupted, properly invokes the signal handler, and bubbles up the exception raised -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 11:52:31 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 11:52:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_null_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/79d7bcbe88f6 changeset: 71190:79d7bcbe88f6 parent: 71186:5b5a33196916 parent: 71189:e924e51e9447 user: Victor Stinner date: Mon Jul 04 11:51:21 2011 +0200 summary: null merge 3.2 Python 3.3 has the correct fix for #12429, use pthread_sigmask(). files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 13:49:04 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 13:49:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=239642=3A_Fix_filesy?= =?utf8?q?stem_encoding_initialization=3A_use_the_ANSI_code_page_on?= Message-ID: http://hg.python.org/cpython/rev/7ce685cda0ae changeset: 71191:7ce685cda0ae user: Victor Stinner date: Mon Jul 04 13:48:30 2011 +0200 summary: Issue #9642: Fix filesystem encoding initialization: use the ANSI code page on Windows if the mbcs codec is not available, and fail with a fatal error if we cannot get the locale encoding (if nl_langinfo(CODESET) is not available) instead of using UTF-8. files: Misc/NEWS | 5 +++++ Python/bltinmodule.c | 5 +---- Python/pythonrun.c | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Core and Builtins ----------------- +- Issue #9642: Fix filesystem encoding initialization: use the ANSI code page + on Windows if the mbcs codec is not available, and fail with a fatal error if + we cannot get the locale encoding (if nl_langinfo(CODESET) is not available) + instead of using UTF-8. + - When a generator yields, do not retain the caller's exception state on the generator. diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -24,12 +24,9 @@ #elif defined(__APPLE__) const char *Py_FileSystemDefaultEncoding = "utf-8"; int Py_HasFileSystemDefaultEncoding = 1; -#elif defined(HAVE_LANGINFO_H) && defined(CODESET) +#else const char *Py_FileSystemDefaultEncoding = NULL; /* set by initfsencoding() */ int Py_HasFileSystemDefaultEncoding = 0; -#else -const char *Py_FileSystemDefaultEncoding = "utf-8"; -int Py_HasFileSystemDefaultEncoding = 1; #endif static PyObject * diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -168,18 +168,25 @@ return NULL; } -#if defined(HAVE_LANGINFO_H) && defined(CODESET) static char* -get_codeset(void) +get_locale_encoding(void) { +#ifdef MS_WINDOWS + char codepage[100]; + PyOS_snprintf(codepage, sizeof(codepage), "cp%d", GetACP()); + return get_codec_name(codepage); +#elif defined(HAVE_LANGINFO_H) && defined(CODESET) char* codeset = nl_langinfo(CODESET); if (!codeset || codeset[0] == '\0') { PyErr_SetString(PyExc_ValueError, "CODESET is not set or empty"); return NULL; } return get_codec_name(codeset); +#else + PyErr_SetNone(PyExc_NotImplementedError); + return NULL; +#endif } -#endif void Py_InitializeEx(int install_sigs) @@ -746,24 +753,17 @@ initfsencoding(PyInterpreterState *interp) { PyObject *codec; -#if defined(HAVE_LANGINFO_H) && defined(CODESET) - char *codeset = NULL; - if (Py_FileSystemDefaultEncoding == NULL) { - /* On Unix, set the file system encoding according to the - user's preference, if the CODESET names a well-known - Python codec, and Py_FileSystemDefaultEncoding isn't - initialized by other means. */ - codeset = get_codeset(); - if (codeset == NULL) + if (Py_FileSystemDefaultEncoding == NULL) + { + Py_FileSystemDefaultEncoding = get_locale_encoding(); + if (Py_FileSystemDefaultEncoding == NULL) Py_FatalError("Py_Initialize: Unable to get the locale encoding"); - Py_FileSystemDefaultEncoding = codeset; Py_HasFileSystemDefaultEncoding = 0; interp->fscodec_initialized = 1; return 0; } -#endif /* the encoding is mbcs, utf-8 or ascii */ codec = _PyCodec_Lookup(Py_FileSystemDefaultEncoding); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 14:03:52 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 14:03:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=239642=3A_Fix_the_de?= =?utf8?q?finition_of_time=2Eclock=28=29_on_Windows?= Message-ID: http://hg.python.org/cpython/rev/75b18b10064f changeset: 71192:75b18b10064f user: Victor Stinner date: Mon Jul 04 13:55:40 2011 +0200 summary: Issue #9642: Fix the definition of time.clock() on Windows Don't unset and set againt the HAVE_CLOCK define, reorder the #if tests instead. Fix also the definition of the timezone encoding. files: Modules/timemodule.c | 54 ++++++++++++++----------------- 1 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -3,8 +3,6 @@ #include "Python.h" #include "_time.h" -#define TZNAME_ENCODING "utf-8" - #include #ifdef HAVE_SYS_TYPES_H @@ -45,12 +43,11 @@ #endif /* MS_WINDOWS */ #endif /* !__WATCOMC__ || __QNX__ */ -#if defined(MS_WINDOWS) && !defined(__BORLANDC__) -/* Win32 has better clock replacement; we have our own version below. */ -#undef HAVE_CLOCK -#undef TZNAME_ENCODING -#define TZNAME_ENCODING "mbcs" -#endif /* MS_WINDOWS && !defined(__BORLANDC__) */ +#if defined(MS_WINDOWS) +# define TZNAME_ENCODING "mbcs" +#else +# define TZNAME_ENCODING "utf-8" +#endif #if defined(PYOS_OS2) #define INCL_DOS @@ -84,25 +81,9 @@ Return the current time in seconds since the Epoch.\n\ Fractions of a second may be present if the system clock provides them."); -#ifdef HAVE_CLOCK - -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#else -#define CLOCKS_PER_SEC 1000000 -#endif -#endif - -static PyObject * -time_clock(PyObject *self, PyObject *unused) -{ - return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC); -} -#endif /* HAVE_CLOCK */ - #if defined(MS_WINDOWS) && !defined(__BORLANDC__) -/* Due to Mark Hammond and Tim Peters */ +/* Win32 has better clock replacement; we have our own version, due to Mark + Hammond and Tim Peters */ static PyObject * time_clock(PyObject *self, PyObject *unused) { @@ -127,8 +108,23 @@ return PyFloat_FromDouble(diff / divisor); } -#define HAVE_CLOCK /* So it gets included in the methods */ -#endif /* MS_WINDOWS && !defined(__BORLANDC__) */ +#elif defined(HAVE_CLOCK) + +#ifndef CLOCKS_PER_SEC +#ifdef CLK_TCK +#define CLOCKS_PER_SEC CLK_TCK +#else +#define CLOCKS_PER_SEC 1000000 +#endif +#endif + +static PyObject * +time_clock(PyObject *self, PyObject *unused) +{ + return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC); +} +#endif /* HAVE_CLOCK */ + #ifdef HAVE_CLOCK PyDoc_STRVAR(clock_doc, @@ -784,7 +780,7 @@ static PyMethodDef time_methods[] = { {"time", time_time, METH_NOARGS, time_doc}, -#ifdef HAVE_CLOCK +#if (defined(MS_WINDOWS) && !defined(__BORLANDC__)) || defined(HAVE_CLOCK) {"clock", time_clock, METH_NOARGS, clock_doc}, #endif {"sleep", time_sleep, METH_VARARGS, sleep_doc}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 14:25:56 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 14:25:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=239642=3A_Uniformize?= =?utf8?q?_the_tests_on_the_availability_of_the_mbcs_codec?= Message-ID: http://hg.python.org/cpython/rev/13e6d3cb2ecd changeset: 71193:13e6d3cb2ecd user: Victor Stinner date: Mon Jul 04 14:23:54 2011 +0200 summary: Issue #9642: Uniformize the tests on the availability of the mbcs codec Add a new HAVE_MBCS define. files: Include/unicodeobject.h | 8 ++++++-- Misc/NEWS | 3 +++ Modules/_codecsmodule.c | 10 +++++----- Modules/timemodule.c | 2 +- Objects/unicodeobject.c | 12 ++++++------ Python/bltinmodule.c | 2 +- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -109,6 +109,10 @@ # endif #endif +#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +# define HAVE_MBCS +#endif + #ifdef HAVE_WCHAR_H /* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ # ifdef _HAVE_BSDI @@ -1162,7 +1166,7 @@ ); #endif -#ifdef MS_WIN32 +#ifdef HAVE_MBCS /* --- MBCS codecs for Windows -------------------------------------------- */ @@ -1191,7 +1195,7 @@ ); #endif -#endif /* MS_WIN32 */ +#endif /* HAVE_MBCS */ /* --- Decimal Encoder ---------------------------------------------------- */ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #9642: Uniformize the tests on the availability of the mbcs codec, add + a new HAVE_MBCS define. + - Issue #9642: Fix filesystem encoding initialization: use the ANSI code page on Windows if the mbcs codec is not available, and fail with a fatal error if we cannot get the locale encoding (if nl_langinfo(CODESET) is not available) diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -588,7 +588,7 @@ return codec_tuple(unicode, pbuf.len); } -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS static PyObject * mbcs_decode(PyObject *self, @@ -613,7 +613,7 @@ return codec_tuple(decoded, consumed); } -#endif /* MS_WINDOWS */ +#endif /* HAVE_MBCS */ /* --- Encoder ------------------------------------------------------------ */ @@ -989,7 +989,7 @@ return PyUnicode_BuildEncodingMap(map); } -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS static PyObject * mbcs_encode(PyObject *self, @@ -1014,7 +1014,7 @@ return v; } -#endif /* MS_WINDOWS */ +#endif /* HAVE_MBCS */ /* --- Error handler registry --------------------------------------------- */ @@ -1101,7 +1101,7 @@ {"charmap_decode", charmap_decode, METH_VARARGS}, {"charmap_build", charmap_build, METH_VARARGS}, {"readbuffer_encode", readbuffer_encode, METH_VARARGS}, -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS {"mbcs_encode", mbcs_encode, METH_VARARGS}, {"mbcs_decode", mbcs_decode, METH_VARARGS}, #endif diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -43,7 +43,7 @@ #endif /* MS_WINDOWS */ #endif /* !__WATCOMC__ || __QNX__ */ -#if defined(MS_WINDOWS) +#if defined(HAVE_MBCS) # define TZNAME_ENCODING "mbcs" #else # define TZNAME_ENCODING "utf-8" diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1506,7 +1506,7 @@ (strcmp(lower, "latin1") == 0) || (strcmp(lower, "iso-8859-1") == 0)) return PyUnicode_DecodeLatin1(s, size, errors); -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS else if (strcmp(lower, "mbcs") == 0) return PyUnicode_DecodeMBCS(s, size, errors); #endif @@ -1644,7 +1644,7 @@ PyObject * PyUnicode_EncodeFSDefault(PyObject *unicode) { -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode), NULL); @@ -1746,7 +1746,7 @@ return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode), errors); -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS else if (strcmp(lower, "mbcs") == 0) return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode), @@ -1848,7 +1848,7 @@ PyObject* PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size) { -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS return PyUnicode_DecodeMBCS(s, size, NULL); #elif defined(__APPLE__) return PyUnicode_DecodeUTF8(s, size, "surrogateescape"); @@ -4942,7 +4942,7 @@ NULL); } -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS /* --- MBCS codecs for Windows -------------------------------------------- */ @@ -5229,7 +5229,7 @@ #undef NEED_RETRY -#endif /* MS_WINDOWS */ +#endif /* HAVE_MBCS */ /* --- Character Mapping Codec -------------------------------------------- */ diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -18,7 +18,7 @@ Don't forget to modify PyUnicode_DecodeFSDefault() if you touch any of the values for Py_FileSystemDefaultEncoding! */ -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) +#ifdef HAVE_MBCS const char *Py_FileSystemDefaultEncoding = "mbcs"; int Py_HasFileSystemDefaultEncoding = 1; #elif defined(__APPLE__) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 14:28:50 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 14:28:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312452=3A_Plist_and?= =?utf8?q?_Dict_are_now_deprecated?= Message-ID: http://hg.python.org/cpython/rev/4f14050a963f changeset: 71194:4f14050a963f user: Victor Stinner date: Mon Jul 04 14:28:45 2011 +0200 summary: Issue #12452: Plist and Dict are now deprecated Replace PendingDeprecationWarning warnings by DeprecationWarning. files: Lib/plistlib.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/plistlib.py b/Lib/plistlib.py --- a/Lib/plistlib.py +++ b/Lib/plistlib.py @@ -266,13 +266,13 @@ raise AttributeError(attr) from warnings import warn warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning, 2) + "notation instead", DeprecationWarning, 2) return value def __setattr__(self, attr, value): from warnings import warn warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning, 2) + "notation instead", DeprecationWarning, 2) self[attr] = value def __delattr__(self, attr): @@ -282,14 +282,14 @@ raise AttributeError(attr) from warnings import warn warn("Attribute access from plist dicts is deprecated, use d[key] " - "notation instead", PendingDeprecationWarning, 2) + "notation instead", DeprecationWarning, 2) class Dict(_InternalDict): def __init__(self, **kwargs): from warnings import warn warn("The plistlib.Dict class is deprecated, use builtin dict instead", - PendingDeprecationWarning, 2) + DeprecationWarning, 2) super().__init__(**kwargs) @@ -302,7 +302,7 @@ def __init__(self, **kwargs): from warnings import warn warn("The Plist class is deprecated, use the readPlist() and " - "writePlist() functions instead", PendingDeprecationWarning, 2) + "writePlist() functions instead", DeprecationWarning, 2) super().__init__(**kwargs) def fromFile(cls, pathOrFile): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 17:49:49 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 17:49:49 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDY5?= =?utf8?q?=3A_Run_=22wakeup=22_signal_tests_in_subprocess_to_run_the_test_?= =?utf8?q?in_a?= Message-ID: http://hg.python.org/cpython/rev/e07b331bf489 changeset: 71195:e07b331bf489 branch: 3.2 parent: 71189:e924e51e9447 user: Victor Stinner date: Mon Jul 04 17:35:10 2011 +0200 summary: Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a fresh process with only one thread and to not change signal handling of the parent process. files: Lib/test/test_signal.py | 105 ++++++++++++++++++--------- Misc/NEWS | 4 + 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -11,7 +11,7 @@ import unittest from test import support from contextlib import closing -from test.script_helper import spawn_python +from test.script_helper import assert_python_ok, spawn_python if sys.platform in ('os2', 'riscos'): raise unittest.SkipTest("Can't test signal on %s" % sys.platform) @@ -233,49 +233,80 @@ @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") class WakeupSignalTests(unittest.TestCase): - TIMEOUT_FULL = 10 - TIMEOUT_HALF = 5 + def check_wakeup(self, test_body): + # use a subprocess to have only one thread and to not change signal + # handling of the parent process + code = """if 1: + import fcntl + import os + import signal + + def handler(signum, frame): + pass + + {} + + signal.signal(signal.SIGALRM, handler) + read, write = os.pipe() + flags = fcntl.fcntl(write, fcntl.F_GETFL, 0) + flags = flags | os.O_NONBLOCK + fcntl.fcntl(write, fcntl.F_SETFL, flags) + signal.set_wakeup_fd(write) + + test() + + os.close(read) + os.close(write) + """.format(test_body) + + assert_python_ok('-c', code) def test_wakeup_fd_early(self): - import select + self.check_wakeup("""def test(): + import select + import time - signal.alarm(1) - before_time = time.time() - # We attempt to get a signal during the sleep, - # before select is called - time.sleep(self.TIMEOUT_FULL) - mid_time = time.time() - self.assertTrue(mid_time - before_time < self.TIMEOUT_HALF) - select.select([self.read], [], [], self.TIMEOUT_FULL) - after_time = time.time() - self.assertTrue(after_time - mid_time < self.TIMEOUT_HALF) + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the sleep, + # before select is called + time.sleep(TIMEOUT_FULL) + mid_time = time.time() + dt = mid_time - before_time + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) + select.select([read], [], [], TIMEOUT_FULL) + after_time = time.time() + dt = after_time - mid_time + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) + """) def test_wakeup_fd_during(self): - import select + self.check_wakeup("""def test(): + import select + import time - signal.alarm(1) - before_time = time.time() - # We attempt to get a signal during the select call - self.assertRaises(select.error, select.select, - [self.read], [], [], self.TIMEOUT_FULL) - after_time = time.time() - self.assertTrue(after_time - before_time < self.TIMEOUT_HALF) + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 - def setUp(self): - import fcntl - - self.alrm = signal.signal(signal.SIGALRM, lambda x,y:None) - self.read, self.write = os.pipe() - flags = fcntl.fcntl(self.write, fcntl.F_GETFL, 0) - flags = flags | os.O_NONBLOCK - fcntl.fcntl(self.write, fcntl.F_SETFL, flags) - self.old_wakeup = signal.set_wakeup_fd(self.write) - - def tearDown(self): - signal.set_wakeup_fd(self.old_wakeup) - os.close(self.read) - os.close(self.write) - signal.signal(signal.SIGALRM, self.alrm) + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the select call + try: + select.select([read], [], [], TIMEOUT_FULL) + except select.error: + pass + else: + raise Exception("select.error not raised") + after_time = time.time() + dt = after_time - before_time + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) + """) @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") class SiginterruptTest(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,10 @@ Tests ----- +- Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a + fresh process with only one thread and to not change signal handling of the + parent process. + - Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 17:49:50 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 17:49:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312469=3A_Run_wakeup_and_pending_s?= =?utf8?q?ignal_tests_in_a_subprocess?= Message-ID: http://hg.python.org/cpython/rev/b9de5e55f798 changeset: 71196:b9de5e55f798 parent: 71194:4f14050a963f parent: 71195:e07b331bf489 user: Victor Stinner date: Mon Jul 04 17:49:40 2011 +0200 summary: (merge 3.2) Issue #12469: Run wakeup and pending signal tests in a subprocess to run the test in a fresh process with only one thread and to not change signal handling of the parent process. files: Lib/test/test_signal.py | 496 ++++++++++++++------------- Misc/NEWS | 4 + 2 files changed, 261 insertions(+), 239 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -224,117 +224,115 @@ @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") class WakeupSignalTests(unittest.TestCase): - TIMEOUT_FULL = 10 - TIMEOUT_HALF = 5 + def check_wakeup(self, test_body, *signals): + # use a subprocess to have only one thread + code = """if 1: + import fcntl + import os + import signal + import struct - def handler(self, signum, frame): - pass + signals = {!r} - def check_signum(self, *signals): - data = os.read(self.read, len(signals)+1) - raised = struct.unpack('%uB' % len(data), data) - # We don't care of the signal delivery order (it's not portable or - # reliable) - raised = set(raised) - signals = set(signals) - self.assertEqual(raised, signals) + def handler(signum, frame): + pass + + def check_signum(signals): + data = os.read(read, len(signals)+1) + raised = struct.unpack('%uB' % len(data), data) + # We don't care of the signal delivery order (it's not portable or + # reliable) + raised = set(raised) + signals = set(signals) + assert raised == signals, "%r != %r" % (raised, signals) + + {} + + signal.signal(signal.SIGALRM, handler) + read, write = os.pipe() + for fd in (read, write): + flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) + flags = flags | os.O_NONBLOCK + fcntl.fcntl(fd, fcntl.F_SETFL, flags) + signal.set_wakeup_fd(write) + + test() + check_signum(signals) + + os.close(read) + os.close(write) + """.format(signals, test_body) + + assert_python_ok('-c', code) def test_wakeup_fd_early(self): - import select + self.check_wakeup("""def test(): + import select + import time - signal.alarm(1) - before_time = time.time() - # We attempt to get a signal during the sleep, - # before select is called - time.sleep(self.TIMEOUT_FULL) - mid_time = time.time() - self.assertTrue(mid_time - before_time < self.TIMEOUT_HALF) - select.select([self.read], [], [], self.TIMEOUT_FULL) - after_time = time.time() - self.assertTrue(after_time - mid_time < self.TIMEOUT_HALF) - self.check_signum(signal.SIGALRM) + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the sleep, + # before select is called + time.sleep(TIMEOUT_FULL) + mid_time = time.time() + dt = mid_time - before_time + assert dt < TIMEOUT_HALF, dt + select.select([read], [], [], TIMEOUT_FULL) + after_time = time.time() + dt = after_time - mid_time + assert dt < TIMEOUT_HALF, dt + """, signal.SIGALRM) def test_wakeup_fd_during(self): - import select + self.check_wakeup("""def test(): + import select + import time - signal.alarm(1) - before_time = time.time() - # We attempt to get a signal during the select call - self.assertRaises(select.error, select.select, - [self.read], [], [], self.TIMEOUT_FULL) - after_time = time.time() - self.assertTrue(after_time - before_time < self.TIMEOUT_HALF) - self.check_signum(signal.SIGALRM) + TIMEOUT_FULL = 10 + TIMEOUT_HALF = 5 + + signal.alarm(1) + before_time = time.time() + # We attempt to get a signal during the select call + try: + select.select([read], [], [], TIMEOUT_FULL) + except select.error: + pass + else: + raise Exception("select.error not raised") + after_time = time.time() + dt = after_time - before_time + assert dt < TIMEOUT_HALF, dt + """, signal.SIGALRM) def test_signum(self): - old_handler = signal.signal(signal.SIGUSR1, self.handler) - self.addCleanup(signal.signal, signal.SIGUSR1, old_handler) - os.kill(os.getpid(), signal.SIGUSR1) - os.kill(os.getpid(), signal.SIGALRM) - self.check_signum(signal.SIGUSR1, signal.SIGALRM) + self.check_wakeup("""def test(): + signal.signal(signal.SIGUSR1, handler) + os.kill(os.getpid(), signal.SIGUSR1) + os.kill(os.getpid(), signal.SIGALRM) + """, signal.SIGUSR1, signal.SIGALRM) @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') - @unittest.skipUnless(hasattr(signal, 'pthread_kill'), - 'need signal.pthread_kill()') def test_pending(self): - signum1 = signal.SIGUSR1 - signum2 = signal.SIGUSR2 - tid = threading.current_thread().ident + self.check_wakeup("""def test(): + signum1 = signal.SIGUSR1 + signum2 = signal.SIGUSR2 - old_handler = signal.signal(signum1, self.handler) - self.addCleanup(signal.signal, signum1, old_handler) - old_handler = signal.signal(signum2, self.handler) - self.addCleanup(signal.signal, signum2, old_handler) + signal.signal(signum1, handler) + signal.signal(signum2, handler) - signal.pthread_sigmask(signal.SIG_BLOCK, (signum1, signum2)) - signal.pthread_kill(tid, signum1) - signal.pthread_kill(tid, signum2) - # Unblocking the 2 signals calls the C signal handler twice - signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2)) + signal.pthread_sigmask(signal.SIG_BLOCK, (signum1, signum2)) + os.kill(os.getpid(), signum1) + os.kill(os.getpid(), signum2) + # Unblocking the 2 signals calls the C signal handler twice + signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2)) + """, signal.SIGUSR1, signal.SIGUSR2) - self.check_signum(signum1, signum2) - - @unittest.skipUnless(hasattr(signal, 'pthread_kill'), - 'need signal.pthread_kill()') - def test_pthread_kill_main_thread(self): - # Test that a signal can be sent to the main thread with pthread_kill() - # before any other thread has been created (see issue #12392). - code = """if True: - import threading - import signal - import sys - - def handler(signum, frame): - sys.exit(3) - - signal.signal(signal.SIGUSR1, handler) - signal.pthread_kill(threading.get_ident(), signal.SIGUSR1) - sys.exit(1) - """ - - with spawn_python('-c', code) as process: - stdout, stderr = process.communicate() - exitcode = process.wait() - if exitcode != 3: - raise Exception("Child error (exit code %s): %s" % - (exitcode, stdout)) - - def setUp(self): - import fcntl - - self.alrm = signal.signal(signal.SIGALRM, self.handler) - self.read, self.write = os.pipe() - flags = fcntl.fcntl(self.write, fcntl.F_GETFL, 0) - flags = flags | os.O_NONBLOCK - fcntl.fcntl(self.write, fcntl.F_SETFL, flags) - self.old_wakeup = signal.set_wakeup_fd(self.write) - - def tearDown(self): - signal.set_wakeup_fd(self.old_wakeup) - os.close(self.read) - os.close(self.write) - signal.signal(signal.SIGALRM, self.alrm) @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") class SiginterruptTest(unittest.TestCase): @@ -519,60 +517,6 @@ Test pthread_sigmask(), pthread_kill(), sigpending() and sigwait() functions. """ - def setUp(self): - self.has_pthread_kill = hasattr(signal, 'pthread_kill') - - def handler(self, signum, frame): - 1/0 - - def read_sigmask(self): - return signal.pthread_sigmask(signal.SIG_BLOCK, []) - - def can_test_blocked_signals(self, skip): - """ - Check if a blocked signal can be raised to the main thread without - calling its signal handler. We need pthread_kill() or exactly one - thread (the main thread). - - Return True if it's possible. Otherwise, return False and print a - warning if skip is False, or raise a SkipTest exception if skip is - True. - """ - if self.has_pthread_kill: - return True - - # The fault handler timeout thread masks all signals. If the main - # thread masks also SIGUSR1, all threads mask this signal. In this - # case, if we send SIGUSR1 to the process, the signal is pending in the - # main or the faulthandler timeout thread. Unblock SIGUSR1 in the main - # thread calls the signal handler only if the signal is pending for the - # main thread. Stop the faulthandler timeout thread to workaround this - # problem. - import faulthandler - faulthandler.cancel_dump_tracebacks_later() - - # Issue #11998: The _tkinter module loads the Tcl library which - # creates a thread waiting events in select(). This thread receives - # signals blocked by all other threads. We cannot test blocked - # signals - if '_tkinter' in sys.modules: - message = ("_tkinter is loaded and pthread_kill() is missing, " - "cannot test blocked signals (issue #11998)") - if skip: - self.skipTest(message) - else: - print("WARNING: %s" % message) - return False - return True - - def kill(self, signum): - if self.has_pthread_kill: - tid = threading.get_ident() - signal.pthread_kill(tid, signum) - else: - pid = os.getpid() - os.kill(pid, signum) - @unittest.skipUnless(hasattr(signal, 'sigpending'), 'need signal.sigpending()') def test_sigpending_empty(self): @@ -583,70 +527,103 @@ @unittest.skipUnless(hasattr(signal, 'sigpending'), 'need signal.sigpending()') def test_sigpending(self): - self.can_test_blocked_signals(True) + code = """if 1: + import os + import signal - signum = signal.SIGUSR1 - old_handler = signal.signal(signum, self.handler) - self.addCleanup(signal.signal, signum, old_handler) + def handler(signum, frame): + 1/0 - signal.pthread_sigmask(signal.SIG_BLOCK, [signum]) - self.kill(signum) - self.assertEqual(signal.sigpending(), {signum}) - with self.assertRaises(ZeroDivisionError): - signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) + signum = signal.SIGUSR1 + signal.signal(signum, handler) + + signal.pthread_sigmask(signal.SIG_BLOCK, [signum]) + os.kill(os.getpid(), signum) + pending = signal.sigpending() + assert pending == {signum}, '%s != {%s}' % (pending, signum) + try: + signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) + except ZeroDivisionError: + pass + else: + raise Exception("ZeroDivisionError not raised") + """ + assert_python_ok('-c', code) @unittest.skipUnless(hasattr(signal, 'pthread_kill'), 'need signal.pthread_kill()') def test_pthread_kill(self): - signum = signal.SIGUSR1 - current = threading.get_ident() + code = """if 1: + import signal + import threading + import sys - old_handler = signal.signal(signum, self.handler) - self.addCleanup(signal.signal, signum, old_handler) + signum = signal.SIGUSR1 - with self.assertRaises(ZeroDivisionError): - signal.pthread_kill(current, signum) + def handler(signum, frame): + 1/0 + + signal.signal(signum, handler) + + if sys.platform == 'freebsd6': + # Issue #12392 and #12469: send a signal to the main thread + # doesn't work before the creation of the first thread on + # FreeBSD 6 + def noop(): + pass + thread = threading.Thread(target=noop) + thread.start() + thread.join() + + tid = threading.get_ident() + try: + signal.pthread_kill(tid, signum) + except ZeroDivisionError: + pass + else: + raise Exception("ZeroDivisionError not raised") + """ + assert_python_ok('-c', code) @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') - def wait_helper(self, test, blocked): + def wait_helper(self, blocked, test): """ test: body of the "def test(signum):" function. blocked: number of the blocked signal """ - code = ''' -import signal -import sys + code = '''if 1: + import signal + import sys -def handler(signum, frame): - 1/0 + def handler(signum, frame): + 1/0 -def test(signum): -%s + %s -blocked = %s -signum = signal.SIGALRM + blocked = %s + signum = signal.SIGALRM -# child: block and wait the signal -try: - signal.signal(signum, handler) - signal.pthread_sigmask(signal.SIG_BLOCK, [blocked]) + # child: block and wait the signal + try: + signal.signal(signum, handler) + signal.pthread_sigmask(signal.SIG_BLOCK, [blocked]) - # Do the tests - test(signum) + # Do the tests + test(signum) - # The handler must not be called on unblock - try: - signal.pthread_sigmask(signal.SIG_UNBLOCK, [blocked]) - except ZeroDivisionError: - print("the signal handler has been called", - file=sys.stderr) - sys.exit(1) -except BaseException as err: - print("error: {}".format(err), file=sys.stderr) - sys.stderr.flush() - sys.exit(1) -''' % (test, blocked) + # The handler must not be called on unblock + try: + signal.pthread_sigmask(signal.SIG_UNBLOCK, [blocked]) + except ZeroDivisionError: + print("the signal handler has been called", + file=sys.stderr) + sys.exit(1) + except BaseException as err: + print("error: {}".format(err), file=sys.stderr) + sys.stderr.flush() + sys.exit(1) + ''' % (test.strip(), blocked) # sig*wait* must be called with the signal blocked: since the current # process might have several threads running, use a subprocess to have @@ -656,61 +633,56 @@ @unittest.skipUnless(hasattr(signal, 'sigwait'), 'need signal.sigwait()') def test_sigwait(self): - test = ''' + self.wait_helper(signal.SIGALRM, ''' + def test(signum): signal.alarm(1) received = signal.sigwait([signum]) assert received == signum , 'received %s, not %s' % (received, signum) - ''' - - self.wait_helper(test, signal.SIGALRM) + ''') @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'), 'need signal.sigwaitinfo()') def test_sigwaitinfo(self): - test = ''' + self.wait_helper(signal.SIGALRM, ''' + def test(signum): signal.alarm(1) info = signal.sigwaitinfo([signum]) assert info.si_signo == signum, "info.si_signo != %s" % signum - ''' - - self.wait_helper(test, signal.SIGALRM) + ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), 'need signal.sigtimedwait()') def test_sigtimedwait(self): - test = ''' + self.wait_helper(signal.SIGALRM, ''' + def test(signum): signal.alarm(1) info = signal.sigtimedwait([signum], (10, 1000)) assert info.si_signo == signum, 'info.si_signo != %s' % signum - ''' - - self.wait_helper(test, signal.SIGALRM) + ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), 'need signal.sigtimedwait()') # issue #12303: sigtimedwait() takes 30 seconds on FreeBSD 6 (kernel bug) @unittest.skipIf(sys.platform =='freebsd6', - 'sigtimedwait() with a null timeout doens\'t work on FreeBSD 6') + "sigtimedwait() with a null timeout doens't work on FreeBSD 6") def test_sigtimedwait_poll(self): # check that polling with sigtimedwait works - test = ''' + self.wait_helper(signal.SIGALRM, ''' + def test(signum): import os os.kill(os.getpid(), signum) info = signal.sigtimedwait([signum], (0, 0)) assert info.si_signo == signum, 'info.si_signo != %s' % signum - ''' - - self.wait_helper(test, signal.SIGALRM) + ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), 'need signal.sigtimedwait()') def test_sigtimedwait_timeout(self): - test = ''' + self.wait_helper(signal.SIGALRM, ''' + def test(signum): received = signal.sigtimedwait([signum], (1, 0)) assert received is None, "received=%r" % (received,) - ''' - - self.wait_helper(test, signal.SIGALRM) + ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), 'need signal.sigtimedwait()') @@ -723,7 +695,8 @@ @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'), 'need signal.sigwaitinfo()') def test_sigwaitinfo_interrupted(self): - test = ''' + self.wait_helper(signal.SIGUSR1, ''' + def test(signum): import errno hndl_called = True @@ -741,9 +714,7 @@ raise Exception("Expected EINTR to be raised by sigwaitinfo") else: raise Exception("Expected EINTR to be raised by sigwaitinfo") - ''' - - self.wait_helper(test, signal.SIGUSR1) + ''') @unittest.skipUnless(hasattr(signal, 'sigwait'), 'need signal.sigwait()') @@ -791,46 +762,93 @@ @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') def test_pthread_sigmask(self): - test_blocked_signals = self.can_test_blocked_signals(False) + code = """if 1: + import signal + import os; import threading + + def handler(signum, frame): + 1/0 + + def kill(signum): + os.kill(os.getpid(), signum) + + def read_sigmask(): + return signal.pthread_sigmask(signal.SIG_BLOCK, []) + signum = signal.SIGUSR1 # Install our signal handler - old_handler = signal.signal(signum, self.handler) - self.addCleanup(signal.signal, signum, old_handler) + old_handler = signal.signal(signum, handler) # Unblock SIGUSR1 (and copy the old mask) to test our signal handler old_mask = signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) - self.addCleanup(signal.pthread_sigmask, signal.SIG_SETMASK, old_mask) - with self.assertRaises(ZeroDivisionError): - self.kill(signum) + try: + kill(signum) + except ZeroDivisionError: + pass + else: + raise Exception("ZeroDivisionError not raised") # Block and then raise SIGUSR1. The signal is blocked: the signal # handler is not called, and the signal is now pending signal.pthread_sigmask(signal.SIG_BLOCK, [signum]) - if test_blocked_signals: - self.kill(signum) + kill(signum) # Check the new mask - blocked = self.read_sigmask() - self.assertIn(signum, blocked) - self.assertEqual(old_mask ^ blocked, {signum}) + blocked = read_sigmask() + assert signum in blocked, "%s not in %s" % (signum, blocked) + assert old_mask ^ blocked == {signum}, "%s ^ %s != {%s}" % (old_mask, blocked, signum) # Unblock SIGUSR1 - if test_blocked_signals: - with self.assertRaises(ZeroDivisionError): - # unblock the pending signal calls immediatly the signal handler - signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) + try: + # unblock the pending signal calls immediatly the signal handler + signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) + except ZeroDivisionError: + pass else: - signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) - with self.assertRaises(ZeroDivisionError): - self.kill(signum) + raise Exception("ZeroDivisionError not raised") + try: + kill(signum) + except ZeroDivisionError: + pass + else: + raise Exception("ZeroDivisionError not raised") # Check the new mask - unblocked = self.read_sigmask() - self.assertNotIn(signum, unblocked) - self.assertEqual(blocked ^ unblocked, {signum}) - self.assertSequenceEqual(old_mask, unblocked) - # Finally, restore the previous signal handler and the signal mask + unblocked = read_sigmask() + assert signum not in unblocked, "%s in %s" % (signum, unblocked) + assert blocked ^ unblocked == {signum}, "%s ^ %s != {%s}" % (blocked, unblocked, signum) + assert old_mask == unblocked, "%s != %s" % (old_mask, unblocked) + """ + assert_python_ok('-c', code) + + @unittest.skipIf(sys.platform == 'freebsd6', + "issue #12392: send a signal to the main thread doesn't work " + "before the creation of the first thread on FreeBSD 6") + @unittest.skipUnless(hasattr(signal, 'pthread_kill'), + 'need signal.pthread_kill()') + def test_pthread_kill_main_thread(self): + # Test that a signal can be sent to the main thread with pthread_kill() + # before any other thread has been created (see issue #12392). + code = """if True: + import threading + import signal + import sys + + def handler(signum, frame): + sys.exit(3) + + signal.signal(signal.SIGUSR1, handler) + signal.pthread_kill(threading.get_ident(), signal.SIGUSR1) + sys.exit(2) + """ + + with spawn_python('-c', code) as process: + stdout, stderr = process.communicate() + exitcode = process.wait() + if exitcode != 3: + raise Exception("Child error (exit code %s): %s" % + (exitcode, stdout)) def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -981,6 +981,10 @@ Tests ----- +- Issue #12469: Run wakeup and pending signal tests in a subprocess to run the + test in a fresh process with only one thread and to not change signal + handling of the parent process. + - Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 18:06:53 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 18:06:53 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312469=3A_replace_a?= =?utf8?q?ssertions_by_explicit_if+raise?= Message-ID: http://hg.python.org/cpython/rev/7eef821ab20d changeset: 71197:7eef821ab20d user: Victor Stinner date: Mon Jul 04 18:06:35 2011 +0200 summary: Issue #12469: replace assertions by explicit if+raise files: Lib/test/test_signal.py | 48 +++++++++++++++++++--------- 1 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -244,7 +244,8 @@ # reliable) raised = set(raised) signals = set(signals) - assert raised == signals, "%r != %r" % (raised, signals) + if raised != signals: + raise Exception("%r != %r" % (raised, signals)) {} @@ -280,11 +281,13 @@ time.sleep(TIMEOUT_FULL) mid_time = time.time() dt = mid_time - before_time - assert dt < TIMEOUT_HALF, dt + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) select.select([read], [], [], TIMEOUT_FULL) after_time = time.time() dt = after_time - mid_time - assert dt < TIMEOUT_HALF, dt + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) """, signal.SIGALRM) def test_wakeup_fd_during(self): @@ -306,7 +309,8 @@ raise Exception("select.error not raised") after_time = time.time() dt = after_time - before_time - assert dt < TIMEOUT_HALF, dt + if dt >= TIMEOUT_HALF: + raise Exception("%s >= %s" % (dt, TIMEOUT_HALF)) """, signal.SIGALRM) def test_signum(self): @@ -540,7 +544,8 @@ signal.pthread_sigmask(signal.SIG_BLOCK, [signum]) os.kill(os.getpid(), signum) pending = signal.sigpending() - assert pending == {signum}, '%s != {%s}' % (pending, signum) + if pending != {signum}: + raise Exception('%s != {%s}' % (pending, signum)) try: signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum]) except ZeroDivisionError: @@ -637,7 +642,8 @@ def test(signum): signal.alarm(1) received = signal.sigwait([signum]) - assert received == signum , 'received %s, not %s' % (received, signum) + if received != signum: + raise Exception('received %s, not %s' % (received, signum)) ''') @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'), @@ -647,7 +653,8 @@ def test(signum): signal.alarm(1) info = signal.sigwaitinfo([signum]) - assert info.si_signo == signum, "info.si_signo != %s" % signum + if info.si_signo != signum: + raise Exception("info.si_signo != %s" % signum) ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), @@ -657,7 +664,8 @@ def test(signum): signal.alarm(1) info = signal.sigtimedwait([signum], (10, 1000)) - assert info.si_signo == signum, 'info.si_signo != %s' % signum + if info.si_signo != signum: + raise Exception('info.si_signo != %s' % signum) ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), @@ -672,7 +680,8 @@ import os os.kill(os.getpid(), signum) info = signal.sigtimedwait([signum], (0, 0)) - assert info.si_signo == signum, 'info.si_signo != %s' % signum + if info.si_signo != signum: + raise Exception('info.si_signo != %s' % signum) ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), @@ -681,7 +690,8 @@ self.wait_helper(signal.SIGALRM, ''' def test(signum): received = signal.sigtimedwait([signum], (1, 0)) - assert received is None, "received=%r" % (received,) + if received is not None: + raise Exception("received=%r" % (received,)) ''') @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), @@ -709,7 +719,8 @@ signal.sigwaitinfo([signal.SIGUSR1]) except OSError as e: if e.errno == errno.EINTR: - assert hndl_called, "SIGALRM handler not called" + if not hndl_called: + raise Exception("SIGALRM handler not called") else: raise Exception("Expected EINTR to be raised by sigwaitinfo") else: @@ -796,8 +807,10 @@ # Check the new mask blocked = read_sigmask() - assert signum in blocked, "%s not in %s" % (signum, blocked) - assert old_mask ^ blocked == {signum}, "%s ^ %s != {%s}" % (old_mask, blocked, signum) + if signum not in blocked: + raise Exception("%s not in %s" % (signum, blocked)) + if old_mask ^ blocked != {signum}: + raise Exception("%s ^ %s != {%s}" % (old_mask, blocked, signum)) # Unblock SIGUSR1 try: @@ -816,9 +829,12 @@ # Check the new mask unblocked = read_sigmask() - assert signum not in unblocked, "%s in %s" % (signum, unblocked) - assert blocked ^ unblocked == {signum}, "%s ^ %s != {%s}" % (blocked, unblocked, signum) - assert old_mask == unblocked, "%s != %s" % (old_mask, unblocked) + if signum in unblocked: + raise Exception("%s in %s" % (signum, unblocked)) + if blocked ^ unblocked != {signum}: + raise Exception("%s ^ %s != {%s}" % (blocked, unblocked, signum)) + if old_mask != unblocked: + raise Exception("%s != %s" % (old_mask, unblocked)) """ assert_python_ok('-c', code) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:51 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_target_path?= =?utf8?q?_in_message=2E?= Message-ID: http://hg.python.org/cpython/rev/8acdaf766644 changeset: 71198:8acdaf766644 branch: 3.2 parent: 71141:2a3563bc9fcb user: Georg Brandl date: Sun Jul 03 09:30:42 2011 +0200 summary: Fix target path in message. files: Doc/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -113,7 +113,7 @@ pydoc-topics: BUILDER = pydoc-topics pydoc-topics: build @echo "Building finished; now copy build/pydoc-topics/topics.py" \ - "to Lib/pydoc_data/topics.py" + "to ../Lib/pydoc_data/topics.py" htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:51 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Update_pydoc_to?= =?utf8?q?pics=2E?= Message-ID: http://hg.python.org/cpython/rev/1cf59e5149ca changeset: 71199:1cf59e5149ca branch: 3.2 user: Georg Brandl date: Sun Jul 03 09:31:04 2011 +0200 summary: Update pydoc topics. files: Lib/pydoc_data/topics.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Sun May 15 17:48:55 2011 +# Autogenerated by Sphinx on Sun Jul 3 09:27:35 2011 topics = {'assert': '\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': '\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be an iterable with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an asterisk,\n called a "starred" target: The object must be a sequence with at\n least as many items as there are targets in the target list, minus\n one. The first items of the sequence are assigned, from left to\n right, to the targets before the starred target. The final items\n of the sequence are assigned to the targets after the starred\n target. A list of the remaining items in the sequence is then\n assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of items\n as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` or ``nonlocal``\n statement in the current code block: the name is bound to the\n object in the current local namespace.\n\n * Otherwise: the name is bound to the object in the global namespace\n or the outer namespace determined by ``nonlocal``, respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be an iterable with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n ``a.x`` can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target ``a.x`` is\n always set as an instance attribute, creating it if necessary.\n Thus, the two occurrences of ``a.x`` do not necessarily refer to the\n same attribute: if the RHS expression refers to a class attribute,\n the LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with ``property()``.\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, ``IndexError`` is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the ``__setitem__()`` method is called\n with appropriate arguments.\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to integers. If either bound is\n negative, the sequence\'s length is added to it. The resulting\n bounds are clipped to lie between zero and the sequence\'s length,\n inclusive. Finally, the sequence object is asked to replace the\n slice with the items of the assigned sequence. The length of the\n slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print(x)\n\nSee also:\n\n **PEP 3132** - Extended Iterable Unpacking\n The specification for the ``*target`` feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': '\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', @@ -16,9 +16,9 @@ 'break': '\nThe ``break`` statement\n***********************\n\n break_stmt ::= "break"\n\n``break`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition\nwithin that loop.\n\nIt terminates the nearest enclosing loop, skipping the optional\n``else`` clause if the loop has one.\n\nIf a ``for`` loop is terminated by ``break``, the loop control target\nkeeps its current value.\n\nWhen ``break`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nleaving the loop.\n', 'callable-types': '\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n', 'calls': '\nCalls\n*****\n\nA call calls a callable object (e.g., a function) with a possibly\nempty series of arguments:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," keyword_arguments] ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n``__call__()`` method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal parameter lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use ``PyArg_ParseTuple()`` to\nparse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to a sequence. Elements from this\nsequence are treated as if they were additional positional arguments;\nif there are positional arguments *x1*,..., *xN*, and ``expression``\nevaluates to a sequence *y1*, ..., *yM*, this is equivalent to a call\nwith M+N positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the ``*expression`` syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', - 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'comparisons': '\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nthe ``==`` and ``!=`` operators *always* consider objects of different\ntypes to be unequal, while the ``<``, ``>``, ``>=`` and ``<=``\noperators raise a ``TypeError`` when comparing objects of different\ntypes that do not implement these operators for the given pair of\ntypes. You can control comparison behavior of objects of non-built-in\ntypes by defining rich comparison methods like ``__gt__()``, described\nin section *Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values ``float(\'NaN\')`` and ``Decimal(\'NaN\')`` are special. The\n are identical to themselves, ``x is x`` but are not equal to\n themselves, ``x != x``. Additionally, comparing any value to a\n not-a-number value will return ``False``. For example, both ``3 <\n float(\'NaN\')`` and ``float(\'NaN\') < 3`` will return ``False``.\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``[1,2,x] <= [1,2,y]`` has the\n same value as ``x <= y``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if they have the\n same ``(key, value)`` pairs. Order comparisons ``(\'<\', \'<=\', \'>=\',\n \'>\')`` raise ``TypeError``.\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets ``{1,2}`` and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, ``min()``, ``max()``, and ``sorted()`` produce\n undefined results given a list of sets as inputs.\n\n* Most other objects of built-in types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nComparison of objects of the differing types depends on whether either\nof the types provide explicit support for the comparison. Most\nnumeric types can be compared with one another, but comparisons of\n``float`` and ``Decimal`` are not supported to avoid the inevitable\nconfusion arising from representation issues such as ``float(\'1.1\')``\nbeing inexactly represented and therefore not exactly equal to\n``Decimal(\'1.1\')`` which is. When cross-type comparison is not\nsupported, the comparison method returns ``NotImplemented``. This can\ncreate the illusion of non-transitivity between supported cross-type\ncomparisons and unsupported comparisons. For example, ``Decimal(2) ==\n2`` and ``2 == float(2)`` but ``Decimal(2) != float(2)``.\n\nThe operators ``in`` and ``not in`` test for membership. ``x in s``\nevaluates to true if *x* is a member of *s*, and false otherwise. ``x\nnot in s`` returns the negation of ``x in s``. All built-in sequences\nand set types support this as well as dictionary, for which ``in``\ntests whether a the dictionary has a given key. For container types\nsuch as list, tuple, set, frozenset, dict, or collections.deque, the\nexpression ``x in y`` is equivalent to ``any(x is e or x == e for e in\ny)``.\n\nFor the string and bytes types, ``x in y`` is true if and only if *x*\nis a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nEmpty strings are always considered to be a substring of any other\nstring, so ``"" in "abc"`` will return ``True``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` but do\ndefine ``__iter__()``, ``x in y`` is true if some value ``z`` with ``x\n== z`` is produced while iterating over ``y``. If an exception is\nraised during the iteration, it is as if ``in`` raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n``__getitem__()``, ``x in y`` is true if and only if there is a non-\nnegative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value. [4]\n', - 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting of\nthe exception class, the exception instance and a traceback object\n(see section *The standard type hierarchy*) identifying the point in\nthe program where the exception occurred. ``sys.exc_info()`` values\nare restored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting of\nthe exception class, the exception instance and a traceback object\n(see section *The standard type hierarchy*) identifying the point in\nthe program where the exception occurred. ``sys.exc_info()`` values\nare restored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'context-managers': '\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n', 'continue': '\nThe ``continue`` statement\n**************************\n\n continue_stmt ::= "continue"\n\n``continue`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition or\n``finally`` clause within that loop. It continues with the next cycle\nof the nearest enclosing loop.\n\nWhen ``continue`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nstarting the next loop cycle.\n', 'conversions': '\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works that way:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the other\n is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:52 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_bad_markup?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/13c9b93e97ad changeset: 71200:13c9b93e97ad branch: 3.2 user: Georg Brandl date: Sun Jul 03 09:39:49 2011 +0200 summary: Fix bad markup. files: Doc/library/curses.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -566,7 +566,7 @@ Instantiate the string *str* with the supplied parameters, where *str* should be a parameterized string obtained from the terminfo database. E.g. - ``tparm(tigetstr("cup"), 5, 3)`` could result in x``'\033[6;4H'``, the exact + ``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact result depending on terminal type. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:54 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:54 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogQnVtcCB0byAzLjIu?= =?utf8?q?1rc2=2E?= Message-ID: http://hg.python.org/cpython/rev/4360a6c70205 changeset: 71201:4360a6c70205 branch: 3.2 user: Georg Brandl date: Sun Jul 03 09:41:27 2011 +0200 summary: Bump to 3.2.1rc2. files: Include/patchlevel.h | 4 ++-- Lib/distutils/__init__.py | 2 +- Lib/idlelib/idlever.py | 2 +- Misc/NEWS | 2 +- Misc/RPM/python-3.2.spec | 2 +- README | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.2.1rc1+" +#define PY_VERSION "3.2.1rc2" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.2.1rc1" +__version__ = "3.2.1rc2" #--end constants-- diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,1 +1,1 @@ -IDLE_VERSION = "3.2.1rc1" +IDLE_VERSION = "3.2.1rc2" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.2.1 release candidate 2? =============================================== -*Release date: XX-XXX-2011* +*Release date: 03-Jul-2011* Core and Builtins ----------------- diff --git a/Misc/RPM/python-3.2.spec b/Misc/RPM/python-3.2.spec --- a/Misc/RPM/python-3.2.spec +++ b/Misc/RPM/python-3.2.spec @@ -39,7 +39,7 @@ %define name python #--start constants-- -%define version 3.2.1rc1 +%define version 3.2.1rc2 %define libvers 3.2 #--end constants-- %define release 1pydotorg diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.2.1 release candidate 1 +This is Python version 3.2.1 release candidate 2 ================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:54 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:54 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogTkVXUyByZXdyYXAu?= Message-ID: http://hg.python.org/cpython/rev/5df549718fb4 changeset: 71202:5df549718fb4 branch: 3.2 tag: v3.2.1rc2 user: Georg Brandl date: Sun Jul 03 09:42:43 2011 +0200 summary: NEWS rewrap. files: Misc/NEWS | 67 +++++++++++++++++++++--------------------- 1 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,8 +10,8 @@ Core and Builtins ----------------- -- Issue #12291: You can now load multiple marshalled objects from a stream, - with other data interleaved between marshalled objects. +- Issue #12291: You can now load multiple marshalled objects from a stream, with + other data interleaved between marshalled objects. - Issue #12084: os.stat on Windows now works properly with relative symbolic links when called from any directory. @@ -20,30 +20,29 @@ the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c. -- Issue #9670: Increase the default stack size for secondary threads on - Mac OS X and FreeBSD to reduce the chances of a crash instead of a - "maximum recursion depth" RuntimeError exception. - (patch by Ronald Oussoren) +- Issue #9670: Increase the default stack size for secondary threads on Mac OS X + and FreeBSD to reduce the chances of a crash instead of a "maximum recursion + depth" RuntimeError exception (patch by Ronald Oussoren). Library ------- - Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better - conformance to the RFCs: correctly handle Sender and Resent- headers. + conformance to the RFCs: correctly handle Sender and Resent headers. - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. - Issue #12451: The XInclude default loader of xml.etree now decodes files from UTF-8 instead of the locale encoding if the encoding is not specified. It now - also opens XML files for the parser in binary mode instead of the text mode + also opens XML files for the parser in binary mode instead of the text mode to + avoid encoding issues. + +- Issue #12451: doctest.debug_script() doesn't create a temporary file anymore to avoid encoding issues. -- Issue #12451: doctest.debug_script() doesn't create a temporary file - anymore to avoid encoding issues. - -- Issue #12451: pydoc.synopsis() now reads the encoding cookie if available, - to read the Python script from the right encoding. +- Issue #12451: pydoc.synopsis() now reads the encoding cookie if available, to + read the Python script from the right encoding. - Issue #12451: distutils now opens the setup script in binary mode to read the encoding cookie, instead of opening it in UTF-8. @@ -65,9 +64,9 @@ - Issue #12383: Fix subprocess module with env={}: don't copy the environment variables, start with an empty environment. -- Issue #11584: email.header.decode_header no longer fails if the header - passed to it is a Header object, and Header/make_header no longer fail - if given binary unknown-8bit input. +- Issue #11584: email.header.decode_header no longer fails if the header passed + to it is a Header object, and Header/make_header no longer fail if given + binary unknown-8bit input. - Issue #11700: mailbox proxy object close methods can now be called multiple times without error. @@ -99,8 +98,8 @@ constructor has failed, e.g. because of an undeclared keyword argument. Patch written by Oleg Oshmyan. -- Issue #985064: Make plistlib more resilient to faulty input plists. - Patch by Mher Movsisyan. +- Issue #985064: Make plistlib more resilient to faulty input plists. Patch by + Mher Movsisyan. - Issue #12175: RawIOBase.readall() now returns None if read() returns None. @@ -134,13 +133,13 @@ ----- - Issue #8746: Correct faulty configure checks so that os.chflags() and - os.lchflags() are once again built on systems that support these - functions (*BSD and OS X). Also add new stat file flags for OS X - (UF_HIDDEN and UF_COMPRESSED). - -- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds, - ensure "make install" creates symlinks in --prefix bin for the "-32" - files in the framework bin directory like the installer does. + os.lchflags() are once again built on systems that support these functions + (*BSD and OS X). Also add new stat file flags for OS X (UF_HIDDEN and + UF_COMPRESSED). + +- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds, ensure + "make install" creates symlinks in --prefix bin for the "-32" files in the + framework bin directory like the installer does. Tests ----- @@ -151,15 +150,15 @@ the output and displays it on failure instead. regrtest -v doesn't print the error twice anymore if there is only one error. -- Issue #12141: Install a copy of template C module file so that - test_build_ext of test_distutils is no longer silently skipped when - run outside of a build directory. - -- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). - Patch by Garrett Cooper. - -- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 - on Mac OS X. (Patch by Ronald Oussoren) +- Issue #12141: Install a copy of template C module file so that test_build_ext + of test_distutils is no longer silently skipped when run outside of a build + directory. + +- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). Patch + by Garrett Cooper. + +- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 on Mac + OS X. (Patch by Ronald Oussoren) - Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2, iso2022_kr). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:55 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:55 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Added_tag_v3=2E?= =?utf8?q?2=2E1rc2_for_changeset_5df549718fb4?= Message-ID: http://hg.python.org/cpython/rev/788fa7533c95 changeset: 71203:788fa7533c95 branch: 3.2 user: Georg Brandl date: Sun Jul 03 11:54:09 2011 +0200 summary: Added tag v3.2.1rc2 for changeset 5df549718fb4 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -89,3 +89,4 @@ a222a015e28d8ae9af3899258dc6c15c3d40add0 v3.2 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 +5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:56 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Post-release_st?= =?utf8?q?eps=2E?= Message-ID: http://hg.python.org/cpython/rev/a8ebea1da4d8 changeset: 71204:a8ebea1da4d8 branch: 3.2 user: Georg Brandl date: Mon Jul 04 08:20:48 2011 +0200 summary: Post-release steps. files: Include/patchlevel.h | 2 +- Misc/NEWS | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.2.1rc2" +#define PY_VERSION "3.2.1rc2+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.2.1? +=========================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.2.1 release candidate 2? =============================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:56 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:56 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDY3?= =?utf8?q?=3A_warnings=3A_fix_a_race_condition_if_a_warning_is_emitted_at?= Message-ID: http://hg.python.org/cpython/rev/861b483e88d9 changeset: 71205:861b483e88d9 branch: 3.2 user: Victor Stinner date: Mon Jul 04 02:43:09 2011 +0200 summary: Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. files: Lib/test/test_warnings.py | 12 ++++++++++++ Misc/NEWS | 3 +++ Python/_warnings.c | 2 +- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -542,6 +542,18 @@ assert expected_line self.assertEqual(second_line, expected_line) + def test_filename_none(self): + # issue #12467: race condition if a warning is emitted at shutdown + globals_dict = globals() + oldfile = globals_dict['__file__'] + try: + with original_warnings.catch_warnings(module=self.module) as w: + self.module.filterwarnings("always", category=UserWarning) + globals_dict['__file__'] = None + original_warnings.warn('test', UserWarning) + finally: + globals_dict['__file__'] = oldfile + class WarningsDisplayTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + What's New in Python 3.2.1 release candidate 2? =============================================== diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -496,7 +496,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyUnicode_Check(*filename)) { Py_ssize_t len = PyUnicode_GetSize(*filename); Py_UNICODE *unicode = PyUnicode_AS_UNICODE(*filename); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:54:58 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:54:58 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_Merge_3=2E2=2E1_release_clone_changes_into_main_3=2E2_branch_af?= =?utf8?q?ter_3=2E2=2E1rc2_release=2E?= Message-ID: http://hg.python.org/cpython/rev/ab22ffd905b3 changeset: 71206:ab22ffd905b3 branch: 3.2 parent: 71195:e07b331bf489 parent: 71205:861b483e88d9 user: Georg Brandl date: Mon Jul 04 19:55:22 2011 +0200 summary: Merge 3.2.1 release clone changes into main 3.2 branch after 3.2.1rc2 release. files: .hgtags | 1 + Doc/Makefile | 2 +- Doc/library/curses.rst | 2 +- Include/patchlevel.h | 4 +- Lib/distutils/__init__.py | 2 +- Lib/idlelib/idlever.py | 2 +- Lib/pydoc_data/topics.py | 6 +- Misc/NEWS | 84 +++++++++++++++----------- Misc/RPM/python-3.2.spec | 2 +- README | 2 +- 10 files changed, 61 insertions(+), 46 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -89,3 +89,4 @@ a222a015e28d8ae9af3899258dc6c15c3d40add0 v3.2 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 +5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -113,7 +113,7 @@ pydoc-topics: BUILDER = pydoc-topics pydoc-topics: build @echo "Building finished; now copy build/pydoc-topics/topics.py" \ - "to Lib/pydoc_data/topics.py" + "to ../Lib/pydoc_data/topics.py" htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -566,7 +566,7 @@ Instantiate the string *str* with the supplied parameters, where *str* should be a parameterized string obtained from the terminfo database. E.g. - ``tparm(tigetstr("cup"), 5, 3)`` could result in x``'\033[6;4H'``, the exact + ``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact result depending on terminal type. diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.2.1rc1+" +#define PY_VERSION "3.2.1rc2+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.2.1rc1" +__version__ = "3.2.1rc2" #--end constants-- diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,1 +1,1 @@ -IDLE_VERSION = "3.2.1rc1" +IDLE_VERSION = "3.2.1rc2" diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Sun May 15 17:48:55 2011 +# Autogenerated by Sphinx on Sun Jul 3 09:27:35 2011 topics = {'assert': '\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': '\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be an iterable with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an asterisk,\n called a "starred" target: The object must be a sequence with at\n least as many items as there are targets in the target list, minus\n one. The first items of the sequence are assigned, from left to\n right, to the targets before the starred target. The final items\n of the sequence are assigned to the targets after the starred\n target. A list of the remaining items in the sequence is then\n assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of items\n as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` or ``nonlocal``\n statement in the current code block: the name is bound to the\n object in the current local namespace.\n\n * Otherwise: the name is bound to the object in the global namespace\n or the outer namespace determined by ``nonlocal``, respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be an iterable with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n ``a.x`` can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target ``a.x`` is\n always set as an instance attribute, creating it if necessary.\n Thus, the two occurrences of ``a.x`` do not necessarily refer to the\n same attribute: if the RHS expression refers to a class attribute,\n the LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with ``property()``.\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, ``IndexError`` is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the ``__setitem__()`` method is called\n with appropriate arguments.\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to integers. If either bound is\n negative, the sequence\'s length is added to it. The resulting\n bounds are clipped to lie between zero and the sequence\'s length,\n inclusive. Finally, the sequence object is asked to replace the\n slice with the items of the assigned sequence. The length of the\n slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print(x)\n\nSee also:\n\n **PEP 3132** - Extended Iterable Unpacking\n The specification for the ``*target`` feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': '\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', @@ -16,9 +16,9 @@ 'break': '\nThe ``break`` statement\n***********************\n\n break_stmt ::= "break"\n\n``break`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition\nwithin that loop.\n\nIt terminates the nearest enclosing loop, skipping the optional\n``else`` clause if the loop has one.\n\nIf a ``for`` loop is terminated by ``break``, the loop control target\nkeeps its current value.\n\nWhen ``break`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nleaving the loop.\n', 'callable-types': '\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n', 'calls': '\nCalls\n*****\n\nA call calls a callable object (e.g., a function) with a possibly\nempty series of arguments:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," keyword_arguments] ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n``__call__()`` method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal parameter lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use ``PyArg_ParseTuple()`` to\nparse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to a sequence. Elements from this\nsequence are treated as if they were additional positional arguments;\nif there are positional arguments *x1*,..., *xN*, and ``expression``\nevaluates to a sequence *y1*, ..., *yM*, this is equivalent to a call\nwith M+N positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the ``*expression`` syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', - 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'comparisons': '\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nthe ``==`` and ``!=`` operators *always* consider objects of different\ntypes to be unequal, while the ``<``, ``>``, ``>=`` and ``<=``\noperators raise a ``TypeError`` when comparing objects of different\ntypes that do not implement these operators for the given pair of\ntypes. You can control comparison behavior of objects of non-built-in\ntypes by defining rich comparison methods like ``__gt__()``, described\nin section *Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values ``float(\'NaN\')`` and ``Decimal(\'NaN\')`` are special. The\n are identical to themselves, ``x is x`` but are not equal to\n themselves, ``x != x``. Additionally, comparing any value to a\n not-a-number value will return ``False``. For example, both ``3 <\n float(\'NaN\')`` and ``float(\'NaN\') < 3`` will return ``False``.\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``[1,2,x] <= [1,2,y]`` has the\n same value as ``x <= y``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if they have the\n same ``(key, value)`` pairs. Order comparisons ``(\'<\', \'<=\', \'>=\',\n \'>\')`` raise ``TypeError``.\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets ``{1,2}`` and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, ``min()``, ``max()``, and ``sorted()`` produce\n undefined results given a list of sets as inputs.\n\n* Most other objects of built-in types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nComparison of objects of the differing types depends on whether either\nof the types provide explicit support for the comparison. Most\nnumeric types can be compared with one another, but comparisons of\n``float`` and ``Decimal`` are not supported to avoid the inevitable\nconfusion arising from representation issues such as ``float(\'1.1\')``\nbeing inexactly represented and therefore not exactly equal to\n``Decimal(\'1.1\')`` which is. When cross-type comparison is not\nsupported, the comparison method returns ``NotImplemented``. This can\ncreate the illusion of non-transitivity between supported cross-type\ncomparisons and unsupported comparisons. For example, ``Decimal(2) ==\n2`` and ``2 == float(2)`` but ``Decimal(2) != float(2)``.\n\nThe operators ``in`` and ``not in`` test for membership. ``x in s``\nevaluates to true if *x* is a member of *s*, and false otherwise. ``x\nnot in s`` returns the negation of ``x in s``. All built-in sequences\nand set types support this as well as dictionary, for which ``in``\ntests whether a the dictionary has a given key. For container types\nsuch as list, tuple, set, frozenset, dict, or collections.deque, the\nexpression ``x in y`` is equivalent to ``any(x is e or x == e for e in\ny)``.\n\nFor the string and bytes types, ``x in y`` is true if and only if *x*\nis a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nEmpty strings are always considered to be a substring of any other\nstring, so ``"" in "abc"`` will return ``True``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` but do\ndefine ``__iter__()``, ``x in y`` is true if some value ``z`` with ``x\n== z`` is produced while iterating over ``y``. If an exception is\nraised during the iteration, it is as if ``in`` raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n``__getitem__()``, ``x in y`` is true if and only if there is a non-\nnegative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value. [4]\n', - 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting of\nthe exception class, the exception instance and a traceback object\n(see section *The standard type hierarchy*) identifying the point in\nthe program where the exception occurred. ``sys.exc_info()`` values\nare restored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting of\nthe exception class, the exception instance and a traceback object\n(see section *The standard type hierarchy*) identifying the point in\nthe program where the exception occurred. ``sys.exc_info()`` values\nare restored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the ``with_item``)\n is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__exit__()`` is loaded for later use.\n\n3. The context manager\'s ``__enter__()`` method is invoked.\n\n4. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list [","] | comprehension] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class ``object``; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with ``self.name = value``. Both class and\ninstance attributes are accessible through the notation\n"``self.name``", and an instance attribute hides a class attribute\nwith the same name when accessed in this way. Class attributes can be\nused as defaults for instance attributes, but using mutable values\nthere can lead to unexpected results. *Descriptors* can be used to\ncreate instance variables with different implementation details.\n\nSee also:\n\n **PEP 3115** - Metaclasses in Python 3 **PEP 3129** - Class\n Decorators\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless there\n is a ``finally`` clause which happens to raise another exception.\n That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'context-managers': '\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n', 'continue': '\nThe ``continue`` statement\n**************************\n\n continue_stmt ::= "continue"\n\n``continue`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition or\n``finally`` clause within that loop. It continues with the next cycle\nof the nearest enclosing loop.\n\nWhen ``continue`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nstarting the next loop cycle.\n', 'conversions': '\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works that way:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the other\n is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n', diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,16 +47,31 @@ in to the console windowserver (as may be the case under buildbot or ssh). +What's New in Python 3.2.1? +=========================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + + What's New in Python 3.2.1 release candidate 2? =============================================== -*Release date: XX-XXX-2011* +*Release date: 03-Jul-2011* Core and Builtins ----------------- -- Issue #12291: You can now load multiple marshalled objects from a stream, - with other data interleaved between marshalled objects. +- Issue #12291: You can now load multiple marshalled objects from a stream, with + other data interleaved between marshalled objects. - Issue #12084: os.stat on Windows now works properly with relative symbolic links when called from any directory. @@ -65,30 +80,29 @@ the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c. -- Issue #9670: Increase the default stack size for secondary threads on - Mac OS X and FreeBSD to reduce the chances of a crash instead of a - "maximum recursion depth" RuntimeError exception. - (patch by Ronald Oussoren) +- Issue #9670: Increase the default stack size for secondary threads on Mac OS X + and FreeBSD to reduce the chances of a crash instead of a "maximum recursion + depth" RuntimeError exception (patch by Ronald Oussoren). Library ------- - Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better - conformance to the RFCs: correctly handle Sender and Resent- headers. + conformance to the RFCs: correctly handle Sender and Resent headers. - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage collector while the Heap lock is held. - Issue #12451: The XInclude default loader of xml.etree now decodes files from UTF-8 instead of the locale encoding if the encoding is not specified. It now - also opens XML files for the parser in binary mode instead of the text mode + also opens XML files for the parser in binary mode instead of the text mode to + avoid encoding issues. + +- Issue #12451: doctest.debug_script() doesn't create a temporary file anymore to avoid encoding issues. -- Issue #12451: doctest.debug_script() doesn't create a temporary file - anymore to avoid encoding issues. - -- Issue #12451: pydoc.synopsis() now reads the encoding cookie if available, - to read the Python script from the right encoding. +- Issue #12451: pydoc.synopsis() now reads the encoding cookie if available, to + read the Python script from the right encoding. - Issue #12451: distutils now opens the setup script in binary mode to read the encoding cookie, instead of opening it in UTF-8. @@ -110,9 +124,9 @@ - Issue #12383: Fix subprocess module with env={}: don't copy the environment variables, start with an empty environment. -- Issue #11584: email.header.decode_header no longer fails if the header - passed to it is a Header object, and Header/make_header no longer fail - if given binary unknown-8bit input. +- Issue #11584: email.header.decode_header no longer fails if the header passed + to it is a Header object, and Header/make_header no longer fail if given + binary unknown-8bit input. - Issue #11700: mailbox proxy object close methods can now be called multiple times without error. @@ -144,8 +158,8 @@ constructor has failed, e.g. because of an undeclared keyword argument. Patch written by Oleg Oshmyan. -- Issue #985064: Make plistlib more resilient to faulty input plists. - Patch by Mher Movsisyan. +- Issue #985064: Make plistlib more resilient to faulty input plists. Patch by + Mher Movsisyan. - Issue #12175: RawIOBase.readall() now returns None if read() returns None. @@ -179,13 +193,13 @@ ----- - Issue #8746: Correct faulty configure checks so that os.chflags() and - os.lchflags() are once again built on systems that support these - functions (*BSD and OS X). Also add new stat file flags for OS X - (UF_HIDDEN and UF_COMPRESSED). - -- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds, - ensure "make install" creates symlinks in --prefix bin for the "-32" - files in the framework bin directory like the installer does. + os.lchflags() are once again built on systems that support these functions + (*BSD and OS X). Also add new stat file flags for OS X (UF_HIDDEN and + UF_COMPRESSED). + +- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds, ensure + "make install" creates symlinks in --prefix bin for the "-32" files in the + framework bin directory like the installer does. Tests ----- @@ -196,15 +210,15 @@ the output and displays it on failure instead. regrtest -v doesn't print the error twice anymore if there is only one error. -- Issue #12141: Install a copy of template C module file so that - test_build_ext of test_distutils is no longer silently skipped when - run outside of a build directory. - -- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). - Patch by Garrett Cooper. - -- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 - on Mac OS X. (Patch by Ronald Oussoren) +- Issue #12141: Install a copy of template C module file so that test_build_ext + of test_distutils is no longer silently skipped when run outside of a build + directory. + +- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). Patch + by Garrett Cooper. + +- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 on Mac + OS X. (Patch by Ronald Oussoren) - Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2, iso2022_kr). diff --git a/Misc/RPM/python-3.2.spec b/Misc/RPM/python-3.2.spec --- a/Misc/RPM/python-3.2.spec +++ b/Misc/RPM/python-3.2.spec @@ -39,7 +39,7 @@ %define name python #--start constants-- -%define version 3.2.1rc1 +%define version 3.2.1rc2 %define libvers 3.2 #--end constants-- %define release 1pydotorg diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.2.1 release candidate 1 +This is Python version 3.2.1 release candidate 2 ================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 19:57:39 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 04 Jul 2011 19:57:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/24297278c78d changeset: 71207:24297278c78d parent: 71197:7eef821ab20d parent: 71206:ab22ffd905b3 user: Georg Brandl date: Mon Jul 04 19:58:12 2011 +0200 summary: Merge with 3.2. files: .hgtags | 1 + Doc/Makefile | 2 +- Doc/library/curses.rst | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -89,3 +89,4 @@ a222a015e28d8ae9af3899258dc6c15c3d40add0 v3.2 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 +5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -113,7 +113,7 @@ pydoc-topics: BUILDER = pydoc-topics pydoc-topics: build @echo "Building finished; now copy build/pydoc-topics/topics.py" \ - "to Lib/pydoc_data/topics.py" + "to ../Lib/pydoc_data/topics.py" htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -566,7 +566,7 @@ Instantiate the string *str* with the supplied parameters, where *str* should be a parameterized string obtained from the terminfo database. E.g. - ``tparm(tigetstr("cup"), 5, 3)`` could result in x``'\033[6;4H'``, the exact + ``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact result depending on terminal type. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 20:44:31 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 20:44:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_issue10403_-_Le?= =?utf8?q?t=27s_not_use_members_anymore=2E_Use_=27attribute=27_where_it_de?= =?utf8?q?notes?= Message-ID: http://hg.python.org/cpython/rev/d442c313536b changeset: 71208:d442c313536b branch: 3.2 parent: 71206:ab22ffd905b3 user: Senthil Kumaran date: Mon Jul 04 11:28:30 2011 -0700 summary: issue10403 - Let's not use members anymore. Use 'attribute' where it denotes attribute and 'methods' where it denotes methods. Context should clarify usage. files: Doc/library/cmd.rst | 2 +- Doc/library/curses.rst | 4 +- Doc/library/datetime.rst | 133 ++++++++++---------- Doc/library/decimal.rst | 2 +- Doc/library/doctest.rst | 19 +- Doc/library/gzip.rst | 2 +- Doc/library/html.entities.rst | 2 +- Doc/library/http.cookies.rst | 2 +- Doc/library/io.rst | 4 +- Doc/library/nntplib.rst | 2 +- Doc/library/os.rst | 11 +- Doc/library/pyclbr.rst | 4 +- Doc/library/reprlib.rst | 2 +- Doc/library/shlex.rst | 12 +- Doc/library/socketserver.rst | 2 +- Doc/library/stdtypes.rst | 2 +- Doc/library/subprocess.rst | 29 ++-- Doc/library/tempfile.rst | 4 +- Doc/library/urllib.request.rst | 4 +- Doc/library/xdrlib.rst | 2 +- Doc/library/xmlrpc.client.rst | 6 +- Doc/whatsnew/2.5.rst | 2 +- 22 files changed, 127 insertions(+), 125 deletions(-) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -50,7 +50,7 @@ the line as argument. The optional argument is a banner or intro string to be issued before the first - prompt (this overrides the :attr:`intro` class member). + prompt (this overrides the :attr:`intro` class attribute). If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -1639,7 +1639,7 @@ each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the - :attr:`stripspaces` member. + :attr:`stripspaces` attribute. .. method:: do_command(ch) @@ -1711,7 +1711,7 @@ .. attribute:: stripspaces - This data member is a flag which controls the interpretation of blanks in + This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -11,7 +11,7 @@ The :mod:`datetime` module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the -focus of the implementation is on efficient member extraction for output +focus of the implementation is on efficient attribute extraction for output formatting and manipulation. For related functionality, see also the :mod:`time` and :mod:`calendar` modules. @@ -25,7 +25,7 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information member, :attr:`tzinfo`, that can contain +have an optional time zone information attribute, :attr:`tzinfo`, that can contain an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only @@ -499,9 +499,9 @@ .. method:: date.replace(year, month, day) - Return a date with the same value, except for those members given new values by - whichever keyword arguments are specified. For example, if ``d == date(2002, - 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. + Return a date with the same value, except for those parameters given new + values by whichever keyword arguments are specified. For example, if ``d == + date(2002, 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. .. method:: date.timetuple() @@ -732,11 +732,11 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date members are equal to the given - :class:`date` object's, and whose time and :attr:`tzinfo` members are equal to - the given :class:`time` object's. For any :class:`datetime` object *d*, ``d == - datetime.combine(d.date(), d.timetz())``. If date is a :class:`datetime` - object, its time and :attr:`tzinfo` members are ignored. + Return a new :class:`datetime` object whose date attributes are equal to the + given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are + equal to the given :class:`time` object's. For any :class:`datetime` object + *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -830,43 +830,44 @@ (1) datetime2 is a duration of timedelta removed from datetime1, moving forward in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The - result has the same :attr:`tzinfo` member as the input datetime, and datetime2 - - datetime1 == timedelta after. :exc:`OverflowError` is raised if datetime2.year - would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note - that no time zone adjustments are done even if the input is an aware object. + result has the same :attr:`tzinfo` attribute as the input datetime, and + datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if + datetime2.year would be smaller than :const:`MINYEAR` or larger than + :const:`MAXYEAR`. Note that no time zone adjustments are done even if the + input is an aware object. (2) Computes the datetime2 such that datetime2 + timedelta == datetime1. As for - addition, the result has the same :attr:`tzinfo` member as the input datetime, - and no time zone adjustments are done even if the input is aware. This isn't - quite equivalent to datetime1 + (-timedelta), because -timedelta in isolation - can overflow in cases where datetime1 - timedelta does not. + addition, the result has the same :attr:`tzinfo` attribute as the input + datetime, and no time zone adjustments are done even if the input is aware. + This isn't quite equivalent to datetime1 + (-timedelta), because -timedelta + in isolation can overflow in cases where datetime1 - timedelta does not. (3) Subtraction of a :class:`datetime` from a :class:`datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised. - If both are naive, or both are aware and have the same :attr:`tzinfo` member, - the :attr:`tzinfo` members are ignored, and the result is a :class:`timedelta` + If both are naive, or both are aware and have the same :attr:`tzinfo` attribute, + the :attr:`tzinfo` attributes are ignored, and the result is a :class:`timedelta` object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case. - If both are aware and have different :attr:`tzinfo` members, ``a-b`` acts as if - *a* and *b* were first converted to naive UTC datetimes first. The result is - ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - - b.utcoffset())`` except that the implementation never overflows. + If both are aware and have different :attr:`tzinfo` attributes, ``a-b`` acts + as if *a* and *b* were first converted to naive UTC datetimes first. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. (4) *datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. - If both comparands are aware, and have the same :attr:`tzinfo` member, the - common :attr:`tzinfo` member is ignored and the base datetimes are compared. If - both comparands are aware and have different :attr:`tzinfo` members, the - comparands are first adjusted by subtracting their UTC offsets (obtained from - ``self.utcoffset()``). + If both comparands are aware, and have the same :attr:`tzinfo` attribute, the + common :attr:`tzinfo` attribute is ignored and the base datetimes are + compared. If both comparands are aware and have different :attr:`tzinfo` + attributes, the comparands are first adjusted by subtracting their UTC + offsets (obtained from ``self.utcoffset()``). .. note:: @@ -899,22 +900,22 @@ .. method:: datetime.timetz() Return :class:`time` object with same hour, minute, second, microsecond, and - tzinfo members. See also method :meth:`time`. + tzinfo attributes. See also method :meth:`time`. .. method:: datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) - Return a datetime with the same members, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive datetime from an aware datetime with no - conversion of date and time members. + Return a datetime with the same attributes, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive datetime from an aware + datetime with no conversion of date and time attributes. .. method:: datetime.astimezone(tz) - Return a :class:`datetime` object with new :attr:`tzinfo` member *tz*, adjusting - the date and time members so the result is the same UTC time as *self*, but in - *tz*'s local time. + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, + adjusting the date and time attributes so the result is the same UTC time as + *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must @@ -922,18 +923,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time members is performed. Else the result is local time - in time zone *tz*, representing the same UTC time as *self*: after ``astz = - dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have the same date - and time members as ``dt - dt.utcoffset()``. The discussion of class - :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries - where this cannot be achieved (an issue only if *tz* models both standard and - daylight time). + adjustment of date or time attributes is performed. Else the result is local + time in time zone *tz*, representing the same UTC time as *self*: after + ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have + the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + of class :class:`tzinfo` explains the cases at Daylight Saving Time transition + boundaries where this cannot be achieved (an issue only if *tz* models both + standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time members, use ``dt.replace(tzinfo=None)``. + conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1244,14 +1245,14 @@ * comparison of :class:`time` to :class:`time`, where *a* is considered less than *b* when *a* precedes *b* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. If both comparands are aware, and have - the same :attr:`tzinfo` member, the common :attr:`tzinfo` member is ignored and - the base times are compared. If both comparands are aware and have different - :attr:`tzinfo` members, the comparands are first adjusted by subtracting their - UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type - comparisons from falling back to the default comparison by object address, when - a :class:`time` object is compared to an object of a different type, - :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The - latter cases return :const:`False` or :const:`True`, respectively. + the same :attr:`tzinfo` attribute, the common :attr:`tzinfo` attribute is + ignored and the base times are compared. If both comparands are aware and + have different :attr:`tzinfo` attributes, the comparands are first adjusted by + subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order + to stop mixed-type comparisons from falling back to the default comparison by + object address, when a :class:`time` object is compared to an object of a + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key @@ -1266,10 +1267,10 @@ .. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) - Return a :class:`time` with the same value, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive :class:`time` from an aware :class:`time`, - without conversion of the time members. + Return a :class:`time` with the same value, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive :class:`time` from an + aware :class:`time`, without conversion of the time attributes. .. method:: time.isoformat() @@ -1354,7 +1355,7 @@ An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`datetime` and :class:`time` objects. The latter objects -view their members as being in local time, and the :class:`tzinfo` object +view their attributes as being in local time, and the :class:`tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them. @@ -1399,9 +1400,9 @@ already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`tzinfo` - member's :meth:`dst` method to determine how the :attr:`tm_isdst` flag should be - set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes - when crossing time zones. + attribute's :meth:`dst` method to determine how the :attr:`tm_isdst` flag + should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for + DST changes when crossing time zones. An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense: @@ -1477,10 +1478,10 @@ .. method:: tzinfo.fromutc(dt) This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members - are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to - adjust the date and time members, returning an equivalent datetime in *self*'s - local time. + When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time + attributes are to be viewed as expressing a UTC time. The purpose of + :meth:`fromutc` is to adjust the date and time attributes, returning an + equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -654,7 +654,7 @@ Normalize the number by stripping the rightmost trailing zeros and converting any result equal to :const:`Decimal('0')` to - :const:`Decimal('0e0')`. Used for producing canonical values for members + :const:`Decimal('0e0')`. Used for producing canonical values for attributes of an equivalence class. For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1127,11 +1127,10 @@ .. class:: DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The - constructor arguments are used to initialize the member variables of the same - names. + constructor arguments are used to initialize the attributes of the same names. - :class:`DocTest` defines the following member variables. They are initialized by + :class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1184,11 +1183,11 @@ .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None) A single interactive example, consisting of a Python statement and its expected - output. The constructor arguments are used to initialize the member variables - of the same names. + output. The constructor arguments are used to initialize the attributes of + the same names. - :class:`Example` defines the following member variables. They are initialized by + :class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1675,9 +1674,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are - used to initialize the member variables of the same names. + used to initialize the attributes of the same names. -:exc:`DocTestFailure` defines the following member variables: +:exc:`DocTestFailure` defines the following attributes: .. attribute:: DocTestFailure.test @@ -1699,9 +1698,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used - to initialize the member variables of the same names. + to initialize the attributes of the same names. -:exc:`UnexpectedException` defines the following member variables: +:exc:`UnexpectedException` defines the following attributes: .. attribute:: UnexpectedException.test diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -61,7 +61,7 @@ time is used. This module ignores the timestamp when decompressing; however, some programs, such as :program:`gunzip`\ , make use of it. The format of the timestamp is the same as that of the return value of - ``time.time()`` and of the ``st_mtime`` member of the object returned + ``time.time()`` and of the ``st_mtime`` attribute of the object returned by ``os.stat()``. Calling a :class:`GzipFile` object's :meth:`close` method does not close diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -11,7 +11,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs` -member of the :class:`html.parser.HTMLParser` class. The definition provided +attribute of the :class:`html.parser.HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -152,7 +152,7 @@ .. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* members. + Set the *key*, *value* and *coded_value* attributes. .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -391,8 +391,8 @@ :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do. - :class:`BufferedIOBase` provides or overrides these members in addition to - those from :class:`IOBase`: + :class:`BufferedIOBase` provides or overrides these methods and attribute in + addition to those from :class:`IOBase`: .. attribute:: raw diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -394,7 +394,7 @@ Send an ``ARTICLE`` command, where *message_spec* has the same meaning as for :meth:`stat`. Return a tuple ``(response, info)`` where *info* - is a :class:`~collections.namedtuple` with three members *number*, + is a :class:`~collections.namedtuple` with three attributes *number*, *message_id* and *lines* (in that order). *number* is the article number in the group (or 0 if the information is not available), *message_id* the message id as a string, and *lines* a list of lines (without terminating diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1339,11 +1339,12 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and - :attr:`st_ctime` members depends on the operating system and the file system. - For example, on Windows systems using the FAT or FAT32 file systems, - :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day - resolution. See your operating system documentation for details. + The exact meaning and resolution of the :attr:`st_atime`, + :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating + system and the file system. For example, on Windows systems using the FAT + or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and + :attr:`st_atime` has only 1-day resolution. See your operating system + documentation for details. For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -45,7 +45,7 @@ The :class:`Class` objects used as values in the dictionary returned by :func:`readmodule` and :func:`readmodule_ex` provide the following data -members: +attributes: .. attribute:: Class.module @@ -89,7 +89,7 @@ ---------------- The :class:`Function` objects used as values in the dictionary returned by -:func:`readmodule_ex` provide the following data members: +:func:`readmodule_ex` provide the following attributes: .. attribute:: Function.module diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -66,7 +66,7 @@ Repr Objects ------------ -:class:`Repr` instances provide several members which can be used to provide +:class:`Repr` instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -24,8 +24,8 @@ Split the string *s* using shell-like syntax. If *comments* is :const:`False` (the default), the parsing of comments in the given string will be disabled - (setting the :attr:`commenters` member of the :class:`shlex` instance to the - empty string). This function operates in POSIX mode by default, but uses + (setting the :attr:`commenters` attribute of the :class:`shlex` instance to + the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is false. .. note:: @@ -44,7 +44,7 @@ from. It must be a file-/stream-like object with :meth:`read` and :meth:`readline` methods, or a string. If no argument is given, input will be taken from ``sys.stdin``. The second optional argument is a filename - string, which sets the initial value of the :attr:`infile` member. If the + string, which sets the initial value of the :attr:`infile` attribute. If the *instream* argument is omitted or equal to ``sys.stdin``, this second argument defaults to "stdin". The *posix* argument defines the operational mode: when *posix* is not true (default), the :class:`shlex` instance will @@ -202,8 +202,8 @@ .. attribute:: shlex.source - This member is ``None`` by default. If you assign a string to it, that string - will be recognized as a lexical-level inclusion request similar to the + This attribute is ``None`` by default. If you assign a string to it, that + string will be recognized as a lexical-level inclusion request similar to the ``source`` keyword in various shells. That is, the immediately following token will opened as a filename and input taken from that stream until EOF, at which point the :meth:`close` method of that stream will be called and the input @@ -213,7 +213,7 @@ .. attribute:: shlex.debug - If this member is numeric and ``1`` or more, a :class:`shlex` instance will + If this attribute is numeric and ``1`` or more, a :class:`shlex` instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -81,7 +81,7 @@ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in -:class:`UDPServer`. Setting the various member variables also changes the +:class:`UDPServer`. Setting the various attributes also change the behavior of the underlying server mechanism. To implement a service, you must derive a class from :class:`BaseRequestHandler` diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2567,7 +2567,7 @@ foo`` does not require a module object named *foo* to exist, rather it requires an (external) *definition* for a module named *foo* somewhere.) -A special member of every module is :attr:`__dict__`. This is the dictionary +A special attribute of every module is :attr:`__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the :attr:`__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -497,38 +497,39 @@ .. attribute:: dwFlags - A bit field that determines whether certain :class:`STARTUPINFO` members - are used when the process creates a window. :: + A bit field that determines whether certain :class:`STARTUPINFO` + attributes are used when the process creates a window. :: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW .. attribute:: hStdInput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` - is not specified, the default for standard input is the keyboard buffer. + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard input handle for the process. If + :data:`STARTF_USESTDHANDLES` is not specified, the default for standard + input is the keyboard buffer. .. attribute:: hStdOutput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard output handle for the process. Otherwise, this member is - ignored and the default for standard output is the console window's + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard output handle for the process. Otherwise, this attribute + is ignored and the default for standard output is the console window's buffer. .. attribute:: hStdError - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard error handle for the process. Otherwise, this member is + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window's buffer. .. attribute:: wShowWindow - If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this member + If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute can be any of the values that can be specified in the ``nCmdShow`` parameter for the `ShowWindow `__ - function, except for ``SW_SHOWDEFAULT``. Otherwise, this member is + function, except for ``SW_SHOWDEFAULT``. Otherwise, this attribute is ignored. :data:`SW_HIDE` is provided for this attribute. It is used when @@ -562,12 +563,12 @@ .. data:: STARTF_USESTDHANDLES Specifies that the :attr:`STARTUPINFO.hStdInput`, - :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` members + :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional information. .. data:: STARTF_USESHOWWINDOW - Specifies that the :attr:`STARTUPINFO.wShowWindow` member contains + Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains additional information. .. data:: CREATE_NEW_CONSOLE diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -60,7 +60,7 @@ This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` member of the file object. Whether the name can be + from the :attr:`name` attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is @@ -96,7 +96,7 @@ of the temporary directory object), the newly created temporary directory and all its contents are removed from the filesystem. - The directory name can be retrieved from the :attr:`name` member + The directory name can be retrieved from the :attr:`name` attribute of the returned object. The directory can be explicitly cleaned up by calling the diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -105,7 +105,7 @@ can be imported), :class:`HTTPSHandler` will also be added. A :class:`BaseHandler` subclass may also change its :attr:`handler_order` - member variable to modify its position in the handlers list. + attribute to modify its position in the handlers list. .. function:: pathname2url(path) @@ -536,7 +536,7 @@ Remove any parents. -The following members and methods should only be used by classes derived from +The following attribute and methods should only be used by classes derived from :class:`BaseHandler`. .. note:: diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -260,7 +260,7 @@ .. exception:: Error - The base exception class. :exc:`Error` has a single public data member + The base exception class. :exc:`Error` has a single public attribute :attr:`msg` containing the description of the error. diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -136,7 +136,7 @@ :class:`Fault` or :class:`ProtocolError` object indicating an error. Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:`system` member: +grouped under the reserved :attr:`system` attribute: .. method:: ServerProxy.system.listMethods() @@ -310,7 +310,7 @@ ------------- A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following members: +objects have the following attributes: .. attribute:: Fault.faultCode @@ -359,7 +359,7 @@ A :class:`ProtocolError` object describes a protocol error in the underlying transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following members: +does not exist). It has the following attributes: .. attribute:: ProtocolError.url diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1459,7 +1459,7 @@ On FreeBSD, the :func:`os.stat` function now returns times with nanosecond resolution, and the returned object now has :attr:`st_gen` and - :attr:`st_birthtime`. The :attr:`st_flags` member is also available, if the + :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, if the platform supports it. (Contributed by Antti Louko and Diego Petten?.) .. (Patch 1180695, 1212117) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 20:44:32 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 20:44:32 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2_=2E_Replace_the_term_members_with_correct__?= =?utf8?q?and_appropriate?= Message-ID: http://hg.python.org/cpython/rev/283f20f1d31f changeset: 71209:283f20f1d31f parent: 71207:24297278c78d parent: 71208:d442c313536b user: Senthil Kumaran date: Mon Jul 04 11:31:53 2011 -0700 summary: Merge from 3.2 . Replace the term members with correct and appropriate terminology. Initial patch by Adam Woodbeck. files: Doc/library/cmd.rst | 2 +- Doc/library/curses.rst | 4 +- Doc/library/datetime.rst | 133 ++++++++++---------- Doc/library/decimal.rst | 2 +- Doc/library/doctest.rst | 19 +- Doc/library/gzip.rst | 2 +- Doc/library/html.entities.rst | 2 +- Doc/library/http.cookies.rst | 2 +- Doc/library/io.rst | 4 +- Doc/library/nntplib.rst | 2 +- Doc/library/os.rst | 11 +- Doc/library/pyclbr.rst | 4 +- Doc/library/reprlib.rst | 2 +- Doc/library/shlex.rst | 12 +- Doc/library/socketserver.rst | 2 +- Doc/library/stdtypes.rst | 2 +- Doc/library/subprocess.rst | 29 ++-- Doc/library/tempfile.rst | 4 +- Doc/library/urllib.request.rst | 4 +- Doc/library/xdrlib.rst | 2 +- Doc/library/xmlrpc.client.rst | 6 +- Doc/whatsnew/2.5.rst | 2 +- 22 files changed, 127 insertions(+), 125 deletions(-) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -50,7 +50,7 @@ the line as argument. The optional argument is a banner or intro string to be issued before the first - prompt (this overrides the :attr:`intro` class member). + prompt (this overrides the :attr:`intro` class attribute). If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -1639,7 +1639,7 @@ each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the - :attr:`stripspaces` member. + :attr:`stripspaces` attribute. .. method:: do_command(ch) @@ -1711,7 +1711,7 @@ .. attribute:: stripspaces - This data member is a flag which controls the interpretation of blanks in + This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -11,7 +11,7 @@ The :mod:`datetime` module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the -focus of the implementation is on efficient member extraction for output +focus of the implementation is on efficient attribute extraction for output formatting and manipulation. For related functionality, see also the :mod:`time` and :mod:`calendar` modules. @@ -25,7 +25,7 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information member, :attr:`tzinfo`, that can contain +have an optional time zone information attribute, :attr:`tzinfo`, that can contain an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only @@ -499,9 +499,9 @@ .. method:: date.replace(year, month, day) - Return a date with the same value, except for those members given new values by - whichever keyword arguments are specified. For example, if ``d == date(2002, - 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. + Return a date with the same value, except for those parameters given new + values by whichever keyword arguments are specified. For example, if ``d == + date(2002, 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. .. method:: date.timetuple() @@ -748,11 +748,11 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date members are equal to the given - :class:`date` object's, and whose time and :attr:`tzinfo` members are equal to - the given :class:`time` object's. For any :class:`datetime` object *d*, ``d == - datetime.combine(d.date(), d.timetz())``. If date is a :class:`datetime` - object, its time and :attr:`tzinfo` members are ignored. + Return a new :class:`datetime` object whose date attributes are equal to the + given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are + equal to the given :class:`time` object's. For any :class:`datetime` object + *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -846,43 +846,44 @@ (1) datetime2 is a duration of timedelta removed from datetime1, moving forward in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The - result has the same :attr:`tzinfo` member as the input datetime, and datetime2 - - datetime1 == timedelta after. :exc:`OverflowError` is raised if datetime2.year - would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note - that no time zone adjustments are done even if the input is an aware object. + result has the same :attr:`tzinfo` attribute as the input datetime, and + datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if + datetime2.year would be smaller than :const:`MINYEAR` or larger than + :const:`MAXYEAR`. Note that no time zone adjustments are done even if the + input is an aware object. (2) Computes the datetime2 such that datetime2 + timedelta == datetime1. As for - addition, the result has the same :attr:`tzinfo` member as the input datetime, - and no time zone adjustments are done even if the input is aware. This isn't - quite equivalent to datetime1 + (-timedelta), because -timedelta in isolation - can overflow in cases where datetime1 - timedelta does not. + addition, the result has the same :attr:`tzinfo` attribute as the input + datetime, and no time zone adjustments are done even if the input is aware. + This isn't quite equivalent to datetime1 + (-timedelta), because -timedelta + in isolation can overflow in cases where datetime1 - timedelta does not. (3) Subtraction of a :class:`datetime` from a :class:`datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised. - If both are naive, or both are aware and have the same :attr:`tzinfo` member, - the :attr:`tzinfo` members are ignored, and the result is a :class:`timedelta` + If both are naive, or both are aware and have the same :attr:`tzinfo` attribute, + the :attr:`tzinfo` attributes are ignored, and the result is a :class:`timedelta` object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case. - If both are aware and have different :attr:`tzinfo` members, ``a-b`` acts as if - *a* and *b* were first converted to naive UTC datetimes first. The result is - ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - - b.utcoffset())`` except that the implementation never overflows. + If both are aware and have different :attr:`tzinfo` attributes, ``a-b`` acts + as if *a* and *b* were first converted to naive UTC datetimes first. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. (4) *datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. - If both comparands are aware, and have the same :attr:`tzinfo` member, the - common :attr:`tzinfo` member is ignored and the base datetimes are compared. If - both comparands are aware and have different :attr:`tzinfo` members, the - comparands are first adjusted by subtracting their UTC offsets (obtained from - ``self.utcoffset()``). + If both comparands are aware, and have the same :attr:`tzinfo` attribute, the + common :attr:`tzinfo` attribute is ignored and the base datetimes are + compared. If both comparands are aware and have different :attr:`tzinfo` + attributes, the comparands are first adjusted by subtracting their UTC + offsets (obtained from ``self.utcoffset()``). .. note:: @@ -915,22 +916,22 @@ .. method:: datetime.timetz() Return :class:`time` object with same hour, minute, second, microsecond, and - tzinfo members. See also method :meth:`time`. + tzinfo attributes. See also method :meth:`time`. .. method:: datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) - Return a datetime with the same members, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive datetime from an aware datetime with no - conversion of date and time members. + Return a datetime with the same attributes, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive datetime from an aware + datetime with no conversion of date and time attributes. .. method:: datetime.astimezone(tz) - Return a :class:`datetime` object with new :attr:`tzinfo` member *tz*, adjusting - the date and time members so the result is the same UTC time as *self*, but in - *tz*'s local time. + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, + adjusting the date and time attributes so the result is the same UTC time as + *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must @@ -938,18 +939,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time members is performed. Else the result is local time - in time zone *tz*, representing the same UTC time as *self*: after ``astz = - dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have the same date - and time members as ``dt - dt.utcoffset()``. The discussion of class - :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries - where this cannot be achieved (an issue only if *tz* models both standard and - daylight time). + adjustment of date or time attributes is performed. Else the result is local + time in time zone *tz*, representing the same UTC time as *self*: after + ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have + the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + of class :class:`tzinfo` explains the cases at Daylight Saving Time transition + boundaries where this cannot be achieved (an issue only if *tz* models both + standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time members, use ``dt.replace(tzinfo=None)``. + conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1260,14 +1261,14 @@ * comparison of :class:`time` to :class:`time`, where *a* is considered less than *b* when *a* precedes *b* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. If both comparands are aware, and have - the same :attr:`tzinfo` member, the common :attr:`tzinfo` member is ignored and - the base times are compared. If both comparands are aware and have different - :attr:`tzinfo` members, the comparands are first adjusted by subtracting their - UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type - comparisons from falling back to the default comparison by object address, when - a :class:`time` object is compared to an object of a different type, - :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The - latter cases return :const:`False` or :const:`True`, respectively. + the same :attr:`tzinfo` attribute, the common :attr:`tzinfo` attribute is + ignored and the base times are compared. If both comparands are aware and + have different :attr:`tzinfo` attributes, the comparands are first adjusted by + subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order + to stop mixed-type comparisons from falling back to the default comparison by + object address, when a :class:`time` object is compared to an object of a + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key @@ -1282,10 +1283,10 @@ .. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) - Return a :class:`time` with the same value, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive :class:`time` from an aware :class:`time`, - without conversion of the time members. + Return a :class:`time` with the same value, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive :class:`time` from an + aware :class:`time`, without conversion of the time attributes. .. method:: time.isoformat() @@ -1370,7 +1371,7 @@ An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`datetime` and :class:`time` objects. The latter objects -view their members as being in local time, and the :class:`tzinfo` object +view their attributes as being in local time, and the :class:`tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them. @@ -1415,9 +1416,9 @@ already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`tzinfo` - member's :meth:`dst` method to determine how the :attr:`tm_isdst` flag should be - set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes - when crossing time zones. + attribute's :meth:`dst` method to determine how the :attr:`tm_isdst` flag + should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for + DST changes when crossing time zones. An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense: @@ -1493,10 +1494,10 @@ .. method:: tzinfo.fromutc(dt) This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members - are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to - adjust the date and time members, returning an equivalent datetime in *self*'s - local time. + When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time + attributes are to be viewed as expressing a UTC time. The purpose of + :meth:`fromutc` is to adjust the date and time attributes, returning an + equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -654,7 +654,7 @@ Normalize the number by stripping the rightmost trailing zeros and converting any result equal to :const:`Decimal('0')` to - :const:`Decimal('0e0')`. Used for producing canonical values for members + :const:`Decimal('0e0')`. Used for producing canonical values for attributes of an equivalence class. For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1127,11 +1127,10 @@ .. class:: DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The - constructor arguments are used to initialize the member variables of the same - names. + constructor arguments are used to initialize the attributes of the same names. - :class:`DocTest` defines the following member variables. They are initialized by + :class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1184,11 +1183,11 @@ .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None) A single interactive example, consisting of a Python statement and its expected - output. The constructor arguments are used to initialize the member variables - of the same names. + output. The constructor arguments are used to initialize the attributes of + the same names. - :class:`Example` defines the following member variables. They are initialized by + :class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1675,9 +1674,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are - used to initialize the member variables of the same names. + used to initialize the attributes of the same names. -:exc:`DocTestFailure` defines the following member variables: +:exc:`DocTestFailure` defines the following attributes: .. attribute:: DocTestFailure.test @@ -1699,9 +1698,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used - to initialize the member variables of the same names. + to initialize the attributes of the same names. -:exc:`UnexpectedException` defines the following member variables: +:exc:`UnexpectedException` defines the following attributes: .. attribute:: UnexpectedException.test diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -61,7 +61,7 @@ time is used. This module ignores the timestamp when decompressing; however, some programs, such as :program:`gunzip`\ , make use of it. The format of the timestamp is the same as that of the return value of - ``time.time()`` and of the ``st_mtime`` member of the object returned + ``time.time()`` and of the ``st_mtime`` attribute of the object returned by ``os.stat()``. Calling a :class:`GzipFile` object's :meth:`close` method does not close diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -11,7 +11,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs` -member of the :class:`html.parser.HTMLParser` class. The definition provided +attribute of the :class:`html.parser.HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -152,7 +152,7 @@ .. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* members. + Set the *key*, *value* and *coded_value* attributes. .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -391,8 +391,8 @@ :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do. - :class:`BufferedIOBase` provides or overrides these members in addition to - those from :class:`IOBase`: + :class:`BufferedIOBase` provides or overrides these methods and attribute in + addition to those from :class:`IOBase`: .. attribute:: raw diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -407,7 +407,7 @@ Send an ``ARTICLE`` command, where *message_spec* has the same meaning as for :meth:`stat`. Return a tuple ``(response, info)`` where *info* - is a :class:`~collections.namedtuple` with three members *number*, + is a :class:`~collections.namedtuple` with three attributes *number*, *message_id* and *lines* (in that order). *number* is the article number in the group (or 0 if the information is not available), *message_id* the message id as a string, and *lines* a list of lines (without terminating diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1826,11 +1826,12 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and - :attr:`st_ctime` members depends on the operating system and the file system. - For example, on Windows systems using the FAT or FAT32 file systems, - :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day - resolution. See your operating system documentation for details. + The exact meaning and resolution of the :attr:`st_atime`, + :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating + system and the file system. For example, on Windows systems using the FAT + or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and + :attr:`st_atime` has only 1-day resolution. See your operating system + documentation for details. For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -45,7 +45,7 @@ The :class:`Class` objects used as values in the dictionary returned by :func:`readmodule` and :func:`readmodule_ex` provide the following data -members: +attributes: .. attribute:: Class.module @@ -89,7 +89,7 @@ ---------------- The :class:`Function` objects used as values in the dictionary returned by -:func:`readmodule_ex` provide the following data members: +:func:`readmodule_ex` provide the following attributes: .. attribute:: Function.module diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -66,7 +66,7 @@ Repr Objects ------------ -:class:`Repr` instances provide several members which can be used to provide +:class:`Repr` instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -24,8 +24,8 @@ Split the string *s* using shell-like syntax. If *comments* is :const:`False` (the default), the parsing of comments in the given string will be disabled - (setting the :attr:`commenters` member of the :class:`shlex` instance to the - empty string). This function operates in POSIX mode by default, but uses + (setting the :attr:`commenters` attribute of the :class:`shlex` instance to + the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is false. .. note:: @@ -44,7 +44,7 @@ from. It must be a file-/stream-like object with :meth:`read` and :meth:`readline` methods, or a string. If no argument is given, input will be taken from ``sys.stdin``. The second optional argument is a filename - string, which sets the initial value of the :attr:`infile` member. If the + string, which sets the initial value of the :attr:`infile` attribute. If the *instream* argument is omitted or equal to ``sys.stdin``, this second argument defaults to "stdin". The *posix* argument defines the operational mode: when *posix* is not true (default), the :class:`shlex` instance will @@ -202,8 +202,8 @@ .. attribute:: shlex.source - This member is ``None`` by default. If you assign a string to it, that string - will be recognized as a lexical-level inclusion request similar to the + This attribute is ``None`` by default. If you assign a string to it, that + string will be recognized as a lexical-level inclusion request similar to the ``source`` keyword in various shells. That is, the immediately following token will opened as a filename and input taken from that stream until EOF, at which point the :meth:`close` method of that stream will be called and the input @@ -213,7 +213,7 @@ .. attribute:: shlex.debug - If this member is numeric and ``1`` or more, a :class:`shlex` instance will + If this attribute is numeric and ``1`` or more, a :class:`shlex` instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -81,7 +81,7 @@ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in -:class:`UDPServer`. Setting the various member variables also changes the +:class:`UDPServer`. Setting the various attributes also change the behavior of the underlying server mechanism. To implement a service, you must derive a class from :class:`BaseRequestHandler` diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2578,7 +2578,7 @@ foo`` does not require a module object named *foo* to exist, rather it requires an (external) *definition* for a module named *foo* somewhere.) -A special member of every module is :attr:`__dict__`. This is the dictionary +A special attribute of every module is :attr:`__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the :attr:`__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -567,38 +567,39 @@ .. attribute:: dwFlags - A bit field that determines whether certain :class:`STARTUPINFO` members - are used when the process creates a window. :: + A bit field that determines whether certain :class:`STARTUPINFO` + attributes are used when the process creates a window. :: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW .. attribute:: hStdInput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` - is not specified, the default for standard input is the keyboard buffer. + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard input handle for the process. If + :data:`STARTF_USESTDHANDLES` is not specified, the default for standard + input is the keyboard buffer. .. attribute:: hStdOutput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard output handle for the process. Otherwise, this member is - ignored and the default for standard output is the console window's + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard output handle for the process. Otherwise, this attribute + is ignored and the default for standard output is the console window's buffer. .. attribute:: hStdError - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard error handle for the process. Otherwise, this member is + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window's buffer. .. attribute:: wShowWindow - If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this member + If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute can be any of the values that can be specified in the ``nCmdShow`` parameter for the `ShowWindow `__ - function, except for ``SW_SHOWDEFAULT``. Otherwise, this member is + function, except for ``SW_SHOWDEFAULT``. Otherwise, this attribute is ignored. :data:`SW_HIDE` is provided for this attribute. It is used when @@ -632,12 +633,12 @@ .. data:: STARTF_USESTDHANDLES Specifies that the :attr:`STARTUPINFO.hStdInput`, - :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` members + :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional information. .. data:: STARTF_USESHOWWINDOW - Specifies that the :attr:`STARTUPINFO.wShowWindow` member contains + Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains additional information. .. data:: CREATE_NEW_CONSOLE diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -60,7 +60,7 @@ This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` member of the file object. Whether the name can be + from the :attr:`name` attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is @@ -96,7 +96,7 @@ of the temporary directory object), the newly created temporary directory and all its contents are removed from the filesystem. - The directory name can be retrieved from the :attr:`name` member + The directory name can be retrieved from the :attr:`name` attribute of the returned object. The directory can be explicitly cleaned up by calling the diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -105,7 +105,7 @@ can be imported), :class:`HTTPSHandler` will also be added. A :class:`BaseHandler` subclass may also change its :attr:`handler_order` - member variable to modify its position in the handlers list. + attribute to modify its position in the handlers list. .. function:: pathname2url(path) @@ -546,7 +546,7 @@ Remove any parents. -The following members and methods should only be used by classes derived from +The following attribute and methods should only be used by classes derived from :class:`BaseHandler`. .. note:: diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -260,7 +260,7 @@ .. exception:: Error - The base exception class. :exc:`Error` has a single public data member + The base exception class. :exc:`Error` has a single public attribute :attr:`msg` containing the description of the error. diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -136,7 +136,7 @@ :class:`Fault` or :class:`ProtocolError` object indicating an error. Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:`system` member: +grouped under the reserved :attr:`system` attribute: .. method:: ServerProxy.system.listMethods() @@ -310,7 +310,7 @@ ------------- A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following members: +objects have the following attributes: .. attribute:: Fault.faultCode @@ -359,7 +359,7 @@ A :class:`ProtocolError` object describes a protocol error in the underlying transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following members: +does not exist). It has the following attributes: .. attribute:: ProtocolError.url diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1459,7 +1459,7 @@ On FreeBSD, the :func:`os.stat` function now returns times with nanosecond resolution, and the returned object now has :attr:`st_gen` and - :attr:`st_birthtime`. The :attr:`st_flags` member is also available, if the + :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, if the platform supports it. (Contributed by Antti Louko and Diego Petten?.) .. (Patch 1180695, 1212117) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 20:44:33 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 20:44:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_whitespace_?= =?utf8?q?nit_in_datetime_and_os_rst_files=2E?= Message-ID: http://hg.python.org/cpython/rev/184192b3687c changeset: 71210:184192b3687c branch: 3.2 parent: 71208:d442c313536b user: Senthil Kumaran date: Mon Jul 04 11:43:51 2011 -0700 summary: Fix whitespace nit in datetime and os rst files. files: Doc/library/datetime.rst | 2 +- Doc/library/os.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1251,7 +1251,7 @@ subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type comparisons from falling back to the default comparison by object address, when a :class:`time` object is compared to an object of a - different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1339,7 +1339,7 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, + The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 20:44:34 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 20:44:34 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f9d30fac3da0 changeset: 71211:f9d30fac3da0 parent: 71209:283f20f1d31f parent: 71210:184192b3687c user: Senthil Kumaran date: Mon Jul 04 11:44:17 2011 -0700 summary: merge from 3.2 files: Doc/library/datetime.rst | 2 +- Doc/library/os.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1267,7 +1267,7 @@ subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type comparisons from falling back to the default comparison by object address, when a :class:`time` object is compared to an object of a - different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1826,7 +1826,7 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, + The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 20:51:16 2011 From: python-checkins at python.org (local-hg) Date: Mon, 04 Jul 2011 20:51:16 +0200 Subject: [Python-checkins] =?utf8?q?cpython-gd_=283=2E2=29=3A_issue10403_-?= =?utf8?q?_Let=27s_not_use_members_anymore=2E_Use_=27attribute=27_where_it?= =?utf8?q?_denotes?= Message-ID: http://hg.python.org/cpython-gd/rev/d442c313536b changeset: 71208:d442c313536b branch: 3.2 parent: 71206:ab22ffd905b3 user: Senthil Kumaran date: Mon Jul 04 11:28:30 2011 -0700 files: Doc/library/cmd.rst Doc/library/curses.rst Doc/library/datetime.rst Doc/library/decimal.rst Doc/library/doctest.rst Doc/library/gzip.rst Doc/library/html.entities.rst Doc/library/http.cookies.rst Doc/library/io.rst Doc/library/nntplib.rst Doc/library/os.rst Doc/library/pyclbr.rst Doc/library/reprlib.rst Doc/library/shlex.rst Doc/library/socketserver.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/tempfile.rst Doc/library/urllib.request.rst Doc/library/xdrlib.rst Doc/library/xmlrpc.client.rst Doc/whatsnew/2.5.rst description: issue10403 - Let's not use members anymore. Use 'attribute' where it denotes attribute and 'methods' where it denotes methods. Context should clarify usage. summary: issue10403 - Let's not use members anymore. Use 'attribute' where it denotes attribute and 'methods' where it denotes methods. Context should clarify usage. files: Doc/library/cmd.rst | 2 +- Doc/library/curses.rst | 4 +- Doc/library/datetime.rst | 133 ++++++++++---------- Doc/library/decimal.rst | 2 +- Doc/library/doctest.rst | 19 +- Doc/library/gzip.rst | 2 +- Doc/library/html.entities.rst | 2 +- Doc/library/http.cookies.rst | 2 +- Doc/library/io.rst | 4 +- Doc/library/nntplib.rst | 2 +- Doc/library/os.rst | 11 +- Doc/library/pyclbr.rst | 4 +- Doc/library/reprlib.rst | 2 +- Doc/library/shlex.rst | 12 +- Doc/library/socketserver.rst | 2 +- Doc/library/stdtypes.rst | 2 +- Doc/library/subprocess.rst | 29 ++-- Doc/library/tempfile.rst | 4 +- Doc/library/urllib.request.rst | 4 +- Doc/library/xdrlib.rst | 2 +- Doc/library/xmlrpc.client.rst | 6 +- Doc/whatsnew/2.5.rst | 2 +- 22 files changed, 127 insertions(+), 125 deletions(-) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -50,7 +50,7 @@ the line as argument. The optional argument is a banner or intro string to be issued before the first - prompt (this overrides the :attr:`intro` class member). + prompt (this overrides the :attr:`intro` class attribute). If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -1639,7 +1639,7 @@ each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the - :attr:`stripspaces` member. + :attr:`stripspaces` attribute. .. method:: do_command(ch) @@ -1711,7 +1711,7 @@ .. attribute:: stripspaces - This data member is a flag which controls the interpretation of blanks in + This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -11,7 +11,7 @@ The :mod:`datetime` module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the -focus of the implementation is on efficient member extraction for output +focus of the implementation is on efficient attribute extraction for output formatting and manipulation. For related functionality, see also the :mod:`time` and :mod:`calendar` modules. @@ -25,7 +25,7 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information member, :attr:`tzinfo`, that can contain +have an optional time zone information attribute, :attr:`tzinfo`, that can contain an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only @@ -499,9 +499,9 @@ .. method:: date.replace(year, month, day) - Return a date with the same value, except for those members given new values by - whichever keyword arguments are specified. For example, if ``d == date(2002, - 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. + Return a date with the same value, except for those parameters given new + values by whichever keyword arguments are specified. For example, if ``d == + date(2002, 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. .. method:: date.timetuple() @@ -732,11 +732,11 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date members are equal to the given - :class:`date` object's, and whose time and :attr:`tzinfo` members are equal to - the given :class:`time` object's. For any :class:`datetime` object *d*, ``d == - datetime.combine(d.date(), d.timetz())``. If date is a :class:`datetime` - object, its time and :attr:`tzinfo` members are ignored. + Return a new :class:`datetime` object whose date attributes are equal to the + given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are + equal to the given :class:`time` object's. For any :class:`datetime` object + *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -830,43 +830,44 @@ (1) datetime2 is a duration of timedelta removed from datetime1, moving forward in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The - result has the same :attr:`tzinfo` member as the input datetime, and datetime2 - - datetime1 == timedelta after. :exc:`OverflowError` is raised if datetime2.year - would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note - that no time zone adjustments are done even if the input is an aware object. + result has the same :attr:`tzinfo` attribute as the input datetime, and + datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if + datetime2.year would be smaller than :const:`MINYEAR` or larger than + :const:`MAXYEAR`. Note that no time zone adjustments are done even if the + input is an aware object. (2) Computes the datetime2 such that datetime2 + timedelta == datetime1. As for - addition, the result has the same :attr:`tzinfo` member as the input datetime, - and no time zone adjustments are done even if the input is aware. This isn't - quite equivalent to datetime1 + (-timedelta), because -timedelta in isolation - can overflow in cases where datetime1 - timedelta does not. + addition, the result has the same :attr:`tzinfo` attribute as the input + datetime, and no time zone adjustments are done even if the input is aware. + This isn't quite equivalent to datetime1 + (-timedelta), because -timedelta + in isolation can overflow in cases where datetime1 - timedelta does not. (3) Subtraction of a :class:`datetime` from a :class:`datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised. - If both are naive, or both are aware and have the same :attr:`tzinfo` member, - the :attr:`tzinfo` members are ignored, and the result is a :class:`timedelta` + If both are naive, or both are aware and have the same :attr:`tzinfo` attribute, + the :attr:`tzinfo` attributes are ignored, and the result is a :class:`timedelta` object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case. - If both are aware and have different :attr:`tzinfo` members, ``a-b`` acts as if - *a* and *b* were first converted to naive UTC datetimes first. The result is - ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - - b.utcoffset())`` except that the implementation never overflows. + If both are aware and have different :attr:`tzinfo` attributes, ``a-b`` acts + as if *a* and *b* were first converted to naive UTC datetimes first. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. (4) *datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. - If both comparands are aware, and have the same :attr:`tzinfo` member, the - common :attr:`tzinfo` member is ignored and the base datetimes are compared. If - both comparands are aware and have different :attr:`tzinfo` members, the - comparands are first adjusted by subtracting their UTC offsets (obtained from - ``self.utcoffset()``). + If both comparands are aware, and have the same :attr:`tzinfo` attribute, the + common :attr:`tzinfo` attribute is ignored and the base datetimes are + compared. If both comparands are aware and have different :attr:`tzinfo` + attributes, the comparands are first adjusted by subtracting their UTC + offsets (obtained from ``self.utcoffset()``). .. note:: @@ -899,22 +900,22 @@ .. method:: datetime.timetz() Return :class:`time` object with same hour, minute, second, microsecond, and - tzinfo members. See also method :meth:`time`. + tzinfo attributes. See also method :meth:`time`. .. method:: datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) - Return a datetime with the same members, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive datetime from an aware datetime with no - conversion of date and time members. + Return a datetime with the same attributes, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive datetime from an aware + datetime with no conversion of date and time attributes. .. method:: datetime.astimezone(tz) - Return a :class:`datetime` object with new :attr:`tzinfo` member *tz*, adjusting - the date and time members so the result is the same UTC time as *self*, but in - *tz*'s local time. + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, + adjusting the date and time attributes so the result is the same UTC time as + *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must @@ -922,18 +923,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time members is performed. Else the result is local time - in time zone *tz*, representing the same UTC time as *self*: after ``astz = - dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have the same date - and time members as ``dt - dt.utcoffset()``. The discussion of class - :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries - where this cannot be achieved (an issue only if *tz* models both standard and - daylight time). + adjustment of date or time attributes is performed. Else the result is local + time in time zone *tz*, representing the same UTC time as *self*: after + ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have + the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + of class :class:`tzinfo` explains the cases at Daylight Saving Time transition + boundaries where this cannot be achieved (an issue only if *tz* models both + standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time members, use ``dt.replace(tzinfo=None)``. + conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1244,14 +1245,14 @@ * comparison of :class:`time` to :class:`time`, where *a* is considered less than *b* when *a* precedes *b* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. If both comparands are aware, and have - the same :attr:`tzinfo` member, the common :attr:`tzinfo` member is ignored and - the base times are compared. If both comparands are aware and have different - :attr:`tzinfo` members, the comparands are first adjusted by subtracting their - UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type - comparisons from falling back to the default comparison by object address, when - a :class:`time` object is compared to an object of a different type, - :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The - latter cases return :const:`False` or :const:`True`, respectively. + the same :attr:`tzinfo` attribute, the common :attr:`tzinfo` attribute is + ignored and the base times are compared. If both comparands are aware and + have different :attr:`tzinfo` attributes, the comparands are first adjusted by + subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order + to stop mixed-type comparisons from falling back to the default comparison by + object address, when a :class:`time` object is compared to an object of a + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key @@ -1266,10 +1267,10 @@ .. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) - Return a :class:`time` with the same value, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive :class:`time` from an aware :class:`time`, - without conversion of the time members. + Return a :class:`time` with the same value, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive :class:`time` from an + aware :class:`time`, without conversion of the time attributes. .. method:: time.isoformat() @@ -1354,7 +1355,7 @@ An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`datetime` and :class:`time` objects. The latter objects -view their members as being in local time, and the :class:`tzinfo` object +view their attributes as being in local time, and the :class:`tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them. @@ -1399,9 +1400,9 @@ already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`tzinfo` - member's :meth:`dst` method to determine how the :attr:`tm_isdst` flag should be - set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes - when crossing time zones. + attribute's :meth:`dst` method to determine how the :attr:`tm_isdst` flag + should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for + DST changes when crossing time zones. An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense: @@ -1477,10 +1478,10 @@ .. method:: tzinfo.fromutc(dt) This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members - are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to - adjust the date and time members, returning an equivalent datetime in *self*'s - local time. + When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time + attributes are to be viewed as expressing a UTC time. The purpose of + :meth:`fromutc` is to adjust the date and time attributes, returning an + equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -654,7 +654,7 @@ Normalize the number by stripping the rightmost trailing zeros and converting any result equal to :const:`Decimal('0')` to - :const:`Decimal('0e0')`. Used for producing canonical values for members + :const:`Decimal('0e0')`. Used for producing canonical values for attributes of an equivalence class. For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1127,11 +1127,10 @@ .. class:: DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The - constructor arguments are used to initialize the member variables of the same - names. + constructor arguments are used to initialize the attributes of the same names. - :class:`DocTest` defines the following member variables. They are initialized by + :class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1184,11 +1183,11 @@ .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None) A single interactive example, consisting of a Python statement and its expected - output. The constructor arguments are used to initialize the member variables - of the same names. + output. The constructor arguments are used to initialize the attributes of + the same names. - :class:`Example` defines the following member variables. They are initialized by + :class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1675,9 +1674,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are - used to initialize the member variables of the same names. + used to initialize the attributes of the same names. -:exc:`DocTestFailure` defines the following member variables: +:exc:`DocTestFailure` defines the following attributes: .. attribute:: DocTestFailure.test @@ -1699,9 +1698,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used - to initialize the member variables of the same names. + to initialize the attributes of the same names. -:exc:`UnexpectedException` defines the following member variables: +:exc:`UnexpectedException` defines the following attributes: .. attribute:: UnexpectedException.test diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -61,7 +61,7 @@ time is used. This module ignores the timestamp when decompressing; however, some programs, such as :program:`gunzip`\ , make use of it. The format of the timestamp is the same as that of the return value of - ``time.time()`` and of the ``st_mtime`` member of the object returned + ``time.time()`` and of the ``st_mtime`` attribute of the object returned by ``os.stat()``. Calling a :class:`GzipFile` object's :meth:`close` method does not close diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -11,7 +11,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs` -member of the :class:`html.parser.HTMLParser` class. The definition provided +attribute of the :class:`html.parser.HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -152,7 +152,7 @@ .. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* members. + Set the *key*, *value* and *coded_value* attributes. .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -391,8 +391,8 @@ :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do. - :class:`BufferedIOBase` provides or overrides these members in addition to - those from :class:`IOBase`: + :class:`BufferedIOBase` provides or overrides these methods and attribute in + addition to those from :class:`IOBase`: .. attribute:: raw diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -394,7 +394,7 @@ Send an ``ARTICLE`` command, where *message_spec* has the same meaning as for :meth:`stat`. Return a tuple ``(response, info)`` where *info* - is a :class:`~collections.namedtuple` with three members *number*, + is a :class:`~collections.namedtuple` with three attributes *number*, *message_id* and *lines* (in that order). *number* is the article number in the group (or 0 if the information is not available), *message_id* the message id as a string, and *lines* a list of lines (without terminating diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1339,11 +1339,12 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and - :attr:`st_ctime` members depends on the operating system and the file system. - For example, on Windows systems using the FAT or FAT32 file systems, - :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day - resolution. See your operating system documentation for details. + The exact meaning and resolution of the :attr:`st_atime`, + :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating + system and the file system. For example, on Windows systems using the FAT + or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and + :attr:`st_atime` has only 1-day resolution. See your operating system + documentation for details. For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -45,7 +45,7 @@ The :class:`Class` objects used as values in the dictionary returned by :func:`readmodule` and :func:`readmodule_ex` provide the following data -members: +attributes: .. attribute:: Class.module @@ -89,7 +89,7 @@ ---------------- The :class:`Function` objects used as values in the dictionary returned by -:func:`readmodule_ex` provide the following data members: +:func:`readmodule_ex` provide the following attributes: .. attribute:: Function.module diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -66,7 +66,7 @@ Repr Objects ------------ -:class:`Repr` instances provide several members which can be used to provide +:class:`Repr` instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -24,8 +24,8 @@ Split the string *s* using shell-like syntax. If *comments* is :const:`False` (the default), the parsing of comments in the given string will be disabled - (setting the :attr:`commenters` member of the :class:`shlex` instance to the - empty string). This function operates in POSIX mode by default, but uses + (setting the :attr:`commenters` attribute of the :class:`shlex` instance to + the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is false. .. note:: @@ -44,7 +44,7 @@ from. It must be a file-/stream-like object with :meth:`read` and :meth:`readline` methods, or a string. If no argument is given, input will be taken from ``sys.stdin``. The second optional argument is a filename - string, which sets the initial value of the :attr:`infile` member. If the + string, which sets the initial value of the :attr:`infile` attribute. If the *instream* argument is omitted or equal to ``sys.stdin``, this second argument defaults to "stdin". The *posix* argument defines the operational mode: when *posix* is not true (default), the :class:`shlex` instance will @@ -202,8 +202,8 @@ .. attribute:: shlex.source - This member is ``None`` by default. If you assign a string to it, that string - will be recognized as a lexical-level inclusion request similar to the + This attribute is ``None`` by default. If you assign a string to it, that + string will be recognized as a lexical-level inclusion request similar to the ``source`` keyword in various shells. That is, the immediately following token will opened as a filename and input taken from that stream until EOF, at which point the :meth:`close` method of that stream will be called and the input @@ -213,7 +213,7 @@ .. attribute:: shlex.debug - If this member is numeric and ``1`` or more, a :class:`shlex` instance will + If this attribute is numeric and ``1`` or more, a :class:`shlex` instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -81,7 +81,7 @@ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in -:class:`UDPServer`. Setting the various member variables also changes the +:class:`UDPServer`. Setting the various attributes also change the behavior of the underlying server mechanism. To implement a service, you must derive a class from :class:`BaseRequestHandler` diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2567,7 +2567,7 @@ foo`` does not require a module object named *foo* to exist, rather it requires an (external) *definition* for a module named *foo* somewhere.) -A special member of every module is :attr:`__dict__`. This is the dictionary +A special attribute of every module is :attr:`__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the :attr:`__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -497,38 +497,39 @@ .. attribute:: dwFlags - A bit field that determines whether certain :class:`STARTUPINFO` members - are used when the process creates a window. :: + A bit field that determines whether certain :class:`STARTUPINFO` + attributes are used when the process creates a window. :: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW .. attribute:: hStdInput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` - is not specified, the default for standard input is the keyboard buffer. + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard input handle for the process. If + :data:`STARTF_USESTDHANDLES` is not specified, the default for standard + input is the keyboard buffer. .. attribute:: hStdOutput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard output handle for the process. Otherwise, this member is - ignored and the default for standard output is the console window's + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard output handle for the process. Otherwise, this attribute + is ignored and the default for standard output is the console window's buffer. .. attribute:: hStdError - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard error handle for the process. Otherwise, this member is + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window's buffer. .. attribute:: wShowWindow - If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this member + If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute can be any of the values that can be specified in the ``nCmdShow`` parameter for the `ShowWindow `__ - function, except for ``SW_SHOWDEFAULT``. Otherwise, this member is + function, except for ``SW_SHOWDEFAULT``. Otherwise, this attribute is ignored. :data:`SW_HIDE` is provided for this attribute. It is used when @@ -562,12 +563,12 @@ .. data:: STARTF_USESTDHANDLES Specifies that the :attr:`STARTUPINFO.hStdInput`, - :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` members + :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional information. .. data:: STARTF_USESHOWWINDOW - Specifies that the :attr:`STARTUPINFO.wShowWindow` member contains + Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains additional information. .. data:: CREATE_NEW_CONSOLE diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -60,7 +60,7 @@ This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` member of the file object. Whether the name can be + from the :attr:`name` attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is @@ -96,7 +96,7 @@ of the temporary directory object), the newly created temporary directory and all its contents are removed from the filesystem. - The directory name can be retrieved from the :attr:`name` member + The directory name can be retrieved from the :attr:`name` attribute of the returned object. The directory can be explicitly cleaned up by calling the diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -105,7 +105,7 @@ can be imported), :class:`HTTPSHandler` will also be added. A :class:`BaseHandler` subclass may also change its :attr:`handler_order` - member variable to modify its position in the handlers list. + attribute to modify its position in the handlers list. .. function:: pathname2url(path) @@ -536,7 +536,7 @@ Remove any parents. -The following members and methods should only be used by classes derived from +The following attribute and methods should only be used by classes derived from :class:`BaseHandler`. .. note:: diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -260,7 +260,7 @@ .. exception:: Error - The base exception class. :exc:`Error` has a single public data member + The base exception class. :exc:`Error` has a single public attribute :attr:`msg` containing the description of the error. diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -136,7 +136,7 @@ :class:`Fault` or :class:`ProtocolError` object indicating an error. Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:`system` member: +grouped under the reserved :attr:`system` attribute: .. method:: ServerProxy.system.listMethods() @@ -310,7 +310,7 @@ ------------- A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following members: +objects have the following attributes: .. attribute:: Fault.faultCode @@ -359,7 +359,7 @@ A :class:`ProtocolError` object describes a protocol error in the underlying transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following members: +does not exist). It has the following attributes: .. attribute:: ProtocolError.url diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1459,7 +1459,7 @@ On FreeBSD, the :func:`os.stat` function now returns times with nanosecond resolution, and the returned object now has :attr:`st_gen` and - :attr:`st_birthtime`. The :attr:`st_flags` member is also available, if the + :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, if the platform supports it. (Contributed by Antti Louko and Diego Petten?.) .. (Patch 1180695, 1212117) -- Repository URL: http://hg.python.org/cpython-gd From python-checkins at python.org Mon Jul 4 20:51:17 2011 From: python-checkins at python.org (local-hg) Date: Mon, 04 Jul 2011 20:51:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython-gd_=28merge_3=2E2_-=3E_default?= =?utf8?q?=29=3A_Merge_from_3=2E2_=2E_Replace_the_term_members_with_correc?= =?utf8?q?t__and_appropriate?= Message-ID: http://hg.python.org/cpython-gd/rev/283f20f1d31f changeset: 71209:283f20f1d31f parent: 71207:24297278c78d parent: 71208:d442c313536b user: Senthil Kumaran date: Mon Jul 04 11:31:53 2011 -0700 files: Doc/library/cmd.rst Doc/library/datetime.rst Doc/library/gzip.rst Doc/library/io.rst Doc/library/nntplib.rst Doc/library/os.rst Doc/library/socketserver.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/tempfile.rst Doc/library/urllib.request.rst description: Merge from 3.2 . Replace the term members with correct and appropriate terminology. Initial patch by Adam Woodbeck. summary: Merge from 3.2 . Replace the term members with correct and appropriate terminology. Initial patch by Adam Woodbeck. files: Doc/library/cmd.rst | 2 +- Doc/library/curses.rst | 4 +- Doc/library/datetime.rst | 133 ++++++++++---------- Doc/library/decimal.rst | 2 +- Doc/library/doctest.rst | 19 +- Doc/library/gzip.rst | 2 +- Doc/library/html.entities.rst | 2 +- Doc/library/http.cookies.rst | 2 +- Doc/library/io.rst | 4 +- Doc/library/nntplib.rst | 2 +- Doc/library/os.rst | 11 +- Doc/library/pyclbr.rst | 4 +- Doc/library/reprlib.rst | 2 +- Doc/library/shlex.rst | 12 +- Doc/library/socketserver.rst | 2 +- Doc/library/stdtypes.rst | 2 +- Doc/library/subprocess.rst | 29 ++-- Doc/library/tempfile.rst | 4 +- Doc/library/urllib.request.rst | 4 +- Doc/library/xdrlib.rst | 2 +- Doc/library/xmlrpc.client.rst | 6 +- Doc/whatsnew/2.5.rst | 2 +- 22 files changed, 127 insertions(+), 125 deletions(-) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -50,7 +50,7 @@ the line as argument. The optional argument is a banner or intro string to be issued before the first - prompt (this overrides the :attr:`intro` class member). + prompt (this overrides the :attr:`intro` class attribute). If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -1639,7 +1639,7 @@ each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the - :attr:`stripspaces` member. + :attr:`stripspaces` attribute. .. method:: do_command(ch) @@ -1711,7 +1711,7 @@ .. attribute:: stripspaces - This data member is a flag which controls the interpretation of blanks in + This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -11,7 +11,7 @@ The :mod:`datetime` module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the -focus of the implementation is on efficient member extraction for output +focus of the implementation is on efficient attribute extraction for output formatting and manipulation. For related functionality, see also the :mod:`time` and :mod:`calendar` modules. @@ -25,7 +25,7 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information member, :attr:`tzinfo`, that can contain +have an optional time zone information attribute, :attr:`tzinfo`, that can contain an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only @@ -499,9 +499,9 @@ .. method:: date.replace(year, month, day) - Return a date with the same value, except for those members given new values by - whichever keyword arguments are specified. For example, if ``d == date(2002, - 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. + Return a date with the same value, except for those parameters given new + values by whichever keyword arguments are specified. For example, if ``d == + date(2002, 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. .. method:: date.timetuple() @@ -748,11 +748,11 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date members are equal to the given - :class:`date` object's, and whose time and :attr:`tzinfo` members are equal to - the given :class:`time` object's. For any :class:`datetime` object *d*, ``d == - datetime.combine(d.date(), d.timetz())``. If date is a :class:`datetime` - object, its time and :attr:`tzinfo` members are ignored. + Return a new :class:`datetime` object whose date attributes are equal to the + given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are + equal to the given :class:`time` object's. For any :class:`datetime` object + *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -846,43 +846,44 @@ (1) datetime2 is a duration of timedelta removed from datetime1, moving forward in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The - result has the same :attr:`tzinfo` member as the input datetime, and datetime2 - - datetime1 == timedelta after. :exc:`OverflowError` is raised if datetime2.year - would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note - that no time zone adjustments are done even if the input is an aware object. + result has the same :attr:`tzinfo` attribute as the input datetime, and + datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if + datetime2.year would be smaller than :const:`MINYEAR` or larger than + :const:`MAXYEAR`. Note that no time zone adjustments are done even if the + input is an aware object. (2) Computes the datetime2 such that datetime2 + timedelta == datetime1. As for - addition, the result has the same :attr:`tzinfo` member as the input datetime, - and no time zone adjustments are done even if the input is aware. This isn't - quite equivalent to datetime1 + (-timedelta), because -timedelta in isolation - can overflow in cases where datetime1 - timedelta does not. + addition, the result has the same :attr:`tzinfo` attribute as the input + datetime, and no time zone adjustments are done even if the input is aware. + This isn't quite equivalent to datetime1 + (-timedelta), because -timedelta + in isolation can overflow in cases where datetime1 - timedelta does not. (3) Subtraction of a :class:`datetime` from a :class:`datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised. - If both are naive, or both are aware and have the same :attr:`tzinfo` member, - the :attr:`tzinfo` members are ignored, and the result is a :class:`timedelta` + If both are naive, or both are aware and have the same :attr:`tzinfo` attribute, + the :attr:`tzinfo` attributes are ignored, and the result is a :class:`timedelta` object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case. - If both are aware and have different :attr:`tzinfo` members, ``a-b`` acts as if - *a* and *b* were first converted to naive UTC datetimes first. The result is - ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - - b.utcoffset())`` except that the implementation never overflows. + If both are aware and have different :attr:`tzinfo` attributes, ``a-b`` acts + as if *a* and *b* were first converted to naive UTC datetimes first. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. (4) *datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. - If both comparands are aware, and have the same :attr:`tzinfo` member, the - common :attr:`tzinfo` member is ignored and the base datetimes are compared. If - both comparands are aware and have different :attr:`tzinfo` members, the - comparands are first adjusted by subtracting their UTC offsets (obtained from - ``self.utcoffset()``). + If both comparands are aware, and have the same :attr:`tzinfo` attribute, the + common :attr:`tzinfo` attribute is ignored and the base datetimes are + compared. If both comparands are aware and have different :attr:`tzinfo` + attributes, the comparands are first adjusted by subtracting their UTC + offsets (obtained from ``self.utcoffset()``). .. note:: @@ -915,22 +916,22 @@ .. method:: datetime.timetz() Return :class:`time` object with same hour, minute, second, microsecond, and - tzinfo members. See also method :meth:`time`. + tzinfo attributes. See also method :meth:`time`. .. method:: datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) - Return a datetime with the same members, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive datetime from an aware datetime with no - conversion of date and time members. + Return a datetime with the same attributes, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive datetime from an aware + datetime with no conversion of date and time attributes. .. method:: datetime.astimezone(tz) - Return a :class:`datetime` object with new :attr:`tzinfo` member *tz*, adjusting - the date and time members so the result is the same UTC time as *self*, but in - *tz*'s local time. + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, + adjusting the date and time attributes so the result is the same UTC time as + *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must @@ -938,18 +939,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time members is performed. Else the result is local time - in time zone *tz*, representing the same UTC time as *self*: after ``astz = - dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have the same date - and time members as ``dt - dt.utcoffset()``. The discussion of class - :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries - where this cannot be achieved (an issue only if *tz* models both standard and - daylight time). + adjustment of date or time attributes is performed. Else the result is local + time in time zone *tz*, representing the same UTC time as *self*: after + ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have + the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + of class :class:`tzinfo` explains the cases at Daylight Saving Time transition + boundaries where this cannot be achieved (an issue only if *tz* models both + standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time members, use ``dt.replace(tzinfo=None)``. + conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1260,14 +1261,14 @@ * comparison of :class:`time` to :class:`time`, where *a* is considered less than *b* when *a* precedes *b* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. If both comparands are aware, and have - the same :attr:`tzinfo` member, the common :attr:`tzinfo` member is ignored and - the base times are compared. If both comparands are aware and have different - :attr:`tzinfo` members, the comparands are first adjusted by subtracting their - UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type - comparisons from falling back to the default comparison by object address, when - a :class:`time` object is compared to an object of a different type, - :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The - latter cases return :const:`False` or :const:`True`, respectively. + the same :attr:`tzinfo` attribute, the common :attr:`tzinfo` attribute is + ignored and the base times are compared. If both comparands are aware and + have different :attr:`tzinfo` attributes, the comparands are first adjusted by + subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order + to stop mixed-type comparisons from falling back to the default comparison by + object address, when a :class:`time` object is compared to an object of a + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key @@ -1282,10 +1283,10 @@ .. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) - Return a :class:`time` with the same value, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive :class:`time` from an aware :class:`time`, - without conversion of the time members. + Return a :class:`time` with the same value, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive :class:`time` from an + aware :class:`time`, without conversion of the time attributes. .. method:: time.isoformat() @@ -1370,7 +1371,7 @@ An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`datetime` and :class:`time` objects. The latter objects -view their members as being in local time, and the :class:`tzinfo` object +view their attributes as being in local time, and the :class:`tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them. @@ -1415,9 +1416,9 @@ already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`tzinfo` - member's :meth:`dst` method to determine how the :attr:`tm_isdst` flag should be - set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes - when crossing time zones. + attribute's :meth:`dst` method to determine how the :attr:`tm_isdst` flag + should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for + DST changes when crossing time zones. An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense: @@ -1493,10 +1494,10 @@ .. method:: tzinfo.fromutc(dt) This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members - are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to - adjust the date and time members, returning an equivalent datetime in *self*'s - local time. + When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time + attributes are to be viewed as expressing a UTC time. The purpose of + :meth:`fromutc` is to adjust the date and time attributes, returning an + equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -654,7 +654,7 @@ Normalize the number by stripping the rightmost trailing zeros and converting any result equal to :const:`Decimal('0')` to - :const:`Decimal('0e0')`. Used for producing canonical values for members + :const:`Decimal('0e0')`. Used for producing canonical values for attributes of an equivalence class. For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1127,11 +1127,10 @@ .. class:: DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The - constructor arguments are used to initialize the member variables of the same - names. + constructor arguments are used to initialize the attributes of the same names. - :class:`DocTest` defines the following member variables. They are initialized by + :class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1184,11 +1183,11 @@ .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None) A single interactive example, consisting of a Python statement and its expected - output. The constructor arguments are used to initialize the member variables - of the same names. + output. The constructor arguments are used to initialize the attributes of + the same names. - :class:`Example` defines the following member variables. They are initialized by + :class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1675,9 +1674,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are - used to initialize the member variables of the same names. + used to initialize the attributes of the same names. -:exc:`DocTestFailure` defines the following member variables: +:exc:`DocTestFailure` defines the following attributes: .. attribute:: DocTestFailure.test @@ -1699,9 +1698,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used - to initialize the member variables of the same names. + to initialize the attributes of the same names. -:exc:`UnexpectedException` defines the following member variables: +:exc:`UnexpectedException` defines the following attributes: .. attribute:: UnexpectedException.test diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -61,7 +61,7 @@ time is used. This module ignores the timestamp when decompressing; however, some programs, such as :program:`gunzip`\ , make use of it. The format of the timestamp is the same as that of the return value of - ``time.time()`` and of the ``st_mtime`` member of the object returned + ``time.time()`` and of the ``st_mtime`` attribute of the object returned by ``os.stat()``. Calling a :class:`GzipFile` object's :meth:`close` method does not close diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -11,7 +11,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs` -member of the :class:`html.parser.HTMLParser` class. The definition provided +attribute of the :class:`html.parser.HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -152,7 +152,7 @@ .. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* members. + Set the *key*, *value* and *coded_value* attributes. .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -391,8 +391,8 @@ :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do. - :class:`BufferedIOBase` provides or overrides these members in addition to - those from :class:`IOBase`: + :class:`BufferedIOBase` provides or overrides these methods and attribute in + addition to those from :class:`IOBase`: .. attribute:: raw diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -407,7 +407,7 @@ Send an ``ARTICLE`` command, where *message_spec* has the same meaning as for :meth:`stat`. Return a tuple ``(response, info)`` where *info* - is a :class:`~collections.namedtuple` with three members *number*, + is a :class:`~collections.namedtuple` with three attributes *number*, *message_id* and *lines* (in that order). *number* is the article number in the group (or 0 if the information is not available), *message_id* the message id as a string, and *lines* a list of lines (without terminating diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1826,11 +1826,12 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and - :attr:`st_ctime` members depends on the operating system and the file system. - For example, on Windows systems using the FAT or FAT32 file systems, - :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day - resolution. See your operating system documentation for details. + The exact meaning and resolution of the :attr:`st_atime`, + :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating + system and the file system. For example, on Windows systems using the FAT + or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and + :attr:`st_atime` has only 1-day resolution. See your operating system + documentation for details. For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -45,7 +45,7 @@ The :class:`Class` objects used as values in the dictionary returned by :func:`readmodule` and :func:`readmodule_ex` provide the following data -members: +attributes: .. attribute:: Class.module @@ -89,7 +89,7 @@ ---------------- The :class:`Function` objects used as values in the dictionary returned by -:func:`readmodule_ex` provide the following data members: +:func:`readmodule_ex` provide the following attributes: .. attribute:: Function.module diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -66,7 +66,7 @@ Repr Objects ------------ -:class:`Repr` instances provide several members which can be used to provide +:class:`Repr` instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -24,8 +24,8 @@ Split the string *s* using shell-like syntax. If *comments* is :const:`False` (the default), the parsing of comments in the given string will be disabled - (setting the :attr:`commenters` member of the :class:`shlex` instance to the - empty string). This function operates in POSIX mode by default, but uses + (setting the :attr:`commenters` attribute of the :class:`shlex` instance to + the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is false. .. note:: @@ -44,7 +44,7 @@ from. It must be a file-/stream-like object with :meth:`read` and :meth:`readline` methods, or a string. If no argument is given, input will be taken from ``sys.stdin``. The second optional argument is a filename - string, which sets the initial value of the :attr:`infile` member. If the + string, which sets the initial value of the :attr:`infile` attribute. If the *instream* argument is omitted or equal to ``sys.stdin``, this second argument defaults to "stdin". The *posix* argument defines the operational mode: when *posix* is not true (default), the :class:`shlex` instance will @@ -202,8 +202,8 @@ .. attribute:: shlex.source - This member is ``None`` by default. If you assign a string to it, that string - will be recognized as a lexical-level inclusion request similar to the + This attribute is ``None`` by default. If you assign a string to it, that + string will be recognized as a lexical-level inclusion request similar to the ``source`` keyword in various shells. That is, the immediately following token will opened as a filename and input taken from that stream until EOF, at which point the :meth:`close` method of that stream will be called and the input @@ -213,7 +213,7 @@ .. attribute:: shlex.debug - If this member is numeric and ``1`` or more, a :class:`shlex` instance will + If this attribute is numeric and ``1`` or more, a :class:`shlex` instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -81,7 +81,7 @@ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in -:class:`UDPServer`. Setting the various member variables also changes the +:class:`UDPServer`. Setting the various attributes also change the behavior of the underlying server mechanism. To implement a service, you must derive a class from :class:`BaseRequestHandler` diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2578,7 +2578,7 @@ foo`` does not require a module object named *foo* to exist, rather it requires an (external) *definition* for a module named *foo* somewhere.) -A special member of every module is :attr:`__dict__`. This is the dictionary +A special attribute of every module is :attr:`__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the :attr:`__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -567,38 +567,39 @@ .. attribute:: dwFlags - A bit field that determines whether certain :class:`STARTUPINFO` members - are used when the process creates a window. :: + A bit field that determines whether certain :class:`STARTUPINFO` + attributes are used when the process creates a window. :: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW .. attribute:: hStdInput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` - is not specified, the default for standard input is the keyboard buffer. + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard input handle for the process. If + :data:`STARTF_USESTDHANDLES` is not specified, the default for standard + input is the keyboard buffer. .. attribute:: hStdOutput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard output handle for the process. Otherwise, this member is - ignored and the default for standard output is the console window's + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard output handle for the process. Otherwise, this attribute + is ignored and the default for standard output is the console window's buffer. .. attribute:: hStdError - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard error handle for the process. Otherwise, this member is + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window's buffer. .. attribute:: wShowWindow - If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this member + If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute can be any of the values that can be specified in the ``nCmdShow`` parameter for the `ShowWindow `__ - function, except for ``SW_SHOWDEFAULT``. Otherwise, this member is + function, except for ``SW_SHOWDEFAULT``. Otherwise, this attribute is ignored. :data:`SW_HIDE` is provided for this attribute. It is used when @@ -632,12 +633,12 @@ .. data:: STARTF_USESTDHANDLES Specifies that the :attr:`STARTUPINFO.hStdInput`, - :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` members + :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional information. .. data:: STARTF_USESHOWWINDOW - Specifies that the :attr:`STARTUPINFO.wShowWindow` member contains + Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains additional information. .. data:: CREATE_NEW_CONSOLE diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -60,7 +60,7 @@ This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` member of the file object. Whether the name can be + from the :attr:`name` attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is @@ -96,7 +96,7 @@ of the temporary directory object), the newly created temporary directory and all its contents are removed from the filesystem. - The directory name can be retrieved from the :attr:`name` member + The directory name can be retrieved from the :attr:`name` attribute of the returned object. The directory can be explicitly cleaned up by calling the diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -105,7 +105,7 @@ can be imported), :class:`HTTPSHandler` will also be added. A :class:`BaseHandler` subclass may also change its :attr:`handler_order` - member variable to modify its position in the handlers list. + attribute to modify its position in the handlers list. .. function:: pathname2url(path) @@ -546,7 +546,7 @@ Remove any parents. -The following members and methods should only be used by classes derived from +The following attribute and methods should only be used by classes derived from :class:`BaseHandler`. .. note:: diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -260,7 +260,7 @@ .. exception:: Error - The base exception class. :exc:`Error` has a single public data member + The base exception class. :exc:`Error` has a single public attribute :attr:`msg` containing the description of the error. diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -136,7 +136,7 @@ :class:`Fault` or :class:`ProtocolError` object indicating an error. Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:`system` member: +grouped under the reserved :attr:`system` attribute: .. method:: ServerProxy.system.listMethods() @@ -310,7 +310,7 @@ ------------- A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following members: +objects have the following attributes: .. attribute:: Fault.faultCode @@ -359,7 +359,7 @@ A :class:`ProtocolError` object describes a protocol error in the underlying transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following members: +does not exist). It has the following attributes: .. attribute:: ProtocolError.url diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1459,7 +1459,7 @@ On FreeBSD, the :func:`os.stat` function now returns times with nanosecond resolution, and the returned object now has :attr:`st_gen` and - :attr:`st_birthtime`. The :attr:`st_flags` member is also available, if the + :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, if the platform supports it. (Contributed by Antti Louko and Diego Petten?.) .. (Patch 1180695, 1212117) -- Repository URL: http://hg.python.org/cpython-gd From python-checkins at python.org Mon Jul 4 20:51:18 2011 From: python-checkins at python.org (local-hg) Date: Mon, 04 Jul 2011 20:51:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython-gd_=283=2E2=29=3A_Fix_whitespa?= =?utf8?q?ce_nit_in_datetime_and_os_rst_files=2E?= Message-ID: http://hg.python.org/cpython-gd/rev/184192b3687c changeset: 71210:184192b3687c branch: 3.2 parent: 71208:d442c313536b user: Senthil Kumaran date: Mon Jul 04 11:43:51 2011 -0700 files: Doc/library/datetime.rst Doc/library/os.rst description: Fix whitespace nit in datetime and os rst files. summary: Fix whitespace nit in datetime and os rst files. files: Doc/library/datetime.rst | 2 +- Doc/library/os.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1251,7 +1251,7 @@ subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type comparisons from falling back to the default comparison by object address, when a :class:`time` object is compared to an object of a - different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1339,7 +1339,7 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, + The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and -- Repository URL: http://hg.python.org/cpython-gd From python-checkins at python.org Mon Jul 4 20:51:18 2011 From: python-checkins at python.org (local-hg) Date: Mon, 04 Jul 2011 20:51:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython-gd_=28merge_3=2E2_-=3E_default?= =?utf8?q?=29=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython-gd/rev/f9d30fac3da0 changeset: 71211:f9d30fac3da0 parent: 71209:283f20f1d31f parent: 71210:184192b3687c user: Senthil Kumaran date: Mon Jul 04 11:44:17 2011 -0700 files: Doc/library/datetime.rst Doc/library/os.rst description: merge from 3.2 summary: merge from 3.2 files: Doc/library/datetime.rst | 2 +- Doc/library/os.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1267,7 +1267,7 @@ subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type comparisons from falling back to the default comparison by object address, when a :class:`time` object is compared to an object of a - different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1826,7 +1826,7 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, + The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and -- Repository URL: http://hg.python.org/cpython-gd From python-checkins at python.org Mon Jul 4 21:25:48 2011 From: python-checkins at python.org (local-hg) Date: Mon, 04 Jul 2011 21:25:48 +0200 Subject: [Python-checkins] =?utf8?q?hooks=3A_Save_stdout_before_calling_bu?= =?utf8?q?ildbot=27s_integrated_client_script?= Message-ID: http://hg.python.org/hooks/rev/fa3dd53cde8f changeset: 73:fa3dd53cde8f user: Antoine Pitrou date: Mon Jul 04 21:25:47 2011 +0200 summary: Save stdout before calling buildbot's integrated client script (attempting to fix a failure on push) files: hgbuildbot.py | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hgbuildbot.py b/hgbuildbot.py --- a/hgbuildbot.py +++ b/hgbuildbot.py @@ -20,6 +20,7 @@ import os import sys +from cStringIO import StringIO from mercurial.i18n import gettext as _ from mercurial.node import bin, hex, nullid @@ -110,8 +111,16 @@ 'files': files, 'branch': branch, }) - - for master in masters: - sendchanges(master, changes) - reactor.run() + old_stdout = sys.stdout + new_stdout = sys.stdout = StringIO() + try: + for master in masters: + sendchanges(master, changes) + reactor.run() + finally: + sys.stdout = old_stdout + new_stdout.seek(0) + for s in new_stdout: + ui.status(s) + -- Repository URL: http://hg.python.org/hooks From python-checkins at python.org Mon Jul 4 21:50:21 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 04 Jul 2011 21:50:21 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_closes_issu?= =?utf8?q?e10403_-_Let=27s_not_use_members_anymore=2E?= Message-ID: http://hg.python.org/cpython/rev/b8f5da066782 changeset: 71212:b8f5da066782 branch: 2.7 parent: 71188:a624b86264a4 user: Senthil Kumaran date: Mon Jul 04 12:50:02 2011 -0700 summary: Fix closes issue10403 - Let's not use members anymore. files: Doc/library/cmd.rst | 2 +- Doc/library/cookie.rst | 2 +- Doc/library/curses.rst | 4 +- Doc/library/datetime.rst | 133 +++++++++++----------- Doc/library/decimal.rst | 2 +- Doc/library/doctest.rst | 23 +-- Doc/library/gzip.rst | 2 +- Doc/library/htmllib.rst | 2 +- Doc/library/io.rst | 4 +- Doc/library/os.rst | 11 +- Doc/library/pyclbr.rst | 4 +- Doc/library/repr.rst | 2 +- Doc/library/shlex.rst | 12 +- Doc/library/socketserver.rst | 2 +- Doc/library/stdtypes.rst | 2 +- Doc/library/subprocess.rst | 29 ++-- Doc/library/tempfile.rst | 2 +- Doc/library/urllib2.rst | 4 +- Doc/library/xdrlib.rst | 2 +- Doc/library/xmlrpclib.rst | 6 +- Doc/whatsnew/2.5.rst | 2 +- 21 files changed, 127 insertions(+), 125 deletions(-) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -56,7 +56,7 @@ the line as argument. The optional argument is a banner or intro string to be issued before the first - prompt (this overrides the :attr:`intro` class member). + prompt (this overrides the :attr:`intro` class attribute). If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back diff --git a/Doc/library/cookie.rst b/Doc/library/cookie.rst --- a/Doc/library/cookie.rst +++ b/Doc/library/cookie.rst @@ -191,7 +191,7 @@ .. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* members. + Set the *key*, *value* and *coded_value* attributes. .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -1644,7 +1644,7 @@ each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the - :attr:`stripspaces` member. + :attr:`stripspaces` attribute. .. method:: do_command(ch) @@ -1716,7 +1716,7 @@ .. attribute:: stripspaces - This data member is a flag which controls the interpretation of blanks in + This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -13,7 +13,7 @@ The :mod:`datetime` module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the -focus of the implementation is on efficient member extraction for output +focus of the implementation is on efficient attribute extraction for output formatting and manipulation. For related functionality, see also the :mod:`time` and :mod:`calendar` modules. @@ -27,7 +27,7 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information member, :attr:`tzinfo`, that can contain +have an optional time zone information attribute, :attr:`tzinfo`, that can contain an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that no @@ -463,9 +463,9 @@ .. method:: date.replace(year, month, day) - Return a date with the same value, except for those members given new values by - whichever keyword arguments are specified. For example, if ``d == date(2002, - 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. + Return a date with the same value, except for those parameters given new + values by whichever keyword arguments are specified. For example, if ``d == + date(2002, 12, 31)``, then ``d.replace(day=26) == date(2002, 12, 26)``. .. method:: date.timetuple() @@ -696,11 +696,11 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date members are equal to the given - :class:`date` object's, and whose time and :attr:`tzinfo` members are equal to - the given :class:`time` object's. For any :class:`datetime` object *d*, ``d == - datetime.combine(d.date(), d.timetz())``. If date is a :class:`datetime` - object, its time and :attr:`tzinfo` members are ignored. + Return a new :class:`datetime` object whose date attributes are equal to the + given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are + equal to the given :class:`time` object's. For any :class:`datetime` object + *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -795,43 +795,44 @@ (1) datetime2 is a duration of timedelta removed from datetime1, moving forward in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The - result has the same :attr:`tzinfo` member as the input datetime, and datetime2 - - datetime1 == timedelta after. :exc:`OverflowError` is raised if datetime2.year - would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note - that no time zone adjustments are done even if the input is an aware object. + result has the same :attr:`tzinfo` attribute as the input datetime, and + datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if + datetime2.year would be smaller than :const:`MINYEAR` or larger than + :const:`MAXYEAR`. Note that no time zone adjustments are done even if the + input is an aware object. (2) Computes the datetime2 such that datetime2 + timedelta == datetime1. As for - addition, the result has the same :attr:`tzinfo` member as the input datetime, - and no time zone adjustments are done even if the input is aware. This isn't - quite equivalent to datetime1 + (-timedelta), because -timedelta in isolation - can overflow in cases where datetime1 - timedelta does not. + addition, the result has the same :attr:`tzinfo` attribute as the input + datetime, and no time zone adjustments are done even if the input is aware. + This isn't quite equivalent to datetime1 + (-timedelta), because -timedelta + in isolation can overflow in cases where datetime1 - timedelta does not. (3) Subtraction of a :class:`datetime` from a :class:`datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised. - If both are naive, or both are aware and have the same :attr:`tzinfo` member, - the :attr:`tzinfo` members are ignored, and the result is a :class:`timedelta` + If both are naive, or both are aware and have the same :attr:`tzinfo` attribute, + the :attr:`tzinfo` attributes are ignored, and the result is a :class:`timedelta` object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case. - If both are aware and have different :attr:`tzinfo` members, ``a-b`` acts as if - *a* and *b* were first converted to naive UTC datetimes first. The result is - ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - - b.utcoffset())`` except that the implementation never overflows. + If both are aware and have different :attr:`tzinfo` attributes, ``a-b`` acts + as if *a* and *b* were first converted to naive UTC datetimes first. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. (4) *datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. - If both comparands are aware, and have the same :attr:`tzinfo` member, the - common :attr:`tzinfo` member is ignored and the base datetimes are compared. If - both comparands are aware and have different :attr:`tzinfo` members, the - comparands are first adjusted by subtracting their UTC offsets (obtained from - ``self.utcoffset()``). + If both comparands are aware, and have the same :attr:`tzinfo` attribute, the + common :attr:`tzinfo` attribute is ignored and the base datetimes are + compared. If both comparands are aware and have different :attr:`tzinfo` + attributes, the comparands are first adjusted by subtracting their UTC + offsets (obtained from ``self.utcoffset()``). .. note:: @@ -864,22 +865,22 @@ .. method:: datetime.timetz() Return :class:`time` object with same hour, minute, second, microsecond, and - tzinfo members. See also method :meth:`time`. + tzinfo attributes. See also method :meth:`time`. .. method:: datetime.replace([year[, month[, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]]]]) - Return a datetime with the same members, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive datetime from an aware datetime with no - conversion of date and time members. + Return a datetime with the same attributes, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive datetime from an aware + datetime with no conversion of date and time attributes. .. method:: datetime.astimezone(tz) - Return a :class:`datetime` object with new :attr:`tzinfo` member *tz*, adjusting - the date and time members so the result is the same UTC time as *self*, but in - *tz*'s local time. + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, + adjusting the date and time attributes so the result is the same UTC time as + *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must @@ -887,18 +888,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time members is performed. Else the result is local time - in time zone *tz*, representing the same UTC time as *self*: after ``astz = - dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have the same date - and time members as ``dt - dt.utcoffset()``. The discussion of class - :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries - where this cannot be achieved (an issue only if *tz* models both standard and - daylight time). + adjustment of date or time attributes is performed. Else the result is local + time in time zone *tz*, representing the same UTC time as *self*: after + ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have + the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + of class :class:`tzinfo` explains the cases at Daylight Saving Time transition + boundaries where this cannot be achieved (an issue only if *tz* models both + standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time members, use ``dt.replace(tzinfo=None)``. + conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1209,14 +1210,14 @@ * comparison of :class:`time` to :class:`time`, where *a* is considered less than *b* when *a* precedes *b* in time. If one comparand is naive and the other is aware, :exc:`TypeError` is raised. If both comparands are aware, and have - the same :attr:`tzinfo` member, the common :attr:`tzinfo` member is ignored and - the base times are compared. If both comparands are aware and have different - :attr:`tzinfo` members, the comparands are first adjusted by subtracting their - UTC offsets (obtained from ``self.utcoffset()``). In order to stop mixed-type - comparisons from falling back to the default comparison by object address, when - a :class:`time` object is compared to an object of a different type, - :exc:`TypeError` is raised unless the comparison is ``==`` or ``!=``. The - latter cases return :const:`False` or :const:`True`, respectively. + the same :attr:`tzinfo` attribute, the common :attr:`tzinfo` attribute is + ignored and the base times are compared. If both comparands are aware and + have different :attr:`tzinfo` attributes, the comparands are first adjusted by + subtracting their UTC offsets (obtained from ``self.utcoffset()``). In order + to stop mixed-type comparisons from falling back to the default comparison by + object address, when a :class:`time` object is compared to an object of a + different type, :exc:`TypeError` is raised unless the comparison is ``==`` or + ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. * hash, use as dict key @@ -1231,10 +1232,10 @@ .. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]]) - Return a :class:`time` with the same value, except for those members given new - values by whichever keyword arguments are specified. Note that ``tzinfo=None`` - can be specified to create a naive :class:`time` from an aware :class:`time`, - without conversion of the time members. + Return a :class:`time` with the same value, except for those attributes given + new values by whichever keyword arguments are specified. Note that + ``tzinfo=None`` can be specified to create a naive :class:`time` from an + aware :class:`time`, without conversion of the time attributes. .. method:: time.isoformat() @@ -1317,7 +1318,7 @@ An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`datetime` and :class:`time` objects. The latter objects -view their members as being in local time, and the :class:`tzinfo` object +view their attributes as being in local time, and the :class:`tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them. @@ -1362,9 +1363,9 @@ already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`tzinfo` - member's :meth:`dst` method to determine how the :attr:`tm_isdst` flag should be - set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes - when crossing time zones. + attribute's :meth:`dst` method to determine how the :attr:`tm_isdst` flag + should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for + DST changes when crossing time zones. An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense: @@ -1440,10 +1441,10 @@ .. method:: tzinfo.fromutc(self, dt) This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members - are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to - adjust the date and time members, returning an equivalent datetime in *self*'s - local time. + When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time + attributes are to be viewed as expressing a UTC time. The purpose of + :meth:`fromutc` is to adjust the date and time attributes, returning an + equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -742,7 +742,7 @@ Normalize the number by stripping the rightmost trailing zeros and converting any result equal to :const:`Decimal('0')` to - :const:`Decimal('0e0')`. Used for producing canonical values for members + :const:`Decimal('0e0')`. Used for producing canonical values for attributes of an equivalence class. For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1199,12 +1199,11 @@ .. class:: DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The - constructor arguments are used to initialize the member variables of the same - names. + constructor arguments are used to initialize the attributes of the same names. .. versionadded:: 2.4 - :class:`DocTest` defines the following member variables. They are initialized by + :class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1257,12 +1256,12 @@ .. class:: Example(source, want[, exc_msg][, lineno][, indent][, options]) A single interactive example, consisting of a Python statement and its expected - output. The constructor arguments are used to initialize the member variables - of the same names. + output. The constructor arguments are used to initialize the attributes of the + same names. .. versionadded:: 2.4 - :class:`Example` defines the following member variables. They are initialized by + :class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly. @@ -1770,9 +1769,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are - used to initialize the member variables of the same names. - -:exc:`DocTestFailure` defines the following member variables: + used to initialize the attributes of the same names. + +:exc:`DocTestFailure` defines the following attributes: .. attribute:: DocTestFailure.test @@ -1794,9 +1793,9 @@ An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used - to initialize the member variables of the same names. - -:exc:`UnexpectedException` defines the following member variables: + to initialize the attributes of the same names. + +:exc:`UnexpectedException` defines the following attributes: .. attribute:: UnexpectedException.test diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -58,7 +58,7 @@ time is used. This module ignores the timestamp when decompressing; however, some programs, such as :program:`gunzip`\ , make use of it. The format of the timestamp is the same as that of the return value of - ``time.time()`` and of the ``st_mtime`` member of the object returned + ``time.time()`` and of the ``st_mtime`` attribute of the object returned by ``os.stat()``. Calling a :class:`GzipFile` object's :meth:`close` method does not close diff --git a/Doc/library/htmllib.rst b/Doc/library/htmllib.rst --- a/Doc/library/htmllib.rst +++ b/Doc/library/htmllib.rst @@ -168,7 +168,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to -provide the :attr:`entitydefs` member of the :class:`HTMLParser` class. The +provide the :attr:`entitydefs` attribute of the :class:`HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -407,8 +407,8 @@ :class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` and :class:`BufferedReader` do. - :class:`BufferedIOBase` provides or overrides these members in addition to - those from :class:`IOBase`: + :class:`BufferedIOBase` provides or overrides these methods and attribute in + addition to those from :class:`IOBase`: .. attribute:: raw diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1388,11 +1388,12 @@ .. note:: - The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and - :attr:`st_ctime` members depends on the operating system and the file system. - For example, on Windows systems using the FAT or FAT32 file systems, - :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day - resolution. See your operating system documentation for details. + The exact meaning and resolution of the :attr:`st_atime`, + :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating + system and the file system. For example, on Windows systems using the FAT + or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and + :attr:`st_atime` has only 1-day resolution. See your operating system + documentation for details. For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -43,7 +43,7 @@ The :class:`Class` objects used as values in the dictionary returned by :func:`readmodule` and :func:`readmodule_ex` provide the following data -members: +attributes: .. attribute:: Class.module @@ -87,7 +87,7 @@ ---------------- The :class:`Function` objects used as values in the dictionary returned by -:func:`readmodule_ex` provide the following data members: +:func:`readmodule_ex` provide the following attributes: .. attribute:: Function.module diff --git a/Doc/library/repr.rst b/Doc/library/repr.rst --- a/Doc/library/repr.rst +++ b/Doc/library/repr.rst @@ -49,7 +49,7 @@ Repr Objects ------------ -:class:`Repr` instances provide several members which can be used to provide +:class:`Repr` instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types. diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -28,8 +28,8 @@ Split the string *s* using shell-like syntax. If *comments* is :const:`False` (the default), the parsing of comments in the given string will be disabled - (setting the :attr:`commenters` member of the :class:`shlex` instance to the - empty string). This function operates in POSIX mode by default, but uses + (setting the :attr:`commenters` attribute of the :class:`shlex` instance to + the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is false. .. versionadded:: 2.3 @@ -53,7 +53,7 @@ :meth:`readline` methods, or a string (strings are accepted since Python 2.3). If no argument is given, input will be taken from ``sys.stdin``. The second optional argument is a filename string, which sets the initial value of the - :attr:`infile` member. If the *instream* argument is omitted or equal to + :attr:`infile` attribute. If the *instream* argument is omitted or equal to ``sys.stdin``, this second argument defaults to "stdin". The *posix* argument was introduced in Python 2.3, and defines the operational mode. When *posix* is not true (default), the :class:`shlex` instance will operate in compatibility @@ -221,8 +221,8 @@ .. attribute:: shlex.source - This member is ``None`` by default. If you assign a string to it, that string - will be recognized as a lexical-level inclusion request similar to the + This attribute is ``None`` by default. If you assign a string to it, that + string will be recognized as a lexical-level inclusion request similar to the ``source`` keyword in various shells. That is, the immediately following token will opened as a filename and input taken from that stream until EOF, at which point the :meth:`close` method of that stream will be called and the input @@ -232,7 +232,7 @@ .. attribute:: shlex.debug - If this member is numeric and ``1`` or more, a :class:`shlex` instance will + If this attribute is numeric and ``1`` or more, a :class:`shlex` instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -85,7 +85,7 @@ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass The mix-in class must come first, since it overrides a method defined in -:class:`UDPServer`. Setting the various member variables also changes the +:class:`UDPServer`. Setting the various attributes also change the behavior of the underlying server mechanism. To implement a service, you must derive a class from :class:`BaseRequestHandler` diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2787,7 +2787,7 @@ foo`` does not require a module object named *foo* to exist, rather it requires an (external) *definition* for a module named *foo* somewhere.) -A special member of every module is :attr:`__dict__`. This is the dictionary +A special attribute of every module is :attr:`__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the :attr:`__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -428,38 +428,39 @@ .. attribute:: dwFlags - A bit field that determines whether certain :class:`STARTUPINFO` members - are used when the process creates a window. :: + A bit field that determines whether certain :class:`STARTUPINFO` + attributes are used when the process creates a window. :: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW .. attribute:: hStdInput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` - is not specified, the default for standard input is the keyboard buffer. + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard input handle for the process. If + :data:`STARTF_USESTDHANDLES` is not specified, the default for standard + input is the keyboard buffer. .. attribute:: hStdOutput - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard output handle for the process. Otherwise, this member is - ignored and the default for standard output is the console window's + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard output handle for the process. Otherwise, this attribute + is ignored and the default for standard output is the console window's buffer. .. attribute:: hStdError - If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this member is - the standard error handle for the process. Otherwise, this member is + If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute + is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window's buffer. .. attribute:: wShowWindow - If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this member + If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute can be any of the values that can be specified in the ``nCmdShow`` parameter for the `ShowWindow `__ - function, except for ``SW_SHOWDEFAULT``. Otherwise, this member is + function, except for ``SW_SHOWDEFAULT``. Otherwise, this attribute is ignored. :data:`SW_HIDE` is provided for this attribute. It is used when @@ -493,12 +494,12 @@ .. data:: STARTF_USESTDHANDLES Specifies that the :attr:`STARTUPINFO.hStdInput`, - :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` members + :attr:`STARTUPINFO.hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional information. .. data:: STARTF_USESHOWWINDOW - Specifies that the :attr:`STARTUPINFO.wShowWindow` member contains + Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains additional information. .. data:: CREATE_NEW_CONSOLE diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -61,7 +61,7 @@ This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` member of the file object. Whether the name can be + from the :attr:`name` attribute of the file object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -90,7 +90,7 @@ :class:`HTTPSHandler` will also be added. Beginning in Python 2.3, a :class:`BaseHandler` subclass may also change its - :attr:`handler_order` member variable to modify its position in the handlers + :attr:`handler_order` attribute to modify its position in the handlers list. The following exceptions are raised as appropriate: @@ -495,7 +495,7 @@ Remove any parents. -The following members and methods should only be used by classes derived from +The following attributes and methods should only be used by classes derived from :class:`BaseHandler`. .. note:: diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -257,7 +257,7 @@ .. exception:: Error - The base exception class. :exc:`Error` has a single public data member + The base exception class. :exc:`Error` has a single public attribute :attr:`msg` containing the description of the error. diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst --- a/Doc/library/xmlrpclib.rst +++ b/Doc/library/xmlrpclib.rst @@ -148,7 +148,7 @@ :class:`Fault` or :class:`ProtocolError` object indicating an error. Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:`system` member: +grouped under the reserved :attr:`system` attribute: .. method:: ServerProxy.system.listMethods() @@ -341,7 +341,7 @@ ------------- A :class:`Fault` object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following members: +objects have the following attributes: .. attribute:: Fault.faultCode @@ -390,7 +390,7 @@ A :class:`ProtocolError` object describes a protocol error in the underlying transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following members: +does not exist). It has the following attributes: .. attribute:: ProtocolError.url diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1459,7 +1459,7 @@ On FreeBSD, the :func:`os.stat` function now returns times with nanosecond resolution, and the returned object now has :attr:`st_gen` and - :attr:`st_birthtime`. The :attr:`st_flags` member is also available, if the + :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, if the platform supports it. (Contributed by Antti Louko and Diego Petten?.) .. (Patch 1180695, 1212117) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 4 22:55:47 2011 From: python-checkins at python.org (victor.stinner) Date: Mon, 04 Jul 2011 22:55:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312469=3A_partial_r?= =?utf8?q?evert_of_024827a9db64=2C_freebsd6_thread_initialization?= Message-ID: http://hg.python.org/cpython/rev/34061f0d35ba changeset: 71213:34061f0d35ba parent: 71211:f9d30fac3da0 user: Victor Stinner date: Mon Jul 04 22:53:49 2011 +0200 summary: Issue #12469: partial revert of 024827a9db64, freebsd6 thread initialization * Don't create a thread at startup anymore to initialize the pthread library: it changes the behaviour of many functions related to signal handling like sigwait() * Reenable test_sigtimedwait_poll() on FreeBSD 6 files: Lib/test/test_signal.py | 3 --- Python/thread_pthread.h | 5 +---- 2 files changed, 1 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -670,9 +670,6 @@ @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), 'need signal.sigtimedwait()') - # issue #12303: sigtimedwait() takes 30 seconds on FreeBSD 6 (kernel bug) - @unittest.skipIf(sys.platform =='freebsd6', - "sigtimedwait() with a null timeout doens't work on FreeBSD 6") def test_sigtimedwait_poll(self): # check that polling with sigtimedwait works self.wait_helper(signal.SIGALRM, ''' diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -144,10 +144,7 @@ * Initialization. */ -/* On FreeBSD6, pthread_kill() doesn't work on the main thread before - the creation of the first thread */ -#if defined(_HAVE_BSDI) \ - || (defined(__FreeBSD__) && __FreeBSD_version < 700000) +#if defined(_HAVE_BSDI) static void _noop(void) { -- Repository URL: http://hg.python.org/cpython From jimjjewett at gmail.com Tue Jul 5 00:27:33 2011 From: jimjjewett at gmail.com (Jim Jewett) Date: Mon, 4 Jul 2011 18:27:33 -0400 Subject: [Python-checkins] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: Message-ID: If you're going to get rid of the pun, you might as well change the whole sentence... On Sun, Jul 3, 2011 at 1:22 PM, georg.brandl wrote: > http://hg.python.org/cpython/rev/76452b892838 > changeset: ? 71146:76452b892838 > parent: ? ? ?71144:ce52310f61a0 > user: ? ? ? ?Georg Brandl > date: ? ? ? ?Sun Jul 03 19:22:42 2011 +0200 > summary: > ?Remove mention of medical condition from the test suite. > > files: > ?Lib/test/test_csv.py | ?8 ++++---- > ?1 files changed, 4 insertions(+), 4 deletions(-) > > > diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py > --- a/Lib/test/test_csv.py > +++ b/Lib/test/test_csv.py > @@ -459,20 +459,20 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'5', '6']]) > > ? ? def test_quoted_quote(self): > - ? ? ? ?self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', > + ? ? ? ?self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he picked up his hammer and saw"', > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[['1', '2', '3', > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '"I see," said the blind man', > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '"I see," said the happy man', > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'as he picked up his hammer and saw']]) > > ? ? def test_quoted_nl(self): > ? ? ? ? input = '''\ > ?1,2,3,"""I see,"" > -said the blind man","as he picked up his > +said the happy man","as he picked up his > ?hammer and saw" > ?9,8,7,6''' > ? ? ? ? self.readerAssertEqual(input, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[['1', '2', '3', > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '"I see,"\nsaid the blind man', > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '"I see,"\nsaid the happy man', > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'as he picked up his\nhammer and saw'], > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ['9','8','7','6']]) > > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > From python-checkins at python.org Tue Jul 5 01:15:35 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 01:15:35 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312469=3A_test=5Fsi?= =?utf8?q?gnal_checks_wakeup_signals_order=2C_except_on_freebsd6?= Message-ID: http://hg.python.org/cpython/rev/aad86a719fc6 changeset: 71214:aad86a719fc6 user: Victor Stinner date: Tue Jul 05 01:15:08 2011 +0200 summary: Issue #12469: test_signal checks wakeup signals order, except on freebsd6 On FreeBSD 6, when signals are unblocked, FreeBSD 6 delivers signals in the reverse order of their number. files: Lib/test/test_signal.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -240,10 +240,10 @@ def check_signum(signals): data = os.read(read, len(signals)+1) raised = struct.unpack('%uB' % len(data), data) - # We don't care of the signal delivery order (it's not portable or - # reliable) - raised = set(raised) - signals = set(signals) + if sys.platform == 'freebsd6': + # when signals are unblocked, FreeBSD 6 delivers signals in the + # reverse order of their number + signals = tuple(sorted(signals, reverse=False)) if raised != signals: raise Exception("%r != %r" % (raised, signals)) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 01:34:35 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 01:34:35 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312469=3A_fix_signa?= =?utf8?q?l_order_check_of_test=5Fsignal?= Message-ID: http://hg.python.org/cpython/rev/f12b8548b4aa changeset: 71215:f12b8548b4aa user: Victor Stinner date: Tue Jul 05 01:32:06 2011 +0200 summary: Issue #12469: fix signal order check of test_signal When signals are unblocked, pending signal ared delivered in the reverse order of their number (also on Linux, not only on FreeBSD 6). Don't sort signals by their number if signals were not blocked (test_signum). files: Lib/test/test_signal.py | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -240,10 +240,6 @@ def check_signum(signals): data = os.read(read, len(signals)+1) raised = struct.unpack('%uB' % len(data), data) - if sys.platform == 'freebsd6': - # when signals are unblocked, FreeBSD 6 delivers signals in the - # reverse order of their number - signals = tuple(sorted(signals, reverse=False)) if raised != signals: raise Exception("%r != %r" % (raised, signals)) @@ -323,6 +319,11 @@ @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') def test_pending(self): + signals = (signal.SIGUSR1, signal.SIGUSR2) + # when signals are unblocked, pending signal ared delivered in the + # reverse order of their number + signals = tuple(sorted(signals, reverse=True)) + self.check_wakeup("""def test(): signum1 = signal.SIGUSR1 signum2 = signal.SIGUSR2 @@ -335,7 +336,7 @@ os.kill(os.getpid(), signum2) # Unblocking the 2 signals calls the C signal handler twice signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2)) - """, signal.SIGUSR1, signal.SIGUSR2) + """, *signals) @unittest.skipIf(sys.platform == "win32", "Not valid on Windows") -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 02:54:05 2011 From: python-checkins at python.org (ned.deily) Date: Tue, 05 Jul 2011 02:54:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDk2?= =?utf8?q?=3A__Install_test/capath_directory_to_prevent_test=5Fconnect=5Fc?= =?utf8?q?apath?= Message-ID: http://hg.python.org/cpython/rev/7731c900ddce changeset: 71216:7731c900ddce branch: 3.2 parent: 71210:184192b3687c user: Ned Deily date: Mon Jul 04 17:48:01 2011 -0700 summary: Issue #12496: Install test/capath directory to prevent test_connect_capath testcase failure in test_ssl. files: Makefile.pre.in | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -910,6 +910,7 @@ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ tkinter/test/test_ttk site-packages test \ + test/capath \ test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \ test/tracedmodules test/encoded_modules \ concurrent concurrent/futures encodings \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Tests ----- +- Issue #12496: Install test/capath directory to prevent test_connect_capath + testcase failure in test_ssl. + - Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a fresh process with only one thread and to not change signal handling of the parent process. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 02:54:06 2011 From: python-checkins at python.org (ned.deily) Date: Tue, 05 Jul 2011 02:54:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312496=3A__Install_test/capath_directory_to_prevent_?= =?utf8?q?test=5Fconnect=5Fcapath?= Message-ID: http://hg.python.org/cpython/rev/880c3e764ead changeset: 71217:880c3e764ead parent: 71215:f12b8548b4aa parent: 71216:7731c900ddce user: Ned Deily date: Mon Jul 04 17:51:48 2011 -0700 summary: Issue #12496: Install test/capath directory to prevent test_connect_capath testcase failure in test_ssl. files: Makefile.pre.in | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -912,6 +912,7 @@ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ tkinter/test/test_ttk site-packages test \ + test/capath \ test/cjkencodings test/decimaltestdata test/xmltestdata \ test/subprocessdata \ test/tracedmodules test/encoded_modules \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -981,6 +981,9 @@ Tests ----- +- Issue #12496: Install test/capath directory to prevent test_connect_capath + testcase failure in test_ssl. + - Issue #12469: Run wakeup and pending signal tests in a subprocess to run the test in a fresh process with only one thread and to not change signal handling of the parent process. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 04:11:45 2011 From: python-checkins at python.org (ned.deily) Date: Tue, 05 Jul 2011 04:11:45 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDk3?= =?utf8?q?=3A_Install_test/data_to_prevent_failures_of_the_various_codecma?= =?utf8?q?ps?= Message-ID: http://hg.python.org/cpython/rev/95301c58c5d2 changeset: 71218:95301c58c5d2 branch: 3.2 parent: 71216:7731c900ddce user: Ned Deily date: Mon Jul 04 19:06:20 2011 -0700 summary: Issue #12497: Install test/data to prevent failures of the various codecmaps tests. files: Lib/test/data/README | 2 +- Makefile.pre.in | 2 +- Misc/NEWS | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/data/README b/Lib/test/data/README --- a/Lib/test/data/README +++ b/Lib/test/data/README @@ -1,2 +1,2 @@ This empty directory serves as destination for temporary files -created by some tests. +created by some tests, in particular, the test_codecmaps_* tests. diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -910,7 +910,7 @@ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ tkinter/test/test_ttk site-packages test \ - test/capath \ + test/capath test/data \ test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \ test/tracedmodules test/encoded_modules \ concurrent concurrent/futures encodings \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,7 +38,10 @@ Tests ----- -- Issue #12496: Install test/capath directory to prevent test_connect_capath +- Issue #12497: Install test/data to prevent failures of the various codecmaps + tests. + +- Issue #12496: Install test/capath directory to prevent test_connect_capath testcase failure in test_ssl. - Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 04:11:46 2011 From: python-checkins at python.org (ned.deily) Date: Tue, 05 Jul 2011 04:11:46 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312497=3A_Install_test/data_to_prevent_failures_of_t?= =?utf8?q?he_various_codecmaps?= Message-ID: http://hg.python.org/cpython/rev/842147eb1b26 changeset: 71219:842147eb1b26 parent: 71217:880c3e764ead parent: 71218:95301c58c5d2 user: Ned Deily date: Mon Jul 04 19:11:14 2011 -0700 summary: Issue #12497: Install test/data to prevent failures of the various codecmaps tests. files: Lib/test/data/README | 2 +- Makefile.pre.in | 2 +- Misc/NEWS | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/data/README b/Lib/test/data/README --- a/Lib/test/data/README +++ b/Lib/test/data/README @@ -1,2 +1,2 @@ This empty directory serves as destination for temporary files -created by some tests. +created by some tests, in particular, the test_codecmaps_* tests. diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -912,7 +912,7 @@ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ tkinter/test/test_ttk site-packages test \ - test/capath \ + test/capath test/data \ test/cjkencodings test/decimaltestdata test/xmltestdata \ test/subprocessdata \ test/tracedmodules test/encoded_modules \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -981,7 +981,10 @@ Tests ----- -- Issue #12496: Install test/capath directory to prevent test_connect_capath +- Issue #12497: Install test/data to prevent failures of the various codecmaps + tests. + +- Issue #12496: Install test/capath directory to prevent test_connect_capath testcase failure in test_ssl. - Issue #12469: Run wakeup and pending signal tests in a subprocess to run the -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jul 5 05:10:19 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 05 Jul 2011 05:10:19 +0200 Subject: [Python-checkins] Daily reference leaks (880c3e764ead): sum=402 Message-ID: results for 880c3e764ead on branch "default" -------------------------------------------- test_concurrent_futures leaked [108, 0, 0] references, sum=108 test_packaging leaked [100, 100, 100] references, sum=300 test_warnings leaked [-2, -2, -2] references, sum=-6 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogGkT58w', '-x'] From python-checkins at python.org Tue Jul 5 05:23:50 2011 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 05 Jul 2011 05:23:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_start_out_this_?= =?utf8?q?branch_always_with_filename_NULL?= Message-ID: http://hg.python.org/cpython/rev/7eb85a23cf3d changeset: 71220:7eb85a23cf3d branch: 3.2 parent: 71218:95301c58c5d2 user: Benjamin Peterson date: Mon Jul 04 22:27:16 2011 -0500 summary: start out this branch always with filename NULL files: Python/_warnings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -517,7 +517,7 @@ } else { const char *module_str = _PyUnicode_AsString(*module); - Py_XDECREF(*filename); + *filename = NULL; if (module_str == NULL) goto handle_error; if (strcmp(module_str, "__main__") == 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 05:23:51 2011 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 05 Jul 2011 05:23:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_start_out_this_?= =?utf8?q?branch_always_with_filename_NULL?= Message-ID: http://hg.python.org/cpython/rev/a8be035f299f changeset: 71221:a8be035f299f branch: 2.7 parent: 71212:b8f5da066782 user: Benjamin Peterson date: Mon Jul 04 22:27:16 2011 -0500 summary: start out this branch always with filename NULL files: Python/_warnings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -514,7 +514,7 @@ } else { const char *module_str = PyString_AsString(*module); - Py_XDECREF(*filename); + *filename = NULL; if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 05:23:51 2011 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 05 Jul 2011 05:23:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/e38bb637328c changeset: 71222:e38bb637328c parent: 71219:842147eb1b26 parent: 71220:7eb85a23cf3d user: Benjamin Peterson date: Mon Jul 04 22:28:00 2011 -0500 summary: merge 3.2 files: Python/_warnings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -517,7 +517,7 @@ } else { const char *module_str = _PyUnicode_AsString(*module); - Py_XDECREF(*filename); + *filename = NULL; if (module_str == NULL) goto handle_error; if (strcmp(module_str, "__main__") == 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 11:28:34 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 11:28:34 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzk2MTEs?= =?utf8?b?ICM5MDE1OiBGaWxlSU8ucmVhZCgpLCBGaWxlSU8ucmVhZGludG8oKSwgRmlsZUlP?= =?utf8?b?LndyaXRlKCkgYW5k?= Message-ID: http://hg.python.org/cpython/rev/6abbc5f68e20 changeset: 71223:6abbc5f68e20 branch: 2.7 parent: 71221:a8be035f299f user: Victor Stinner date: Tue Jul 05 11:28:19 2011 +0200 summary: Issue #9611, #9015: FileIO.read(), FileIO.readinto(), FileIO.write() and os.write() clamp the length to INT_MAX on Windows. files: Misc/NEWS | 3 +++ Modules/_io/fileio.c | 30 ++++++++++++++++++++++++++---- Modules/posixmodule.c | 13 ++++++++++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #9611, #9015: FileIO.read(), FileIO.readinto(), FileIO.write() and + os.write() clamp the length to INT_MAX on Windows. + - Issue #1195: my_fgets() now always clears errors before calling fgets(). Fix the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -474,7 +474,7 @@ fileio_readinto(fileio *self, PyObject *args) { Py_buffer pbuf; - Py_ssize_t n; + Py_ssize_t n, len; if (self->fd < 0) return err_closed(); @@ -485,9 +485,16 @@ return NULL; if (_PyVerify_fd(self->fd)) { + len = pbuf.len; Py_BEGIN_ALLOW_THREADS errno = 0; - n = read(self->fd, pbuf.buf, pbuf.len); +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (len > INT_MAX) + len = INT_MAX; + n = read(self->fd, pbuf.buf, (int)len); +#else + n = read(self->fd, pbuf.buf, len); +#endif Py_END_ALLOW_THREADS } else n = -1; @@ -620,6 +627,10 @@ return fileio_readall(self); } +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (size > INT_MAX) + size = INT_MAX; +#endif bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; @@ -628,7 +639,11 @@ if (_PyVerify_fd(self->fd)) { Py_BEGIN_ALLOW_THREADS errno = 0; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + n = read(self->fd, ptr, (int)size); +#else n = read(self->fd, ptr, size); +#endif Py_END_ALLOW_THREADS } else n = -1; @@ -655,7 +670,7 @@ fileio_write(fileio *self, PyObject *args) { Py_buffer pbuf; - Py_ssize_t n; + Py_ssize_t n, len; if (self->fd < 0) return err_closed(); @@ -668,7 +683,14 @@ if (_PyVerify_fd(self->fd)) { Py_BEGIN_ALLOW_THREADS errno = 0; - n = write(self->fd, pbuf.buf, pbuf.len); + len = pbuf.len; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (len > INT_MAX) + len = INT_MAX; + n = write(self->fd, pbuf.buf, (int)len); +#else + n = write(self->fd, pbuf.buf, len); +#endif Py_END_ALLOW_THREADS } else n = -1; diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3903,7 +3903,7 @@ #endif gid_t grouplist[MAX_GROUPS]; - /* On MacOSX getgroups(2) can return more than MAX_GROUPS results + /* On MacOSX getgroups(2) can return more than MAX_GROUPS results * This is a helper variable to store the intermediate result when * that happens. * @@ -6648,7 +6648,7 @@ { Py_buffer pbuf; int fd; - Py_ssize_t size; + Py_ssize_t size, len; if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf)) return NULL; @@ -6656,8 +6656,15 @@ PyBuffer_Release(&pbuf); return posix_error(); } + len = pbuf.len; Py_BEGIN_ALLOW_THREADS - size = write(fd, pbuf.buf, (size_t)pbuf.len); +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (len > INT_MAX) + len = INT_MAX; + size = write(fd, pbuf.buf, (int)len); +#else + size = write(fd, pbuf.buf, len); +#endif Py_END_ALLOW_THREADS PyBuffer_Release(&pbuf); if (size < 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 11:38:42 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 11:38:42 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzk2MTEs?= =?utf8?q?_=239015=3A_FileIO=2Eread=28=29_clamps_the_length_to_INT=5FMAX_o?= =?utf8?q?n_Windows=2E?= Message-ID: http://hg.python.org/cpython/rev/7acdf9f5eb31 changeset: 71224:7acdf9f5eb31 branch: 3.2 parent: 71220:7eb85a23cf3d user: Victor Stinner date: Tue Jul 05 11:31:49 2011 +0200 summary: Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. files: Misc/NEWS | 4 +++- Modules/_io/fileio.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. + - When a generator yields, do not retain the caller's exception state on the generator. @@ -908,7 +910,7 @@ (length bigger than 2^31-1 bytes). - Issue #9015, #9611: FileIO.readinto(), FileIO.write(), os.write() and - stdprinter.write() clamp the length to 2^31-1 on Windows. + stdprinter.write() clamp the length to INT_MAX on Windows. - Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime() can now handle dates after 2038. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -664,6 +664,10 @@ return fileio_readall(self); } +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (size > INT_MAX) + size = INT_MAX; +#endif bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; @@ -672,7 +676,11 @@ if (_PyVerify_fd(self->fd)) { Py_BEGIN_ALLOW_THREADS errno = 0; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + n = read(self->fd, ptr, (int)size); +#else n = read(self->fd, ptr, size); +#endif Py_END_ALLOW_THREADS } else n = -1; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 11:38:43 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 11:38:43 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjOTYxMSwgIzkwMTU6IEZpbGVJTy5yZWFkKCkg?= =?utf8?q?clamps_the_length_to_INT=5FMAX_on?= Message-ID: http://hg.python.org/cpython/rev/e8646f120330 changeset: 71225:e8646f120330 parent: 71222:e38bb637328c parent: 71224:7acdf9f5eb31 user: Victor Stinner date: Tue Jul 05 11:34:18 2011 +0200 summary: (merge 3.2) Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. files: Misc/NEWS | 4 +++- Modules/_io/fileio.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. + - Issue #9642: Uniformize the tests on the availability of the mbcs codec, add a new HAVE_MBCS define. @@ -1327,7 +1329,7 @@ (length bigger than 2^31-1 bytes). - Issue #9015, #9611: FileIO.readinto(), FileIO.write(), os.write() and - stdprinter.write() clamp the length to 2^31-1 on Windows. + stdprinter.write() clamp the length to INT_MAX on Windows. - Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime() can now handle dates after 2038. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -687,6 +687,10 @@ return fileio_readall(self); } +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (size > INT_MAX) + size = INT_MAX; +#endif bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; @@ -695,7 +699,11 @@ if (_PyVerify_fd(self->fd)) { Py_BEGIN_ALLOW_THREADS errno = 0; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + n = read(self->fd, ptr, (int)size); +#else n = read(self->fd, ptr, size); +#endif Py_END_ALLOW_THREADS } else n = -1; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 13:37:45 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 13:37:45 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogdGVzdF9hcnJheTog?= =?utf8?q?make_quiet_the_DeprecationWarning?= Message-ID: http://hg.python.org/cpython/rev/7bfedb159e82 changeset: 71226:7bfedb159e82 branch: 2.7 parent: 71223:6abbc5f68e20 user: Victor Stinner date: Tue Jul 05 13:14:17 2011 +0200 summary: test_array: make quiet the DeprecationWarning files: Lib/test/test_array.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -4,6 +4,7 @@ """ import unittest +import warnings from test import test_support from weakref import proxy import array, cStringIO @@ -783,7 +784,9 @@ def test_subclass_with_kwargs(self): # SF bug #1486663 -- this used to erroneously raise a TypeError - ArraySubclassWithKwargs('b', newarg=1) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", '', DeprecationWarning) + ArraySubclassWithKwargs('b', newarg=1) class StringTest(BaseTest): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 13:37:46 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 13:37:46 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogdGVzdF9pbzogbWFr?= =?utf8?q?e_quiet_the_DeprecationWarning=28=27classic_int_division=27=29?= Message-ID: http://hg.python.org/cpython/rev/9864e5d16407 changeset: 71227:9864e5d16407 branch: 2.7 user: Victor Stinner date: Tue Jul 05 13:29:26 2011 +0200 summary: test_io: make quiet the DeprecationWarning('classic int division') files: Lib/test/test_io.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2612,7 +2612,7 @@ def on_alarm(*args): # Will be called reentrantly from the same thread wio.write(data) - 1/0 + 1//0 signal.signal(signal.SIGALRM, on_alarm) r, w = os.pipe() wio = self.io.open(w, **fdopen_kwargs) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:08:17 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:08:17 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDkz?= =?utf8?q?=3A_subprocess=3A_communicate=28=29_handles_EINTR?= Message-ID: http://hg.python.org/cpython/rev/dcfacc2d93b4 changeset: 71228:dcfacc2d93b4 branch: 3.2 parent: 71224:7acdf9f5eb31 user: Victor Stinner date: Tue Jul 05 14:00:56 2011 +0200 summary: Issue #12493: subprocess: communicate() handles EINTR subprocess.Popen.communicate() now also handles EINTR errors if the process has only one pipe. files: Lib/subprocess.py | 6 +++--- Lib/test/test_subprocess.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -450,7 +450,7 @@ while True: try: return func(*args) - except OSError as e: + except (OSError, IOError) as e: if e.errno == errno.EINTR: continue raise @@ -804,10 +804,10 @@ raise self.stdin.close() elif self.stdout: - stdout = self.stdout.read() + stdout = _eintr_retry_call(self.stdout.read) self.stdout.close() elif self.stderr: - stderr = self.stderr.read() + stderr = _eintr_retry_call(self.stderr.read) self.stderr.close() self.wait() return (stdout, stderr) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -675,6 +675,22 @@ time.sleep(2) p.communicate(b"x" * 2**20) + def test_communicate_eintr(self): + # Issue #12493: communicate() should handle EINTR + def handler(signum, frame): + pass + old_handler = signal.signal(signal.SIGALRM, handler) + self.addCleanup(signal.signal, signal.SIGALRM, old_handler) + + # the process is running for 2 seconds + args = [sys.executable, "-c", 'import time; time.sleep(2)'] + for stream in ('stdout', 'stderr'): + kw = {stream: subprocess.PIPE} + with subprocess.Popen(args, **kw) as process: + signal.alarm(1) + # communicate() will be interrupted by SIGALRM + process.communicate() + # context manager class _SuppressCoreFiles(object): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Library ------- +- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors + if the process has only one pipe. + - Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:08:18 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:08:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312493=3A_subprocess=3A_communicat?= =?utf8?q?e=28=29_handles_EINTR?= Message-ID: http://hg.python.org/cpython/rev/42e23db3ddfc changeset: 71229:42e23db3ddfc parent: 71225:e8646f120330 parent: 71228:dcfacc2d93b4 user: Victor Stinner date: Tue Jul 05 14:04:39 2011 +0200 summary: (merge 3.2) Issue #12493: subprocess: communicate() handles EINTR subprocess.Popen.communicate() now also handles EINTR errors if the process has only one pipe. files: Lib/subprocess.py | 6 +++--- Lib/test/test_subprocess.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -446,7 +446,7 @@ while True: try: return func(*args) - except OSError as e: + except (OSError, IOError) as e: if e.errno == errno.EINTR: continue raise @@ -820,10 +820,10 @@ raise self.stdin.close() elif self.stdout: - stdout = self.stdout.read() + stdout = _eintr_retry_call(self.stdout.read) self.stdout.close() elif self.stderr: - stderr = self.stderr.read() + stderr = _eintr_retry_call(self.stderr.read) self.stderr.close() self.wait() else: diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -767,6 +767,22 @@ time.sleep(2) p.communicate(b"x" * 2**20) + def test_communicate_eintr(self): + # Issue #12493: communicate() should handle EINTR + def handler(signum, frame): + pass + old_handler = signal.signal(signal.SIGALRM, handler) + self.addCleanup(signal.signal, signal.SIGALRM, old_handler) + + # the process is running for 2 seconds + args = [sys.executable, "-c", 'import time; time.sleep(2)'] + for stream in ('stdout', 'stderr'): + kw = {stream: subprocess.PIPE} + with subprocess.Popen(args, **kw) as process: + signal.alarm(1) + # communicate() will be interrupted by SIGALRM + process.communicate() + # context manager class _SuppressCoreFiles(object): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,9 @@ Library ------- +- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors + if the process has only one pipe. + - Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:08:19 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:08:19 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDkz?= =?utf8?q?=3A_subprocess=3A_communicate=28=29_handles_EINTR?= Message-ID: http://hg.python.org/cpython/rev/6a28ccde2f1b changeset: 71230:6a28ccde2f1b branch: 2.7 parent: 71227:9864e5d16407 user: Victor Stinner date: Tue Jul 05 14:08:01 2011 +0200 summary: Issue #12493: subprocess: communicate() handles EINTR subprocess.Popen.communicate() now also handles EINTR errors if the process has only one pipe. files: Lib/subprocess.py | 6 +++--- Lib/test/test_subprocess.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -476,7 +476,7 @@ while True: try: return func(*args) - except OSError, e: + except (OSError, IOError) as e: if e.errno == errno.EINTR: continue raise @@ -743,10 +743,10 @@ raise self.stdin.close() elif self.stdout: - stdout = self.stdout.read() + stdout = _eintr_retry_call(self.stdout.read) self.stdout.close() elif self.stderr: - stderr = self.stderr.read() + stderr = _eintr_retry_call(self.stderr.read) self.stderr.close() self.wait() return (stdout, stderr) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -664,6 +664,22 @@ except (ImportError, ValueError, resource.error): pass + def test_communicate_eintr(self): + # Issue #12493: communicate() should handle EINTR + def handler(signum, frame): + pass + old_handler = signal.signal(signal.SIGALRM, handler) + self.addCleanup(signal.signal, signal.SIGALRM, old_handler) + + # the process is running for 2 seconds + args = [sys.executable, "-c", 'import time; time.sleep(2)'] + for stream in ('stdout', 'stderr'): + kw = {stream: subprocess.PIPE} + with subprocess.Popen(args, **kw) as process: + signal.alarm(1) + # communicate() will be interrupted by SIGALRM + process.communicate() + @unittest.skipIf(mswindows, "POSIX specific tests") class POSIXProcessTestCase(BaseTestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Library ------- +- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors + if the process has only one pipe. + - Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:31:55 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:31:55 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjMTI0NTE6IHB5ZG9jOiBodG1sX2dldGZpbGUo?= =?utf8?q?=29_now_uses_tokenize=2Eopen=28=29_to?= Message-ID: http://hg.python.org/cpython/rev/2fbfb7ea362f changeset: 71232:2fbfb7ea362f parent: 71229:42e23db3ddfc parent: 71231:8b62f5d722f4 user: Victor Stinner date: Tue Jul 05 14:31:28 2011 +0200 summary: (merge 3.2) Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support Python scripts using a encoding different than UTF-8 (read the coding cookie of the script). files: Lib/pydoc.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2311,7 +2311,7 @@ def html_getfile(path): """Get and display a source file listing safely.""" path = path.replace('%20', ' ') - with open(path, 'r') as fp: + with tokenize.open(path) as fp: lines = html.escape(fp.read()) body = '
%s
' % lines heading = html.heading( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,10 @@ Library ------- +- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support + Python scripts using a encoding different than UTF-8 (read the coding cookie + of the script). + - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors if the process has only one pipe. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:31:55 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:31:55 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDUx?= =?utf8?q?=3A_pydoc=3A_html=5Fgetfile=28=29_now_uses_tokenize=2Eopen=28=29?= =?utf8?q?_to_support_Python?= Message-ID: http://hg.python.org/cpython/rev/8b62f5d722f4 changeset: 71231:8b62f5d722f4 branch: 3.2 parent: 71228:dcfacc2d93b4 user: Victor Stinner date: Tue Jul 05 14:30:41 2011 +0200 summary: Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support Python scripts using a encoding different than UTF-8 (read the coding cookie of the script). files: Lib/pydoc.py | 2 +- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2580,7 +2580,7 @@ def html_getfile(path): """Get and display a source file listing safely.""" path = path.replace('%20', ' ') - with open(path, 'r') as fp: + with tokenize.open(path) as fp: lines = html.escape(fp.read()) body = '
%s
' % lines heading = html.heading( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,10 @@ - Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. +- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support + Python scripts using a encoding different than UTF-8 (read the coding cookie + of the script). + - Issue #12451: pydoc: importfile() now opens the Python script in binary mode, instead of text mode using the locale encoding, to avoid encoding issues. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:51:04 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:51:04 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDkz?= =?utf8?q?=3A_skip_test=5Fcommunicate=5Feintr=28=29_if_signal=2ESIGALRM_is?= =?utf8?q?_missing?= Message-ID: http://hg.python.org/cpython/rev/807921ba241d changeset: 71233:807921ba241d branch: 3.2 parent: 71231:8b62f5d722f4 user: Victor Stinner date: Tue Jul 05 14:49:46 2011 +0200 summary: Issue #12493: skip test_communicate_eintr() if signal.SIGALRM is missing files: Lib/test/test_subprocess.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -675,6 +675,8 @@ time.sleep(2) p.communicate(b"x" * 2**20) + @unittest.skipUnless(hasattr(signal, 'SIGALRM'), + "Requires signal.SIGALRM") def test_communicate_eintr(self): # Issue #12493: communicate() should handle EINTR def handler(signum, frame): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:51:05 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:51:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312493=3A_skip_test=5Fcommunicate?= =?utf8?q?=5Feintr=28=29_if_signal=2ESIGALRM_is?= Message-ID: http://hg.python.org/cpython/rev/4928cf093a11 changeset: 71234:4928cf093a11 parent: 71232:2fbfb7ea362f parent: 71233:807921ba241d user: Victor Stinner date: Tue Jul 05 14:50:08 2011 +0200 summary: (merge 3.2) Issue #12493: skip test_communicate_eintr() if signal.SIGALRM is missing files: Lib/test/test_subprocess.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -767,6 +767,8 @@ time.sleep(2) p.communicate(b"x" * 2**20) + @unittest.skipUnless(hasattr(signal, 'SIGALRM'), + "Requires signal.SIGALRM") def test_communicate_eintr(self): # Issue #12493: communicate() should handle EINTR def handler(signum, frame): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 5 14:51:05 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 14:51:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDkz?= =?utf8?q?=3A_skip_test=5Fcommunicate=5Feintr=28=29_if_signal=2ESIGALRM_is?= =?utf8?q?_missing?= Message-ID: http://hg.python.org/cpython/rev/8a4c9c154b5d changeset: 71235:8a4c9c154b5d branch: 2.7 parent: 71230:6a28ccde2f1b user: Victor Stinner date: Tue Jul 05 14:50:35 2011 +0200 summary: Issue #12493: skip test_communicate_eintr() if signal.SIGALRM is missing files: Lib/test/test_subprocess.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -664,6 +664,8 @@ except (ImportError, ValueError, resource.error): pass + @unittest.skipUnless(hasattr(signal, 'SIGALRM'), + "Requires signal.SIGALRM") def test_communicate_eintr(self): # Issue #12493: communicate() should handle EINTR def handler(signum, frame): -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Tue Jul 5 15:57:24 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 5 Jul 2011 23:57:24 +1000 Subject: [Python-checkins] [Python-Dev] cpython: Remove mention of medical condition from the test suite. In-Reply-To: <87fwmldyyz.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87fwmldyyz.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On Tue, Jul 5, 2011 at 4:27 PM, Stephen J. Turnbull wrote: > That points to why such changes are justified despite an author's > right to have her mode of expression respected -- the Python project > aims at professionalism, and offensive language detracts from it. Given that the contents of many test strings are quite arbitrary, I personally consider a bit of inoffensive humour or cultural references to be a fine thing to include rather than yet another instance of "foobar" (which itself has humorous *and* offensive origins). Heck, stripping just the Monty Python quotes from the test suite would probably take a while :) Avoiding offensive text has nothing to do with a desire to appear "professional" (at least for me) - it's about demonstrating common courtesy to the potentially wide variety of people that will read the Python source code in the future. (In the specific case, I thought quoting the venerable pun was fine, but I also don't have any real problem with modifying it) Cheers, Nick. P.S. 'twas a sad day when copyright concerns cost us the old test audio file :( -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Tue Jul 5 22:00:33 2011 From: python-checkins at python.org (victor.stinner) Date: Tue, 05 Jul 2011 22:00:33 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312459=3A_time=2Esl?= =?utf8?q?eep=28=29_now_raises_a_ValueError_if_the_sleep_length_is?= Message-ID: http://hg.python.org/cpython/rev/0e5485634817 changeset: 71236:0e5485634817 parent: 71234:4928cf093a11 user: Victor Stinner date: Tue Jul 05 22:00:25 2011 +0200 summary: Issue #12459: time.sleep() now raises a ValueError if the sleep length is negative, instead of an infinite sleep on Windows or raising an IOError on Linux for example, to have the same behaviour on all platforms. files: Lib/test/test_time.py | 2 ++ Misc/NEWS | 4 ++++ Modules/timemodule.c | 5 +++++ 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -27,6 +27,8 @@ int(self.t)) def test_sleep(self): + self.assertRaises(ValueError, time.sleep, -2) + self.assertRaises(ValueError, time.sleep, -1) time.sleep(1.2) def test_strftime(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,10 @@ Library ------- +- Issue #12459: time.sleep() now raises a ValueError if the sleep length is + negative, instead of an infinite sleep on Windows or raising an IOError on + Linux for example, to have the same behaviour on all platforms. + - Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support Python scripts using a encoding different than UTF-8 (read the coding cookie of the script). diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -141,6 +141,11 @@ double secs; if (!PyArg_ParseTuple(args, "d:sleep", &secs)) return NULL; + if (secs < 0) { + PyErr_SetString(PyExc_ValueError, + "sleep length must be non-negative"); + return NULL; + } if (floatsleep(secs) != 0) return NULL; Py_INCREF(Py_None); -- Repository URL: http://hg.python.org/cpython From eric at trueblade.com Tue Jul 5 13:59:10 2011 From: eric at trueblade.com (Eric Smith) Date: Tue, 05 Jul 2011 07:59:10 -0400 Subject: [Python-checkins] cpython: Issue #12452: Plist and Dict are now deprecated In-Reply-To: References: Message-ID: <4E12FC8E.2070609@trueblade.com> On 7/4/2011 8:28 AM, victor.stinner wrote: > http://hg.python.org/cpython/rev/4f14050a963f > changeset: 71194:4f14050a963f > user: Victor Stinner > date: Mon Jul 04 14:28:45 2011 +0200 > summary: > Issue #12452: Plist and Dict are now deprecated > > Replace PendingDeprecationWarning warnings by DeprecationWarning. Shouldn't this be in MISC/News, be accompanied by documentation changes, and have tests? From g.brandl at gmx.net Tue Jul 5 22:17:10 2011 From: g.brandl at gmx.net (Georg Brandl) Date: Tue, 05 Jul 2011 22:17:10 +0200 Subject: [Python-checkins] [Python-Dev] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: <87fwmldyyz.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: Am 05.07.2011 15:57, schrieb Nick Coghlan: > On Tue, Jul 5, 2011 at 4:27 PM, Stephen J. Turnbull wrote: >> That points to why such changes are justified despite an author's >> right to have her mode of expression respected -- the Python project >> aims at professionalism, and offensive language detracts from it. > > Given that the contents of many test strings are quite arbitrary, I > personally consider a bit of inoffensive humour or cultural references > to be a fine thing to include rather than yet another instance of > "foobar" (which itself has humorous *and* offensive origins). Heck, > stripping just the Monty Python quotes from the test suite would > probably take a while :) Well, the diversity list discussed this specific problem, and it was stated that even double-use of such terms documented in dictionaries is offensive to some. For this test string, a) I'm not a native speaker and therefore don't know of any special treatment this pun deserves and b) the content is really quite arbitrary, meaning that the test works just as well with this content. Georg From python-checkins at python.org Tue Jul 5 23:16:52 2011 From: python-checkins at python.org (ned.deily) Date: Tue, 05 Jul 2011 23:16:52 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Add_temporary_code_for_2=2E7_to_help_diagnose_buildbot_failure?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/18ce15f841cf changeset: 71237:18ce15f841cf branch: 2.7 parent: 71235:8a4c9c154b5d user: Ned Deily date: Tue Jul 05 14:16:03 2011 -0700 summary: Issue #8716: Add temporary code for 2.7 to help diagnose buildbot failure. files: Lib/lib-tk/test/runtktests.py | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -25,6 +25,20 @@ return if sys.platform == 'darwin': + + # ** temporary test code for issue8716 ** + try: + import MacOS + wma = MacOS.WMAvailable() + print >> test.test_support.get_original_stdout(), \ + '\tcheck_tk_availability -- WMAvailable returned %r' % wma + except ImportError: + print >> test.test_support.get_original_stdout(), \ + '\tcheck_tk_availability -- could not import MacOS' + if not wma: + raise unittest.SkipTest("Window manager is not available") + # ** end of temporary test code for issue8716 ** + # The Aqua Tk implementations on OS X can abort the process if # being called in an environment where a window server connection # cannot be made, for instance when invoked by a buildbot or ssh -- Repository URL: http://hg.python.org/cpython From guido at python.org Wed Jul 6 00:50:09 2011 From: guido at python.org (Guido van Rossum) Date: Tue, 5 Jul 2011 15:50:09 -0700 Subject: [Python-checkins] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: Message-ID: It's not a bug and shouldn't be "fixed". We leave lots of minor infractions in the code because the code churn of fixing them all would be too distracting. On Jul 3, 2011 10:22 AM, "georg.brandl" wrote: > http://hg.python.org/cpython/rev/76452b892838 > changeset: 71146:76452b892838 > parent: 71144:ce52310f61a0 > user: Georg Brandl > date: Sun Jul 03 19:22:42 2011 +0200 > summary: > Remove mention of medical condition from the test suite. > > files: > Lib/test/test_csv.py | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > > diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py > --- a/Lib/test/test_csv.py > +++ b/Lib/test/test_csv.py > @@ -459,20 +459,20 @@ > '5', '6']]) > > def test_quoted_quote(self): > - self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', > + self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he picked up his hammer and saw"', > [['1', '2', '3', > - '"I see," said the blind man', > + '"I see," said the happy man', > 'as he picked up his hammer and saw']]) > > def test_quoted_nl(self): > input = '''\ > 1,2,3,"""I see,"" > -said the blind man","as he picked up his > +said the happy man","as he picked up his > hammer and saw" > 9,8,7,6''' > self.readerAssertEqual(input, > [['1', '2', '3', > - '"I see,"\nsaid the blind man', > + '"I see,"\nsaid the happy man', > 'as he picked up his\nhammer and saw'], > ['9','8','7','6']]) > > > -- > Repository URL: http://hg.python.org/cpython -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Wed Jul 6 02:16:53 2011 From: python-checkins at python.org (brian.curtin) Date: Wed, 06 Jul 2011 02:16:53 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_=2311512=2E_Add_an_init?= =?utf8?q?ial_test_suite_for_the_cgitb=2C_providing_75=25_coverage=2E?= Message-ID: http://hg.python.org/cpython/rev/7e0102ec95d4 changeset: 71238:7e0102ec95d4 parent: 71236:0e5485634817 user: Brian Curtin date: Tue Jul 05 19:14:16 2011 -0500 summary: Fix #11512. Add an initial test suite for the cgitb, providing 75% coverage. Patch by Robbie Clemons (robquad), produced at the PyCon 2011 sprints. files: Lib/test/test_cgitb.py | 55 ++++++++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 2 + 3 files changed, 58 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_cgitb.py b/Lib/test/test_cgitb.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_cgitb.py @@ -0,0 +1,55 @@ +from test.support import run_unittest +import unittest +import sys +import subprocess +import cgitb + +class TestCgitb(unittest.TestCase): + + def test_fonts(self): + text = "Hello Robbie!" + self.assertEqual(cgitb.small(text), "{}".format(text)) + self.assertEqual(cgitb.strong(text), "{}".format(text)) + self.assertEqual(cgitb.grey(text), + '{}'.format(text)) + + def test_blanks(self): + self.assertEqual(cgitb.small(""), "") + self.assertEqual(cgitb.strong(""), "") + self.assertEqual(cgitb.grey(""), "") + + def test_html(self): + try: + raise ValueError("Hello World") + except ValueError as err: + # If the html was templated we could do a bit more here. + # At least check that we get details on what we just raised. + html = cgitb.html(sys.exc_info()) + self.assertIn("ValueError", html) + self.assertIn(str(err), html) + + def test_text(self): + try: + raise ValueError("Hello World") + except ValueError as err: + text = cgitb.text(sys.exc_info()) + self.assertIn("ValueError", text) + self.assertIn("Hello World", text) + + def test_hook(self): + proc = subprocess.Popen([sys.executable, '-c', + ('import cgitb;' + 'cgitb.enable();' + 'raise ValueError("Hello World")')], + stdout=subprocess.PIPE) + out = proc.stdout.read().decode(sys.getfilesystemencoding()) + self.addCleanup(proc.stdout.close) + self.assertIn("ValueError", out) + self.assertIn("Hello World", out) + + +def test_main(): + run_unittest(TestCgitb) + +if __name__ == "__main__": + test_main() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -175,6 +175,7 @@ Mike Clarkson Andrew Clegg Brad Clements +Robbie Clemons Steve Clift Nick Coghlan Josh Cogliati diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -994,6 +994,8 @@ Tests ----- +- Issue #11512: Add a test suite for the cgitb module. Patch by Robbie Clemons. + - Issue #12497: Install test/data to prevent failures of the various codecmaps tests. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 6 02:16:53 2011 From: python-checkins at python.org (brian.curtin) Date: Wed, 06 Jul 2011 02:16:53 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Normalize_whitespace_for_?= =?utf8?q?=2311512_fix=2E?= Message-ID: http://hg.python.org/cpython/rev/f362f0053eab changeset: 71239:f362f0053eab user: Brian Curtin date: Tue Jul 05 19:16:37 2011 -0500 summary: Normalize whitespace for #11512 fix. files: Lib/test/test_cgitb.py | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_cgitb.py b/Lib/test/test_cgitb.py --- a/Lib/test/test_cgitb.py +++ b/Lib/test/test_cgitb.py @@ -5,19 +5,19 @@ import cgitb class TestCgitb(unittest.TestCase): - + def test_fonts(self): text = "Hello Robbie!" self.assertEqual(cgitb.small(text), "{}".format(text)) self.assertEqual(cgitb.strong(text), "{}".format(text)) self.assertEqual(cgitb.grey(text), '{}'.format(text)) - + def test_blanks(self): self.assertEqual(cgitb.small(""), "") self.assertEqual(cgitb.strong(""), "") self.assertEqual(cgitb.grey(""), "") - + def test_html(self): try: raise ValueError("Hello World") @@ -35,11 +35,11 @@ text = cgitb.text(sys.exc_info()) self.assertIn("ValueError", text) self.assertIn("Hello World", text) - + def test_hook(self): proc = subprocess.Popen([sys.executable, '-c', - ('import cgitb;' - 'cgitb.enable();' + ('import cgitb;' + 'cgitb.enable();' 'raise ValueError("Hello World")')], stdout=subprocess.PIPE) out = proc.stdout.read().decode(sys.getfilesystemencoding()) @@ -50,6 +50,6 @@ def test_main(): run_unittest(TestCgitb) - + if __name__ == "__main__": test_main() -- Repository URL: http://hg.python.org/cpython From guido at python.org Wed Jul 6 02:35:44 2011 From: guido at python.org (Guido van Rossum) Date: Tue, 5 Jul 2011 17:35:44 -0700 Subject: [Python-checkins] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: Message-ID: To clarify, now that I have access to an actual keyboard instead of just a cellphone: I think it should be rolled back, since the proper process for controversial changes was not followed. Our process (part of our culture, if you will) for anything controversial is to discuss the change first, then, if deemed necessary, fix the code. And from the size of this thread it clearly is controversial. Georg, can you please revert this change? Note that another part of our process/culture is that we try not to engage in battling commits, i.e. generally we don't unilaterally roll back a change just to make the point that it is incorrect; we ask the original committer to roll it back. As to the controversy itself, if you want to make blind people fell more at home in the Python community surely there are more useful things to do than to remove puns involving blindness; e.g. improve accessibility of python.org or some part of it. Or maybe find some blind programmers and ask them what would help them. --Guido On Tue, Jul 5, 2011 at 3:50 PM, Guido van Rossum wrote: > It's not a bug and shouldn't be "fixed". We leave lots of minor infractions > in the code because the code churn of fixing them all would be too > distracting. > > On Jul 3, 2011 10:22 AM, "georg.brandl" wrote: >> http://hg.python.org/cpython/rev/76452b892838 >> changeset: 71146:76452b892838 >> parent: 71144:ce52310f61a0 >> user: Georg Brandl >> date: Sun Jul 03 19:22:42 2011 +0200 >> summary: >> Remove mention of medical condition from the test suite. >> >> files: >> Lib/test/test_csv.py | 8 ++++---- >> 1 files changed, 4 insertions(+), 4 deletions(-) >> >> >> diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py >> --- a/Lib/test/test_csv.py >> +++ b/Lib/test/test_csv.py >> @@ -459,20 +459,20 @@ >> '5', '6']]) >> >> def test_quoted_quote(self): >> - self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he >> picked up his hammer and saw"', >> + self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he >> picked up his hammer and saw"', >> [['1', '2', '3', >> - '"I see," said the blind man', >> + '"I see," said the happy man', >> 'as he picked up his hammer and saw']]) >> >> def test_quoted_nl(self): >> input = '''\ >> 1,2,3,"""I see,"" >> -said the blind man","as he picked up his >> +said the happy man","as he picked up his >> hammer and saw" >> 9,8,7,6''' >> self.readerAssertEqual(input, >> [['1', '2', '3', >> - '"I see,"\nsaid the blind man', >> + '"I see,"\nsaid the happy man', >> 'as he picked up his\nhammer and saw'], >> ['9','8','7','6']]) >> >> >> -- >> Repository URL: http://hg.python.org/cpython > -- --Guido van Rossum (python.org/~guido) From python-checkins at python.org Wed Jul 6 04:12:07 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 06 Jul 2011 04:12:07 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Back_out_temporary_changeset_18ce15f841cf?= Message-ID: http://hg.python.org/cpython/rev/b5accd8adc3e changeset: 71240:b5accd8adc3e branch: 2.7 parent: 71237:18ce15f841cf user: Ned Deily date: Tue Jul 05 15:09:32 2011 -0700 summary: Issue #8716: Back out temporary changeset 18ce15f841cf files: Lib/lib-tk/test/runtktests.py | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -25,20 +25,6 @@ return if sys.platform == 'darwin': - - # ** temporary test code for issue8716 ** - try: - import MacOS - wma = MacOS.WMAvailable() - print >> test.test_support.get_original_stdout(), \ - '\tcheck_tk_availability -- WMAvailable returned %r' % wma - except ImportError: - print >> test.test_support.get_original_stdout(), \ - '\tcheck_tk_availability -- could not import MacOS' - if not wma: - raise unittest.SkipTest("Window manager is not available") - # ** end of temporary test code for issue8716 ** - # The Aqua Tk implementations on OS X can abort the process if # being called in an environment where a window server connection # cannot be made, for instance when invoked by a buildbot or ssh -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 6 04:12:11 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 06 Jul 2011 04:12:11 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Instead_of_relying_on_Aqua_Tk_exceptions_to_detect_lack_of?= Message-ID: http://hg.python.org/cpython/rev/b5ac5e25d506 changeset: 71241:b5ac5e25d506 branch: 2.7 user: Ned Deily date: Tue Jul 05 19:08:38 2011 -0700 summary: Issue #8716: Instead of relying on Aqua Tk exceptions to detect lack of OS X window manager connection in tk tests, use OS X Application Services API calls instead. files: Lib/lib-tk/test/runtktests.py | 60 +++++++++++++--------- 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -10,41 +10,51 @@ import sys import unittest import importlib -import subprocess import test.test_support this_dir_path = os.path.abspath(os.path.dirname(__file__)) -_tk_available = None +_tk_unavailable = None def check_tk_availability(): """Check that Tk is installed and available.""" - global _tk_available + global _tk_unavailable - if _tk_available is not None: - return + if _tk_unavailable is None: + _tk_unavailable = False + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. To avoid that, raise an exception if the window manager + # connection is not available. + from ctypes import cdll, c_int, pointer, Structure + from ctypes.util import find_library - if sys.platform == 'darwin': - # The Aqua Tk implementations on OS X can abort the process if - # being called in an environment where a window server connection - # cannot be made, for instance when invoked by a buildbot or ssh - # process not running under the same user id as the current console - # user. Instead, try to initialize Tk under a subprocess. - p = subprocess.Popen( - [sys.executable, '-c', 'import Tkinter; Tkinter.Button()'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stderr = test.test_support.strip_python_stderr(p.communicate()[1]) - if stderr or p.returncode: - raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) - else: - import Tkinter - try: - Tkinter.Button() - except Tkinter.TclError as msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) + app_services = cdll.LoadLibrary(find_library("ApplicationServices")) - _tk_available = True + if app_services.CGMainDisplayID() == 0: + _tk_unavailable = "cannot run without OS X window manager" + else: + class ProcessSerialNumber(Structure): + _fields_ = [("highLongOfPSN", c_int), + ("lowLongOfPSN", c_int)] + psn = ProcessSerialNumber() + psn_p = pointer(psn) + if ( (app_services.GetCurrentProcess(psn_p) < 0) or + (app_services.SetFrontProcess(psn_p) < 0) ): + _tk_unavailable = "cannot run without OS X gui process" + else: # not OS X + import Tkinter + try: + Tkinter.Button() + except Tkinter.TclError as msg: + # assuming tk is not available + _tk_unavailable = "tk not available: %s" % msg + + if _tk_unavailable: + raise unittest.SkipTest(_tk_unavailable) return def is_package(path): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 6 04:12:12 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 06 Jul 2011 04:12:12 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzg3MTY6?= =?utf8?q?_Instead_of_relying_on_Aqua_Tk_exceptions_to_detect_lack_of?= Message-ID: http://hg.python.org/cpython/rev/b58b0c5c7e96 changeset: 71242:b58b0c5c7e96 branch: 3.2 parent: 71233:807921ba241d user: Ned Deily date: Tue Jul 05 19:09:37 2011 -0700 summary: Issue #8716: Instead of relying on Aqua Tk exceptions to detect lack of OS X window manager connection in tk tests, use OS X Application Services API calls instead. files: Lib/tkinter/test/support.py | 60 ++++++++++++++---------- 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py --- a/Lib/tkinter/test/support.py +++ b/Lib/tkinter/test/support.py @@ -1,38 +1,48 @@ -import subprocess import sys -from test import support import tkinter import unittest -_tk_available = None +_tk_unavailable = None def check_tk_availability(): """Check that Tk is installed and available.""" - global _tk_available + global _tk_unavailable - if _tk_available is not None: - return + if _tk_unavailable is None: + _tk_unavailable = False + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. To avoid that, raise an exception if the window manager + # connection is not available. + from ctypes import cdll, c_int, pointer, Structure + from ctypes.util import find_library - if sys.platform == 'darwin': - # The Aqua Tk implementations on OS X can abort the process if - # being called in an environment where a window server connection - # cannot be made, for instance when invoked by a buildbot or ssh - # process not running under the same user id as the current console - # user. Instead, try to initialize Tk under a subprocess. - p = subprocess.Popen( - [sys.executable, '-c', 'import tkinter; tkinter.Button()'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stderr = support.strip_python_stderr(p.communicate()[1]) - if stderr or p.returncode: - raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) - else: - try: - tkinter.Button() - except tkinter.TclError as msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) + app_services = cdll.LoadLibrary(find_library("ApplicationServices")) - _tk_available = True + if app_services.CGMainDisplayID() == 0: + _tk_unavailable = "cannot run without OS X window manager" + else: + class ProcessSerialNumber(Structure): + _fields_ = [("highLongOfPSN", c_int), + ("lowLongOfPSN", c_int)] + psn = ProcessSerialNumber() + psn_p = pointer(psn) + if ( (app_services.GetCurrentProcess(psn_p) < 0) or + (app_services.SetFrontProcess(psn_p) < 0) ): + _tk_unavailable = "cannot run without OS X gui process" + else: # not OS X + import tkinter + try: + tkinter.Button() + except tkinter.TclError as msg: + # assuming tk is not available + _tk_unavailable = "tk not available: %s" % msg + + if _tk_unavailable: + raise unittest.SkipTest(_tk_unavailable) return def get_tk_root(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 6 04:12:15 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 06 Jul 2011 04:12:15 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=238716=3A_Instead_of_relying_on_Aqua_Tk_exceptions_to?= =?utf8?q?_detect_lack_of?= Message-ID: http://hg.python.org/cpython/rev/2f7e353f9e83 changeset: 71243:2f7e353f9e83 parent: 71239:f362f0053eab parent: 71242:b58b0c5c7e96 user: Ned Deily date: Tue Jul 05 19:11:15 2011 -0700 summary: Issue #8716: Instead of relying on Aqua Tk exceptions to detect lack of OS X window manager connection in tk tests, use OS X Application Services API calls instead. files: Lib/tkinter/test/support.py | 60 ++++++++++++++---------- 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py --- a/Lib/tkinter/test/support.py +++ b/Lib/tkinter/test/support.py @@ -1,38 +1,48 @@ -import subprocess import sys -from test import support import tkinter import unittest -_tk_available = None +_tk_unavailable = None def check_tk_availability(): """Check that Tk is installed and available.""" - global _tk_available + global _tk_unavailable - if _tk_available is not None: - return + if _tk_unavailable is None: + _tk_unavailable = False + if sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. To avoid that, raise an exception if the window manager + # connection is not available. + from ctypes import cdll, c_int, pointer, Structure + from ctypes.util import find_library - if sys.platform == 'darwin': - # The Aqua Tk implementations on OS X can abort the process if - # being called in an environment where a window server connection - # cannot be made, for instance when invoked by a buildbot or ssh - # process not running under the same user id as the current console - # user. Instead, try to initialize Tk under a subprocess. - p = subprocess.Popen( - [sys.executable, '-c', 'import tkinter; tkinter.Button()'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stderr = support.strip_python_stderr(p.communicate()[1]) - if stderr or p.returncode: - raise unittest.SkipTest("tk cannot be initialized: %s" % stderr) - else: - try: - tkinter.Button() - except tkinter.TclError as msg: - # assuming tk is not available - raise unittest.SkipTest("tk not available: %s" % msg) + app_services = cdll.LoadLibrary(find_library("ApplicationServices")) - _tk_available = True + if app_services.CGMainDisplayID() == 0: + _tk_unavailable = "cannot run without OS X window manager" + else: + class ProcessSerialNumber(Structure): + _fields_ = [("highLongOfPSN", c_int), + ("lowLongOfPSN", c_int)] + psn = ProcessSerialNumber() + psn_p = pointer(psn) + if ( (app_services.GetCurrentProcess(psn_p) < 0) or + (app_services.SetFrontProcess(psn_p) < 0) ): + _tk_unavailable = "cannot run without OS X gui process" + else: # not OS X + import tkinter + try: + tkinter.Button() + except tkinter.TclError as msg: + # assuming tk is not available + _tk_unavailable = "tk not available: %s" % msg + + if _tk_unavailable: + raise unittest.SkipTest(_tk_unavailable) return def get_tk_root(): -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jul 6 05:08:56 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 06 Jul 2011 05:08:56 +0200 Subject: [Python-checkins] Daily reference leaks (f362f0053eab): sum=-77 Message-ID: results for f362f0053eab on branch "default" -------------------------------------------- test_concurrent_futures leaked [54, 0, -108] references, sum=-54 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [0, 0, -323] references, sum=-323 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogSK9znv', '-x'] From python-checkins at python.org Wed Jul 6 07:31:12 2011 From: python-checkins at python.org (georg.brandl) Date: Wed, 06 Jul 2011 07:31:12 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Revert_76452b892838_as_per?= Message-ID: http://hg.python.org/cpython/rev/71a1f53c8203 changeset: 71244:71a1f53c8203 user: Georg Brandl date: Wed Jul 06 07:31:38 2011 +0200 summary: Revert 76452b892838 as per http://mail.python.org/pipermail/python-dev/2011-July/112243.html. files: Lib/test/test_csv.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -459,20 +459,20 @@ '5', '6']]) def test_quoted_quote(self): - self.readerAssertEqual('1,2,3,"""I see,"" said the happy man","as he picked up his hammer and saw"', + self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', [['1', '2', '3', - '"I see," said the happy man', + '"I see," said the blind man', 'as he picked up his hammer and saw']]) def test_quoted_nl(self): input = '''\ 1,2,3,"""I see,"" -said the happy man","as he picked up his +said the blind man","as he picked up his hammer and saw" 9,8,7,6''' self.readerAssertEqual(input, [['1', '2', '3', - '"I see,"\nsaid the happy man', + '"I see,"\nsaid the blind man', 'as he picked up his\nhammer and saw'], ['9','8','7','6']]) -- Repository URL: http://hg.python.org/cpython From g.brandl at gmx.net Wed Jul 6 07:35:15 2011 From: g.brandl at gmx.net (Georg Brandl) Date: Wed, 06 Jul 2011 07:35:15 +0200 Subject: [Python-checkins] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: Message-ID: Am 06.07.2011 02:35, schrieb Guido van Rossum: > To clarify, now that I have access to an actual keyboard instead of > just a cellphone: I think it should be rolled back, since the proper > process for controversial changes was not followed. Our process (part > of our culture, if you will) for anything controversial is to discuss > the change first, then, if deemed necessary, fix the code. And from > the size of this thread it clearly is controversial. Georg, can you > please revert this change? Sure; done. > Note that another part of our process/culture is that we try not to > engage in battling commits, i.e. generally we don't unilaterally roll > back a change just to make the point that it is incorrect; we ask the > original committer to roll it back. > > As to the controversy itself, if you want to make blind people fell > more at home in the Python community surely there are more useful > things to do than to remove puns involving blindness; e.g. improve > accessibility of python.org or some part of it. Or maybe find some > blind programmers and ask them what would help them. Well, it was stated that even non-joking use of such words can offend (the example given was "your argument is blind to (these facts)"). I consider use in jokes to be more serious, since it's careless use. Sorry if I overreacted here. Georg From ncoghlan at gmail.com Wed Jul 6 08:49:32 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 6 Jul 2011 16:49:32 +1000 Subject: [Python-checkins] [Python-Dev] cpython: Remove mention of medical condition from the test suite. In-Reply-To: References: <87fwmldyyz.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On Wed, Jul 6, 2011 at 6:17 AM, Georg Brandl wrote: > For this test string, a) I'm not a native speaker and therefore don't know of > any special treatment this pun deserves It's not an especially *good* joke, just a very old one that plays on double meanings of both "see" (as in sight and understanding) and "saw" (as in sight and a tool). Still, I'd put it in the same category as the Monty Python quotes we have scattered around the test suite - if people came across them and didn't realise they were quotes they might be puzzled, but attempting to retain that Pythonesque sense of humour is itself part of what makes the Python community what it is. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From solipsis at pitrou.net Thu Jul 7 05:09:11 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 07 Jul 2011 05:09:11 +0200 Subject: [Python-checkins] Daily reference leaks (71a1f53c8203): sum=300 Message-ID: results for 71a1f53c8203 on branch "default" -------------------------------------------- test_concurrent_futures leaked [639, 0, -639] references, sum=0 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [-323, 323, 0] references, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog0fk6PV', '-x'] From python-checkins at python.org Thu Jul 7 13:59:39 2011 From: python-checkins at python.org (vinay.sajip) Date: Thu, 07 Jul 2011 13:59:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Closes_=2312391=3A_temporar?= =?utf8?q?y_files_are_now_cleaned_up=2E?= Message-ID: http://hg.python.org/cpython/rev/a4405b799e1b changeset: 71245:a4405b799e1b user: Vinay Sajip date: Thu Jul 07 12:59:31 2011 +0100 summary: Closes #12391: temporary files are now cleaned up. files: Lib/packaging/install.py | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/packaging/install.py b/Lib/packaging/install.py --- a/Lib/packaging/install.py +++ b/Lib/packaging/install.py @@ -42,10 +42,7 @@ :param files: a list of files to move. :param destination: the destination directory to put on the files. - if not defined, create a new one, using mkdtemp """ - if not destination: - destination = tempfile.mkdtemp() for old in files: filename = os.path.split(old)[-1] @@ -126,8 +123,11 @@ elif _is_archive_file(path): logger.info('Installing from archive: %s', path) _unpacked_dir = tempfile.mkdtemp() - shutil.unpack_archive(path, _unpacked_dir) - return _run_install_from_archive(_unpacked_dir) + try: + shutil.unpack_archive(path, _unpacked_dir) + return _run_install_from_archive(_unpacked_dir) + finally: + shutil.rmtree(_unpacked_dir) else: logger.warning('No projects to install.') return False @@ -179,8 +179,6 @@ :param path: base path to install distribution in :param paths: list of paths (defaults to sys.path) to look for info """ - if not path: - path = tempfile.mkdtemp() installed_dists = [] for dist in dists: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 7 14:08:54 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 07 Jul 2011 14:08:54 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_PEP_400=3A_Deprecate_codec?= =?utf8?q?s=2EStreamReader_and_codecs=2EStreamWriter?= Message-ID: http://hg.python.org/peps/rev/49565ae9b261 changeset: 3894:49565ae9b261 user: Victor Stinner date: Thu Jul 07 14:08:47 2011 +0200 summary: Add PEP 400: Deprecate codecs.StreamReader and codecs.StreamWriter files: pep-0400.txt | 323 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 323 insertions(+), 0 deletions(-) diff --git a/pep-0400.txt b/pep-0400.txt new file mode 100644 --- /dev/null +++ b/pep-0400.txt @@ -0,0 +1,323 @@ +PEP: 400 +Title: Deprecate codecs.StreamReader and codecs.StreamWriter +Version: $Revision$ +Last-Modified: $Date$ +Author: Victor Stinner +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 28-May-2011 +Python-Version: 3.3 + + +Abstract +======== + +io.TextIOWrapper and codecs.StreamReaderWriter offer the same API +[#f1]_. TextIOWrapper has more features and is faster than +StreamReaderWriter. Duplicate code means that bugs should be fixed +twice and that we may have subtle differences between the two +implementations. + +The codecs modules was introduced in Python 2.0, see the PEP 100. The +io module was introduced in Python 2.6 and 3.0 (see the PEP 3116), and +reimplemented in C in Python 2.7 and 3.1. + + +Motivation +========== + +When the Python I/O model was updated for 3.0, the concept of a +"stream-with-known-encoding" was introduced in the form of +io.TextIOWrapper. As this class is critical to the performance of +text-based I/O in Python 3, this module has an optimised C version +which is used by CPython by default. Many corner cases in handling +buffering, stateful codecs and universal newlines have been dealt with +since the release of Python 3.0. + +This new interface overlaps heavily with the legacy +codecs.StreamReader, codecs.StreamWriter and codecs.StreamReaderWriter +interfaces that were part of the original codec interface design in +PEP 100. These interfaces are organised around the principle of an +encoding with an associated stream (i.e. the reverse of arrangement in +the io module), so the original PEP 100 design required that codec +writers provide appropriate StreamReader and StreamWriter +implementations in addition to the core codec encode() and decode() +methods. This places a heavy burden on codec authors providing these +specialised implementations to correctly handle many of the corner +cases that have now been dealt with by io.TextIOWrapper. While deeper +integration between the codec and the stream allows for additional +optimisations in theory, these optimisations have in practice either +not been carried out and else the associated code duplication means +that the corner cases that have been fixed in io.TextIOWrapper are +still not handled correctly in the various StreamReader and +StreamWriter implementations. + +Accordingly, this PEP proposes that: + +* codecs.open() be updated to delegate to the builtin open() in Python + 3.3; +* the legacy codecs.Stream* interfaces, including the streamreader and + streamwriter attributes of codecs.CodecInfo be deprecated in Python + 3.3 and removed in Python 3.4. + + +Rationale +========= + +StreamReader and StreamWriter issues +'''''''''''''''''''''''''''''''''''' + + * StreamReader is unable to translate newlines. + * StreamReaderWriter handles reads using StreamReader and writes + using StreamWriter. These two classes may be inconsistent. To stay + consistent, flush() must be called after each write which slows + down interlaced read-write. + * StreamWriter doesn't support "line buffering" (flush if the input + text contains a newline). + * StreamReader classes of the CJK encodings (e.g. GB18030) don't + support universal newlines, only UNIX newlines ('\\n'). + * StreamReader and StreamWriter are stateful codecs but don't expose + functions to control their state (getstate() or setstate()). Each + codec has to implement corner cases, see "Issue with stateful + codecs". + * StreamReader and StreamWriter are very similar to IncrementalReader + and IncrementalEncoder, some code is duplicated for stateful codecs + (e.g. UTF-16). + * Each codec has to reimplement its own StreamReader and StreamWriter + class, even if it's trivial (just call the encoder/decoder). + * codecs.open(filename, "r") creates a io.TextIOWrapper object. + * No codec implements an optimized method in StreamReader or + StreamWriter based on the specificities of the codec. + +Other issues in the bug tracker: + + * `Issue #5445 `_ (2009-03-08): + codecs.StreamWriter.writelines problem when passed generator + * `Issue #7262: `_ (2009-11-04): + codecs.open() + eol (windows) + * `Issue #8260 `_ (2010-03-29): + When I use codecs.open(...) and f.readline() follow up by f.read() + return bad result + * `Issue #8630 `_ (2010-05-05): + Keepends param in codec readline(s) + * `Issue #10344 `_ (2010-11-06): + codecs.readline doesn't care buffering + * `Issue #11461 `_ (2011-03-10): + Reading UTF-16 with codecs.readline() breaks on surrogate pairs + * `Issue #12446 `_ (2011-06-30): + StreamReader Readlines behavior odd + * `Issue #12508 `_ (2011-07-06): + Codecs Anomaly + * `Issue #12512 `_ (2011-07-07): + codecs: StreamWriter issues with stateful codecs after a seek or + with append mode + +TextIOWrapper features +'''''''''''''''''''''' + + * TextIOWrapper supports any kind of newline, including translating + newlines (to UNIX newlines), to read and write. + * TextIOWrapper reuses incremental encoders and decoders (no + duplication of code). + * The io module (TextIOWrapper) is faster than the codecs module + (StreamReader). It is implemented in C, whereas codecs is + implemented in Python. + * TextIOWrapper has a readahead algorithm which speeds up small + reads: read character by character or line by line (io is 10x + through 25x faster than codecs on these operations). + * TextIOWrapper has a write buffer. + * TextIOWrapper.tell() is optimized. + * TextIOWrapper supports random access (read+write) using a single + class which permit to optimize interlaced read-write (but no such + optimization is implemented). + +TextIOWrapper issues +'''''''''''''''''''' + + * `Issue #12213 `_ (2011-05-30): + BufferedRandom, BufferedRWPair: issues with interlaced read-write + * `Issue #12215 `_ (2011-05-30): + TextIOWrapper: issues with interlaced read-write + +Possible improvements of StreamReader and StreamWriter +'''''''''''''''''''''''''''''''''''''''''''''''''''''' + +It would be possible to add functions to StreamReader and StreamWriter +to give access to the state of codec. And so it would be possible fix +issues with stateful codecs in a base class instead of having to fix +them is each stateful StreamReader and StreamWriter classes. + +It would be possible to change StreamReader and StreamWriter to make +them use IncrementalDecoder and IncrementalEncoder. + +A codec can implement variants which are optimized for the specific +encoding or intercept certain stream methods to add functionality or +improve the encoding/decoding performance. TextIOWrapper cannot +implement such optimization, but TextIOWrapper uses incremental +encoders and decoders and uses read and write buffers, so the overhead +of incomplete inputs is low or nul. + +A lot more could be done for other variable length encoding codecs, +e.g. UTF-8, since these often have problems near the end of a read due +to missing bytes. The UTF-32-BE/LE codecs could simply multiply the +character position by 4 to get the byte position. + + +Usage of StreamReader and StreamWriter +'''''''''''''''''''''''''''''''''''''' + +These classes are rarely used directly, but indirectly using +codecs.open(). They are not used in Python 3 standard library (except +in the codecs module). + +Some projects implement their own codec with StreamReader and +StreamWriter, but don't use these classes. + + +Backwards Compatibility +======================= + +Keep the public API, codecs.open +'''''''''''''''''''''''''''''''' + +codecs.open() can be replaced by the builtin open() function. open() +has a similar API but has also more options. + +codecs.open() was the only way to open a text file in Unicode mode +until Python 2.6. Many Python 2 programs uses this function. Removing +codecs.open() implies more work to port programs from Python 2 to +Python 3, especially projets using the same code base for the two +Python versions (without using 2to3 program). + +codecs.open() is kept for backward compatibility with Python 2. + + +Deprecate StreamReader and StreamWriter +''''''''''''''''''''''''''''''''''''''' + +Instanciate StreamReader or StreamWriter must raise a +DeprecationWarning in Python 3.3. Implement a subclass don't raise a +DeprecationWarning. + +codecs.open() will be changed to reuse the builtin open() function +(TextIOWrapper). + +EncodedFile(), StreamRandom, StreamReader, StreamReaderWriter and +StreamWriter will be removed in Python 3.4. + + +Issue with stateful codecs +========================== + +It is difficult to use correctly a stateful codec with a stream. Some +cases are supported by the codecs module, while io has no more known +bug related to stateful codecs. The main difference between the codecs +and the io module is that bugs have to be fixed in StreamReader and/or +StreamWriter classes of each codec for the codecs module, whereas bugs +can be fixed only once in io.TextIOWrapper. Here are some examples of +issues with stateful codecs. + +Stateful codecs +''''''''''''''' + +Python supports the following stateful codecs: + + * cp932 + * cp949 + * cp950 + * euc_jis_2004 + * euc_jisx2003 + * euc_jp + * euc_kr + * gb18030 + * gbk + * hz + * iso2022_jp + * iso2022_jp_1 + * iso2022_jp_2 + * iso2022_jp_2004 + * iso2022_jp_3 + * iso2022_jp_ext + * iso2022_kr + * shift_jis + * shift_jis_2004 + * shift_jisx0213 + * utf_8_sig + * utf_16 + * utf_32 + +Read and seek(0) +'''''''''''''''' + +:: + + with open(filename, 'w', encoding='utf-16') as f: + f.write('abc') + f.write('def') + f.seek(0) + assert f.read() == 'abcdef' + f.seek(0) + assert f.read() == 'abcdef' + +The io and codecs modules support this usecase correctly. + +seek(n) +''''''' + +:: + + with open(filename, 'w', encoding='utf-16') as f: + f.write('abc') + pos = f.tell() + with open(filename, 'w', encoding='utf-16') as f: + f.seek(pos) + f.write('def') + f.seek(0) + f.write('###') + with open(filename, 'r', encoding='utf-16') as f: + assert f.read() == '###def' + +The io module supports this usecase, whereas codecs fails because it +writes a new BOM on the second write (issue #12512). + +Append mode +''''''''''' + +:: + + with open(filename, 'w', encoding='utf-16') as f: + f.write('abc') + with open(filename, 'a', encoding='utf-16') as f: + f.write('def') + with open(filename, 'r', encoding='utf-16') as f: + assert f.read() == 'abcdef' + +The io module supports this usecase, whereas codecs fails because it +writes a new BOM on the second write (issue #12512). + + +Links +===== + + * `PEP 100: Python Unicode Integration + `_ + * `PEP 3116 `_ + * `Issue #8796: Deprecate codecs.open() + `_ + * `[python-dev] Deprecate codecs.open() and StreamWriter/StreamReader + `_ + + +Copyright +========= + +This document has been placed in the public domain. + + +Footnotes +========= + +.. [#f1] StreamReaderWriter has two more attributes than + TextIOWrapper, reader and writer. + -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 7 14:40:52 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 07 Jul 2011 14:40:52 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_PEP_400=3A_typo?= Message-ID: http://hg.python.org/peps/rev/bd79ad755ca2 changeset: 3895:bd79ad755ca2 user: Victor Stinner date: Thu Jul 07 14:40:48 2011 +0200 summary: PEP 400: typo files: pep-0400.txt | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pep-0400.txt b/pep-0400.txt --- a/pep-0400.txt +++ b/pep-0400.txt @@ -19,7 +19,7 @@ twice and that we may have subtle differences between the two implementations. -The codecs modules was introduced in Python 2.0, see the PEP 100. The +The codecs module was introduced in Python 2.0, see the PEP 100. The io module was introduced in Python 2.6 and 3.0 (see the PEP 3116), and reimplemented in C in Python 2.7 and 3.1. @@ -143,10 +143,10 @@ Possible improvements of StreamReader and StreamWriter '''''''''''''''''''''''''''''''''''''''''''''''''''''' -It would be possible to add functions to StreamReader and StreamWriter -to give access to the state of codec. And so it would be possible fix -issues with stateful codecs in a base class instead of having to fix -them is each stateful StreamReader and StreamWriter classes. +By adding codec state read/write functions to the StreamReader and +StreamWriter classes, it will become possible to fix issues with +stateful codecs in a base class instead of in each stateful +StreamReader and StreamWriter classes. It would be possible to change StreamReader and StreamWriter to make them use IncrementalDecoder and IncrementalEncoder. @@ -196,9 +196,9 @@ Deprecate StreamReader and StreamWriter ''''''''''''''''''''''''''''''''''''''' -Instanciate StreamReader or StreamWriter must raise a -DeprecationWarning in Python 3.3. Implement a subclass don't raise a -DeprecationWarning. +Instanciating StreamReader or StreamWriter must raise a +DeprecationWarning in Python 3.3. Implementing a subclass doesn't +raise a DeprecationWarning. codecs.open() will be changed to reuse the builtin open() function (TextIOWrapper). -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 7 15:15:20 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 07 Jul 2011 15:15:20 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_PEP_400=3A_update_interlaced_r?= =?utf8?q?ead-write_issues?= Message-ID: http://hg.python.org/peps/rev/472453d5bbb3 changeset: 3896:472453d5bbb3 user: Victor Stinner date: Thu Jul 07 15:15:17 2011 +0200 summary: PEP 400: update interlaced read-write issues Note: Issue #12213 doesn't concern TextIOWrapper, it concerns Buffered* classes which are also used by the codecs module. files: pep-0400.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0400.txt b/pep-0400.txt --- a/pep-0400.txt +++ b/pep-0400.txt @@ -112,6 +112,8 @@ * `Issue #12512 `_ (2011-07-07): codecs: StreamWriter issues with stateful codecs after a seek or with append mode + * `Issue #12513 `_ (2011-07-07): + codec.StreamReaderWriter: issues with interlaced read-write TextIOWrapper features '''''''''''''''''''''' @@ -135,8 +137,6 @@ TextIOWrapper issues '''''''''''''''''''' - * `Issue #12213 `_ (2011-05-30): - BufferedRandom, BufferedRWPair: issues with interlaced read-write * `Issue #12215 `_ (2011-05-30): TextIOWrapper: issues with interlaced read-write -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jul 8 01:10:39 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 01:10:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=239566=3A_cast_unsig?= =?utf8?q?ned_int_to_Py=5Fssize=5Ft_in_md5_and_sha1_modules?= Message-ID: http://hg.python.org/cpython/rev/43fd627cc060 changeset: 71246:43fd627cc060 user: Victor Stinner date: Fri Jul 08 01:10:28 2011 +0200 summary: Issue #9566: cast unsigned int to Py_ssize_t in md5 and sha1 modules Fix a compiler warning on Windows 64 bits. files: Modules/md5module.c | 2 +- Modules/sha1module.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/md5module.c b/Modules/md5module.c --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -243,7 +243,7 @@ in += MD5_BLOCKSIZE; inlen -= MD5_BLOCKSIZE; } else { - n = MIN(inlen, (MD5_BLOCKSIZE - md5->curlen)); + n = MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen)); memcpy(md5->buf + md5->curlen, in, (size_t)n); md5->curlen += n; in += n; diff --git a/Modules/sha1module.c b/Modules/sha1module.c --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -218,7 +218,7 @@ in += SHA1_BLOCKSIZE; inlen -= SHA1_BLOCKSIZE; } else { - n = MIN(inlen, (SHA1_BLOCKSIZE - sha1->curlen)); + n = MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen)); memcpy(sha1->buf + sha1->curlen, in, (size_t)n); sha1->curlen += n; in += n; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 01:45:23 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 01:45:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312016=3A_Multibyte?= =?utf8?q?_CJK_decoders_now_resynchronize_faster?= Message-ID: http://hg.python.org/cpython/rev/16cbd84de848 changeset: 71247:16cbd84de848 user: Victor Stinner date: Fri Jul 08 01:45:13 2011 +0200 summary: Issue #12016: Multibyte CJK decoders now resynchronize faster They only ignore the first byte of an invalid byte sequence. For example, b'\xff\n'.decode('gb2312', 'replace') gives '\ufffd\n' instead of '\ufffd'. files: Doc/whatsnew/3.3.rst | 23 ++++ Lib/test/test_codecencodings_cn.py | 21 ++- Lib/test/test_codecencodings_hk.py | 4 +- Lib/test/test_codecencodings_jp.py | 96 +++++++++++------ Lib/test/test_codecencodings_kr.py | 25 ++- Lib/test/test_codecencodings_tw.py | 4 +- Lib/test/test_codecmaps_tw.py | 3 + Misc/NEWS | 4 + Modules/cjkcodecs/_codecs_cn.c | 14 +- Modules/cjkcodecs/_codecs_hk.c | 2 +- Modules/cjkcodecs/_codecs_jp.c | 34 +++--- Modules/cjkcodecs/_codecs_kr.c | 18 +- Modules/cjkcodecs/_codecs_tw.c | 4 +- 13 files changed, 159 insertions(+), 93 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -68,6 +68,29 @@ * Stub +codecs +------ + +Multibyte CJK decoders now resynchronize faster. They only ignore the first +byte of an invalid byte sequence. For example, b'\xff\n'.decode('gb2312', +'replace') gives '?\n' instead of '?'. + +(http://bugs.python.org/issue12016) + +Don't reset incremental encoders of CJK codecs at each call to their encode() +method anymore. For example: :: + + $ ./python -q + >>> import codecs + >>> encoder = codecs.getincrementalencoder('hz')('strict') + >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.') + b'~{NpJ)l6HK!#~} Bye.' + +This example gives b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.' with older Python +versions. + +(http://bugs.python.org/issue12100) + faulthandler ------------ diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x81\x81\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x81\x81\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x81\x81\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x81\x81\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x81\x81\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x81\x81\xc1\xc4", "ignore", "abc\u804a"), (b"\xc1\x64", "strict", None), ) @@ -28,8 +28,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), (b"\x83\x34\x83\x31", "strict", None), ("\u30fb", "strict", None), @@ -42,11 +42,14 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), - (b"abc\x84\x39\x84\x39\xc1\xc4", "replace", "abc\ufffd\u804a"), + (b"abc\x84\x39\x84\x39\xc1\xc4", "replace", "abc\ufffd9\ufffd9\u804a"), ("\u30fb", "strict", b"\x819\xa79"), + (b"abc\x84\x32\x80\x80def", "replace", 'abc\ufffd2\ufffd\ufffddef'), + (b"abc\x81\x30\x81\x30def", "strict", 'abc\x80def'), + (b"abc\x86\x30\x81\x30def", "replace", 'abc\ufffd0\ufffd0def'), ) has_iso10646 = True @@ -74,9 +77,11 @@ '\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' 'Bye.\n'), # invalid bytes - (b'ab~cd', 'replace', 'ab\uFFFDd'), + (b'ab~cd', 'replace', 'ab\uFFFDcd'), (b'ab\xffcd', 'replace', 'ab\uFFFDcd'), (b'ab~{\x81\x81\x41\x44~}cd', 'replace', 'ab\uFFFD\uFFFD\u804Acd'), + (b'ab~{\x41\x44~}cd', 'replace', 'ab\u804Acd'), + (b"ab~{\x79\x79\x41\x44~}cd", "replace", "ab\ufffd\ufffd\u804acd"), ) def test_main(): diff --git a/Lib/test/test_codecencodings_hk.py b/Lib/test/test_codecencodings_hk.py --- a/Lib/test/test_codecencodings_hk.py +++ b/Lib/test/test_codecencodings_hk.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py --- a/Lib/test/test_codecencodings_jp.py +++ b/Lib/test/test_codecencodings_jp.py @@ -15,50 +15,57 @@ # invalid bytes (b"abc\x81\x00\x81\x00\x82\x84", "strict", None), (b"abc\xf8", "strict", None), - (b"abc\x81\x00\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - (b"abc\x81\x00\x82\x84", "ignore", "abc\uff44"), + (b"abc\x81\x00\x82\x84", "replace", "abc\ufffd\x00\uff44"), + (b"abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\x00\uff44\ufffd"), + (b"abc\x81\x00\x82\x84", "ignore", "abc\x00\uff44"), + (b"ab\xEBxy", "replace", "ab\uFFFDxy"), + (b"ab\xF0\x39xy", "replace", "ab\uFFFD9xy"), + (b"ab\xEA\xF0xy", "replace", 'ab\ufffd\ue038y'), # sjis vs cp932 (b"\\\x7e", "replace", "\\\x7e"), (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\uff3c\u2225\uff0d"), ) +euc_commontests = ( + # invalid bytes + (b"abc\x80\x80\xc1\xc4", "strict", None), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u7956"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u7956\ufffd"), + (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + (b"abc\xc8", "strict", None), + (b"abc\x8f\x83\x83", "replace", "abc\ufffd\ufffd\ufffd"), + (b"\x82\xFCxy", "replace", "\ufffd\ufffdxy"), + (b"\xc1\x64", "strict", None), + (b"\xa1\xc0", "strict", "\uff3c"), + (b"\xa1\xc0\\", "strict", "\uff3c\\"), + (b"\x8eXY", "replace", "\ufffdXY"), +) + +class Test_EUC_JIS_2004(test_multibytecodec_support.TestBase, + unittest.TestCase): + encoding = 'euc_jis_2004' + tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') + codectests = euc_commontests + xmlcharnametest = ( + "\xab\u211c\xbb = \u2329\u1234\u232a", + b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" + ) + class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'euc_jisx0213' tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') - codectests = ( - # invalid bytes - (b"abc\x80\x80\xc1\xc4", "strict", None), - (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), - (b"\xc1\x64", "strict", None), - (b"\xa1\xc0", "strict", "\uff3c"), - ) + codectests = euc_commontests xmlcharnametest = ( "\xab\u211c\xbb = \u2329\u1234\u232a", b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" ) -eucjp_commontests = ( - (b"abc\x80\x80\xc1\xc4", "strict", None), - (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), - (b"\xc1\x64", "strict", None), -) - class Test_EUC_JP_COMPAT(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'euc_jp' tstring = test_multibytecodec_support.load_teststring('euc_jp') - codectests = eucjp_commontests + ( - (b"\xa1\xc0\\", "strict", "\uff3c\\"), + codectests = euc_commontests + ( ("\xa5", "strict", b"\x5c"), ("\u203e", "strict", b"\x7e"), ) @@ -66,8 +73,6 @@ shiftjis_commonenctests = ( (b"abc\x80\x80\x82\x84", "strict", None), (b"abc\xf8", "strict", None), - (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), ) @@ -75,20 +80,41 @@ encoding = 'shift_jis' tstring = test_multibytecodec_support.load_teststring('shift_jis') codectests = shiftjis_commonenctests + ( + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\ufffd\uff44\ufffd"), + (b"\\\x7e", "strict", "\\\x7e"), (b"\x81\x5f\x81\x61\x81\x7c", "strict", "\uff3c\u2016\u2212"), + (b"abc\x81\x39", "replace", "abc\ufffd9"), + (b"abc\xEA\xFC", "replace", "abc\ufffd\ufffd"), + (b"abc\xFF\x58", "replace", "abc\ufffdX"), + ) + +class Test_SJIS_2004(test_multibytecodec_support.TestBase, unittest.TestCase): + encoding = 'shift_jis_2004' + tstring = test_multibytecodec_support.load_teststring('shift_jis') + codectests = shiftjis_commonenctests + ( + (b"\\\x7e", "strict", "\xa5\u203e"), + (b"\x81\x5f\x81\x61\x81\x7c", "strict", "\\\u2016\u2212"), + (b"abc\xEA\xFC", "strict", "abc\u64bf"), + (b"\x81\x39xy", "replace", "\ufffd9xy"), + (b"\xFF\x58xy", "replace", "\ufffdXxy"), + (b"\x80\x80\x82\x84xy", "replace", "\ufffd\ufffd\uff44xy"), + (b"\x80\x80\x82\x84\x88xy", "replace", "\ufffd\ufffd\uff44\u5864y"), + (b"\xFC\xFBxy", "replace", '\ufffd\u95b4y'), + ) + xmlcharnametest = ( + "\xab\u211c\xbb = \u2329\u1234\u232a", + b"\x85Gℜ\x85Q = ⟨ሴ⟩" ) class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'shift_jisx0213' tstring = test_multibytecodec_support.load_teststring('shift_jisx0213') - codectests = ( - # invalid bytes - (b"abc\x80\x80\x82\x84", "strict", None), - (b"abc\xf8", "strict", None), - (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), + codectests = shiftjis_commonenctests + ( + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\ufffd\uff44\ufffd"), + # sjis vs cp932 (b"\\\x7e", "replace", "\xa5\u203e"), (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\x5c\u2016\u2212"), diff --git a/Lib/test/test_codecencodings_kr.py b/Lib/test/test_codecencodings_kr.py --- a/Lib/test/test_codecencodings_kr.py +++ b/Lib/test/test_codecencodings_kr.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\uc894"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), ) @@ -27,8 +27,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", 'abc\ufffd\ufffd\uc894'), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), # composed make-up sequence errors @@ -40,13 +40,14 @@ (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "strict", "\uc4d4"), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4x", "strict", "\uc4d4x"), - (b"a\xa4\xd4\xa4\xb6\xa4", "replace", "a\ufffd"), + (b"a\xa4\xd4\xa4\xb6\xa4", "replace", 'a\ufffd'), (b"\xa4\xd4\xa3\xb6\xa4\xd0\xa4\xd4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa3\xd0\xa4\xd4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa3\xd4", "strict", None), - (b"\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", "\ufffd"), - (b"\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", "\ufffd"), - (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", "\ufffd"), + (b"\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", '\ufffd\u6e21\ufffd\u3160\ufffd'), + (b"\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", '\ufffd\u6e21\ub544\ufffd\ufffd'), + (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", '\ufffd\u6e21\ub544\u572d\ufffd'), + (b"\xa4\xd4\xff\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "replace", '\ufffd\ufffd\ufffd\uc4d4'), (b"\xc1\xc4", "strict", "\uc894"), ) @@ -57,9 +58,13 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ucd27"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ucd27\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\ucd27"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\ucd27\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\ucd27"), + (b"\xD8abc", "replace", "\uFFFDabc"), + (b"\xD8\xFFabc", "replace", "\uFFFD\uFFFDabc"), + (b"\x84bxy", "replace", "\uFFFDbxy"), + (b"\x8CBxy", "replace", "\uFFFDBxy"), ) def test_main(): diff --git a/Lib/test/test_codecencodings_tw.py b/Lib/test/test_codecencodings_tw.py --- a/Lib/test/test_codecencodings_tw.py +++ b/Lib/test/test_codecencodings_tw.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) diff --git a/Lib/test/test_codecmaps_tw.py b/Lib/test/test_codecmaps_tw.py --- a/Lib/test/test_codecmaps_tw.py +++ b/Lib/test/test_codecmaps_tw.py @@ -23,6 +23,9 @@ (b'\xa2\xcc', '\u5341'), (b'\xa2\xce', '\u5345'), ] + codectests = ( + (b"\xFFxy", "replace", "\ufffdxy"), + ) def test_main(): support.run_unittest(__name__) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,10 @@ Library ------- +- Issue #12016: Multibyte CJK decoders now resynchronize faster. They only + ignore the first byte of an invalid byte sequence. For example, + b'\xff\n'.decode('gb2312', 'replace') gives '\ufffd\n' instead of '\ufffd'. + - Issue #12459: time.sleep() now raises a ValueError if the sleep length is negative, instead of an infinite sleep on Windows or raising an IOError on Linux for example, to have the same behaviour on all platforms. diff --git a/Modules/cjkcodecs/_codecs_cn.c b/Modules/cjkcodecs/_codecs_cn.c --- a/Modules/cjkcodecs/_codecs_cn.c +++ b/Modules/cjkcodecs/_codecs_cn.c @@ -85,7 +85,7 @@ TRYMAP_DEC(gb2312, **outbuf, c ^ 0x80, IN2 ^ 0x80) { NEXT(2, 1) } - else return 2; + else return 1; } return 0; @@ -141,7 +141,7 @@ REQUIRE_INBUF(2) GBK_DECODE(c, IN2, **outbuf) - else return 2; + else return 1; NEXT(2, 1) } @@ -267,7 +267,7 @@ c3 = IN3; c4 = IN4; if (c < 0x81 || c3 < 0x81 || c4 < 0x30 || c4 > 0x39) - return 4; + return 1; c -= 0x81; c2 -= 0x30; c3 -= 0x81; c4 -= 0x30; @@ -292,12 +292,12 @@ continue; } } - return 4; + return 1; } GBK_DECODE(c, c2, **outbuf) else TRYMAP_DEC(gb18030ext, **outbuf, c, c2); - else return 2; + else return 1; NEXT(2, 1) } @@ -400,7 +400,7 @@ else if (c2 == '\n') ; /* line-continuation */ else - return 2; + return 1; NEXT(2, 0); continue; } @@ -419,7 +419,7 @@ NEXT(2, 1) } else - return 2; + return 1; } } diff --git a/Modules/cjkcodecs/_codecs_hk.c b/Modules/cjkcodecs/_codecs_hk.c --- a/Modules/cjkcodecs/_codecs_hk.c +++ b/Modules/cjkcodecs/_codecs_hk.c @@ -161,7 +161,7 @@ case 0x8864: WRITE2(0x00ca, 0x030c); break; case 0x88a3: WRITE2(0x00ea, 0x0304); break; case 0x88a5: WRITE2(0x00ea, 0x030c); break; - default: return 2; + default: return 1; } NEXT(2, 2) /* all decoded codepoints are pairs, above. */ diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c --- a/Modules/cjkcodecs/_codecs_jp.c +++ b/Modules/cjkcodecs/_codecs_jp.c @@ -112,7 +112,7 @@ TRYMAP_DEC(cp932ext, **outbuf, c, c2); else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -120,7 +120,7 @@ c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; TRYMAP_DEC(jisx0208, **outbuf, c, c2); - else return 2; + else return 1; } else if (c >= 0xf0 && c <= 0xf9) { if ((c2 >= 0x40 && c2 <= 0x7e) || @@ -128,10 +128,10 @@ OUT1(0xe000 + 188 * (c - 0xf0) + (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41)) else - return 2; + return 1; } else - return 2; + return 1; NEXT(2, 1) } @@ -256,7 +256,7 @@ NEXT(2, 1) } else - return 2; + return 1; } else if (c == 0x8f) { unsigned char c2, c3; @@ -274,7 +274,7 @@ continue; } else TRYMAP_DEC(jisx0212, **outbuf, c2, c3) ; - else return 3; + else return 1; NEXT(3, 1) } else { @@ -300,7 +300,7 @@ NEXT(2, 2) continue; } - else return 2; + else return 1; NEXT(2, 1) } } @@ -388,7 +388,7 @@ NEXT(2, 1) } else - return 2; + return 1; } else if (c == 0x8f) { unsigned char c2, c3; @@ -401,7 +401,7 @@ NEXT(3, 1) } else - return 3; + return 1; } else { unsigned char c2; @@ -417,7 +417,7 @@ #endif TRYMAP_DEC(jisx0208, **outbuf, c ^ 0x80, c2 ^ 0x80) ; - else return 2; + else return 1; NEXT(2, 1) } } @@ -502,7 +502,7 @@ REQUIRE_INBUF(2) c2 = IN2; if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -522,10 +522,10 @@ continue; } else - return 2; + return 1; } else - return 2; + return 1; NEXT(1, 1) /* JIS X 0201 */ } @@ -645,7 +645,7 @@ REQUIRE_INBUF(2) c2 = IN2; if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -671,7 +671,7 @@ NEXT_OUT(2) } else - return 2; + return 1; NEXT_IN(2) } else { /* Plane 2 */ @@ -689,13 +689,13 @@ continue; } else - return 2; + return 1; NEXT(2, 1) } continue; } else - return 2; + return 1; NEXT(1, 1) /* JIS X 0201 */ } diff --git a/Modules/cjkcodecs/_codecs_kr.c b/Modules/cjkcodecs/_codecs_kr.c --- a/Modules/cjkcodecs/_codecs_kr.c +++ b/Modules/cjkcodecs/_codecs_kr.c @@ -123,7 +123,7 @@ if ((*inbuf)[2] != EUCKR_JAMO_FIRSTBYTE || (*inbuf)[4] != EUCKR_JAMO_FIRSTBYTE || (*inbuf)[6] != EUCKR_JAMO_FIRSTBYTE) - return 8; + return 1; c = (*inbuf)[3]; if (0xa1 <= c && c <= 0xbe) @@ -143,7 +143,7 @@ jong = NONE; if (cho == NONE || jung == NONE || jong == NONE) - return 8; + return 1; OUT1(0xac00 + cho*588 + jung*28 + jong); NEXT(8, 1) @@ -152,7 +152,7 @@ NEXT(2, 1) } else - return 2; + return 1; } return 0; @@ -208,7 +208,7 @@ REQUIRE_INBUF(2) TRYMAP_DEC(ksx1001, **outbuf, c ^ 0x80, IN2 ^ 0x80); else TRYMAP_DEC(cp949ext, **outbuf, c, IN2); - else return 2; + else return 1; NEXT(2, 1) } @@ -375,7 +375,7 @@ i_jong = johabidx_jongseong[c_jong]; if (i_cho == NONE || i_jung == NONE || i_jong == NONE) - return 2; + return 1; /* we don't use U+1100 hangul jamo yet. */ if (i_cho == FILL) { @@ -391,7 +391,7 @@ OUT1(0x3100 | johabjamo_jungseong[c_jung]) else - return 2; + return 1; } } else { if (i_jung == FILL) { @@ -399,7 +399,7 @@ OUT1(0x3100 | johabjamo_choseong[c_cho]) else - return 2; + return 1; } else OUT1(0xac00 + @@ -414,7 +414,7 @@ c2 < 0x31 || (c2 >= 0x80 && c2 < 0x91) || (c2 & 0x7f) == 0x7f || (c == 0xda && (c2 >= 0xa1 && c2 <= 0xd3))) - return 2; + return 1; else { unsigned char t1, t2; @@ -425,7 +425,7 @@ t2 = (t2 < 0x5e ? t2 : t2 - 0x5e) + 0x21; TRYMAP_DEC(ksx1001, **outbuf, t1, t2); - else return 2; + else return 1; NEXT(2, 1) } } diff --git a/Modules/cjkcodecs/_codecs_tw.c b/Modules/cjkcodecs/_codecs_tw.c --- a/Modules/cjkcodecs/_codecs_tw.c +++ b/Modules/cjkcodecs/_codecs_tw.c @@ -55,7 +55,7 @@ TRYMAP_DEC(big5, **outbuf, c, IN2) { NEXT(2, 1) } - else return 2; + else return 1; } return 0; @@ -109,7 +109,7 @@ TRYMAP_DEC(cp950ext, **outbuf, c, IN2); else TRYMAP_DEC(big5, **outbuf, c, IN2); - else return 2; + else return 1; NEXT(2, 1) } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 02:08:03 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 02:08:03 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogQ2xvc2UgIzEyNTAx?= =?utf8?q?=3A_Adjust_callable=28=29_warning=3A_callable=28=29_is_only_not_?= =?utf8?q?supported_in?= Message-ID: http://hg.python.org/cpython/rev/1f814faaf54d changeset: 71248:1f814faaf54d branch: 2.7 parent: 71241:b5ac5e25d506 user: Victor Stinner date: Fri Jul 08 02:07:45 2011 +0200 summary: Close #12501: Adjust callable() warning: callable() is only not supported in Python 3.1. callable() is again supported in Python 3.2. files: Lib/test/test_builtin.py | 1 + Misc/NEWS | 3 +++ Python/bltinmodule.c | 2 +- 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1683,6 +1683,7 @@ def _run_unittest(*args): with check_py3k_warnings( + (".+ not supported in 3.1", DeprecationWarning), (".+ not supported in 3.x", DeprecationWarning), (".+ is renamed to imp.reload", DeprecationWarning), ("classic int division", DeprecationWarning)): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #12501: Adjust callable() warning: callable() is only not supported in + Python 3.1. callable() is again supported in Python 3.2. + - Issue #9611, #9015: FileIO.read(), FileIO.readinto(), FileIO.write() and os.write() clamp the length to INT_MAX on Windows. diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -224,7 +224,7 @@ static PyObject * builtin_callable(PyObject *self, PyObject *v) { - if (PyErr_WarnPy3k("callable() not supported in 3.x; " + if (PyErr_WarnPy3k("callable() not supported in 3.1; " "use isinstance(x, collections.Callable)", 1) < 0) return NULL; return PyBool_FromLong((long)PyCallable_Check(v)); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 02:27:17 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 02:27:17 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDIz?= =?utf8?q?=3A_Fix_os=2Eabort=28=29_documentation?= Message-ID: http://hg.python.org/cpython/rev/1ac21a715c5d changeset: 71249:1ac21a715c5d branch: 2.7 user: Victor Stinner date: Fri Jul 08 02:14:55 2011 +0200 summary: Issue #12423: Fix os.abort() documentation The Python signal handler for SIGABRT is not called on os.abort() (only if the signal is raised manually or sent by another process). Patch by Kamil Kisiel. files: Doc/ACKS.txt | 3 ++- Doc/library/os.rst | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -103,6 +103,7 @@ * Robert Kern * Jim Kerr * Jan Kim + * Kamil Kisiel * Greg Kochanski * Guido Kollerie * Peter A. Koren @@ -139,7 +140,7 @@ * Ross Moore * Sjoerd Mullender * Dale Nagata - * Michal Nowikowski + * Michal Nowikowski * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1666,8 +1666,9 @@ Generate a :const:`SIGABRT` signal to the current process. On Unix, the default behavior is to produce a core dump; on Windows, the process immediately returns - an exit code of ``3``. Be aware that programs which use :func:`signal.signal` - to register a handler for :const:`SIGABRT` will behave differently. + an exit code of ``3``. Be aware that calling this function will not call the + Python signal handler registered for :const:`SIGABRT` with + :func:`signal.signal`. Availability: Unix, Windows. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 02:27:18 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 02:27:18 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDIz?= =?utf8?q?=3A_Fix_os=2Eabort=28=29_documentation?= Message-ID: http://hg.python.org/cpython/rev/4e83d8f6d496 changeset: 71250:4e83d8f6d496 branch: 3.2 parent: 71242:b58b0c5c7e96 user: Victor Stinner date: Fri Jul 08 02:26:39 2011 +0200 summary: Issue #12423: Fix os.abort() documentation The Python signal handler for SIGABRT is not called on os.abort() (only if the signal is raised manually or sent by another process). Patch by Kamil Kisiel. files: Doc/ACKS.txt | 3 ++- Doc/library/os.rst | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -105,6 +105,7 @@ * Robert Kern * Jim Kerr * Jan Kim + * Kamil Kisiel * Greg Kochanski * Guido Kollerie * Peter A. Koren @@ -142,7 +143,7 @@ * Ross Moore * Sjoerd Mullender * Dale Nagata - * Michal Nowikowski + * Michal Nowikowski * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1582,8 +1582,9 @@ Generate a :const:`SIGABRT` signal to the current process. On Unix, the default behavior is to produce a core dump; on Windows, the process immediately returns - an exit code of ``3``. Be aware that programs which use :func:`signal.signal` - to register a handler for :const:`SIGABRT` will behave differently. + an exit code of ``3``. Be aware that calling this function will not call the + Python signal handler registered for :const:`SIGABRT` with + :func:`signal.signal`. Availability: Unix, Windows. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 02:27:18 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 08 Jul 2011 02:27:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiAobWVyZ2UgMy4yKSBJc3N1ZSAjMTI0MjM6IEZpeCBvcy5hYm9ydCgpIGRvY3Vt?= =?utf8?q?entation?= Message-ID: http://hg.python.org/cpython/rev/e3c115ba8dc0 changeset: 71251:e3c115ba8dc0 parent: 71247:16cbd84de848 parent: 71250:4e83d8f6d496 user: Victor Stinner date: Fri Jul 08 02:27:06 2011 +0200 summary: (merge 3.2) Issue #12423: Fix os.abort() documentation The Python signal handler for SIGABRT is not called on os.abort() (only if the signal is raised manually or sent by another process). Patch by Kamil Kisiel. files: Doc/ACKS.txt | 3 ++- Doc/library/os.rst | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -105,6 +105,7 @@ * Robert Kern * Jim Kerr * Jan Kim + * Kamil Kisiel * Greg Kochanski * Guido Kollerie * Peter A. Koren @@ -142,7 +143,7 @@ * Ross Moore * Sjoerd Mullender * Dale Nagata - * Michal Nowikowski + * Michal Nowikowski * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2088,8 +2088,9 @@ Generate a :const:`SIGABRT` signal to the current process. On Unix, the default behavior is to produce a core dump; on Windows, the process immediately returns - an exit code of ``3``. Be aware that programs which use :func:`signal.signal` - to register a handler for :const:`SIGABRT` will behave differently. + an exit code of ``3``. Be aware that calling this function will not call the + Python signal handler registered for :const:`SIGABRT` with + :func:`signal.signal`. Availability: Unix, Windows. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jul 8 05:08:47 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 08 Jul 2011 05:08:47 +0200 Subject: [Python-checkins] Daily reference leaks (e3c115ba8dc0): sum=300 Message-ID: results for e3c115ba8dc0 on branch "default" -------------------------------------------- test_concurrent_futures leaked [54, 0, -54] references, sum=0 test_packaging leaked [100, 100, 100] references, sum=300 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogKQ8FH2', '-x'] From python-checkins at python.org Fri Jul 8 16:28:29 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 08 Jul 2011 16:28:29 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Improve_reST_target?= Message-ID: http://hg.python.org/cpython/rev/5fea9b9d8b63 changeset: 71252:5fea9b9d8b63 user: ?ric Araujo date: Sat Jul 02 16:58:25 2011 +0200 summary: Improve reST target files: Doc/install/install.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/install/install.rst b/Doc/install/install.rst --- a/Doc/install/install.rst +++ b/Doc/install/install.rst @@ -4,7 +4,7 @@ Installing Python projects: overwiew ==================================== -.. _packaging_packaging-intro: +.. _packaging-install-intro: Introduction ============ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 16:28:30 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 08 Jul 2011 16:28:30 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Factor_out_code_used_by_pac?= =?utf8?q?kaging_commands_for_HTTP_requests_=28=2312169=29=2E?= Message-ID: http://hg.python.org/cpython/rev/c2785ed52ed4 changeset: 71253:c2785ed52ed4 user: ?ric Araujo date: Fri Jul 08 16:27:12 2011 +0200 summary: Factor out code used by packaging commands for HTTP requests (#12169). We now have one function to prepare multipart POST requests, and we use CRLF, as recommended by the HTTP spec (#10150). Initial patch by John Edmonds. files: Lib/packaging/command/register.py | 24 +---- Lib/packaging/command/upload.py | 50 +-------- Lib/packaging/command/upload_docs.py | 46 +-------- Lib/packaging/tests/test_command_register.py | 10 +- Lib/packaging/tests/test_command_upload_docs.py | 27 +----- Lib/packaging/tests/test_util.py | 26 +++++- Lib/packaging/util.py | 47 +++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + 9 files changed, 96 insertions(+), 138 deletions(-) diff --git a/Lib/packaging/command/register.py b/Lib/packaging/command/register.py --- a/Lib/packaging/command/register.py +++ b/Lib/packaging/command/register.py @@ -10,7 +10,7 @@ from packaging import logger from packaging.util import (read_pypirc, generate_pypirc, DEFAULT_REPOSITORY, - DEFAULT_REALM, get_pypirc_path) + DEFAULT_REALM, get_pypirc_path, encode_multipart) from packaging.command.cmd import Command class register(Command): @@ -231,29 +231,11 @@ if 'name' in data: logger.info('Registering %s to %s', data['name'], self.repository) # Build up the MIME payload for the urllib2 POST data - boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = '\n--' + boundary - end_boundary = sep_boundary + '--' - body = io.StringIO() - for key, value in data.items(): - # handle multiple entries for the same name - if not isinstance(value, (tuple, list)): - value = [value] - - for value in value: - body.write(sep_boundary) - body.write('\nContent-Disposition: form-data; name="%s"'%key) - body.write("\n\n") - body.write(value) - if value and value[-1] == '\r': - body.write('\n') # write an extra newline (lurve Macs) - body.write(end_boundary) - body.write("\n") - body = body.getvalue() + content_type, body = encode_multipart(data.items(), []) # build the Request headers = { - 'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'%boundary, + 'Content-type': content_type, 'Content-length': str(len(body)) } req = urllib.request.Request(self.repository, body, headers) diff --git a/Lib/packaging/command/upload.py b/Lib/packaging/command/upload.py --- a/Lib/packaging/command/upload.py +++ b/Lib/packaging/command/upload.py @@ -14,7 +14,7 @@ from packaging import logger from packaging.errors import PackagingOptionError from packaging.util import (spawn, read_pypirc, DEFAULT_REPOSITORY, - DEFAULT_REALM) + DEFAULT_REALM, encode_multipart) from packaging.command.cmd import Command @@ -131,54 +131,22 @@ auth = b"Basic " + standard_b64encode(user_pass) # Build up the MIME payload for the POST data - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = b'\n--' + boundary - end_boundary = sep_boundary + b'--' - body = BytesIO() + files = [] + for key in ('content', 'gpg_signature'): + if key in data: + filename_, value = data.pop(key) + files.append((key, filename_, value)) - file_fields = ('content', 'gpg_signature') - - for key, value in data.items(): - # handle multiple entries for the same name - if not isinstance(value, tuple): - value = [value] - - content_dispo = '\nContent-Disposition: form-data; name="%s"' % key - - if key in file_fields: - filename_, content = value - filename_ = ';filename="%s"' % filename_ - body.write(sep_boundary) - body.write(content_dispo.encode('utf-8')) - body.write(filename_.encode('utf-8')) - body.write(b"\n\n") - body.write(content) - else: - for value in value: - value = str(value).encode('utf-8') - body.write(sep_boundary) - body.write(content_dispo.encode('utf-8')) - body.write(b"\n\n") - body.write(value) - if value and value.endswith(b'\r'): - # write an extra newline (lurve Macs) - body.write(b'\n') - - body.write(end_boundary) - body.write(b"\n") - body = body.getvalue() + content_type, body = encode_multipart(data.items(), files) logger.info("Submitting %s to %s", filename, self.repository) # build the Request - headers = {'Content-type': - 'multipart/form-data; boundary=%s' % - boundary.decode('ascii'), + headers = {'Content-type': content_type, 'Content-length': str(len(body)), 'Authorization': auth} - request = Request(self.repository, data=body, - headers=headers) + request = Request(self.repository, body, headers) # send the data try: result = urlopen(request) diff --git a/Lib/packaging/command/upload_docs.py b/Lib/packaging/command/upload_docs.py --- a/Lib/packaging/command/upload_docs.py +++ b/Lib/packaging/command/upload_docs.py @@ -10,7 +10,8 @@ from io import BytesIO from packaging import logger -from packaging.util import read_pypirc, DEFAULT_REPOSITORY, DEFAULT_REALM +from packaging.util import (read_pypirc, DEFAULT_REPOSITORY, DEFAULT_REALM, + encode_multipart) from packaging.errors import PackagingFileError from packaging.command.cmd import Command @@ -28,49 +29,6 @@ return destination -# grabbed from -# http://code.activestate.com/recipes/ -# 146306-http-client-to-post-using-multipartform-data/ -# TODO factor this out for use by install and command/upload - -def encode_multipart(fields, files, boundary=None): - """ - *fields* is a sequence of (name: str, value: str) elements for regular - form fields, *files* is a sequence of (name: str, filename: str, value: - bytes) elements for data to be uploaded as files. - - Returns (content_type: bytes, body: bytes) ready for http.client.HTTP. - """ - if boundary is None: - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - elif not isinstance(boundary, bytes): - raise TypeError('boundary is not bytes but %r' % type(boundary)) - - l = [] - for key, value in fields: - l.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"' % - key).encode('utf-8'), - b'', - value.encode('utf-8'))) - - for key, filename, value in files: - l.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"; filename="%s"' % - (key, filename)).encode('utf-8'), - b'', - value)) - l.append(b'--' + boundary + b'--') - l.append(b'') - - body = b'\r\n'.join(l) - - content_type = b'multipart/form-data; boundary=' + boundary - return content_type, body - - class upload_docs(Command): description = "upload HTML documentation to PyPI" diff --git a/Lib/packaging/tests/test_command_register.py b/Lib/packaging/tests/test_command_register.py --- a/Lib/packaging/tests/test_command_register.py +++ b/Lib/packaging/tests/test_command_register.py @@ -152,7 +152,7 @@ req1 = dict(self.conn.reqs[0].headers) req2 = dict(self.conn.reqs[1].headers) self.assertEqual(req2['Content-length'], req1['Content-length']) - self.assertIn('xxx', self.conn.reqs[1].data) + self.assertIn(b'xxx', self.conn.reqs[1].data) def test_password_not_in_file(self): @@ -180,8 +180,8 @@ self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) - self.assertEqual(headers['Content-length'], '608') - self.assertIn('tarek', req.data) + self.assertEqual(headers['Content-length'], '628') + self.assertIn(b'tarek', req.data) def test_password_reset(self): # this test runs choice 3 @@ -195,8 +195,8 @@ self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) - self.assertEqual(headers['Content-length'], '290') - self.assertIn('tarek', req.data) + self.assertEqual(headers['Content-length'], '298') + self.assertIn(b'tarek', req.data) @unittest.skipUnless(DOCUTILS_SUPPORT, 'needs docutils') def test_strict(self): diff --git a/Lib/packaging/tests/test_command_upload_docs.py b/Lib/packaging/tests/test_command_upload_docs.py --- a/Lib/packaging/tests/test_command_upload_docs.py +++ b/Lib/packaging/tests/test_command_upload_docs.py @@ -9,8 +9,7 @@ _ssl = None from packaging.command import upload_docs as upload_docs_mod -from packaging.command.upload_docs import (upload_docs, zip_dir, - encode_multipart) +from packaging.command.upload_docs import upload_docs, zip_dir from packaging.dist import Distribution from packaging.errors import PackagingFileError, PackagingOptionError @@ -23,23 +22,6 @@ PyPIServerTestCase = object -EXPECTED_MULTIPART_OUTPUT = [ - b'---x', - b'Content-Disposition: form-data; name="username"', - b'', - b'wok', - b'---x', - b'Content-Disposition: form-data; name="password"', - b'', - b'secret', - b'---x', - b'Content-Disposition: form-data; name="picture"; filename="wok.png"', - b'', - b'PNG89', - b'---x--', - b'', -] - PYPIRC = """\ [distutils] index-servers = server1 @@ -108,13 +90,6 @@ zip_f = zipfile.ZipFile(compressed) self.assertEqual(zip_f.namelist(), ['index.html', 'docs/index.html']) - def test_encode_multipart(self): - fields = [('username', 'wok'), ('password', 'secret')] - files = [('picture', 'wok.png', b'PNG89')] - content_type, body = encode_multipart(fields, files, b'-x') - self.assertEqual(b'multipart/form-data; boundary=-x', content_type) - self.assertEqual(EXPECTED_MULTIPART_OUTPUT, body.split(b'\r\n')) - def prepare_command(self): self.cmd.upload_dir = self.prepare_sample_dir() self.cmd.ensure_finalized() diff --git a/Lib/packaging/tests/test_util.py b/Lib/packaging/tests/test_util.py --- a/Lib/packaging/tests/test_util.py +++ b/Lib/packaging/tests/test_util.py @@ -19,7 +19,7 @@ get_compiler_versions, _MAC_OS_X_LD_VERSION, byte_compile, find_packages, spawn, get_pypirc_path, generate_pypirc, read_pypirc, resolve_name, iglob, RICH_GLOB, egginfo_to_distinfo, is_setuptools, is_distutils, is_packaging, - get_install_method, cfg_to_args) + get_install_method, cfg_to_args, encode_multipart) PYPIRC = """\ @@ -54,6 +54,23 @@ password:xxx """ +EXPECTED_MULTIPART_OUTPUT = [ + b'---x', + b'Content-Disposition: form-data; name="username"', + b'', + b'wok', + b'---x', + b'Content-Disposition: form-data; name="password"', + b'', + b'secret', + b'---x', + b'Content-Disposition: form-data; name="picture"; filename="wok.png"', + b'', + b'PNG89', + b'---x--', + b'', +] + class FakePopen: test_class = None @@ -525,6 +542,13 @@ self.assertEqual(args['scripts'], dist.scripts) self.assertEqual(args['py_modules'], dist.py_modules) + def test_encode_multipart(self): + fields = [('username', 'wok'), ('password', 'secret')] + files = [('picture', 'wok.png', b'PNG89')] + content_type, body = encode_multipart(fields, files, b'-x') + self.assertEqual(b'multipart/form-data; boundary=-x', content_type) + self.assertEqual(EXPECTED_MULTIPART_OUTPUT, body.split(b'\r\n')) + class GlobTestCaseBase(support.TempdirManager, support.LoggingCatcher, diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -1487,3 +1487,50 @@ _path_created.add(abs_head) return created_dirs + + +def encode_multipart(fields, files, boundary=None): + """Prepare a multipart HTTP request. + + *fields* is a sequence of (name: str, value: str) elements for regular + form fields, *files* is a sequence of (name: str, filename: str, value: + bytes) elements for data to be uploaded as files. + + Returns (content_type: bytes, body: bytes) ready for http.client.HTTP. + """ + # Taken from + # http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/ + + if boundary is None: + boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' + elif not isinstance(boundary, bytes): + raise TypeError('boundary must be bytes, not %r' % type(boundary)) + + l = [] + for key, values in fields: + # handle multiple entries for the same name + if not isinstance(values, (tuple, list)): + values=[values] + + for value in values: + l.extend(( + b'--' + boundary, + ('Content-Disposition: form-data; name="%s"' % + key).encode('utf-8'), + b'', + value.encode('utf-8'))) + + for key, filename, value in files: + l.extend(( + b'--' + boundary, + ('Content-Disposition: form-data; name="%s"; filename="%s"' % + (key, filename)).encode('utf-8'), + b'', + value)) + + l.append(b'--' + boundary + b'--') + l.append(b'') + + body = b'\r\n'.join(l) + content_type = b'multipart/form-data; boundary=' + boundary + return content_type, body diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -263,6 +263,7 @@ Walter D?rwald Hans Eckardt Rodolpho Eckhardt +John Edmonds Grant Edwards John Ehresman Eric Eisner diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,9 @@ Library ------- +- Issues #12169 and #10510: Factor out code used by various packaging commands + to make HTTP POST requests, and make sure it uses CRLF. + - Issue #12016: Multibyte CJK decoders now resynchronize faster. They only ignore the first byte of an invalid byte sequence. For example, b'\xff\n'.decode('gb2312', 'replace') gives '\ufffd\n' instead of '\ufffd'. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 17:22:39 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 08 Jul 2011 17:22:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Close_file_handles_in_a_tim?= =?utf8?q?ely_manner_in_packaging=2Edatabase_=28=2312504=29=2E?= Message-ID: http://hg.python.org/cpython/rev/2b9a0a091566 changeset: 71254:2b9a0a091566 user: ?ric Araujo date: Fri Jul 08 17:22:19 2011 +0200 summary: Close file handles in a timely manner in packaging.database (#12504). This fixes a bug with the remove (uninstall) feature on Windows. Patch by Thomas Holmes. files: Lib/packaging/database.py | 12 +++++++----- Lib/packaging/tests/test_uninstall.py | 2 -- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/packaging/database.py b/Lib/packaging/database.py --- a/Lib/packaging/database.py +++ b/Lib/packaging/database.py @@ -158,17 +158,18 @@ self.name, self.version, self.path) def _get_records(self, local=False): + results = [] with self.get_distinfo_file('RECORD') as record: record_reader = csv.reader(record, delimiter=',', lineterminator='\n') - # XXX needs an explaining comment for row in record_reader: - path, checksum, size = (row[:] + - [None for i in range(len(row), 3)]) + missing = [None for i in range(len(row), 3)] + path, checksum, size = row + missing if local: path = path.replace('/', os.sep) path = os.path.join(sys.prefix, path) - yield path, checksum, size + results.append((path, checksum, size)) + return results def get_resource_path(self, relative_path): with self.get_distinfo_file('RESOURCES') as resources_file: @@ -197,7 +198,8 @@ :type local: boolean :returns: iterator of (path, md5, size) """ - return self._get_records(local) + for result in self._get_records(local): + yield result def uses(self, path): """ diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py --- a/Lib/packaging/tests/test_uninstall.py +++ b/Lib/packaging/tests/test_uninstall.py @@ -93,7 +93,6 @@ self.assertRaises(PackagingError, remove, 'Foo', paths=[self.root_dir]) - @unittest.skipIf(sys.platform == 'win32', 'deactivated for now') def test_uninstall(self): dist, install_lib = self.install_dist() self.assertIsFile(install_lib, 'foo', '__init__.py') @@ -103,7 +102,6 @@ self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py') self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD') - @unittest.skipIf(sys.platform == 'win32', 'deactivated for now') def test_remove_issue(self): # makes sure if there are OSErrors (like permission denied) # remove() stops and display a clean error diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -419,6 +419,7 @@ Gerrit Holl Shane Holloway Rune Holm +Thomas Holmes Philip Homburg Naofumi Honda Jeffrey Honig diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,9 @@ Library ------- +- Issue #12504: Close file handles in a timely manner in packaging.database. + This fixes a bug with the remove (uninstall) feature on Windows. + - Issues #12169 and #10510: Factor out code used by various packaging commands to make HTTP POST requests, and make sure it uses CRLF. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 18:50:17 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 18:50:17 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDQw?= =?utf8?q?=3A_When_testing_whether_some_bits_in_SSLContext=2Eoptions_can_b?= =?utf8?q?e?= Message-ID: http://hg.python.org/cpython/rev/52ed0c6bb461 changeset: 71255:52ed0c6bb461 branch: 3.2 parent: 71250:4e83d8f6d496 user: Antoine Pitrou date: Fri Jul 08 18:47:06 2011 +0200 summary: Issue #12440: When testing whether some bits in SSLContext.options can be reset, check the version of the OpenSSL headers Python was compiled against, rather than the runtime version of the OpenSSL library. files: Lib/ssl.py | 2 + Lib/test/test_ssl.py | 2 +- Misc/NEWS | 4 +++ Modules/_ssl.c | 34 +++++++++++++++++++++++-------- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -77,6 +77,8 @@ ) from _ssl import HAS_SNI from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1 +from _ssl import _OPENSSL_API_VERSION + _PROTOCOL_NAMES = { PROTOCOL_TLSv1: "TLSv1", PROTOCOL_SSLv23: "SSLv23", diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -60,7 +60,7 @@ def can_clear_options(): # 0.9.8m or higher - return ssl.OPENSSL_VERSION_INFO >= (0, 9, 8, 13, 15) + return ssl._OPENSSL_API_VERSION >= (0, 9, 8, 13, 15) def no_sslv2_implies_sslv3_hello(): # 0.9.7h or higher diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,10 @@ Tests ----- +- Issue #12440: When testing whether some bits in SSLContext.options can be + reset, check the version of the OpenSSL headers Python was compiled against, + rather than the runtime version of the OpenSSL library. + - Issue #12497: Install test/data to prevent failures of the various codecmaps tests. diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2037,6 +2037,24 @@ NULL }; + +static void +parse_openssl_version(unsigned long libver, + unsigned int *major, unsigned int *minor, + unsigned int *fix, unsigned int *patch, + unsigned int *status) +{ + *status = libver & 0xF; + libver >>= 4; + *patch = libver & 0xFF; + libver >>= 8; + *fix = libver & 0xFF; + libver >>= 8; + *minor = libver & 0xFF; + libver >>= 8; + *major = libver & 0xFF; +} + PyMODINIT_FUNC PyInit__ssl(void) { @@ -2149,15 +2167,7 @@ return NULL; if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r)) return NULL; - status = libver & 0xF; - libver >>= 4; - patch = libver & 0xFF; - libver >>= 8; - fix = libver & 0xFF; - libver >>= 8; - minor = libver & 0xFF; - libver >>= 8; - major = libver & 0xFF; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); r = Py_BuildValue("IIIII", major, minor, fix, patch, status); if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r)) return NULL; @@ -2165,5 +2175,11 @@ if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r)) return NULL; + libver = OPENSSL_VERSION_NUMBER; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); + r = Py_BuildValue("IIIII", major, minor, fix, patch, status); + if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) + return NULL; + return m; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 18:50:17 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 18:50:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312440=3A_When_testing_whether_some_bits_in_SSLConte?= =?utf8?q?xt=2Eoptions_can_be?= Message-ID: http://hg.python.org/cpython/rev/4120cd8a86f4 changeset: 71256:4120cd8a86f4 parent: 71254:2b9a0a091566 parent: 71255:52ed0c6bb461 user: Antoine Pitrou date: Fri Jul 08 18:49:07 2011 +0200 summary: Issue #12440: When testing whether some bits in SSLContext.options can be reset, check the version of the OpenSSL headers Python was compiled against, rather than the runtime version of the OpenSSL library. files: Lib/ssl.py | 2 + Lib/test/test_ssl.py | 2 +- Misc/NEWS | 4 +++ Modules/_ssl.c | 34 +++++++++++++++++++++++-------- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -78,6 +78,8 @@ from _ssl import HAS_SNI from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1) +from _ssl import _OPENSSL_API_VERSION + _PROTOCOL_NAMES = { PROTOCOL_TLSv1: "TLSv1", PROTOCOL_SSLv23: "SSLv23", diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -60,7 +60,7 @@ def can_clear_options(): # 0.9.8m or higher - return ssl.OPENSSL_VERSION_INFO >= (0, 9, 8, 13, 15) + return ssl._OPENSSL_API_VERSION >= (0, 9, 8, 13, 15) def no_sslv2_implies_sslv3_hello(): # 0.9.7h or higher diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1004,6 +1004,10 @@ Tests ----- +- Issue #12440: When testing whether some bits in SSLContext.options can be + reset, check the version of the OpenSSL headers Python was compiled against, + rather than the runtime version of the OpenSSL library. + - Issue #11512: Add a test suite for the cgitb module. Patch by Robbie Clemons. - Issue #12497: Install test/data to prevent failures of the various codecmaps diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2101,6 +2101,24 @@ NULL }; + +static void +parse_openssl_version(unsigned long libver, + unsigned int *major, unsigned int *minor, + unsigned int *fix, unsigned int *patch, + unsigned int *status) +{ + *status = libver & 0xF; + libver >>= 4; + *patch = libver & 0xFF; + libver >>= 8; + *fix = libver & 0xFF; + libver >>= 8; + *minor = libver & 0xFF; + libver >>= 8; + *major = libver & 0xFF; +} + PyMODINIT_FUNC PyInit__ssl(void) { @@ -2213,15 +2231,7 @@ return NULL; if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r)) return NULL; - status = libver & 0xF; - libver >>= 4; - patch = libver & 0xFF; - libver >>= 8; - fix = libver & 0xFF; - libver >>= 8; - minor = libver & 0xFF; - libver >>= 8; - major = libver & 0xFF; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); r = Py_BuildValue("IIIII", major, minor, fix, patch, status); if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r)) return NULL; @@ -2229,5 +2239,11 @@ if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r)) return NULL; + libver = OPENSSL_VERSION_NUMBER; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); + r = Py_BuildValue("IIIII", major, minor, fix, patch, status); + if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) + return NULL; + return m; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:15:15 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:15:15 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Avoid_failing_i?= =?utf8?q?n_test=5Furllibnet=2Etest=5Fbad=5Faddress_when_some_overzealous?= Message-ID: http://hg.python.org/cpython/rev/3eaf019aa017 changeset: 71257:3eaf019aa017 branch: 2.7 parent: 71249:1ac21a715c5d user: Antoine Pitrou date: Fri Jul 08 19:14:19 2011 +0200 summary: Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. files: Lib/test/test_urllibnet.py | 8 ++++++++ Misc/NEWS | 4 ++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -131,6 +131,14 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,10 @@ Tests ----- +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + - Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or test_ttk_guionly under a username that is not currently logged in to the console windowserver (as may be the case under buildbot or ssh). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:23:27 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:23:27 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Avoid_failing_i?= =?utf8?q?n_test=5Furllibnet=2Etest=5Fbad=5Faddress_when_some_overzealous?= Message-ID: http://hg.python.org/cpython/rev/6adab7448272 changeset: 71258:6adab7448272 branch: 3.2 parent: 71255:52ed0c6bb461 user: Antoine Pitrou date: Fri Jul 08 19:19:57 2011 +0200 summary: Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. files: Lib/test/test_urllibnet.py | 8 ++++++++ Misc/NEWS | 4 ++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -113,6 +113,14 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,10 @@ Tests ----- +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + - Issue #12440: When testing whether some bits in SSLContext.options can be reset, check the version of the OpenSSL headers Python was compiled against, rather than the runtime version of the OpenSSL library. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:23:28 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:23:28 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Avoid_failing_in_test=5Furllibnet=2Etest=5Fbad=5Faddress_whe?= =?utf8?q?n_some_overzealous?= Message-ID: http://hg.python.org/cpython/rev/99d20a3e3c29 changeset: 71259:99d20a3e3c29 parent: 71256:4120cd8a86f4 parent: 71258:6adab7448272 user: Antoine Pitrou date: Fri Jul 08 19:22:31 2011 +0200 summary: Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. files: Lib/test/test_urllibnet.py | 8 ++++++++ Misc/NEWS | 4 ++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -113,6 +113,14 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1004,6 +1004,10 @@ Tests ----- +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + - Issue #12440: When testing whether some bits in SSLContext.options can be reset, check the version of the OpenSSL headers Python was compiled against, rather than the runtime version of the OpenSSL library. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:41:11 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:41:11 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Avoid_failing_i?= =?utf8?q?n_test=5Frobotparser_when_mueblesmoraleda=2Ecom_is_flaky_and?= Message-ID: http://hg.python.org/cpython/rev/e6e37f1e29ca changeset: 71260:e6e37f1e29ca branch: 2.7 parent: 71257:3eaf019aa017 user: Antoine Pitrou date: Fri Jul 08 19:40:15 2011 +0200 summary: Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. files: Lib/test/test_robotparser.py | 17 ++++++++++++++++- Misc/NEWS | 4 ++++ 2 files changed, 20 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -1,5 +1,6 @@ import unittest, StringIO, robotparser from test import test_support +from urllib2 import urlopen, HTTPError class RobotTestCase(unittest.TestCase): def __init__(self, index, parser, url, good, agent): @@ -234,13 +235,27 @@ test_support.requires('network') with test_support.transient_internet('mueblesmoraleda.com'): url = 'http://mueblesmoraleda.com' + robots_url = url + "/robots.txt" + # First check the URL is usable for our purposes, since the + # test site is a bit flaky. + try: + urlopen(robots_url) + except HTTPError as e: + if e.code not in {401, 403}: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not %r" + % (robots_url, e.code)) + else: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not succeed" + % (robots_url)) parser = robotparser.RobotFileParser() parser.set_url(url) try: parser.read() except IOError: self.skipTest('%s is unavailable' % url) - self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) + self.assertEqual(parser.can_fetch("*", robots_url), False) def testPythonOrg(self): test_support.requires('network') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,10 @@ Tests ----- +- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and + an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder + Web site. + - Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:45:51 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:45:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Avoid_failing_i?= =?utf8?q?n_test=5Frobotparser_when_mueblesmoraleda=2Ecom_is_flaky_and?= Message-ID: http://hg.python.org/cpython/rev/6e72490bbff6 changeset: 71261:6e72490bbff6 branch: 3.2 parent: 71258:6adab7448272 user: Antoine Pitrou date: Fri Jul 08 19:43:51 2011 +0200 summary: Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. files: Lib/test/test_robotparser.py | 19 +++++++++++++++++-- Misc/NEWS | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -1,7 +1,8 @@ import io import unittest import urllib.robotparser -from urllib.error import URLError +from urllib.error import URLError, HTTPError +from urllib.request import urlopen from test import support class RobotTestCase(unittest.TestCase): @@ -237,13 +238,27 @@ support.requires('network') with support.transient_internet('mueblesmoraleda.com'): url = 'http://mueblesmoraleda.com' + robots_url = url + "/robots.txt" + # First check the URL is usable for our purposes, since the + # test site is a bit flaky. + try: + urlopen(robots_url) + except HTTPError as e: + if e.code not in {401, 403}: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not %r" + % (robots_url, e.code)) + else: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not succeed" + % (robots_url)) parser = urllib.robotparser.RobotFileParser() parser.set_url(url) try: parser.read() except URLError: self.skipTest('%s is unavailable' % url) - self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) + self.assertEqual(parser.can_fetch("*", robots_url), False) def testPythonOrg(self): support.requires('network') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,10 @@ Tests ----- +- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and + an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder + Web site. + - Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 19:45:52 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 19:45:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Avoid_failing_in_test=5Frobotparser_when_mueblesmoraleda=2Ec?= =?utf8?q?om_is_flaky_and?= Message-ID: http://hg.python.org/cpython/rev/71fed8437db1 changeset: 71262:71fed8437db1 parent: 71259:99d20a3e3c29 parent: 71261:6e72490bbff6 user: Antoine Pitrou date: Fri Jul 08 19:44:55 2011 +0200 summary: Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. files: Lib/test/test_robotparser.py | 19 +++++++++++++++++-- Misc/NEWS | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -1,7 +1,8 @@ import io import unittest import urllib.robotparser -from urllib.error import URLError +from urllib.error import URLError, HTTPError +from urllib.request import urlopen from test import support class RobotTestCase(unittest.TestCase): @@ -237,13 +238,27 @@ support.requires('network') with support.transient_internet('mueblesmoraleda.com'): url = 'http://mueblesmoraleda.com' + robots_url = url + "/robots.txt" + # First check the URL is usable for our purposes, since the + # test site is a bit flaky. + try: + urlopen(robots_url) + except HTTPError as e: + if e.code not in {401, 403}: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not %r" + % (robots_url, e.code)) + else: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not succeed" + % (robots_url)) parser = urllib.robotparser.RobotFileParser() parser.set_url(url) try: parser.read() except URLError: self.skipTest('%s is unavailable' % url) - self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) + self.assertEqual(parser.can_fetch("*", robots_url), False) def testPythonOrg(self): support.requires('network') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1004,6 +1004,10 @@ Tests ----- +- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and + an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder + Web site. + - Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 20:34:31 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 08 Jul 2011 20:34:31 +0200 Subject: [Python-checkins] =?utf8?q?release=3A_normalize_the_version_to_al?= =?utf8?q?ways_have_patch_level?= Message-ID: http://hg.python.org/release/rev/ccd9861ad360 changeset: 58:ccd9861ad360 user: Benjamin Peterson date: Fri Jul 08 13:38:52 2011 -0500 summary: normalize the version to always have patch level files: release.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/release.py b/release.py --- a/release.py +++ b/release.py @@ -344,13 +344,16 @@ for i, thing in enumerate(data): if thing is None: data[i] = 0 - self.text = tag_name - self.next_text = tag_name self.major = int(data[0]) self.minor = int(data[1]) self.patch = int(data[2]) self.level = data[3] self.serial = int(data[4]) + # This has the effect of normalizing the version. + self.text = "{}.{}.{}".format(self.major, self.minor, self.patch) + if self.level != "f": + self.text += self.level + str(self.serial) + self.next_text = tag_name self.basic_version = '%s.%s' % (self.major, self.minor) def __str__(self): -- Repository URL: http://hg.python.org/release From python-checkins at python.org Fri Jul 8 20:35:31 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 08 Jul 2011 20:35:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_add_patchlevel_to_version_s?= =?utf8?q?tring?= Message-ID: http://hg.python.org/cpython/rev/2ebcbdca0dee changeset: 71263:2ebcbdca0dee parent: 71244:71a1f53c8203 user: Benjamin Peterson date: Fri Jul 08 13:39:35 2011 -0500 summary: add patchlevel to version string files: Include/patchlevel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.3a0" +#define PY_VERSION "3.3.0a0" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 20:35:32 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 08 Jul 2011 20:35:32 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/1ca24391c8b1 changeset: 71264:1ca24391c8b1 parent: 71263:2ebcbdca0dee parent: 71262:71fed8437db1 user: Benjamin Peterson date: Fri Jul 08 13:39:56 2011 -0500 summary: merge heads files: Doc/ACKS.txt | 3 +- Doc/install/install.rst | 2 +- Doc/library/os.rst | 5 +- Doc/whatsnew/3.3.rst | 23 ++ Lib/packaging/command/register.py | 24 +-- Lib/packaging/command/upload.py | 50 +---- Lib/packaging/command/upload_docs.py | 46 +---- Lib/packaging/database.py | 12 +- Lib/packaging/install.py | 12 +- Lib/packaging/tests/test_command_register.py | 10 +- Lib/packaging/tests/test_command_upload_docs.py | 27 +-- Lib/packaging/tests/test_uninstall.py | 2 - Lib/packaging/tests/test_util.py | 26 ++- Lib/packaging/util.py | 47 ++++ Lib/ssl.py | 2 + Lib/test/test_codecencodings_cn.py | 21 +- Lib/test/test_codecencodings_hk.py | 4 +- Lib/test/test_codecencodings_jp.py | 96 ++++++--- Lib/test/test_codecencodings_kr.py | 25 +- Lib/test/test_codecencodings_tw.py | 4 +- Lib/test/test_codecmaps_tw.py | 3 + Lib/test/test_robotparser.py | 19 +- Lib/test/test_ssl.py | 2 +- Lib/test/test_urllibnet.py | 8 + Misc/ACKS | 2 + Misc/NEWS | 22 ++ Modules/_ssl.c | 34 ++- Modules/cjkcodecs/_codecs_cn.c | 14 +- Modules/cjkcodecs/_codecs_hk.c | 2 +- Modules/cjkcodecs/_codecs_jp.c | 34 +- Modules/cjkcodecs/_codecs_kr.c | 18 +- Modules/cjkcodecs/_codecs_tw.c | 4 +- Modules/md5module.c | 2 +- Modules/sha1module.c | 2 +- 34 files changed, 344 insertions(+), 263 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -105,6 +105,7 @@ * Robert Kern * Jim Kerr * Jan Kim + * Kamil Kisiel * Greg Kochanski * Guido Kollerie * Peter A. Koren @@ -142,7 +143,7 @@ * Ross Moore * Sjoerd Mullender * Dale Nagata - * Michal Nowikowski + * Michal Nowikowski * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/install/install.rst b/Doc/install/install.rst --- a/Doc/install/install.rst +++ b/Doc/install/install.rst @@ -4,7 +4,7 @@ Installing Python projects: overwiew ==================================== -.. _packaging_packaging-intro: +.. _packaging-install-intro: Introduction ============ diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2088,8 +2088,9 @@ Generate a :const:`SIGABRT` signal to the current process. On Unix, the default behavior is to produce a core dump; on Windows, the process immediately returns - an exit code of ``3``. Be aware that programs which use :func:`signal.signal` - to register a handler for :const:`SIGABRT` will behave differently. + an exit code of ``3``. Be aware that calling this function will not call the + Python signal handler registered for :const:`SIGABRT` with + :func:`signal.signal`. Availability: Unix, Windows. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -68,6 +68,29 @@ * Stub +codecs +------ + +Multibyte CJK decoders now resynchronize faster. They only ignore the first +byte of an invalid byte sequence. For example, b'\xff\n'.decode('gb2312', +'replace') gives '?\n' instead of '?'. + +(http://bugs.python.org/issue12016) + +Don't reset incremental encoders of CJK codecs at each call to their encode() +method anymore. For example: :: + + $ ./python -q + >>> import codecs + >>> encoder = codecs.getincrementalencoder('hz')('strict') + >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.') + b'~{NpJ)l6HK!#~} Bye.' + +This example gives b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.' with older Python +versions. + +(http://bugs.python.org/issue12100) + faulthandler ------------ diff --git a/Lib/packaging/command/register.py b/Lib/packaging/command/register.py --- a/Lib/packaging/command/register.py +++ b/Lib/packaging/command/register.py @@ -10,7 +10,7 @@ from packaging import logger from packaging.util import (read_pypirc, generate_pypirc, DEFAULT_REPOSITORY, - DEFAULT_REALM, get_pypirc_path) + DEFAULT_REALM, get_pypirc_path, encode_multipart) from packaging.command.cmd import Command class register(Command): @@ -231,29 +231,11 @@ if 'name' in data: logger.info('Registering %s to %s', data['name'], self.repository) # Build up the MIME payload for the urllib2 POST data - boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = '\n--' + boundary - end_boundary = sep_boundary + '--' - body = io.StringIO() - for key, value in data.items(): - # handle multiple entries for the same name - if not isinstance(value, (tuple, list)): - value = [value] - - for value in value: - body.write(sep_boundary) - body.write('\nContent-Disposition: form-data; name="%s"'%key) - body.write("\n\n") - body.write(value) - if value and value[-1] == '\r': - body.write('\n') # write an extra newline (lurve Macs) - body.write(end_boundary) - body.write("\n") - body = body.getvalue() + content_type, body = encode_multipart(data.items(), []) # build the Request headers = { - 'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'%boundary, + 'Content-type': content_type, 'Content-length': str(len(body)) } req = urllib.request.Request(self.repository, body, headers) diff --git a/Lib/packaging/command/upload.py b/Lib/packaging/command/upload.py --- a/Lib/packaging/command/upload.py +++ b/Lib/packaging/command/upload.py @@ -14,7 +14,7 @@ from packaging import logger from packaging.errors import PackagingOptionError from packaging.util import (spawn, read_pypirc, DEFAULT_REPOSITORY, - DEFAULT_REALM) + DEFAULT_REALM, encode_multipart) from packaging.command.cmd import Command @@ -131,54 +131,22 @@ auth = b"Basic " + standard_b64encode(user_pass) # Build up the MIME payload for the POST data - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - sep_boundary = b'\n--' + boundary - end_boundary = sep_boundary + b'--' - body = BytesIO() + files = [] + for key in ('content', 'gpg_signature'): + if key in data: + filename_, value = data.pop(key) + files.append((key, filename_, value)) - file_fields = ('content', 'gpg_signature') - - for key, value in data.items(): - # handle multiple entries for the same name - if not isinstance(value, tuple): - value = [value] - - content_dispo = '\nContent-Disposition: form-data; name="%s"' % key - - if key in file_fields: - filename_, content = value - filename_ = ';filename="%s"' % filename_ - body.write(sep_boundary) - body.write(content_dispo.encode('utf-8')) - body.write(filename_.encode('utf-8')) - body.write(b"\n\n") - body.write(content) - else: - for value in value: - value = str(value).encode('utf-8') - body.write(sep_boundary) - body.write(content_dispo.encode('utf-8')) - body.write(b"\n\n") - body.write(value) - if value and value.endswith(b'\r'): - # write an extra newline (lurve Macs) - body.write(b'\n') - - body.write(end_boundary) - body.write(b"\n") - body = body.getvalue() + content_type, body = encode_multipart(data.items(), files) logger.info("Submitting %s to %s", filename, self.repository) # build the Request - headers = {'Content-type': - 'multipart/form-data; boundary=%s' % - boundary.decode('ascii'), + headers = {'Content-type': content_type, 'Content-length': str(len(body)), 'Authorization': auth} - request = Request(self.repository, data=body, - headers=headers) + request = Request(self.repository, body, headers) # send the data try: result = urlopen(request) diff --git a/Lib/packaging/command/upload_docs.py b/Lib/packaging/command/upload_docs.py --- a/Lib/packaging/command/upload_docs.py +++ b/Lib/packaging/command/upload_docs.py @@ -10,7 +10,8 @@ from io import BytesIO from packaging import logger -from packaging.util import read_pypirc, DEFAULT_REPOSITORY, DEFAULT_REALM +from packaging.util import (read_pypirc, DEFAULT_REPOSITORY, DEFAULT_REALM, + encode_multipart) from packaging.errors import PackagingFileError from packaging.command.cmd import Command @@ -28,49 +29,6 @@ return destination -# grabbed from -# http://code.activestate.com/recipes/ -# 146306-http-client-to-post-using-multipartform-data/ -# TODO factor this out for use by install and command/upload - -def encode_multipart(fields, files, boundary=None): - """ - *fields* is a sequence of (name: str, value: str) elements for regular - form fields, *files* is a sequence of (name: str, filename: str, value: - bytes) elements for data to be uploaded as files. - - Returns (content_type: bytes, body: bytes) ready for http.client.HTTP. - """ - if boundary is None: - boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' - elif not isinstance(boundary, bytes): - raise TypeError('boundary is not bytes but %r' % type(boundary)) - - l = [] - for key, value in fields: - l.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"' % - key).encode('utf-8'), - b'', - value.encode('utf-8'))) - - for key, filename, value in files: - l.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"; filename="%s"' % - (key, filename)).encode('utf-8'), - b'', - value)) - l.append(b'--' + boundary + b'--') - l.append(b'') - - body = b'\r\n'.join(l) - - content_type = b'multipart/form-data; boundary=' + boundary - return content_type, body - - class upload_docs(Command): description = "upload HTML documentation to PyPI" diff --git a/Lib/packaging/database.py b/Lib/packaging/database.py --- a/Lib/packaging/database.py +++ b/Lib/packaging/database.py @@ -158,17 +158,18 @@ self.name, self.version, self.path) def _get_records(self, local=False): + results = [] with self.get_distinfo_file('RECORD') as record: record_reader = csv.reader(record, delimiter=',', lineterminator='\n') - # XXX needs an explaining comment for row in record_reader: - path, checksum, size = (row[:] + - [None for i in range(len(row), 3)]) + missing = [None for i in range(len(row), 3)] + path, checksum, size = row + missing if local: path = path.replace('/', os.sep) path = os.path.join(sys.prefix, path) - yield path, checksum, size + results.append((path, checksum, size)) + return results def get_resource_path(self, relative_path): with self.get_distinfo_file('RESOURCES') as resources_file: @@ -197,7 +198,8 @@ :type local: boolean :returns: iterator of (path, md5, size) """ - return self._get_records(local) + for result in self._get_records(local): + yield result def uses(self, path): """ diff --git a/Lib/packaging/install.py b/Lib/packaging/install.py --- a/Lib/packaging/install.py +++ b/Lib/packaging/install.py @@ -42,10 +42,7 @@ :param files: a list of files to move. :param destination: the destination directory to put on the files. - if not defined, create a new one, using mkdtemp """ - if not destination: - destination = tempfile.mkdtemp() for old in files: filename = os.path.split(old)[-1] @@ -126,8 +123,11 @@ elif _is_archive_file(path): logger.info('Installing from archive: %s', path) _unpacked_dir = tempfile.mkdtemp() - shutil.unpack_archive(path, _unpacked_dir) - return _run_install_from_archive(_unpacked_dir) + try: + shutil.unpack_archive(path, _unpacked_dir) + return _run_install_from_archive(_unpacked_dir) + finally: + shutil.rmtree(_unpacked_dir) else: logger.warning('No projects to install.') return False @@ -179,8 +179,6 @@ :param path: base path to install distribution in :param paths: list of paths (defaults to sys.path) to look for info """ - if not path: - path = tempfile.mkdtemp() installed_dists = [] for dist in dists: diff --git a/Lib/packaging/tests/test_command_register.py b/Lib/packaging/tests/test_command_register.py --- a/Lib/packaging/tests/test_command_register.py +++ b/Lib/packaging/tests/test_command_register.py @@ -152,7 +152,7 @@ req1 = dict(self.conn.reqs[0].headers) req2 = dict(self.conn.reqs[1].headers) self.assertEqual(req2['Content-length'], req1['Content-length']) - self.assertIn('xxx', self.conn.reqs[1].data) + self.assertIn(b'xxx', self.conn.reqs[1].data) def test_password_not_in_file(self): @@ -180,8 +180,8 @@ self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) - self.assertEqual(headers['Content-length'], '608') - self.assertIn('tarek', req.data) + self.assertEqual(headers['Content-length'], '628') + self.assertIn(b'tarek', req.data) def test_password_reset(self): # this test runs choice 3 @@ -195,8 +195,8 @@ self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) - self.assertEqual(headers['Content-length'], '290') - self.assertIn('tarek', req.data) + self.assertEqual(headers['Content-length'], '298') + self.assertIn(b'tarek', req.data) @unittest.skipUnless(DOCUTILS_SUPPORT, 'needs docutils') def test_strict(self): diff --git a/Lib/packaging/tests/test_command_upload_docs.py b/Lib/packaging/tests/test_command_upload_docs.py --- a/Lib/packaging/tests/test_command_upload_docs.py +++ b/Lib/packaging/tests/test_command_upload_docs.py @@ -9,8 +9,7 @@ _ssl = None from packaging.command import upload_docs as upload_docs_mod -from packaging.command.upload_docs import (upload_docs, zip_dir, - encode_multipart) +from packaging.command.upload_docs import upload_docs, zip_dir from packaging.dist import Distribution from packaging.errors import PackagingFileError, PackagingOptionError @@ -23,23 +22,6 @@ PyPIServerTestCase = object -EXPECTED_MULTIPART_OUTPUT = [ - b'---x', - b'Content-Disposition: form-data; name="username"', - b'', - b'wok', - b'---x', - b'Content-Disposition: form-data; name="password"', - b'', - b'secret', - b'---x', - b'Content-Disposition: form-data; name="picture"; filename="wok.png"', - b'', - b'PNG89', - b'---x--', - b'', -] - PYPIRC = """\ [distutils] index-servers = server1 @@ -108,13 +90,6 @@ zip_f = zipfile.ZipFile(compressed) self.assertEqual(zip_f.namelist(), ['index.html', 'docs/index.html']) - def test_encode_multipart(self): - fields = [('username', 'wok'), ('password', 'secret')] - files = [('picture', 'wok.png', b'PNG89')] - content_type, body = encode_multipart(fields, files, b'-x') - self.assertEqual(b'multipart/form-data; boundary=-x', content_type) - self.assertEqual(EXPECTED_MULTIPART_OUTPUT, body.split(b'\r\n')) - def prepare_command(self): self.cmd.upload_dir = self.prepare_sample_dir() self.cmd.ensure_finalized() diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py --- a/Lib/packaging/tests/test_uninstall.py +++ b/Lib/packaging/tests/test_uninstall.py @@ -93,7 +93,6 @@ self.assertRaises(PackagingError, remove, 'Foo', paths=[self.root_dir]) - @unittest.skipIf(sys.platform == 'win32', 'deactivated for now') def test_uninstall(self): dist, install_lib = self.install_dist() self.assertIsFile(install_lib, 'foo', '__init__.py') @@ -103,7 +102,6 @@ self.assertIsNotFile(install_lib, 'foo', 'sub', '__init__.py') self.assertIsNotFile(install_lib, 'Foo-0.1.dist-info', 'RECORD') - @unittest.skipIf(sys.platform == 'win32', 'deactivated for now') def test_remove_issue(self): # makes sure if there are OSErrors (like permission denied) # remove() stops and display a clean error diff --git a/Lib/packaging/tests/test_util.py b/Lib/packaging/tests/test_util.py --- a/Lib/packaging/tests/test_util.py +++ b/Lib/packaging/tests/test_util.py @@ -19,7 +19,7 @@ get_compiler_versions, _MAC_OS_X_LD_VERSION, byte_compile, find_packages, spawn, get_pypirc_path, generate_pypirc, read_pypirc, resolve_name, iglob, RICH_GLOB, egginfo_to_distinfo, is_setuptools, is_distutils, is_packaging, - get_install_method, cfg_to_args) + get_install_method, cfg_to_args, encode_multipart) PYPIRC = """\ @@ -54,6 +54,23 @@ password:xxx """ +EXPECTED_MULTIPART_OUTPUT = [ + b'---x', + b'Content-Disposition: form-data; name="username"', + b'', + b'wok', + b'---x', + b'Content-Disposition: form-data; name="password"', + b'', + b'secret', + b'---x', + b'Content-Disposition: form-data; name="picture"; filename="wok.png"', + b'', + b'PNG89', + b'---x--', + b'', +] + class FakePopen: test_class = None @@ -525,6 +542,13 @@ self.assertEqual(args['scripts'], dist.scripts) self.assertEqual(args['py_modules'], dist.py_modules) + def test_encode_multipart(self): + fields = [('username', 'wok'), ('password', 'secret')] + files = [('picture', 'wok.png', b'PNG89')] + content_type, body = encode_multipart(fields, files, b'-x') + self.assertEqual(b'multipart/form-data; boundary=-x', content_type) + self.assertEqual(EXPECTED_MULTIPART_OUTPUT, body.split(b'\r\n')) + class GlobTestCaseBase(support.TempdirManager, support.LoggingCatcher, diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -1487,3 +1487,50 @@ _path_created.add(abs_head) return created_dirs + + +def encode_multipart(fields, files, boundary=None): + """Prepare a multipart HTTP request. + + *fields* is a sequence of (name: str, value: str) elements for regular + form fields, *files* is a sequence of (name: str, filename: str, value: + bytes) elements for data to be uploaded as files. + + Returns (content_type: bytes, body: bytes) ready for http.client.HTTP. + """ + # Taken from + # http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/ + + if boundary is None: + boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' + elif not isinstance(boundary, bytes): + raise TypeError('boundary must be bytes, not %r' % type(boundary)) + + l = [] + for key, values in fields: + # handle multiple entries for the same name + if not isinstance(values, (tuple, list)): + values=[values] + + for value in values: + l.extend(( + b'--' + boundary, + ('Content-Disposition: form-data; name="%s"' % + key).encode('utf-8'), + b'', + value.encode('utf-8'))) + + for key, filename, value in files: + l.extend(( + b'--' + boundary, + ('Content-Disposition: form-data; name="%s"; filename="%s"' % + (key, filename)).encode('utf-8'), + b'', + value)) + + l.append(b'--' + boundary + b'--') + l.append(b'') + + body = b'\r\n'.join(l) + content_type = b'multipart/form-data; boundary=' + boundary + return content_type, body diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -78,6 +78,8 @@ from _ssl import HAS_SNI from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1) +from _ssl import _OPENSSL_API_VERSION + _PROTOCOL_NAMES = { PROTOCOL_TLSv1: "TLSv1", PROTOCOL_SSLv23: "SSLv23", diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x81\x81\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x81\x81\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x81\x81\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x81\x81\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x81\x81\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x81\x81\xc1\xc4", "ignore", "abc\u804a"), (b"\xc1\x64", "strict", None), ) @@ -28,8 +28,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), (b"\x83\x34\x83\x31", "strict", None), ("\u30fb", "strict", None), @@ -42,11 +42,14 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u804a"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u804a\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), - (b"abc\x84\x39\x84\x39\xc1\xc4", "replace", "abc\ufffd\u804a"), + (b"abc\x84\x39\x84\x39\xc1\xc4", "replace", "abc\ufffd9\ufffd9\u804a"), ("\u30fb", "strict", b"\x819\xa79"), + (b"abc\x84\x32\x80\x80def", "replace", 'abc\ufffd2\ufffd\ufffddef'), + (b"abc\x81\x30\x81\x30def", "strict", 'abc\x80def'), + (b"abc\x86\x30\x81\x30def", "replace", 'abc\ufffd0\ufffd0def'), ) has_iso10646 = True @@ -74,9 +77,11 @@ '\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' 'Bye.\n'), # invalid bytes - (b'ab~cd', 'replace', 'ab\uFFFDd'), + (b'ab~cd', 'replace', 'ab\uFFFDcd'), (b'ab\xffcd', 'replace', 'ab\uFFFDcd'), (b'ab~{\x81\x81\x41\x44~}cd', 'replace', 'ab\uFFFD\uFFFD\u804Acd'), + (b'ab~{\x41\x44~}cd', 'replace', 'ab\u804Acd'), + (b"ab~{\x79\x79\x41\x44~}cd", "replace", "ab\ufffd\ufffd\u804acd"), ) def test_main(): diff --git a/Lib/test/test_codecencodings_hk.py b/Lib/test/test_codecencodings_hk.py --- a/Lib/test/test_codecencodings_hk.py +++ b/Lib/test/test_codecencodings_hk.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py --- a/Lib/test/test_codecencodings_jp.py +++ b/Lib/test/test_codecencodings_jp.py @@ -15,50 +15,57 @@ # invalid bytes (b"abc\x81\x00\x81\x00\x82\x84", "strict", None), (b"abc\xf8", "strict", None), - (b"abc\x81\x00\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - (b"abc\x81\x00\x82\x84", "ignore", "abc\uff44"), + (b"abc\x81\x00\x82\x84", "replace", "abc\ufffd\x00\uff44"), + (b"abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\x00\uff44\ufffd"), + (b"abc\x81\x00\x82\x84", "ignore", "abc\x00\uff44"), + (b"ab\xEBxy", "replace", "ab\uFFFDxy"), + (b"ab\xF0\x39xy", "replace", "ab\uFFFD9xy"), + (b"ab\xEA\xF0xy", "replace", 'ab\ufffd\ue038y'), # sjis vs cp932 (b"\\\x7e", "replace", "\\\x7e"), (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\uff3c\u2225\uff0d"), ) +euc_commontests = ( + # invalid bytes + (b"abc\x80\x80\xc1\xc4", "strict", None), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u7956"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u7956\ufffd"), + (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + (b"abc\xc8", "strict", None), + (b"abc\x8f\x83\x83", "replace", "abc\ufffd\ufffd\ufffd"), + (b"\x82\xFCxy", "replace", "\ufffd\ufffdxy"), + (b"\xc1\x64", "strict", None), + (b"\xa1\xc0", "strict", "\uff3c"), + (b"\xa1\xc0\\", "strict", "\uff3c\\"), + (b"\x8eXY", "replace", "\ufffdXY"), +) + +class Test_EUC_JIS_2004(test_multibytecodec_support.TestBase, + unittest.TestCase): + encoding = 'euc_jis_2004' + tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') + codectests = euc_commontests + xmlcharnametest = ( + "\xab\u211c\xbb = \u2329\u1234\u232a", + b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" + ) + class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'euc_jisx0213' tstring = test_multibytecodec_support.load_teststring('euc_jisx0213') - codectests = ( - # invalid bytes - (b"abc\x80\x80\xc1\xc4", "strict", None), - (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), - (b"\xc1\x64", "strict", None), - (b"\xa1\xc0", "strict", "\uff3c"), - ) + codectests = euc_commontests xmlcharnametest = ( "\xab\u211c\xbb = \u2329\u1234\u232a", b"\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" ) -eucjp_commontests = ( - (b"abc\x80\x80\xc1\xc4", "strict", None), - (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), - (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), - (b"abc\x8f\x83\x83", "replace", "abc\ufffd"), - (b"\xc1\x64", "strict", None), -) - class Test_EUC_JP_COMPAT(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'euc_jp' tstring = test_multibytecodec_support.load_teststring('euc_jp') - codectests = eucjp_commontests + ( - (b"\xa1\xc0\\", "strict", "\uff3c\\"), + codectests = euc_commontests + ( ("\xa5", "strict", b"\x5c"), ("\u203e", "strict", b"\x7e"), ) @@ -66,8 +73,6 @@ shiftjis_commonenctests = ( (b"abc\x80\x80\x82\x84", "strict", None), (b"abc\xf8", "strict", None), - (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), ) @@ -75,20 +80,41 @@ encoding = 'shift_jis' tstring = test_multibytecodec_support.load_teststring('shift_jis') codectests = shiftjis_commonenctests + ( + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\ufffd\uff44\ufffd"), + (b"\\\x7e", "strict", "\\\x7e"), (b"\x81\x5f\x81\x61\x81\x7c", "strict", "\uff3c\u2016\u2212"), + (b"abc\x81\x39", "replace", "abc\ufffd9"), + (b"abc\xEA\xFC", "replace", "abc\ufffd\ufffd"), + (b"abc\xFF\x58", "replace", "abc\ufffdX"), + ) + +class Test_SJIS_2004(test_multibytecodec_support.TestBase, unittest.TestCase): + encoding = 'shift_jis_2004' + tstring = test_multibytecodec_support.load_teststring('shift_jis') + codectests = shiftjis_commonenctests + ( + (b"\\\x7e", "strict", "\xa5\u203e"), + (b"\x81\x5f\x81\x61\x81\x7c", "strict", "\\\u2016\u2212"), + (b"abc\xEA\xFC", "strict", "abc\u64bf"), + (b"\x81\x39xy", "replace", "\ufffd9xy"), + (b"\xFF\x58xy", "replace", "\ufffdXxy"), + (b"\x80\x80\x82\x84xy", "replace", "\ufffd\ufffd\uff44xy"), + (b"\x80\x80\x82\x84\x88xy", "replace", "\ufffd\ufffd\uff44\u5864y"), + (b"\xFC\xFBxy", "replace", '\ufffd\u95b4y'), + ) + xmlcharnametest = ( + "\xab\u211c\xbb = \u2329\u1234\u232a", + b"\x85Gℜ\x85Q = ⟨ሴ⟩" ) class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'shift_jisx0213' tstring = test_multibytecodec_support.load_teststring('shift_jisx0213') - codectests = ( - # invalid bytes - (b"abc\x80\x80\x82\x84", "strict", None), - (b"abc\xf8", "strict", None), - (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), - (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), - (b"abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), + codectests = shiftjis_commonenctests + ( + (b"abc\x80\x80\x82\x84", "replace", "abc\ufffd\ufffd\uff44"), + (b"abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\ufffd\uff44\ufffd"), + # sjis vs cp932 (b"\\\x7e", "replace", "\xa5\u203e"), (b"\x81\x5f\x81\x61\x81\x7c", "replace", "\x5c\u2016\u2212"), diff --git a/Lib/test/test_codecencodings_kr.py b/Lib/test/test_codecencodings_kr.py --- a/Lib/test/test_codecencodings_kr.py +++ b/Lib/test/test_codecencodings_kr.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\uc894"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), ) @@ -27,8 +27,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", 'abc\ufffd\ufffd\uc894'), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\uc894\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), # composed make-up sequence errors @@ -40,13 +40,14 @@ (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "strict", "\uc4d4"), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4x", "strict", "\uc4d4x"), - (b"a\xa4\xd4\xa4\xb6\xa4", "replace", "a\ufffd"), + (b"a\xa4\xd4\xa4\xb6\xa4", "replace", 'a\ufffd'), (b"\xa4\xd4\xa3\xb6\xa4\xd0\xa4\xd4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa3\xd0\xa4\xd4", "strict", None), (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa3\xd4", "strict", None), - (b"\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", "\ufffd"), - (b"\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", "\ufffd"), - (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", "\ufffd"), + (b"\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", '\ufffd\u6e21\ufffd\u3160\ufffd'), + (b"\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", '\ufffd\u6e21\ub544\ufffd\ufffd'), + (b"\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", '\ufffd\u6e21\ub544\u572d\ufffd'), + (b"\xa4\xd4\xff\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "replace", '\ufffd\ufffd\ufffd\uc4d4'), (b"\xc1\xc4", "strict", "\uc894"), ) @@ -57,9 +58,13 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ucd27"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ucd27\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\ucd27"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\ucd27\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\ucd27"), + (b"\xD8abc", "replace", "\uFFFDabc"), + (b"\xD8\xFFabc", "replace", "\uFFFD\uFFFDabc"), + (b"\x84bxy", "replace", "\uFFFDbxy"), + (b"\x8CBxy", "replace", "\uFFFDBxy"), ) def test_main(): diff --git a/Lib/test/test_codecencodings_tw.py b/Lib/test/test_codecencodings_tw.py --- a/Lib/test/test_codecencodings_tw.py +++ b/Lib/test/test_codecencodings_tw.py @@ -15,8 +15,8 @@ # invalid bytes (b"abc\x80\x80\xc1\xc4", "strict", None), (b"abc\xc8", "strict", None), - (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), - (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"), + (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"), (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) diff --git a/Lib/test/test_codecmaps_tw.py b/Lib/test/test_codecmaps_tw.py --- a/Lib/test/test_codecmaps_tw.py +++ b/Lib/test/test_codecmaps_tw.py @@ -23,6 +23,9 @@ (b'\xa2\xcc', '\u5341'), (b'\xa2\xce', '\u5345'), ] + codectests = ( + (b"\xFFxy", "replace", "\ufffdxy"), + ) def test_main(): support.run_unittest(__name__) diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -1,7 +1,8 @@ import io import unittest import urllib.robotparser -from urllib.error import URLError +from urllib.error import URLError, HTTPError +from urllib.request import urlopen from test import support class RobotTestCase(unittest.TestCase): @@ -237,13 +238,27 @@ support.requires('network') with support.transient_internet('mueblesmoraleda.com'): url = 'http://mueblesmoraleda.com' + robots_url = url + "/robots.txt" + # First check the URL is usable for our purposes, since the + # test site is a bit flaky. + try: + urlopen(robots_url) + except HTTPError as e: + if e.code not in {401, 403}: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not %r" + % (robots_url, e.code)) + else: + self.skipTest( + "%r should return a 401 or 403 HTTP error, not succeed" + % (robots_url)) parser = urllib.robotparser.RobotFileParser() parser.set_url(url) try: parser.read() except URLError: self.skipTest('%s is unavailable' % url) - self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) + self.assertEqual(parser.can_fetch("*", robots_url), False) def testPythonOrg(self): support.requires('network') diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -60,7 +60,7 @@ def can_clear_options(): # 0.9.8m or higher - return ssl.OPENSSL_VERSION_INFO >= (0, 9, 8, 13, 15) + return ssl._OPENSSL_API_VERSION >= (0, 9, 8, 13, 15) def no_sslv2_implies_sslv3_hello(): # 0.9.7h or higher diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -113,6 +113,14 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -263,6 +263,7 @@ Walter D?rwald Hans Eckardt Rodolpho Eckhardt +John Edmonds Grant Edwards John Ehresman Eric Eisner @@ -418,6 +419,7 @@ Gerrit Holl Shane Holloway Rune Holm +Thomas Holmes Philip Homburg Naofumi Honda Jeffrey Honig diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -219,6 +219,16 @@ Library ------- +- Issue #12504: Close file handles in a timely manner in packaging.database. + This fixes a bug with the remove (uninstall) feature on Windows. + +- Issues #12169 and #10510: Factor out code used by various packaging commands + to make HTTP POST requests, and make sure it uses CRLF. + +- Issue #12016: Multibyte CJK decoders now resynchronize faster. They only + ignore the first byte of an invalid byte sequence. For example, + b'\xff\n'.decode('gb2312', 'replace') gives '\ufffd\n' instead of '\ufffd'. + - Issue #12459: time.sleep() now raises a ValueError if the sleep length is negative, instead of an infinite sleep on Windows or raising an IOError on Linux for example, to have the same behaviour on all platforms. @@ -994,6 +1004,18 @@ Tests ----- +- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and + an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder + Web site. + +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + +- Issue #12440: When testing whether some bits in SSLContext.options can be + reset, check the version of the OpenSSL headers Python was compiled against, + rather than the runtime version of the OpenSSL library. + - Issue #11512: Add a test suite for the cgitb module. Patch by Robbie Clemons. - Issue #12497: Install test/data to prevent failures of the various codecmaps diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2101,6 +2101,24 @@ NULL }; + +static void +parse_openssl_version(unsigned long libver, + unsigned int *major, unsigned int *minor, + unsigned int *fix, unsigned int *patch, + unsigned int *status) +{ + *status = libver & 0xF; + libver >>= 4; + *patch = libver & 0xFF; + libver >>= 8; + *fix = libver & 0xFF; + libver >>= 8; + *minor = libver & 0xFF; + libver >>= 8; + *major = libver & 0xFF; +} + PyMODINIT_FUNC PyInit__ssl(void) { @@ -2213,15 +2231,7 @@ return NULL; if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r)) return NULL; - status = libver & 0xF; - libver >>= 4; - patch = libver & 0xFF; - libver >>= 8; - fix = libver & 0xFF; - libver >>= 8; - minor = libver & 0xFF; - libver >>= 8; - major = libver & 0xFF; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); r = Py_BuildValue("IIIII", major, minor, fix, patch, status); if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r)) return NULL; @@ -2229,5 +2239,11 @@ if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r)) return NULL; + libver = OPENSSL_VERSION_NUMBER; + parse_openssl_version(libver, &major, &minor, &fix, &patch, &status); + r = Py_BuildValue("IIIII", major, minor, fix, patch, status); + if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) + return NULL; + return m; } diff --git a/Modules/cjkcodecs/_codecs_cn.c b/Modules/cjkcodecs/_codecs_cn.c --- a/Modules/cjkcodecs/_codecs_cn.c +++ b/Modules/cjkcodecs/_codecs_cn.c @@ -85,7 +85,7 @@ TRYMAP_DEC(gb2312, **outbuf, c ^ 0x80, IN2 ^ 0x80) { NEXT(2, 1) } - else return 2; + else return 1; } return 0; @@ -141,7 +141,7 @@ REQUIRE_INBUF(2) GBK_DECODE(c, IN2, **outbuf) - else return 2; + else return 1; NEXT(2, 1) } @@ -267,7 +267,7 @@ c3 = IN3; c4 = IN4; if (c < 0x81 || c3 < 0x81 || c4 < 0x30 || c4 > 0x39) - return 4; + return 1; c -= 0x81; c2 -= 0x30; c3 -= 0x81; c4 -= 0x30; @@ -292,12 +292,12 @@ continue; } } - return 4; + return 1; } GBK_DECODE(c, c2, **outbuf) else TRYMAP_DEC(gb18030ext, **outbuf, c, c2); - else return 2; + else return 1; NEXT(2, 1) } @@ -400,7 +400,7 @@ else if (c2 == '\n') ; /* line-continuation */ else - return 2; + return 1; NEXT(2, 0); continue; } @@ -419,7 +419,7 @@ NEXT(2, 1) } else - return 2; + return 1; } } diff --git a/Modules/cjkcodecs/_codecs_hk.c b/Modules/cjkcodecs/_codecs_hk.c --- a/Modules/cjkcodecs/_codecs_hk.c +++ b/Modules/cjkcodecs/_codecs_hk.c @@ -161,7 +161,7 @@ case 0x8864: WRITE2(0x00ca, 0x030c); break; case 0x88a3: WRITE2(0x00ea, 0x0304); break; case 0x88a5: WRITE2(0x00ea, 0x030c); break; - default: return 2; + default: return 1; } NEXT(2, 2) /* all decoded codepoints are pairs, above. */ diff --git a/Modules/cjkcodecs/_codecs_jp.c b/Modules/cjkcodecs/_codecs_jp.c --- a/Modules/cjkcodecs/_codecs_jp.c +++ b/Modules/cjkcodecs/_codecs_jp.c @@ -112,7 +112,7 @@ TRYMAP_DEC(cp932ext, **outbuf, c, c2); else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -120,7 +120,7 @@ c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; TRYMAP_DEC(jisx0208, **outbuf, c, c2); - else return 2; + else return 1; } else if (c >= 0xf0 && c <= 0xf9) { if ((c2 >= 0x40 && c2 <= 0x7e) || @@ -128,10 +128,10 @@ OUT1(0xe000 + 188 * (c - 0xf0) + (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41)) else - return 2; + return 1; } else - return 2; + return 1; NEXT(2, 1) } @@ -256,7 +256,7 @@ NEXT(2, 1) } else - return 2; + return 1; } else if (c == 0x8f) { unsigned char c2, c3; @@ -274,7 +274,7 @@ continue; } else TRYMAP_DEC(jisx0212, **outbuf, c2, c3) ; - else return 3; + else return 1; NEXT(3, 1) } else { @@ -300,7 +300,7 @@ NEXT(2, 2) continue; } - else return 2; + else return 1; NEXT(2, 1) } } @@ -388,7 +388,7 @@ NEXT(2, 1) } else - return 2; + return 1; } else if (c == 0x8f) { unsigned char c2, c3; @@ -401,7 +401,7 @@ NEXT(3, 1) } else - return 3; + return 1; } else { unsigned char c2; @@ -417,7 +417,7 @@ #endif TRYMAP_DEC(jisx0208, **outbuf, c ^ 0x80, c2 ^ 0x80) ; - else return 2; + else return 1; NEXT(2, 1) } } @@ -502,7 +502,7 @@ REQUIRE_INBUF(2) c2 = IN2; if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -522,10 +522,10 @@ continue; } else - return 2; + return 1; } else - return 2; + return 1; NEXT(1, 1) /* JIS X 0201 */ } @@ -645,7 +645,7 @@ REQUIRE_INBUF(2) c2 = IN2; if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; + return 1; c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); @@ -671,7 +671,7 @@ NEXT_OUT(2) } else - return 2; + return 1; NEXT_IN(2) } else { /* Plane 2 */ @@ -689,13 +689,13 @@ continue; } else - return 2; + return 1; NEXT(2, 1) } continue; } else - return 2; + return 1; NEXT(1, 1) /* JIS X 0201 */ } diff --git a/Modules/cjkcodecs/_codecs_kr.c b/Modules/cjkcodecs/_codecs_kr.c --- a/Modules/cjkcodecs/_codecs_kr.c +++ b/Modules/cjkcodecs/_codecs_kr.c @@ -123,7 +123,7 @@ if ((*inbuf)[2] != EUCKR_JAMO_FIRSTBYTE || (*inbuf)[4] != EUCKR_JAMO_FIRSTBYTE || (*inbuf)[6] != EUCKR_JAMO_FIRSTBYTE) - return 8; + return 1; c = (*inbuf)[3]; if (0xa1 <= c && c <= 0xbe) @@ -143,7 +143,7 @@ jong = NONE; if (cho == NONE || jung == NONE || jong == NONE) - return 8; + return 1; OUT1(0xac00 + cho*588 + jung*28 + jong); NEXT(8, 1) @@ -152,7 +152,7 @@ NEXT(2, 1) } else - return 2; + return 1; } return 0; @@ -208,7 +208,7 @@ REQUIRE_INBUF(2) TRYMAP_DEC(ksx1001, **outbuf, c ^ 0x80, IN2 ^ 0x80); else TRYMAP_DEC(cp949ext, **outbuf, c, IN2); - else return 2; + else return 1; NEXT(2, 1) } @@ -375,7 +375,7 @@ i_jong = johabidx_jongseong[c_jong]; if (i_cho == NONE || i_jung == NONE || i_jong == NONE) - return 2; + return 1; /* we don't use U+1100 hangul jamo yet. */ if (i_cho == FILL) { @@ -391,7 +391,7 @@ OUT1(0x3100 | johabjamo_jungseong[c_jung]) else - return 2; + return 1; } } else { if (i_jung == FILL) { @@ -399,7 +399,7 @@ OUT1(0x3100 | johabjamo_choseong[c_cho]) else - return 2; + return 1; } else OUT1(0xac00 + @@ -414,7 +414,7 @@ c2 < 0x31 || (c2 >= 0x80 && c2 < 0x91) || (c2 & 0x7f) == 0x7f || (c == 0xda && (c2 >= 0xa1 && c2 <= 0xd3))) - return 2; + return 1; else { unsigned char t1, t2; @@ -425,7 +425,7 @@ t2 = (t2 < 0x5e ? t2 : t2 - 0x5e) + 0x21; TRYMAP_DEC(ksx1001, **outbuf, t1, t2); - else return 2; + else return 1; NEXT(2, 1) } } diff --git a/Modules/cjkcodecs/_codecs_tw.c b/Modules/cjkcodecs/_codecs_tw.c --- a/Modules/cjkcodecs/_codecs_tw.c +++ b/Modules/cjkcodecs/_codecs_tw.c @@ -55,7 +55,7 @@ TRYMAP_DEC(big5, **outbuf, c, IN2) { NEXT(2, 1) } - else return 2; + else return 1; } return 0; @@ -109,7 +109,7 @@ TRYMAP_DEC(cp950ext, **outbuf, c, IN2); else TRYMAP_DEC(big5, **outbuf, c, IN2); - else return 2; + else return 1; NEXT(2, 1) } diff --git a/Modules/md5module.c b/Modules/md5module.c --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -243,7 +243,7 @@ in += MD5_BLOCKSIZE; inlen -= MD5_BLOCKSIZE; } else { - n = MIN(inlen, (MD5_BLOCKSIZE - md5->curlen)); + n = MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen)); memcpy(md5->buf + md5->curlen, in, (size_t)n); md5->curlen += n; in += n; diff --git a/Modules/sha1module.c b/Modules/sha1module.c --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -218,7 +218,7 @@ in += SHA1_BLOCKSIZE; inlen -= SHA1_BLOCKSIZE; } else { - n = MIN(inlen, (SHA1_BLOCKSIZE - sha1->curlen)); + n = MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen)); memcpy(sha1->buf + sha1->curlen, in, (size_t)n); sha1->curlen += n; in += n; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 23:38:35 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 23:38:35 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2311863=3A_remove_un?= =?utf8?q?used_file_Python/thread=5Fwince=2Eh?= Message-ID: http://hg.python.org/cpython/rev/638039a4fef3 changeset: 71265:638039a4fef3 user: Antoine Pitrou date: Fri Jul 08 23:37:39 2011 +0200 summary: Issue #11863: remove unused file Python/thread_wince.h files: Python/thread_wince.h | 136 ------------------------------ 1 files changed, 0 insertions(+), 136 deletions(-) diff --git a/Python/thread_wince.h b/Python/thread_wince.h deleted file mode 100644 --- a/Python/thread_wince.h +++ /dev/null @@ -1,136 +0,0 @@ - -/* This code implemented by Mark Hammond (MHammond at skippinet.com.au) */ - -#include -#include -#include - -long PyThread_get_thread_ident(void); - -/* - * Change all headers to pure ANSI as no one will use K&R style on an - * NT - */ - -/* - * Initialization of the C package, should not be needed. - */ -static void PyThread__init_thread(void) -{ -} - -/* - * Thread support. - */ -long PyThread_start_new_thread(void (*func)(void *), void *arg) -{ - long rv; - int success = -1; - - dprintf(("%ld: PyThread_start_new_thread called\n", PyThread_get_thread_ident())); - if (!initialized) - PyThread_init_thread(); - - rv = _beginthread(func, 0, arg); /* use default stack size */ - - if (rv != -1) { - success = 0; - dprintf(("%ld: PyThread_start_new_thread succeeded:\n", PyThread_get_thread_ident())); - } - - return success; -} - -/* - * Return the thread Id instead of an handle. The Id is said to uniquely identify the - * thread in the system - */ -long PyThread_get_thread_ident(void) -{ - if (!initialized) - PyThread_init_thread(); - - return GetCurrentThreadId(); -} - -void PyThread_exit_thread(void) -{ - dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident())); - if (!initialized) - exit(0); - _endthread(); -} - -/* - * Lock support. It has to be implemented using Mutexes, as - * CE doesnt support semaphores. Therefore we use some hacks to - * simulate the non reentrant requirements of Python locks - */ -PyThread_type_lock PyThread_allocate_lock(void) -{ - HANDLE aLock; - - dprintf(("PyThread_allocate_lock called\n")); - if (!initialized) - PyThread_init_thread(); - - aLock = CreateEvent(NULL, /* Security attributes */ - 0, /* Manual-Reset */ - 1, /* Is initially signalled */ - NULL); /* Name of event */ - - dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock)); - - return (PyThread_type_lock) aLock; -} - -void PyThread_free_lock(PyThread_type_lock aLock) -{ - dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); - - CloseHandle(aLock); -} - -/* - * Return 1 on success if the lock was acquired - * - * and 0 if the lock was not acquired. This means a 0 is returned - * if the lock has already been acquired by this thread! - */ -int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag) -{ - int success = 1; - DWORD waitResult; - - dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),aLock, waitflag)); - -#ifndef DEBUG - waitResult = WaitForSingleObject(aLock, (waitflag ? INFINITE : 0)); -#else - /* To aid in debugging, we regularly wake up. This allows us to - break into the debugger */ - while (TRUE) { - waitResult = WaitForSingleObject(aLock, waitflag ? 3000 : 0); - if (waitflag==0 || (waitflag && waitResult == WAIT_OBJECT_0)) - break; - } -#endif - - if (waitResult != WAIT_OBJECT_0) { - success = 0; /* We failed */ - } - - dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success)); - - return success; -} - -void PyThread_release_lock(PyThread_type_lock aLock) -{ - dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); - - if (!SetEvent(aLock)) - dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError())); -} - - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 8 23:52:45 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 08 Jul 2011 23:52:45 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2311863=3A_Remove_su?= =?utf8?q?pport_for_legacy_systems_deprecated_in_Python_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/0aa3f90f0830 changeset: 71266:0aa3f90f0830 user: Antoine Pitrou date: Fri Jul 08 23:47:50 2011 +0200 summary: Issue #11863: Remove support for legacy systems deprecated in Python 3.2 (following PEP 11). These systems are systems using Mach C Threads, SunOS lightweight processes, GNU pth threads and IRIX threads. files: Include/Python.h | 5 - Misc/NEWS | 4 + PC/pyconfig.h | 3 - Python/thread.c | 43 - Python/thread_cthread.h | 112 ----- Python/thread_lwp.h | 113 ----- Python/thread_sgi.h | 259 ----------- Python/thread_solaris.h | 130 ----- configure | 627 +++++++++++++-------------- configure.in | 16 +- pyconfig.h.in | 12 - 11 files changed, 315 insertions(+), 1009 deletions(-) diff --git a/Include/Python.h b/Include/Python.h --- a/Include/Python.h +++ b/Include/Python.h @@ -151,11 +151,6 @@ #define Py_file_input 257 #define Py_eval_input 258 -#ifdef HAVE_PTH -/* GNU pth user-space thread support */ -#include -#endif - /* Define macros for inline documentation. */ #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -948,6 +948,10 @@ Build ----- +- Issue #11863: Remove support for legacy systems deprecated in Python 3.2 + (following PEP 11). These systems are systems using Mach C Threads, + SunOS lightweight processes, GNU pth threads and IRIX threads. + - Issue #8746: Correct faulty configure checks so that os.chflags() and os.lchflags() are once again built on systems that support these functions (*BSD and OS X). Also add new stat file flags for OS X diff --git a/PC/pyconfig.h b/PC/pyconfig.h --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -711,9 +711,6 @@ /* Define if you have the header file. */ /* #define HAVE_SYS_UTSNAME_H 1 */ -/* Define if you have the header file. */ -/* #undef HAVE_THREAD_H */ - /* Define if you have the header file. */ /* #define HAVE_UNISTD_H 1 */ diff --git a/Python/thread.c b/Python/thread.c --- a/Python/thread.c +++ b/Python/thread.c @@ -26,18 +26,6 @@ #ifndef _POSIX_THREADS -#ifdef __sgi -#define SGI_THREADS -#endif - -#ifdef HAVE_THREAD_H -#define SOLARIS_THREADS -#endif - -#if defined(sun) && !defined(SOLARIS_THREADS) -#define SUN_LWP -#endif - /* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then enough of the Posix threads package is implemented to support python threads. @@ -93,37 +81,11 @@ or the size specified by the THREAD_STACK_SIZE macro. */ static size_t _pythread_stacksize = 0; -#ifdef SGI_THREADS -#error SGI Irix threads are now unsupported, and code will be removed in 3.3. -#include "thread_sgi.h" -#endif - -#ifdef SOLARIS_THREADS -#define PYTHREAD_NAME "solaris" -#include "thread_solaris.h" -#endif - -#ifdef SUN_LWP -#error SunOS lightweight processes are now unsupported, and code will be removed in 3.3. -#include "thread_lwp.h" -#endif - -#ifdef HAVE_PTH -#error GNU pth threads are now unsupported, and code will be removed in 3.3. -#include "thread_pth.h" -#undef _POSIX_THREADS -#endif - #ifdef _POSIX_THREADS #define PYTHREAD_NAME "pthread" #include "thread_pthread.h" #endif -#ifdef C_THREADS -#error Mach C Threads are now unsupported, and code will be removed in 3.3. -#include "thread_cthread.h" -#endif - #ifdef NT_THREADS #define PYTHREAD_NAME "nt" #include "thread_nt.h" @@ -134,11 +96,6 @@ #include "thread_os2.h" #endif -#ifdef PLAN9_THREADS -#define PYTHREAD_NAME "plan9" -#include "thread_plan9.h" -#endif - /* #ifdef FOOBAR_THREADS #include "thread_foobar.h" diff --git a/Python/thread_cthread.h b/Python/thread_cthread.h deleted file mode 100644 --- a/Python/thread_cthread.h +++ /dev/null @@ -1,112 +0,0 @@ - -#ifdef MACH_C_THREADS -#include -#endif - -#ifdef HURD_C_THREADS -#include -#endif - -/* - * Initialization. - */ -static void -PyThread__init_thread(void) -{ -#ifndef HURD_C_THREADS - /* Roland McGrath said this should not be used since this is - done while linking to threads */ - cthread_init(); -#else -/* do nothing */ - ; -#endif -} - -/* - * Thread support. - */ -long -PyThread_start_new_thread(void (*func)(void *), void *arg) -{ - int success = 0; /* init not needed when SOLARIS_THREADS and */ - /* C_THREADS implemented properly */ - - dprintf(("PyThread_start_new_thread called\n")); - if (!initialized) - PyThread_init_thread(); - /* looks like solaris detaches the thread to never rejoin - * so well do it here - */ - cthread_detach(cthread_fork((cthread_fn_t) func, arg)); - return success < 0 ? -1 : 0; -} - -long -PyThread_get_thread_ident(void) -{ - if (!initialized) - PyThread_init_thread(); - return (long) cthread_self(); -} - -void -PyThread_exit_thread(void) -{ - dprintf(("PyThread_exit_thread called\n")); - if (!initialized) - exit(0); - cthread_exit(0); -} - -/* - * Lock support. - */ -PyThread_type_lock -PyThread_allocate_lock(void) -{ - mutex_t lock; - - dprintf(("PyThread_allocate_lock called\n")); - if (!initialized) - PyThread_init_thread(); - - lock = mutex_alloc(); - if (mutex_init(lock)) { - perror("mutex_init"); - free((void *) lock); - lock = 0; - } - dprintf(("PyThread_allocate_lock() -> %p\n", lock)); - return (PyThread_type_lock) lock; -} - -void -PyThread_free_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_free_lock(%p) called\n", lock)); - mutex_free(lock); -} - -int -PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) -{ - int success = FALSE; - - dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); - if (waitflag) { /* blocking */ - mutex_lock((mutex_t)lock); - success = TRUE; - } else { /* non blocking */ - success = mutex_try_lock((mutex_t)lock); - } - dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); - return success; -} - -void -PyThread_release_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_release_lock(%p) called\n", lock)); - mutex_unlock((mutex_t )lock); -} diff --git a/Python/thread_lwp.h b/Python/thread_lwp.h deleted file mode 100644 --- a/Python/thread_lwp.h +++ /dev/null @@ -1,113 +0,0 @@ - -#include -#include -#include - -#define STACKSIZE 1000 /* stacksize for a thread */ -#define NSTACKS 2 /* # stacks to be put in cache initially */ - -struct lock { - int lock_locked; - cv_t lock_condvar; - mon_t lock_monitor; -}; - - -/* - * Initialization. - */ -static void PyThread__init_thread(void) -{ - lwp_setstkcache(STACKSIZE, NSTACKS); -} - -/* - * Thread support. - */ - - -long PyThread_start_new_thread(void (*func)(void *), void *arg) -{ - thread_t tid; - int success; - dprintf(("PyThread_start_new_thread called\n")); - if (!initialized) - PyThread_init_thread(); - success = lwp_create(&tid, func, MINPRIO, 0, lwp_newstk(), 1, arg); - return success < 0 ? -1 : 0; -} - -long PyThread_get_thread_ident(void) -{ - thread_t tid; - if (!initialized) - PyThread_init_thread(); - if (lwp_self(&tid) < 0) - return -1; - return tid.thread_id; -} - -void PyThread_exit_thread(void) -{ - dprintf(("PyThread_exit_thread called\n")); - if (!initialized) - exit(0); - lwp_destroy(SELF); -} - -/* - * Lock support. - */ -PyThread_type_lock PyThread_allocate_lock(void) -{ - struct lock *lock; - extern char *malloc(size_t); - - dprintf(("PyThread_allocate_lock called\n")); - if (!initialized) - PyThread_init_thread(); - - lock = (struct lock *) malloc(sizeof(struct lock)); - lock->lock_locked = 0; - (void) mon_create(&lock->lock_monitor); - (void) cv_create(&lock->lock_condvar, lock->lock_monitor); - dprintf(("PyThread_allocate_lock() -> %p\n", lock)); - return (PyThread_type_lock) lock; -} - -void PyThread_free_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_free_lock(%p) called\n", lock)); - mon_destroy(((struct lock *) lock)->lock_monitor); - free((char *) lock); -} - -int PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) -{ - int success; - - dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); - success = 0; - - (void) mon_enter(((struct lock *) lock)->lock_monitor); - if (waitflag) - while (((struct lock *) lock)->lock_locked) - cv_wait(((struct lock *) lock)->lock_condvar); - if (!((struct lock *) lock)->lock_locked) { - success = 1; - ((struct lock *) lock)->lock_locked = 1; - } - cv_broadcast(((struct lock *) lock)->lock_condvar); - mon_exit(((struct lock *) lock)->lock_monitor); - dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); - return success; -} - -void PyThread_release_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_release_lock(%p) called\n", lock)); - (void) mon_enter(((struct lock *) lock)->lock_monitor); - ((struct lock *) lock)->lock_locked = 0; - cv_broadcast(((struct lock *) lock)->lock_condvar); - mon_exit(((struct lock *) lock)->lock_monitor); -} diff --git a/Python/thread_sgi.h b/Python/thread_sgi.h deleted file mode 100644 --- a/Python/thread_sgi.h +++ /dev/null @@ -1,259 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define HDR_SIZE 2680 /* sizeof(ushdr_t) */ -#define MAXPROC 100 /* max # of threads that can be started */ - -static usptr_t *shared_arena; -static ulock_t count_lock; /* protection for some variables */ -static ulock_t wait_lock; /* lock used to wait for other threads */ -static int waiting_for_threads; /* protected by count_lock */ -static int nthreads; /* protected by count_lock */ -static int exit_status; -static int exiting; /* we're already exiting (for maybe_exit) */ -static pid_t my_pid; /* PID of main thread */ -static struct pidlist { - pid_t parent; - pid_t child; -} pidlist[MAXPROC]; /* PIDs of other threads; protected by count_lock */ -static int maxpidindex; /* # of PIDs in pidlist */ -/* - * Initialization. - */ -static void PyThread__init_thread(void) -{ -#ifdef USE_DL - long addr, size; -#endif /* USE_DL */ - - -#ifdef USE_DL - if ((size = usconfig(CONF_INITSIZE, 64*1024)) < 0) - perror("usconfig - CONF_INITSIZE (check)"); - if (usconfig(CONF_INITSIZE, size) < 0) - perror("usconfig - CONF_INITSIZE (reset)"); - addr = (long) dl_getrange(size + HDR_SIZE); - dprintf(("trying to use addr %p-%p for shared arena\n", addr, addr+size)); - errno = 0; - if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 && errno != 0) - perror("usconfig - CONF_ATTACHADDR (set)"); -#endif /* USE_DL */ - if (usconfig(CONF_INITUSERS, 16) < 0) - perror("usconfig - CONF_INITUSERS"); - my_pid = getpid(); /* so that we know which is the main thread */ - if (usconfig(CONF_ARENATYPE, US_SHAREDONLY) < 0) - perror("usconfig - CONF_ARENATYPE"); - usconfig(CONF_LOCKTYPE, US_DEBUG); /* XXX */ -#ifdef Py_DEBUG - if (thread_debug & 4) - usconfig(CONF_LOCKTYPE, US_DEBUGPLUS); - else if (thread_debug & 2) - usconfig(CONF_LOCKTYPE, US_DEBUG); -#endif /* Py_DEBUG */ - if ((shared_arena = usinit(tmpnam(0))) == 0) - perror("usinit"); -#ifdef USE_DL - if (usconfig(CONF_ATTACHADDR, addr) < 0) /* reset address */ - perror("usconfig - CONF_ATTACHADDR (reset)"); -#endif /* USE_DL */ - if ((count_lock = usnewlock(shared_arena)) == NULL) - perror("usnewlock (count_lock)"); - (void) usinitlock(count_lock); - if ((wait_lock = usnewlock(shared_arena)) == NULL) - perror("usnewlock (wait_lock)"); - dprintf(("arena start: %p, arena size: %ld\n", shared_arena, (long) usconfig(CONF_GETSIZE, shared_arena))); -} - -/* - * Thread support. - */ - -static void clean_threads(void) -{ - int i, j; - pid_t mypid, pid; - - /* clean up any exited threads */ - mypid = getpid(); - i = 0; - while (i < maxpidindex) { - if (pidlist[i].parent == mypid && (pid = pidlist[i].child) > 0) { - pid = waitpid(pid, 0, WNOHANG); - if (pid > 0) { - /* a thread has exited */ - pidlist[i] = pidlist[--maxpidindex]; - /* remove references to children of dead proc */ - for (j = 0; j < maxpidindex; j++) - if (pidlist[j].parent == pid) - pidlist[j].child = -1; - continue; /* don't increment i */ - } - } - i++; - } - /* clean up the list */ - i = 0; - while (i < maxpidindex) { - if (pidlist[i].child == -1) { - pidlist[i] = pidlist[--maxpidindex]; - continue; /* don't increment i */ - } - i++; - } -} - -long PyThread_start_new_thread(void (*func)(void *), void *arg) -{ -#ifdef USE_DL - long addr, size; - static int local_initialized = 0; -#endif /* USE_DL */ - int success = 0; /* init not needed when SOLARIS_THREADS and */ - /* C_THREADS implemented properly */ - - dprintf(("PyThread_start_new_thread called\n")); - if (!initialized) - PyThread_init_thread(); - switch (ussetlock(count_lock)) { - case 0: return 0; - case -1: perror("ussetlock (count_lock)"); - } - if (maxpidindex >= MAXPROC) - success = -1; - else { -#ifdef USE_DL - if (!local_initialized) { - if ((size = usconfig(CONF_INITSIZE, 64*1024)) < 0) - perror("usconfig - CONF_INITSIZE (check)"); - if (usconfig(CONF_INITSIZE, size) < 0) - perror("usconfig - CONF_INITSIZE (reset)"); - addr = (long) dl_getrange(size + HDR_SIZE); - dprintf(("trying to use addr %p-%p for sproc\n", - addr, addr+size)); - errno = 0; - if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 && - errno != 0) - perror("usconfig - CONF_ATTACHADDR (set)"); - } -#endif /* USE_DL */ - clean_threads(); - if ((success = sproc(func, PR_SALL, arg)) < 0) - perror("sproc"); -#ifdef USE_DL - if (!local_initialized) { - if (usconfig(CONF_ATTACHADDR, addr) < 0) - /* reset address */ - perror("usconfig - CONF_ATTACHADDR (reset)"); - local_initialized = 1; - } -#endif /* USE_DL */ - if (success >= 0) { - nthreads++; - pidlist[maxpidindex].parent = getpid(); - pidlist[maxpidindex++].child = success; - dprintf(("pidlist[%d] = %d\n", - maxpidindex-1, success)); - } - } - if (usunsetlock(count_lock) < 0) - perror("usunsetlock (count_lock)"); - return success; -} - -long PyThread_get_thread_ident(void) -{ - return getpid(); -} - -void PyThread_exit_thread(void) -{ - dprintf(("PyThread_exit_thread called\n")); - if (!initialized) - exit(0); - if (ussetlock(count_lock) < 0) - perror("ussetlock (count_lock)"); - nthreads--; - if (getpid() == my_pid) { - /* main thread; wait for other threads to exit */ - exiting = 1; - waiting_for_threads = 1; - if (ussetlock(wait_lock) < 0) - perror("ussetlock (wait_lock)"); - for (;;) { - if (nthreads < 0) { - dprintf(("really exit (%d)\n", exit_status)); - exit(exit_status); - } - if (usunsetlock(count_lock) < 0) - perror("usunsetlock (count_lock)"); - dprintf(("waiting for other threads (%d)\n", nthreads)); - if (ussetlock(wait_lock) < 0) - perror("ussetlock (wait_lock)"); - if (ussetlock(count_lock) < 0) - perror("ussetlock (count_lock)"); - } - } - /* not the main thread */ - if (waiting_for_threads) { - dprintf(("main thread is waiting\n")); - if (usunsetlock(wait_lock) < 0) - perror("usunsetlock (wait_lock)"); - } - if (usunsetlock(count_lock) < 0) - perror("usunsetlock (count_lock)"); - _exit(0); -} - -/* - * Lock support. - */ -PyThread_type_lock PyThread_allocate_lock(void) -{ - ulock_t lock; - - dprintf(("PyThread_allocate_lock called\n")); - if (!initialized) - PyThread_init_thread(); - - if ((lock = usnewlock(shared_arena)) == NULL) - perror("usnewlock"); - (void) usinitlock(lock); - dprintf(("PyThread_allocate_lock() -> %p\n", lock)); - return (PyThread_type_lock) lock; -} - -void PyThread_free_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_free_lock(%p) called\n", lock)); - usfreelock((ulock_t) lock, shared_arena); -} - -int PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) -{ - int success; - - dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); - errno = 0; /* clear it just in case */ - if (waitflag) - success = ussetlock((ulock_t) lock); - else - success = uscsetlock((ulock_t) lock, 1); /* Try it once */ - if (success < 0) - perror(waitflag ? "ussetlock" : "uscsetlock"); - dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); - return success; -} - -void PyThread_release_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_release_lock(%p) called\n", lock)); - if (usunsetlock((ulock_t) lock) < 0) - perror("usunsetlock"); -} diff --git a/Python/thread_solaris.h b/Python/thread_solaris.h deleted file mode 100644 --- a/Python/thread_solaris.h +++ /dev/null @@ -1,130 +0,0 @@ - -#include -#include -#include -#include -#undef _POSIX_THREADS - - -/* - * Initialization. - */ -static void PyThread__init_thread(void) -{ -} - -/* - * Thread support. - */ -struct func_arg { - void (*func)(void *); - void *arg; -}; - -static void * -new_func(void *funcarg) -{ - void (*func)(void *); - void *arg; - - func = ((struct func_arg *) funcarg)->func; - arg = ((struct func_arg *) funcarg)->arg; - free(funcarg); - (*func)(arg); - return 0; -} - - -long -PyThread_start_new_thread(void (*func)(void *), void *arg) -{ - thread_t tid; - struct func_arg *funcarg; - - dprintf(("PyThread_start_new_thread called\n")); - if (!initialized) - PyThread_init_thread(); - funcarg = (struct func_arg *) malloc(sizeof(struct func_arg)); - funcarg->func = func; - funcarg->arg = arg; - if (thr_create(0, 0, new_func, funcarg, - THR_DETACHED | THR_NEW_LWP, &tid)) { - perror("thr_create"); - free((void *) funcarg); - return -1; - } - return tid; -} - -long -PyThread_get_thread_ident(void) -{ - if (!initialized) - PyThread_init_thread(); - return thr_self(); -} - -void -PyThread_exit_thread(void) -{ - dprintf(("PyThread_exit_thread called\n")); - if (!initialized) - exit(0); - thr_exit(0); -} - -/* - * Lock support. - */ -PyThread_type_lock -PyThread_allocate_lock(void) -{ - mutex_t *lock; - - dprintf(("PyThread_allocate_lock called\n")); - if (!initialized) - PyThread_init_thread(); - - lock = (mutex_t *) malloc(sizeof(mutex_t)); - if (mutex_init(lock, USYNC_THREAD, 0)) { - perror("mutex_init"); - free((void *) lock); - lock = 0; - } - dprintf(("PyThread_allocate_lock() -> %p\n", lock)); - return (PyThread_type_lock) lock; -} - -void -PyThread_free_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_free_lock(%p) called\n", lock)); - mutex_destroy((mutex_t *) lock); - free((void *) lock); -} - -int -PyThread_acquire_lock(PyThread_type_lock lock, int waitflag) -{ - int success; - - dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag)); - if (waitflag) - success = mutex_lock((mutex_t *) lock); - else - success = mutex_trylock((mutex_t *) lock); - if (success < 0) - perror(waitflag ? "mutex_lock" : "mutex_trylock"); - else - success = !success; /* solaris does it the other way round */ - dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success)); - return success; -} - -void -PyThread_release_lock(PyThread_type_lock lock) -{ - dprintf(("PyThread_release_lock(%p) called\n", lock)); - if (mutex_unlock((mutex_t *) lock)) - perror("mutex_unlock"); -} diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for python 3.3. +# Generated by GNU Autoconf 2.68 for python 3.3. # # Report bugs to . # @@ -91,6 +91,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -216,11 +217,18 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1175,7 +1183,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1512,7 +1520,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 3.3 -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1558,7 +1566,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1604,7 +1612,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1641,7 +1649,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1654,10 +1662,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1724,7 +1732,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1733,7 +1741,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1774,7 +1782,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1788,7 +1796,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1806,7 +1814,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1819,7 +1827,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1860,7 +1868,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1873,7 +1881,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1913,7 +1921,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t @@ -1926,7 +1934,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1987,7 +1995,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t @@ -2164,7 +2172,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2177,7 +2185,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2232,7 +2240,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2245,7 +2253,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2289,7 +2297,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member @@ -2304,7 +2312,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2335,7 +2343,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2343,7 +2351,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 3.3, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2601,7 +2609,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2701,7 +2709,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_HAS_HG+set}" = set; then : +if ${ac_cv_prog_HAS_HG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -3249,7 +3257,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3289,7 +3297,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3342,7 +3350,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3382,7 +3390,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3441,7 +3449,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3485,7 +3493,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3540,7 +3548,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3655,7 +3663,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3698,7 +3706,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3757,7 +3765,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3768,7 +3776,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3809,7 +3817,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3819,7 +3827,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3856,7 +3864,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3934,7 +3942,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4069,7 +4077,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CXX+set}" = set; then : +if ${ac_cv_path_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4110,7 +4118,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CXX+set}" = set; then : +if ${ac_cv_path_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4161,7 +4169,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4262,7 +4270,7 @@ CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4378,7 +4386,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -4390,7 +4398,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4453,7 +4461,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4520,7 +4528,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4649,7 +4657,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : +if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= @@ -4671,7 +4679,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : +if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4864,7 +4872,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -5060,7 +5068,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5100,7 +5108,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5154,7 +5162,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5205,7 +5213,7 @@ set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_HAS_PYTHON+set}" = set; then : +if ${ac_cv_prog_HAS_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_PYTHON"; then @@ -5299,7 +5307,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5485,7 +5493,7 @@ ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" save_CFLAGS="$CFLAGS" - if test "${ac_cv_no_strict_aliasing+set}" = set; then : + if ${ac_cv_no_strict_aliasing+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5735,7 +5743,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if test "${ac_cv_pthread_is_default+set}" = set; then : +if ${ac_cv_pthread_is_default+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5788,7 +5796,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if test "${ac_cv_kpthread+set}" = set; then : +if ${ac_cv_kpthread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5837,7 +5845,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if test "${ac_cv_kthread+set}" = set; then : +if ${ac_cv_kthread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5886,7 +5894,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if test "${ac_cv_thread+set}" = set; then : +if ${ac_cv_thread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5971,7 +5979,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6084,7 +6092,7 @@ for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -shadow.h signal.h stdint.h stropts.h termios.h thread.h \ +shadow.h signal.h stdint.h stropts.h termios.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ @@ -6110,7 +6118,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval "test \"\${$as_ac_Header+set}\"" = set; then : +if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6150,7 +6158,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6184,11 +6192,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -6207,7 +6215,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6241,11 +6249,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -6265,7 +6273,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : +if ${ac_cv_header_sys_types_h_makedev+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6293,7 +6301,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6303,7 +6311,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6331,7 +6339,7 @@ #endif " -if test "x$ac_cv_header_net_if_h" = x""yes; then : +if test "x$ac_cv_header_net_if_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NET_IF_H 1 _ACEOF @@ -6351,7 +6359,7 @@ #endif " -if test "x$ac_cv_header_term_h" = x""yes; then : +if test "x$ac_cv_header_term_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6373,7 +6381,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : +if test "x$ac_cv_header_linux_netlink_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6509,7 +6517,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = x""yes; then : +if test "x$ac_cv_type_mode_t" = xyes; then : else @@ -6520,7 +6528,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = x""yes; then : +if test "x$ac_cv_type_off_t" = xyes; then : else @@ -6531,7 +6539,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = x""yes; then : +if test "x$ac_cv_type_pid_t" = xyes; then : else @@ -6547,7 +6555,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : +if test "x$ac_cv_type_size_t" = xyes; then : else @@ -6559,7 +6567,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if test "${ac_cv_type_uid_t+set}" = set; then : +if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6638,7 +6646,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = x""yes; then : +if test "x$ac_cv_type_ssize_t" = xyes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6653,7 +6661,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6663,7 +6671,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi @@ -6686,7 +6694,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : +if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6696,7 +6704,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi @@ -6719,7 +6727,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if test "${ac_cv_sizeof_void_p+set}" = set; then : +if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6729,7 +6737,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi @@ -6752,7 +6760,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : +if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6762,7 +6770,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi @@ -6785,7 +6793,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if test "${ac_cv_sizeof_float+set}" = set; then : +if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6795,7 +6803,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi @@ -6818,7 +6826,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6828,7 +6836,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi @@ -6851,7 +6859,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if test "${ac_cv_sizeof_fpos_t+set}" = set; then : +if ${ac_cv_sizeof_fpos_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6861,7 +6869,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_fpos_t=0 fi @@ -6884,7 +6892,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if test "${ac_cv_sizeof_size_t+set}" = set; then : +if ${ac_cv_sizeof_size_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6894,7 +6902,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_size_t=0 fi @@ -6917,7 +6925,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if test "${ac_cv_sizeof_pid_t+set}" = set; then : +if ${ac_cv_sizeof_pid_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6927,7 +6935,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_pid_t=0 fi @@ -6977,7 +6985,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if test "${ac_cv_sizeof_long_long+set}" = set; then : +if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -6987,7 +6995,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi @@ -7038,7 +7046,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : +if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7048,7 +7056,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_double=0 fi @@ -7100,7 +7108,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if test "${ac_cv_sizeof__Bool+set}" = set; then : +if ${ac_cv_sizeof__Bool+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7110,7 +7118,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof__Bool=0 fi @@ -7136,7 +7144,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = x""yes; then : +if test "x$ac_cv_type_uintptr_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7148,7 +7156,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : +if ${ac_cv_sizeof_uintptr_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7158,7 +7166,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7184,7 +7192,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if test "${ac_cv_sizeof_off_t+set}" = set; then : +if ${ac_cv_sizeof_off_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7199,7 +7207,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off_t=0 fi @@ -7243,7 +7251,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if test "${ac_cv_sizeof_time_t+set}" = set; then : +if ${ac_cv_sizeof_time_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7261,7 +7269,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_time_t=0 fi @@ -7318,7 +7326,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if test "${ac_cv_sizeof_pthread_t+set}" = set; then : +if ${ac_cv_sizeof_pthread_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7333,7 +7341,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_pthread_t=0 fi @@ -7764,7 +7772,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile in -lsendfile" >&5 $as_echo_n "checking for sendfile in -lsendfile... " >&6; } -if test "${ac_cv_lib_sendfile_sendfile+set}" = set; then : +if ${ac_cv_lib_sendfile_sendfile+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7798,7 +7806,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sendfile_sendfile" >&5 $as_echo "$ac_cv_lib_sendfile_sendfile" >&6; } -if test "x$ac_cv_lib_sendfile_sendfile" = x""yes; then : +if test "x$ac_cv_lib_sendfile_sendfile" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSENDFILE 1 _ACEOF @@ -7809,7 +7817,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7843,7 +7851,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7854,7 +7862,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7888,7 +7896,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7902,7 +7910,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if test "${ac_cv_search_sem_init+set}" = set; then : +if ${ac_cv_search_sem_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -7936,11 +7944,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_sem_init+set}" = set; then : + if ${ac_cv_search_sem_init+:} false; then : break fi done -if test "${ac_cv_search_sem_init+set}" = set; then : +if ${ac_cv_search_sem_init+:} false; then : else ac_cv_search_sem_init=no @@ -7963,7 +7971,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if test "${ac_cv_lib_intl_textdomain+set}" = set; then : +if ${ac_cv_lib_intl_textdomain+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7997,7 +8005,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : +if test "x$ac_cv_lib_intl_textdomain" = xyes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8044,7 +8052,7 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_t_open+set}" = set; then : +if ${ac_cv_lib_nsl_t_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8078,13 +8086,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : +if test "x$ac_cv_lib_nsl_t_open" = xyes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8118,7 +8126,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8144,7 +8152,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8187,7 +8195,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8349,7 +8357,6 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-threads" >&5 $as_echo_n "checking for --with-threads... " >&6; } @@ -8451,31 +8458,6 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h - ac_fn_c_check_header_mongrel "$LINENO" "cthreads.h" "ac_cv_header_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_cthreads_h" = x""yes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h - - $as_echo "#define C_THREADS 1" >>confdefs.h - - -$as_echo "#define HURD_C_THREADS 1" >>confdefs.h - - LIBS="$LIBS -lthreads" - THREADOBJ="Python/thread.o" -else - - ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h - - $as_echo "#define C_THREADS 1" >>confdefs.h - - -$as_echo "#define MACH_C_THREADS 1" >>confdefs.h - - THREADOBJ="Python/thread.o" -else - # Just looking for pthread_create in libpthread is not enough: # on HP/UX, pthread.h renames pthread_create to a different symbol name. # So we really have to include pthread.h, and then link. @@ -8509,7 +8491,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = x""yes; then : +if test "x$ac_cv_func_pthread_detach" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8518,7 +8500,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthreads_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8552,7 +8534,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8562,7 +8544,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : +if ${ac_cv_lib_c_r_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8596,7 +8578,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8606,7 +8588,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : +if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8640,7 +8622,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8650,7 +8632,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : +if ${ac_cv_lib_cma_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8684,7 +8666,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8707,16 +8689,10 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : +if ${ac_cv_lib_mpc_usconfig+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8750,7 +8726,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : +if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8762,7 +8738,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if test "${ac_cv_lib_thread_thr_create+set}" = set; then : +if ${ac_cv_lib_thread_thr_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8796,7 +8772,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : +if test "x$ac_cv_lib_thread_thr_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -8836,7 +8812,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if test "${ac_cv_pthread_system_supported+set}" = set; then : + if ${ac_cv_pthread_system_supported+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -8879,7 +8855,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : +if test "x$ac_cv_func_pthread_sigmask" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9271,7 +9247,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9293,7 +9269,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9625,7 +9601,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if test "${ac_cv_flock_decl+set}" = set; then : +if ${ac_cv_flock_decl+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9655,7 +9631,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = x""yes; then : +if test "x$ac_cv_func_flock" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9663,7 +9639,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_flock+set}" = set; then : +if ${ac_cv_lib_bsd_flock+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9697,7 +9673,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = x""yes; then : +if test "x$ac_cv_lib_bsd_flock" = xyes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9774,7 +9750,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_TRUE+set}" = set; then : +if ${ac_cv_prog_TRUE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9814,7 +9790,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if test "${ac_cv_lib_c_inet_aton+set}" = set; then : +if ${ac_cv_lib_c_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9848,12 +9824,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : +if test "x$ac_cv_lib_c_inet_aton" = xyes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : +if ${ac_cv_lib_resolv_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9887,7 +9863,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -9904,7 +9880,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if test "${ac_cv_have_chflags+set}" = set; then : +if ${ac_cv_have_chflags+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9938,7 +9914,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = x""yes; then : +if test "x$ac_cv_func_chflags" = xyes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -9953,7 +9929,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if test "${ac_cv_have_lchflags+set}" = set; then : +if ${ac_cv_have_lchflags+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9987,7 +9963,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = x""yes; then : +if test "x$ac_cv_func_lchflags" = xyes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -10011,7 +9987,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : +if ${ac_cv_lib_z_inflateCopy+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10045,7 +10021,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : +if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10188,7 +10164,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = x""yes; then : +if test "x$ac_cv_func_openpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10196,7 +10172,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if test "${ac_cv_lib_util_openpty+set}" = set; then : +if ${ac_cv_lib_util_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10230,13 +10206,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = x""yes; then : +if test "x$ac_cv_lib_util_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_openpty+set}" = set; then : +if ${ac_cv_lib_bsd_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10270,7 +10246,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : +if test "x$ac_cv_lib_bsd_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10285,7 +10261,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = x""yes; then : +if test "x$ac_cv_func_forkpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10293,7 +10269,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if test "${ac_cv_lib_util_forkpty+set}" = set; then : +if ${ac_cv_lib_util_forkpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10327,13 +10303,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = x""yes; then : +if test "x$ac_cv_lib_util_forkpty" = xyes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : +if ${ac_cv_lib_bsd_forkpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10367,7 +10343,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : +if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10384,7 +10360,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = x""yes; then : +if test "x$ac_cv_func_memmove" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10408,7 +10384,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = x""yes; then : +if test "x$ac_cv_func_dup2" = xyes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10421,7 +10397,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = x""yes; then : +if test "x$ac_cv_func_getcwd" = xyes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10434,7 +10410,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = x""yes; then : +if test "x$ac_cv_func_strdup" = xyes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10450,7 +10426,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = x""yes; then : +if test "x$ac_cv_func_getpgrp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10478,7 +10454,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = x""yes; then : +if test "x$ac_cv_func_setpgrp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10506,7 +10482,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : +if test "x$ac_cv_func_gettimeofday" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10608,7 +10584,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : + if ${ac_cv_buggy_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10737,7 +10713,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = x""yes; then : +if test "x$ac_cv_func_getnameinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10749,7 +10725,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then : +if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10784,7 +10760,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : +if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10821,7 +10797,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10837,7 +10813,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = x""yes; then : +if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -10849,7 +10825,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if test "${ac_cv_var_tzname+set}" = set; then : +if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10885,7 +10861,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -10895,7 +10871,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -10905,7 +10881,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -10915,7 +10891,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -10925,7 +10901,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -10935,7 +10911,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -10957,7 +10933,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if test "${ac_cv_header_time_altzone+set}" = set; then : +if ${ac_cv_header_time_altzone+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11021,7 +10997,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if test "${ac_cv_struct_addrinfo+set}" = set; then : +if ${ac_cv_struct_addrinfo+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11053,7 +11029,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : +if ${ac_cv_struct_sockaddr_storage+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11089,7 +11065,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if test "${ac_cv_c_char_unsigned+set}" = set; then : +if ${ac_cv_c_char_unsigned+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11121,7 +11097,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11409,7 +11385,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : +if test "x$ac_cv_func_gethostbyname_r" = xyes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11540,7 +11516,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = x""yes; then : +if test "x$ac_cv_func_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11562,12 +11538,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = x""yes; then : +if test "x$ac_cv_func___fpu_control" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : +if ${ac_cv_lib_ieee___fpu_control+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11601,7 +11577,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11695,7 +11671,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_little_endian_double+set}" = set; then : +if ${ac_cv_little_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11737,7 +11713,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_big_endian_double+set}" = set; then : +if ${ac_cv_big_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11783,7 +11759,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_mixed_endian_double+set}" = set; then : +if ${ac_cv_mixed_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11953,7 +11929,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = x""yes; then : +if test "x$ac_cv_have_decl_isinf" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11964,7 +11940,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = x""yes; then : +if test "x$ac_cv_have_decl_isnan" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11975,7 +11951,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = x""yes; then : +if test "x$ac_cv_have_decl_isfinite" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11990,7 +11966,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : +if ${ac_cv_tanh_preserves_zero_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12038,7 +12014,7 @@ # -0. See issue #9920. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether log1p drops the sign of negative zero" >&5 $as_echo_n "checking whether log1p drops the sign of negative zero... " >&6; } - if test "${ac_cv_log1p_drops_zero_sign+set}" = set; then : + if ${ac_cv_log1p_drops_zero_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12090,7 +12066,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : +if ${ac_cv_posix_semaphores_enabled+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12141,7 +12117,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if test "${ac_cv_broken_sem_getvalue+set}" = set; then : +if ${ac_cv_broken_sem_getvalue+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12206,7 +12182,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12224,7 +12200,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = x""yes; then : +if test "x$ac_cv_header_wchar_h" = xyes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12247,7 +12223,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if test "${ac_cv_sizeof_wchar_t+set}" = set; then : +if ${ac_cv_sizeof_wchar_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12258,7 +12234,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_wchar_t=0 fi @@ -12313,7 +12289,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if test "${ac_cv_wchar_t_signed+set}" = set; then : + if ${ac_cv_wchar_t_signed+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12409,7 +12385,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12628,7 +12604,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12700,7 +12676,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if test "${ac_cv_rshift_extends_sign+set}" = set; then : +if ${ac_cv_rshift_extends_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12739,7 +12715,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if test "${ac_cv_have_getc_unlocked+set}" = set; then : +if ${ac_cv_have_getc_unlocked+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12837,7 +12813,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : +if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12871,7 +12847,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12923,7 +12899,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : +if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12957,7 +12933,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -12967,7 +12943,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : +if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13001,7 +12977,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -13011,7 +12987,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : +if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13045,7 +13021,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13086,7 +13062,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if test "${ac_cv_broken_nice+set}" = set; then : +if ${ac_cv_broken_nice+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13127,7 +13103,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if test "${ac_cv_broken_poll+set}" = set; then : +if ${ac_cv_broken_poll+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13182,7 +13158,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13198,7 +13174,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = x""yes; then : +if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13210,7 +13186,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if test "${ac_cv_var_tzname+set}" = set; then : +if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13249,7 +13225,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if test "${ac_cv_working_tzset+set}" = set; then : +if ${ac_cv_working_tzset+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13346,7 +13322,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if test "${ac_cv_stat_tv_nsec+set}" = set; then : +if ${ac_cv_stat_tv_nsec+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13383,7 +13359,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if test "${ac_cv_stat_tv_nsec2+set}" = set; then : +if ${ac_cv_stat_tv_nsec2+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13420,7 +13396,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : +if ${ac_cv_mvwdelch_is_expression+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13457,7 +13433,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if test "${ac_cv_window_has_flags+set}" = set; then : +if ${ac_cv_window_has_flags+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13605,7 +13581,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if test "${ac_cv_have_long_long_format+set}" = set; then : + if ${ac_cv_have_long_long_format+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13675,7 +13651,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if test "${ac_cv_have_size_t_format+set}" = set; then : +if ${ac_cv_have_size_t_format+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13748,7 +13724,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = x""yes; then : +if test "x$ac_cv_type_socklen_t" = xyes; then : else @@ -13759,7 +13735,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken mbstowcs" >&5 $as_echo_n "checking for broken mbstowcs... " >&6; } -if test "${ac_cv_broken_mbstowcs+set}" = set; then : +if ${ac_cv_broken_mbstowcs+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13799,7 +13775,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5 $as_echo_n "checking whether $CC supports computed gotos... " >&6; } -if test "${ac_cv_computed_gotos+set}" = set; then : +if ${ac_cv_computed_gotos+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13966,10 +13942,21 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -14002,7 +13989,7 @@ -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14103,6 +14090,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14410,7 +14398,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 3.3, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14434,8 +14422,8 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" +config_files="`echo $ac_config_files`" +config_headers="`echo $ac_config_headers`" _ACEOF @@ -14472,7 +14460,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 3.3 -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14603,7 +14591,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -14625,9 +14613,10 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14635,12 +14624,13 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14662,7 +14652,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -14690,7 +14680,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14738,7 +14728,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14770,7 +14760,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14804,7 +14794,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14816,8 +14806,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14918,7 +14908,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14937,7 +14927,7 @@ for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -14946,7 +14936,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -14972,8 +14962,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15103,21 +15093,22 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15128,20 +15119,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -1301,7 +1301,7 @@ AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -shadow.h signal.h stdint.h stropts.h termios.h thread.h \ +shadow.h signal.h stdint.h stropts.h termios.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ @@ -2044,7 +2044,6 @@ # Templates for things AC_DEFINEd more than once. # For a single AC_DEFINE, no template is needed. -AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package]) AH_TEMPLATE(_REENTRANT, [Define to force use of thread-safe errno, h_errno, and other functions]) AH_TEMPLATE(WITH_THREAD, @@ -2126,17 +2125,6 @@ AC_MSG_RESULT($unistd_defines_pthreads) AC_DEFINE(_REENTRANT) - AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) - AC_DEFINE(C_THREADS) - AC_DEFINE(HURD_C_THREADS, 1, - [Define if you are using Mach cthreads directly under /include]) - LIBS="$LIBS -lthreads" - THREADOBJ="Python/thread.o"],[ - AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) - AC_DEFINE(C_THREADS) - AC_DEFINE(MACH_C_THREADS, 1, - [Define if you are using Mach cthreads under mach /]) - THREADOBJ="Python/thread.o"],[ # Just looking for pthread_create in libpthread is not enough: # on HP/UX, pthread.h renames pthread_create to a different symbol name. # So we really have to include pthread.h, and then link. @@ -2172,7 +2160,7 @@ LIBS="$LIBS -lcma" THREADOBJ="Python/thread.o"],[ USE_THREAD_MODULE="#"]) - ])])])])])])]) + ])])])])]) AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lmpc" diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -12,9 +12,6 @@ support for AIX C++ shared extension modules. */ #undef AIX_GENUINE_CPLUSPLUS -/* Define if you have the Mach cthreads package */ -#undef C_THREADS - /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM mixed-endian order (byte order 45670123) */ #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 @@ -948,9 +945,6 @@ /* Define to 1 if you have the `tgamma' function. */ #undef HAVE_TGAMMA -/* Define to 1 if you have the header file. */ -#undef HAVE_THREAD_H - /* Define to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM @@ -1049,15 +1043,9 @@ /* Define to 1 if you have the `_getpty' function. */ #undef HAVE__GETPTY -/* Define if you are using Mach cthreads directly under /include */ -#undef HURD_C_THREADS - /* Define if log1p(-0.) is 0. rather than -0. */ #undef LOG1P_DROPS_ZERO_SIGN -/* Define if you are using Mach cthreads under mach / */ -#undef MACH_C_THREADS - /* Define to 1 if `major', `minor', and `makedev' are declared in . */ #undef MAJOR_IN_MKDEV -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 01:04:41 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 01:04:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Rebind_locally_the_globals_?= =?utf8?q?which_can_be_looked_up_at_shutdown?= Message-ID: http://hg.python.org/cpython/rev/27224f7ef000 changeset: 71267:27224f7ef000 user: Antoine Pitrou date: Sat Jul 09 01:03:00 2011 +0200 summary: Rebind locally the globals which can be looked up at shutdown (to avoid the warnings seen on a buildbot) files: Lib/multiprocessing/connection.py | 12 ++++++------ Lib/multiprocessing/util.py | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -290,8 +290,8 @@ """ _buffered = b'' - def _close(self): - win32.CloseHandle(self._handle) + def _close(self, _CloseHandle=win32.CloseHandle): + _CloseHandle(self._handle) def _send_bytes(self, buf): overlapped = win32.WriteFile(self._handle, buf, overlapped=True) @@ -376,13 +376,13 @@ """ if win32: - def _close(self): - win32.closesocket(self._handle) + def _close(self, _close=win32.closesocket): + _close(self._handle) _write = win32.send _read = win32.recv else: - def _close(self): - os.close(self._handle) + def _close(self, _close=os.close): + _close(self._handle) _write = os.write _read = os.read diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -188,7 +188,11 @@ _finalizer_registry[self._key] = self - def __call__(self, wr=None): + def __call__(self, wr=None, + # Need to bind these locally because the globals can have + # been cleared at shutdown + _finalizer_registry=_finalizer_registry, + sub_debug=sub_debug): ''' Run the callback unless it has already been called or cancelled ''' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 01:04:42 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 01:04:42 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_comment?= Message-ID: http://hg.python.org/cpython/rev/1a6d69dad821 changeset: 71268:1a6d69dad821 user: Antoine Pitrou date: Sat Jul 09 01:03:46 2011 +0200 summary: Add comment files: Lib/multiprocessing/connection.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -149,6 +149,8 @@ self._readable = readable self._writable = writable + # XXX should we use util.Finalize instead of a __del__? + def __del__(self): if self._handle is not None: self._close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 02:32:20 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 02:32:20 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Skip_network_te?= =?utf8?q?sts_when_getaddrinfo=28=29_returns_EAI=5FAGAIN=2C_meaning_a_temp?= =?utf8?q?orary?= Message-ID: http://hg.python.org/cpython/rev/ef4b40eb52cc changeset: 71269:ef4b40eb52cc branch: 3.2 parent: 71261:6e72490bbff6 user: Antoine Pitrou date: Sat Jul 09 02:31:24 2011 +0200 summary: Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. Should fix a buildbot failure. files: Lib/test/support.py | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -867,6 +867,7 @@ ('ETIMEDOUT', 110), ] default_gai_errnos = [ + ('EAI_AGAIN', -3), ('EAI_NONAME', -2), ('EAI_NODATA', -5), # Encountered when trying to resolve IPv6-only hostnames diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,9 @@ Tests ----- +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 02:33:32 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 02:33:32 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Skip_network_tests_when_getaddrinfo=28=29_returns_EAI=5FAGAI?= =?utf8?q?N=2C_meaning_a_temporary?= Message-ID: http://hg.python.org/cpython/rev/b039b16f0415 changeset: 71270:b039b16f0415 parent: 71268:1a6d69dad821 parent: 71269:ef4b40eb52cc user: Antoine Pitrou date: Sat Jul 09 02:32:36 2011 +0200 summary: Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. Should fix a buildbot failure. files: Lib/test/support.py | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -909,6 +909,7 @@ ('ETIMEDOUT', 110), ] default_gai_errnos = [ + ('EAI_AGAIN', -3), ('EAI_NONAME', -2), ('EAI_NODATA', -5), # Encountered when trying to resolve IPv6-only hostnames diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1008,6 +1008,9 @@ Tests ----- +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 02:35:01 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 02:35:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Skip_network_te?= =?utf8?q?sts_when_getaddrinfo=28=29_returns_EAI=5FAGAIN=2C_meaning_a_temp?= =?utf8?q?orary?= Message-ID: http://hg.python.org/cpython/rev/a9c6f468012e changeset: 71271:a9c6f468012e branch: 2.7 parent: 71260:e6e37f1e29ca user: Antoine Pitrou date: Sat Jul 09 02:34:05 2011 +0200 summary: Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. Should fix a buildbot failure. files: Lib/test/test_support.py | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -763,6 +763,7 @@ ('ETIMEDOUT', 110), ] default_gai_errnos = [ + ('EAI_AGAIN', -3), ('EAI_NONAME', -2), ('EAI_NODATA', -5), ] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,9 @@ Tests ----- +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jul 9 05:13:10 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 09 Jul 2011 05:13:10 +0200 Subject: [Python-checkins] Daily reference leaks (b039b16f0415): sum=300 Message-ID: results for b039b16f0415 on branch "default" -------------------------------------------- test_concurrent_futures leaked [0, -108, 108] references, sum=0 test_packaging leaked [100, 100, 100] references, sum=300 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogxNVXEh', '-x'] From python-checkins at python.org Sat Jul 9 10:58:08 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:08 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12438__-_idlelib=2EPyShell=27s_showformatwarning_method_was_pas?= =?utf8?q?sing?= Message-ID: http://hg.python.org/cpython/rev/7dd9313c300b changeset: 71272:7dd9313c300b branch: 3.2 parent: 71205:861b483e88d9 user: Senthil Kumaran date: Sun Jul 03 17:39:20 2011 -0700 summary: Fix closes issue12438 - idlelib.PyShell's showformatwarning method was passing an incorrect arg. files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -59,7 +59,7 @@ file = warning_stream try: file.write(warnings.formatwarning(message, category, filename, - lineno, file=file, line=line)) + lineno, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:08 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:08 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e_issue12470_-_check_for_utime_for_the_skipUnless_condition=2E?= Message-ID: http://hg.python.org/cpython/rev/f92bf428c647 changeset: 71273:f92bf428c647 branch: 3.2 user: Senthil Kumaran date: Sun Jul 03 18:21:38 2011 -0700 summary: Fix closes issue issue12470 - check for utime for the skipUnless condition. files: Lib/test/test_shutil.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -427,7 +427,7 @@ self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode) @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.chmod') - @unittest.skipUnless(hasattr(os, 'chmod'), 'requires os.utime') + @unittest.skipUnless(hasattr(os, 'utime'), 'requires os.utime') def test_copy2(self): # Ensure that the copied file exists and has the same mode and # modification time bits. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:09 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:09 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNDI5?= =?utf8?q?=3A_Skip_interrupted_write_tests_on_FreeBSD_=3C=3D_7?= Message-ID: http://hg.python.org/cpython/rev/ad16e4a0ef80 changeset: 71274:ad16e4a0ef80 branch: 3.2 user: Victor Stinner date: Mon Jul 04 11:48:17 2011 +0200 summary: Issue #12429: Skip interrupted write tests on FreeBSD <= 7 On FreeBSD, the SIGALRM signal is sometimes received by the reader thread. files: Lib/test/test_io.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2651,6 +2651,8 @@ 1/0 @unittest.skipUnless(threading, 'Threading required for this test.') + @unittest.skipIf(sys.platform in ('freebsd5', 'freebsd6', 'freebsd7'), + 'issue #12429: skip test on FreeBSD <= 7') def check_interrupted_write(self, item, bytes, **fdopen_kwargs): """Check that a partial write, when it gets interrupted, properly invokes the signal handler, and bubbles up the exception raised -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:10 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Avoid_failing_i?= =?utf8?q?n_test=5Furllibnet=2Etest=5Fbad=5Faddress_when_some_overzealous?= Message-ID: http://hg.python.org/cpython/rev/a9cf9d2085a7 changeset: 71275:a9cf9d2085a7 branch: 3.2 user: Antoine Pitrou date: Fri Jul 08 19:19:57 2011 +0200 summary: Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. files: Lib/test/test_urllibnet.py | 8 ++++++++ Misc/NEWS | 7 +++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -113,6 +113,14 @@ def test_bad_address(self): # Make sure proper exception is raised when connecting to a bogus # address. + bogus_domain = "sadflkjsasf.i.nvali.d" + try: + socket.gethostbyname(bogus_domain) + except socket.gaierror: + pass + else: + # This happens with some overzealous DNS providers such as OpenDNS + self.skipTest("%r should not resolve for test to work" % bogus_domain) self.assertRaises(IOError, # SF patch 809915: In Sep 2003, VeriSign started # highjacking invalid .com and .net addresses to diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,6 +16,13 @@ - Issue #12467: warnings: fix a race condition if a warning is emitted at shutdown, if globals()['__file__'] is None. +Tests +----- + +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + What's New in Python 3.2.1 release candidate 2? =============================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:12 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:12 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Skip_network_te?= =?utf8?q?sts_when_getaddrinfo=28=29_returns_EAI=5FAGAIN=2C_meaning_a_temp?= =?utf8?q?orary?= Message-ID: http://hg.python.org/cpython/rev/369bac3bb82f changeset: 71276:369bac3bb82f branch: 3.2 user: Antoine Pitrou date: Sat Jul 09 02:31:24 2011 +0200 summary: Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. Should fix a buildbot failure. files: Lib/test/support.py | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -867,6 +867,7 @@ ('ETIMEDOUT', 110), ] default_gai_errnos = [ + ('EAI_AGAIN', -3), ('EAI_NONAME', -2), ('EAI_NODATA', -5), # Encountered when trying to resolve IPv6-only hostnames diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Tests ----- +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + - Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:13 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Bump_version_to?= =?utf8?b?IDMuMi4xLg==?= Message-ID: http://hg.python.org/cpython/rev/ac1f7e5c0510 changeset: 71277:ac1f7e5c0510 branch: 3.2 tag: v3.2.1 user: Georg Brandl date: Sat Jul 09 08:56:21 2011 +0200 summary: Bump version to 3.2.1. files: Include/patchlevel.h | 6 +++--- Lib/distutils/__init__.py | 2 +- Lib/idlelib/idlever.py | 2 +- Misc/NEWS | 4 +--- Misc/RPM/python-3.2.spec | 2 +- README | 4 ++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.2.1rc2+" +#define PY_VERSION "3.2.1" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.2.1rc2" +__version__ = "3.2.1" #--end constants-- diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,1 +1,1 @@ -IDLE_VERSION = "3.2.1rc2" +IDLE_VERSION = "3.2.1" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,10 +5,7 @@ What's New in Python 3.2.1? =========================== -*Release date: XXXX-XX-XX* - -Core and Builtins ------------------ +*Release date: 10-Jul-2011* Library ------- diff --git a/Misc/RPM/python-3.2.spec b/Misc/RPM/python-3.2.spec --- a/Misc/RPM/python-3.2.spec +++ b/Misc/RPM/python-3.2.spec @@ -39,7 +39,7 @@ %define name python #--start constants-- -%define version 3.2.1rc2 +%define version 3.2.1 %define libvers 3.2 #--end constants-- %define release 1pydotorg diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.2.1 release candidate 2 -================================================ +This is Python version 3.2.1 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Python Software Foundation. All rights reserved. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:13 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Added_tag_v3=2E?= =?utf8?q?2=2E1_for_changeset_ac1f7e5c0510?= Message-ID: http://hg.python.org/cpython/rev/5100423355df changeset: 71278:5100423355df branch: 3.2 user: Georg Brandl date: Sat Jul 09 08:56:41 2011 +0200 summary: Added tag v3.2.1 for changeset ac1f7e5c0510 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -90,3 +90,4 @@ 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 +ac1f7e5c05104d557d5acd922e95625ba5d1fe10 v3.2.1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:14 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:14 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Post-release_st?= =?utf8?q?eps_for_3=2E2=2E1=2E?= Message-ID: http://hg.python.org/cpython/rev/e1d2085cdae1 changeset: 71279:e1d2085cdae1 branch: 3.2 user: Georg Brandl date: Sat Jul 09 10:56:06 2011 +0200 summary: Post-release steps for 3.2.1. files: Include/patchlevel.h | 2 +- Misc/NEWS | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.2.1" +#define PY_VERSION "3.2.1+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.2.2? +=========================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.2.1? =========================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:58:15 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:58:15 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_Merge_3=2E2=2E1_release_clone_into_main_repo=2E?= Message-ID: http://hg.python.org/cpython/rev/ad9f54c993ae changeset: 71280:ad9f54c993ae branch: 3.2 parent: 71269:ef4b40eb52cc parent: 71279:e1d2085cdae1 user: Georg Brandl date: Sat Jul 09 10:58:37 2011 +0200 summary: Merge 3.2.1 release clone into main repo. files: .hgtags | 1 + Include/patchlevel.h | 6 +- Lib/distutils/__init__.py | 2 +- Lib/idlelib/idlever.py | 2 +- Misc/NEWS | 75 +++++++++++++------------- Misc/RPM/python-3.2.spec | 2 +- README | 4 +- 7 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -90,3 +90,4 @@ 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 +ac1f7e5c05104d557d5acd922e95625ba5d1fe10 v3.2.1 diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.2.1rc2+" +#define PY_VERSION "3.2.1+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py --- a/Lib/distutils/__init__.py +++ b/Lib/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.2.1rc2" +__version__ = "3.2.1" #--end constants-- diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,1 +1,1 @@ -IDLE_VERSION = "3.2.1rc2" +IDLE_VERSION = "3.2.1" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.2.2? =========================== -*Release date: XX-XX-2011* +*Release date: XX-XXX-2011* Core and Builtins ----------------- @@ -24,9 +24,6 @@ - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors if the process has only one pipe. -- Issue #12467: warnings: fix a race condition if a warning is emitted at - shutdown, if globals()['__file__'] is None. - - Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support Python scripts using a encoding different than UTF-8 (read the coding cookie of the script). @@ -47,50 +44,50 @@ Tests ----- -- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary - failure in name resolution. - - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. +- Issue #12440: When testing whether some bits in SSLContext.options can be + reset, check the version of the OpenSSL headers Python was compiled against, + rather than the runtime version of the OpenSSL library. + +- Issue #12497: Install test/data to prevent failures of the various codecmaps + tests. + +- Issue #12496: Install test/capath directory to prevent test_connect_capath + testcase failure in test_ssl. + +- Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a + fresh process with only one thread and to not change signal handling of the + parent process. + +- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run + test_tk or test_ttk_guionly under a username that is not currently logged + in to the console windowserver (as may be the case under buildbot or ssh). + + +What's New in Python 3.2.1? +=========================== + +*Release date: 10-Jul-2011* + +Library +------- + +- Issue #12467: warnings: fix a race condition if a warning is emitted at + shutdown, if globals()['__file__'] is None. + +Tests +----- + +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + - Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test is now skipped instead. -- Issue #12440: When testing whether some bits in SSLContext.options can be - reset, check the version of the OpenSSL headers Python was compiled against, - rather than the runtime version of the OpenSSL library. - -- Issue #12497: Install test/data to prevent failures of the various codecmaps - tests. - -- Issue #12496: Install test/capath directory to prevent test_connect_capath - testcase failure in test_ssl. - -- Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a - fresh process with only one thread and to not change signal handling of the - parent process. - -- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run - test_tk or test_ttk_guionly under a username that is not currently logged - in to the console windowserver (as may be the case under buildbot or ssh). - - -What's New in Python 3.2.1? -=========================== - -*Release date: XXXX-XX-XX* - -Core and Builtins ------------------ - -Library -------- - -- Issue #12467: warnings: fix a race condition if a warning is emitted at - shutdown, if globals()['__file__'] is None. - What's New in Python 3.2.1 release candidate 2? =============================================== diff --git a/Misc/RPM/python-3.2.spec b/Misc/RPM/python-3.2.spec --- a/Misc/RPM/python-3.2.spec +++ b/Misc/RPM/python-3.2.spec @@ -39,7 +39,7 @@ %define name python #--start constants-- -%define version 3.2.1rc2 +%define version 3.2.1 %define libvers 3.2 #--end constants-- %define release 1pydotorg diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.2.1 release candidate 2 -================================================ +This is Python version 3.2.1 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Python Software Foundation. All rights reserved. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 10:59:58 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 10:59:58 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Dummy-merge_3=2E2=2E1_release_changes_into_default=2E?= Message-ID: http://hg.python.org/cpython/rev/263bafbe601a changeset: 71281:263bafbe601a parent: 71270:b039b16f0415 parent: 71280:ad9f54c993ae user: Georg Brandl date: Sat Jul 09 11:00:36 2011 +0200 summary: Dummy-merge 3.2.1 release changes into default. files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -90,3 +90,4 @@ 8ffac2337a3323323d02153ac919fd1483176652 v3.2.1b1 cfa9364997c7f2e67b9cbb45c3a5fa3bba4e4999 v3.2.1rc1 5df549718fb4841ff521fe051f6b54f290fad5d8 v3.2.1rc2 +ac1f7e5c05104d557d5acd922e95625ba5d1fe10 v3.2.1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 11:42:56 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 11:42:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_markup_and_remove_chara?= =?utf8?q?cter_unsupported_by_latex_in_3=2E3_whatsnew_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/0b172166b940 changeset: 71282:0b172166b940 user: Georg Brandl date: Sat Jul 09 11:43:33 2011 +0200 summary: Fix markup and remove character unsupported by latex in 3.3 whatsnew doc. files: Doc/whatsnew/3.3.rst | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -72,13 +72,13 @@ ------ Multibyte CJK decoders now resynchronize faster. They only ignore the first -byte of an invalid byte sequence. For example, b'\xff\n'.decode('gb2312', -'replace') gives '?\n' instead of '?'. +byte of an invalid byte sequence. For example, ``b'\xff\n'.decode('gb2312', +'replace')`` now returns a ``\n`` after the replacement character. -(http://bugs.python.org/issue12016) +(:issue:`12016`) Don't reset incremental encoders of CJK codecs at each call to their encode() -method anymore. For example: :: +method anymore. For example:: $ ./python -q >>> import codecs @@ -86,10 +86,10 @@ >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.') b'~{NpJ)l6HK!#~} Bye.' -This example gives b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.' with older Python +This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older Python versions. -(http://bugs.python.org/issue12100) +(:issue:`12100`) faulthandler ------------ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 11:48:13 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 09 Jul 2011 11:48:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_syntax_in_packaging_doc?= =?utf8?q?s_and_update_suspicious_ignore_file=2E?= Message-ID: http://hg.python.org/cpython/rev/3a4b983dd70b changeset: 71283:3a4b983dd70b user: Georg Brandl date: Sat Jul 09 11:48:50 2011 +0200 summary: Fix syntax in packaging docs and update suspicious ignore file. files: Doc/library/packaging.compiler.rst | 2 +- Doc/packaging/builtdist.rst | 2 +- Doc/packaging/commandref.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 27 ++++++++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Doc/library/packaging.compiler.rst b/Doc/library/packaging.compiler.rst --- a/Doc/library/packaging.compiler.rst +++ b/Doc/library/packaging.compiler.rst @@ -368,7 +368,7 @@ *sources* must be a list of filenames, most likely C/C++ files, but in reality anything that can be handled by a particular compiler and compiler class (e.g. - an ``'msvc'`` compiler` can handle resource files in *sources*). Return a list of + an ``'msvc'`` compiler can handle resource files in *sources*). Return a list of object filenames, one per source filename in *sources*. Depending on the implementation, not all source files will necessarily be compiled, but all corresponding object filenames will be returned. diff --git a/Doc/packaging/builtdist.rst b/Doc/packaging/builtdist.rst --- a/Doc/packaging/builtdist.rst +++ b/Doc/packaging/builtdist.rst @@ -283,7 +283,7 @@ Which folders are available depends on the exact Windows version, and probably also the configuration. For details refer to Microsoft's documentation of the - c:function:`SHGetSpecialFolderPath` function. + :c:func:`SHGetSpecialFolderPath` function. .. function:: create_shortcut(target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]]) diff --git a/Doc/packaging/commandref.rst b/Doc/packaging/commandref.rst --- a/Doc/packaging/commandref.rst +++ b/Doc/packaging/commandref.rst @@ -57,7 +57,7 @@ .. cmdoption:: --suite=NAME, -s NAME Specify the test suite (or module, class, or method) to be run. The default - for this option can be set by in the project's :file:`setup.cfg` file:: + for this option can be set by in the project's :file:`setup.cfg` file: .. code-block:: cfg diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -46,8 +46,8 @@ library/functions,,:stop,a[start:stop:step] library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)" library/httplib,,:port,host:port -library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM""" -library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM""" +library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS" +library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS" library/itertools,,:stop,elements from seq[start:stop:step] library/itertools,,:step,elements from seq[start:stop:step] library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh" @@ -495,3 +495,26 @@ library/pprint,209,::,"'Programming Language :: Python :: 2.7'," library/pprint,209,::,"'Topic :: Software Development :: Libraries'," library/pprint,209,::,"'Topic :: Software Development :: Libraries :: Python Modules']," +library/packaging.dist,,:action,http://pypi.python.org/pypi?:action=list_classifiers +packaging/examples,,`,This is the description of the ``foobar`` project. +packaging/setupcfg,,::,Development Status :: 3 - Alpha +packaging/setupcfg,,::,License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1) +packaging/setupscript,,::,"'Development Status :: 4 - Beta'," +packaging/setupscript,,::,"'Environment :: Console'," +packaging/setupscript,,::,"'Environment :: Web Environment'," +packaging/setupscript,,::,"'Intended Audience :: End Users/Desktop'," +packaging/setupscript,,::,"'Intended Audience :: Developers'," +packaging/setupscript,,::,"'Intended Audience :: System Administrators'," +packaging/setupscript,,::,"'License :: OSI Approved :: Python Software Foundation License'," +packaging/setupscript,,::,"'Operating System :: MacOS :: MacOS X'," +packaging/setupscript,,::,"'Operating System :: Microsoft :: Windows'," +packaging/setupscript,,::,"'Operating System :: POSIX'," +packaging/setupscript,,::,"'Programming Language :: Python'," +packaging/setupscript,,::,"'Topic :: Communications :: Email'," +packaging/setupscript,,::,"'Topic :: Office/Business'," +packaging/setupscript,,::,"'Topic :: Software Development :: Bug Tracking'," +packaging/tutorial,,::,1) License :: OSI Approved :: GNU General Public License (GPL) +packaging/tutorial,,::,2) License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) +packaging/tutorial,,::,Type the number of the license you wish to use or ? to try again:: 1 +packaging/tutorial,,::,classifier = Development Status :: 3 - Alpha +packaging/tutorial,,::,License :: OSI Approved :: GNU General Public License (GPL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 15:49:26 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 15:49:26 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMzI2?= =?utf8?q?=3A_document_the_recommended_idiom_for_checking_sys=2Eplatform_o?= =?utf8?q?n_Unix?= Message-ID: http://hg.python.org/cpython/rev/53d2d30d6ca0 changeset: 71284:53d2d30d6ca0 branch: 2.7 parent: 71271:a9c6f468012e user: Antoine Pitrou date: Sat Jul 09 15:48:29 2011 +0200 summary: Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. Also, point to the various alternatives. files: Doc/library/os.rst | 7 +++++++ Doc/library/sys.rst | 12 ++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -53,6 +53,13 @@ names have currently been registered: ``'posix'``, ``'nt'``, ``'os2'``, ``'ce'``, ``'java'``, ``'riscos'``. + .. seealso:: + :attr:`sys.platform` has a finer granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. + .. _os-procinfo: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -726,6 +726,12 @@ For Unix systems, this is the lowercased OS name as returned by ``uname -s`` with the first part of the version as returned by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*. + Unless you want to test for a specific system version, it is therefore + recommended to use the following idiom:: + + if sys.platform.startswith('linux'): + # Linux-specific code here... + For other systems, the values are: ================ =========================== @@ -740,6 +746,12 @@ AtheOS ``'atheos'`` ================ =========================== + .. seealso:: + :attr:`os.name` has a coarser granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. .. data:: prefix -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 15:56:38 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 15:56:38 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzI2?= =?utf8?q?=3A_document_the_recommended_idiom_for_checking_sys=2Eplatform_o?= =?utf8?q?n_Unix?= Message-ID: http://hg.python.org/cpython/rev/8bc9dbc61ba6 changeset: 71285:8bc9dbc61ba6 branch: 3.2 parent: 71280:ad9f54c993ae user: Antoine Pitrou date: Sat Jul 09 15:54:23 2011 +0200 summary: Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. Also, point to the various alternatives. files: Doc/library/os.rst | 7 +++++++ Doc/library/sys.rst | 12 ++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -61,6 +61,13 @@ names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, ``'os2'``, ``'ce'``, ``'java'``. + .. seealso:: + :attr:`sys.platform` has a finer granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. + .. _os-filenames: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -714,6 +714,12 @@ For Unix systems, this is the lowercased OS name as returned by ``uname -s`` with the first part of the version as returned by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*. + Unless you want to test for a specific system version, it is therefore + recommended to use the following idiom:: + + if sys.platform.startswith('linux'): + # Linux-specific code here... + For other systems, the values are: ================ =========================== @@ -726,6 +732,12 @@ OS/2 EMX ``'os2emx'`` ================ =========================== + .. seealso:: + :attr:`os.name` has a coarser granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. .. data:: prefix -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 15:56:39 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 15:56:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312326=3A_document_the_recommended_idiom_for_checkin?= =?utf8?q?g_sys=2Eplatform_on_Unix?= Message-ID: http://hg.python.org/cpython/rev/19b3b2d93a63 changeset: 71286:19b3b2d93a63 parent: 71283:3a4b983dd70b parent: 71285:8bc9dbc61ba6 user: Antoine Pitrou date: Sat Jul 09 15:55:38 2011 +0200 summary: Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. Also, point to the various alternatives. files: Doc/library/os.rst | 7 +++++++ Doc/library/sys.rst | 12 ++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -61,6 +61,13 @@ names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, ``'os2'``, ``'ce'``, ``'java'``. + .. seealso:: + :attr:`sys.platform` has a finer granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. + .. _os-filenames: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -705,6 +705,12 @@ For Unix systems, this is the lowercased OS name as returned by ``uname -s`` with the first part of the version as returned by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*. + Unless you want to test for a specific system version, it is therefore + recommended to use the following idiom:: + + if sys.platform.startswith('linux'): + # Linux-specific code here... + For other systems, the values are: ================ =========================== @@ -717,6 +723,12 @@ OS/2 EMX ``'os2emx'`` ================ =========================== + .. seealso:: + :attr:`os.name` has a coarser granularity. :func:`os.uname` gives + system-dependent version information. + + The :mod:`platform` module provides detailed checks for the + system's identity. .. data:: prefix -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 16:04:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 16:04:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Move_sys=2Esubv?= =?utf8?q?ersion_at_the_right_place_in_alphabetical_order=2C_and_informall?= =?utf8?q?y?= Message-ID: http://hg.python.org/cpython/rev/fc8b5c6a021c changeset: 71287:fc8b5c6a021c branch: 3.2 parent: 71285:8bc9dbc61ba6 user: Antoine Pitrou date: Sat Jul 09 16:02:19 2011 +0200 summary: Move sys.subversion at the right place in alphabetical order, and informally deprecate it. files: Doc/library/sys.rst | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -36,18 +36,6 @@ little-endian (least-significant byte first) platforms. -.. data:: subversion - - A triple (repo, branch, version) representing the Subversion information of the - Python interpreter. *repo* is the name of the repository, ``'CPython'``. - *branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or - ``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter - was built from a Subversion checkout; it contains the revision number (range) - and possibly a trailing 'M' if there were local modifications. If the tree was - exported (or svnversion was not available), it is the revision of - ``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. - - .. data:: builtin_module_names A tuple of strings giving the names of all modules that are compiled into this @@ -982,6 +970,24 @@ to a console and Python apps started with :program:`pythonw`. +.. data:: subversion + + A triple (repo, branch, version) representing the Subversion information of the + Python interpreter. *repo* is the name of the repository, ``'CPython'``. + *branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or + ``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter + was built from a Subversion checkout; it contains the revision number (range) + and possibly a trailing 'M' if there were local modifications. If the tree was + exported (or svnversion was not available), it is the revision of + ``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. + + .. deprecated:: 3.2.1 + Python is now `developed `_ using + Mercurial. In recent Python 3.2 bugfix releases, :data:`subversion` + therefore contains placeholder information. It is removed in Python + 3.3. + + .. data:: tracebacklimit When this variable is set to an integer value, it determines the maximum number -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 16:04:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 16:04:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Dummy_merge?= Message-ID: http://hg.python.org/cpython/rev/df7289fbe4ac changeset: 71288:df7289fbe4ac parent: 71286:19b3b2d93a63 parent: 71287:fc8b5c6a021c user: Antoine Pitrou date: Sat Jul 09 16:02:58 2011 +0200 summary: Dummy merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 16:07:16 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 16:07:16 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Move_sys=2Esubv?= =?utf8?q?ersion_at_the_right_place_in_alphabetical_order=2C?= Message-ID: http://hg.python.org/cpython/rev/e1660bc0fa5b changeset: 71289:e1660bc0fa5b branch: 2.7 parent: 71284:53d2d30d6ca0 user: Antoine Pitrou date: Sat Jul 09 16:06:19 2011 +0200 summary: Move sys.subversion at the right place in alphabetical order, and add a note concerning its status. files: Doc/library/sys.rst | 34 +++++++++++++++++++------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -32,20 +32,6 @@ .. versionadded:: 2.0 -.. data:: subversion - - A triple (repo, branch, version) representing the Subversion information of the - Python interpreter. *repo* is the name of the repository, ``'CPython'``. - *branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or - ``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter - was built from a Subversion checkout; it contains the revision number (range) - and possibly a trailing 'M' if there were local modifications. If the tree was - exported (or svnversion was not available), it is the revision of - ``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. - - .. versionadded:: 2.5 - - .. data:: builtin_module_names A tuple of strings giving the names of all modules that are compiled into this @@ -992,6 +978,26 @@ replacing it, and restore the saved object. +.. data:: subversion + + A triple (repo, branch, version) representing the Subversion information of the + Python interpreter. *repo* is the name of the repository, ``'CPython'``. + *branch* is a string of one of the forms ``'trunk'``, ``'branches/name'`` or + ``'tags/name'``. *version* is the output of ``svnversion``, if the interpreter + was built from a Subversion checkout; it contains the revision number (range) + and possibly a trailing 'M' if there were local modifications. If the tree was + exported (or svnversion was not available), it is the revision of + ``Include/patchlevel.h`` if the branch is a tag. Otherwise, it is ``None``. + + .. versionadded:: 2.5 + + .. note:: + Python is now `developed `_ using + Mercurial. In recent Python 2.7 bugfix releases, :data:`subversion` + therefore contains placeholder information. It is removed in Python + 3.3. + + .. data:: tracebacklimit When this variable is set to an integer value, it determines the maximum number -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 21:30:39 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 21:30:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Mention_logging?= =?utf8?q?=2EcaptureWarnings_in_the_warnings_module_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/09c9cb6ece33 changeset: 71290:09c9cb6ece33 branch: 2.7 user: Antoine Pitrou date: Sat Jul 09 21:29:36 2011 +0200 summary: Mention logging.captureWarnings in the warnings module doc. files: Doc/library/warnings.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -39,6 +39,10 @@ message by calling :func:`formatwarning`, which is also available for use by custom implementations. +.. seealso:: + :func:`logging.captureWarnings` allows you to handle all warnings with + the standard logging infrastructure. + .. _warning-categories: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 21:32:27 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 21:32:27 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Mention_logging?= =?utf8?q?=2EcaptureWarnings_in_the_warnings_module_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/0b922abbcaf7 changeset: 71291:0b922abbcaf7 branch: 3.2 parent: 71287:fc8b5c6a021c user: Antoine Pitrou date: Sat Jul 09 21:29:36 2011 +0200 summary: Mention logging.captureWarnings in the warnings module doc. files: Doc/library/warnings.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -40,6 +40,10 @@ message by calling :func:`formatwarning`, which is also available for use by custom implementations. +.. seealso:: + :func:`logging.captureWarnings` allows you to handle all warnings with + the standard logging infrastructure. + .. _warning-categories: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 9 21:32:27 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 09 Jul 2011 21:32:27 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Mention_logging=2EcaptureWarnings_in_the_warnings_module_doc?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/661195a92131 changeset: 71292:661195a92131 parent: 71288:df7289fbe4ac parent: 71291:0b922abbcaf7 user: Antoine Pitrou date: Sat Jul 09 21:31:07 2011 +0200 summary: Mention logging.captureWarnings in the warnings module doc. files: Doc/library/warnings.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -40,6 +40,10 @@ message by calling :func:`formatwarning`, which is also available for use by custom implementations. +.. seealso:: + :func:`logging.captureWarnings` allows you to handle all warnings with + the standard logging infrastructure. + .. _warning-categories: -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jul 10 05:09:42 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 10 Jul 2011 05:09:42 +0200 Subject: [Python-checkins] Daily reference leaks (661195a92131): sum=246 Message-ID: results for 661195a92131 on branch "default" -------------------------------------------- test_concurrent_futures leaked [108, 0, -162] references, sum=-54 test_packaging leaked [100, 100, 100] references, sum=300 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogiNfeaU', '-x'] From python-checkins at python.org Mon Jul 11 01:40:39 2011 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 11 Jul 2011 01:40:39 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzQz?= =?utf8?q?=3A_Add_some_notes_on_behaviour_of_non-blocking_SSL_sockets=2E?= Message-ID: http://hg.python.org/cpython/rev/b763c1ba5589 changeset: 71293:b763c1ba5589 branch: 3.2 parent: 71291:0b922abbcaf7 user: Antoine Pitrou date: Mon Jul 11 01:35:48 2011 +0200 summary: Issue #12343: Add some notes on behaviour of non-blocking SSL sockets. files: Doc/library/ssl.rst | 61 +++++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 18 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -408,27 +408,16 @@ the same limitation) - :meth:`~socket.socket.shutdown()` -They also have the following additional methods and attributes: +However, since the SSL (and TLS) protocol has its own framing atop +of TCP, the SSL sockets abstraction can, in certain respects, diverge from +the specification of normal, OS-level sockets. See especially the +:ref:`notes on non-blocking sockets `. + +SSL sockets also have the following additional methods and attributes: .. method:: SSLSocket.do_handshake() - Performs the SSL setup handshake. If the socket is non-blocking, this method - may raise :exc:`SSLError` with the value of the exception instance's - ``args[0]`` being either :const:`SSL_ERROR_WANT_READ` or - :const:`SSL_ERROR_WANT_WRITE`, and should be called again until it stops - raising those exceptions. Here's an example of how to do that:: - - while True: - try: - sock.do_handshake() - break - except ssl.SSLError as err: - if err.args[0] == ssl.SSL_ERROR_WANT_READ: - select.select([sock], [], []) - elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: - select.select([], [sock], []) - else: - raise + Performs the SSL setup handshake. .. method:: SSLSocket.getpeercert(binary_form=False) @@ -917,6 +906,42 @@ the sockets in non-blocking mode and use an event loop). +.. _ssl-nonblocking: + +Notes on non-blocking sockets +----------------------------- + +When working with non-blocking sockets, there are several things you need +to be aware of: + +- Calling :func:`~select.select` tells you that the OS-level socket can be + read from (or written to), but it does not imply that there is sufficient + data at the upper SSL layer. For example, only part of an SSL frame might + have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` + and :meth:`SSLSocket.send` failures, and retry after another call to + :func:`~select.select`. + + (of course, similar provisions apply when using other primitives such as + :func:`~select.poll`) + +- The SSL handshake itself will be non-blocking: the + :meth:`SSLSocket.do_handshake` method has to be retried until it returns + successfully. Here is a synopsis using :func:`~select.select` to wait for + the socket's readiness:: + + while True: + try: + sock.do_handshake() + break + except ssl.SSLError as err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([sock], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [sock], []) + else: + raise + + .. _ssl-security: Security considerations -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 11 01:40:40 2011 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 11 Jul 2011 01:40:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312343=3A_Add_some_notes_on_behaviour_of_non-blockin?= =?utf8?q?g_SSL_sockets=2E?= Message-ID: http://hg.python.org/cpython/rev/77334eb5038d changeset: 71294:77334eb5038d parent: 71292:661195a92131 parent: 71293:b763c1ba5589 user: Antoine Pitrou date: Mon Jul 11 01:38:27 2011 +0200 summary: Issue #12343: Add some notes on behaviour of non-blocking SSL sockets. files: Doc/library/ssl.rst | 61 +++++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 18 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -440,27 +440,16 @@ the same limitation) - :meth:`~socket.socket.shutdown()` -They also have the following additional methods and attributes: +However, since the SSL (and TLS) protocol has its own framing atop +of TCP, the SSL sockets abstraction can, in certain respects, diverge from +the specification of normal, OS-level sockets. See especially the +:ref:`notes on non-blocking sockets `. + +SSL sockets also have the following additional methods and attributes: .. method:: SSLSocket.do_handshake() - Performs the SSL setup handshake. If the socket is non-blocking, this method - may raise :exc:`SSLError` with the value of the exception instance's - ``args[0]`` being either :const:`SSL_ERROR_WANT_READ` or - :const:`SSL_ERROR_WANT_WRITE`, and should be called again until it stops - raising those exceptions. Here's an example of how to do that:: - - while True: - try: - sock.do_handshake() - break - except ssl.SSLError as err: - if err.args[0] == ssl.SSL_ERROR_WANT_READ: - select.select([sock], [], []) - elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: - select.select([], [sock], []) - else: - raise + Performs the SSL setup handshake. .. method:: SSLSocket.getpeercert(binary_form=False) @@ -949,6 +938,42 @@ the sockets in non-blocking mode and use an event loop). +.. _ssl-nonblocking: + +Notes on non-blocking sockets +----------------------------- + +When working with non-blocking sockets, there are several things you need +to be aware of: + +- Calling :func:`~select.select` tells you that the OS-level socket can be + read from (or written to), but it does not imply that there is sufficient + data at the upper SSL layer. For example, only part of an SSL frame might + have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` + and :meth:`SSLSocket.send` failures, and retry after another call to + :func:`~select.select`. + + (of course, similar provisions apply when using other primitives such as + :func:`~select.poll`) + +- The SSL handshake itself will be non-blocking: the + :meth:`SSLSocket.do_handshake` method has to be retried until it returns + successfully. Here is a synopsis using :func:`~select.select` to wait for + the socket's readiness:: + + while True: + try: + sock.do_handshake() + break + except ssl.SSLError as err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([sock], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [sock], []) + else: + raise + + .. _ssl-security: Security considerations -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 11 01:40:41 2011 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 11 Jul 2011 01:40:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Use_infinitive?= =?utf8?q?=2C_not_3rd_person_of_present_tense=2E?= Message-ID: http://hg.python.org/cpython/rev/7f3dd627103b changeset: 71295:7f3dd627103b branch: 3.2 parent: 71293:b763c1ba5589 user: Antoine Pitrou date: Mon Jul 11 01:39:19 2011 +0200 summary: Use infinitive, not 3rd person of present tense. files: Doc/library/ssl.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -417,7 +417,7 @@ .. method:: SSLSocket.do_handshake() - Performs the SSL setup handshake. + Perform the SSL setup handshake. .. method:: SSLSocket.getpeercert(binary_form=False) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 11 01:40:41 2011 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 11 Jul 2011 01:40:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Use_infinitive=2C_not_3rd_person_of_present_tense=2E?= Message-ID: http://hg.python.org/cpython/rev/ab162f925761 changeset: 71296:ab162f925761 parent: 71294:77334eb5038d parent: 71295:7f3dd627103b user: Antoine Pitrou date: Mon Jul 11 01:39:35 2011 +0200 summary: Use infinitive, not 3rd person of present tense. files: Doc/library/ssl.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -449,7 +449,7 @@ .. method:: SSLSocket.do_handshake() - Performs the SSL setup handshake. + Perform the SSL setup handshake. .. method:: SSLSocket.getpeercert(binary_form=False) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jul 11 05:11:03 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 11 Jul 2011 05:11:03 +0200 Subject: [Python-checkins] Daily reference leaks (ab162f925761): sum=-77 Message-ID: results for ab162f925761 on branch "default" -------------------------------------------- test_concurrent_futures leaked [54, 0, -108] references, sum=-54 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [0, 0, -323] references, sum=-323 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog5h1g09', '-x'] From solipsis at pitrou.net Tue Jul 12 05:14:15 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 12 Jul 2011 05:14:15 +0200 Subject: [Python-checkins] Daily reference leaks (ab162f925761): sum=616 Message-ID: results for ab162f925761 on branch "default" -------------------------------------------- test_concurrent_futures leaked [477, 162, 0] references, sum=639 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [0, 0, -323] references, sum=-323 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogdg9LBd', '-x'] From python-checkins at python.org Tue Jul 12 22:01:46 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 12 Jul 2011 22:01:46 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMTQ5?= =?utf8?q?=3A_Update_the_method_cache_after_a_type=27s_dictionnary_gets?= Message-ID: http://hg.python.org/cpython/rev/cd40ea4087b0 changeset: 71297:cd40ea4087b0 branch: 3.2 parent: 71295:7f3dd627103b user: Antoine Pitrou date: Tue Jul 12 21:57:15 2011 +0200 summary: Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo. files: Lib/test/test_io.py | 19 ++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 6 ++++++ Objects/typeobject.c | 2 ++ 4 files changed, 27 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -611,7 +611,24 @@ self.assertEqual(rawio.read(2), b"") class CIOTest(IOTest): - pass + + def test_IOBase_finalize(self): + # Issue #12149: segmentation fault on _PyIOBase_finalize when both a + # class which inherits IOBase and an object of this class are caught + # in a reference cycle and close() is already in the method cache. + class MyIO(self.IOBase): + def close(self): + pass + + # create an instance to populate the method cache + MyIO() + obj = MyIO() + obj.obj = obj + wr = weakref.ref(obj) + del MyIO + del obj + support.gc_collect() + self.assertTrue(wr() is None, wr) class PyIOTest(IOTest): pass diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -736,6 +736,7 @@ Nicholas Riley Jean-Claude Rimbault Juan M. Bello Rivas +Davide Rizzo Anthony Roach Mark Roberts Jim Robinson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ Core and Builtins ----------------- +- Issue #12149: Update the method cache after a type's dictionnary gets + cleared by the garbage collector. This fixes a segfault when an instance + and its type get caught in a reference cycle, and the instance's + deallocator calls one of the methods on the type (e.g. when subclassing + IOBase). Diagnosis and patch by Davide Rizzo. + - Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. - When a generator yields, do not retain the caller's exception state on the diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -967,6 +967,8 @@ assert(basedealloc); basedealloc(self); + PyType_Modified(type); + /* Can't reference self beyond this point */ Py_DECREF(type); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 12 22:01:47 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 12 Jul 2011 22:01:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312149=3A_Update_the_method_cache_after_a_type=27s_d?= =?utf8?q?ictionnary_gets?= Message-ID: http://hg.python.org/cpython/rev/5992cbbedf59 changeset: 71298:5992cbbedf59 parent: 71296:ab162f925761 parent: 71297:cd40ea4087b0 user: Antoine Pitrou date: Tue Jul 12 21:58:39 2011 +0200 summary: Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo. files: Lib/test/test_io.py | 19 ++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 6 ++++++ Objects/typeobject.c | 2 ++ 4 files changed, 27 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -611,7 +611,24 @@ self.assertEqual(rawio.read(2), b"") class CIOTest(IOTest): - pass + + def test_IOBase_finalize(self): + # Issue #12149: segmentation fault on _PyIOBase_finalize when both a + # class which inherits IOBase and an object of this class are caught + # in a reference cycle and close() is already in the method cache. + class MyIO(self.IOBase): + def close(self): + pass + + # create an instance to populate the method cache + MyIO() + obj = MyIO() + obj.obj = obj + wr = weakref.ref(obj) + del MyIO + del obj + support.gc_collect() + self.assertTrue(wr() is None, wr) class PyIOTest(IOTest): pass diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -785,6 +785,7 @@ Nicholas Riley Jean-Claude Rimbault Juan M. Bello Rivas +Davide Rizzo Anthony Roach Mark Roberts Jim Robinson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ Core and Builtins ----------------- +- Issue #12149: Update the method cache after a type's dictionnary gets + cleared by the garbage collector. This fixes a segfault when an instance + and its type get caught in a reference cycle, and the instance's + deallocator calls one of the methods on the type (e.g. when subclassing + IOBase). Diagnosis and patch by Davide Rizzo. + - Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. - Issue #9642: Uniformize the tests on the availability of the mbcs codec, add diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -967,6 +967,8 @@ assert(basedealloc); basedealloc(self); + PyType_Modified(type); + /* Can't reference self beyond this point */ Py_DECREF(type); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 12 22:05:50 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 12 Jul 2011 22:05:50 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMTQ5?= =?utf8?q?=3A_Update_the_method_cache_after_a_type=27s_dictionnary_gets?= Message-ID: http://hg.python.org/cpython/rev/9618303852da changeset: 71299:9618303852da branch: 2.7 parent: 71290:09c9cb6ece33 user: Antoine Pitrou date: Tue Jul 12 22:04:20 2011 +0200 summary: Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo. files: Lib/test/test_io.py | 19 ++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 6 ++++++ Objects/typeobject.c | 2 ++ 4 files changed, 27 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -585,7 +585,24 @@ self.assertEqual(rawio.read(2), b"") class CIOTest(IOTest): - pass + + def test_IOBase_finalize(self): + # Issue #12149: segmentation fault on _PyIOBase_finalize when both a + # class which inherits IOBase and an object of this class are caught + # in a reference cycle and close() is already in the method cache. + class MyIO(self.IOBase): + def close(self): + pass + + # create an instance to populate the method cache + MyIO() + obj = MyIO() + obj.obj = obj + wr = weakref.ref(obj) + del MyIO + del obj + support.gc_collect() + self.assertTrue(wr() is None, wr) class PyIOTest(IOTest): test_array_writes = unittest.skip( diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -686,6 +686,7 @@ Nicholas Riley Jean-Claude Rimbault Juan M. Bello Rivas +Davide Rizzo Anthony Roach Mark Roberts Jim Robinson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,12 @@ Core and Builtins ----------------- +- Issue #12149: Update the method cache after a type's dictionnary gets + cleared by the garbage collector. This fixes a segfault when an instance + and its type get caught in a reference cycle, and the instance's + deallocator calls one of the methods on the type (e.g. when subclassing + IOBase). Diagnosis and patch by Davide Rizzo. + - Issue #12501: Adjust callable() warning: callable() is only not supported in Python 3.1. callable() is again supported in Python 3.2. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1013,6 +1013,8 @@ assert(basedealloc); basedealloc(self); + PyType_Modified(type); + /* Can't reference self beyond this point */ Py_DECREF(type); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 02:19:06 2011 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 13 Jul 2011 02:19:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_this_can_be_don?= =?utf8?q?e_without_a_custom_dict_=28also_fixes_=2312544=29?= Message-ID: http://hg.python.org/cpython/rev/02a591131360 changeset: 71300:02a591131360 branch: 2.7 user: Benjamin Peterson date: Tue Jul 12 19:21:42 2011 -0500 summary: this can be done without a custom dict (also fixes #12544) files: Lib/unittest/case.py | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -129,27 +129,6 @@ return True -class _TypeEqualityDict(object): - - def __init__(self, testcase): - self.testcase = testcase - self._store = {} - - def __setitem__(self, key, value): - self._store[key] = value - - def __getitem__(self, key): - value = self._store[key] - if isinstance(value, basestring): - return getattr(self.testcase, value) - return value - - def get(self, key, default=None): - if key in self._store: - return self[key] - return default - - class TestCase(object): """A class whose instances are single test cases. @@ -216,7 +195,7 @@ # Map types to custom assertEqual functions that will compare # instances of said type in more detail to generate a more useful # error message. - self._type_equality_funcs = _TypeEqualityDict(self) + self._type_equality_funcs = {} self.addTypeEqualityFunc(dict, 'assertDictEqual') self.addTypeEqualityFunc(list, 'assertListEqual') self.addTypeEqualityFunc(tuple, 'assertTupleEqual') @@ -511,6 +490,8 @@ if type(first) is type(second): asserter = self._type_equality_funcs.get(type(first)) if asserter is not None: + if isinstance(asserter, basestring): + asserter = getattr(self, asserter) return asserter return self._baseAssertEqual -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 02:19:07 2011 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 13 Jul 2011 02:19:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_this_can_be_don?= =?utf8?q?e_without_a_custom_dict_=28also_fixes_=2312544=29?= Message-ID: http://hg.python.org/cpython/rev/842f5ed06255 changeset: 71301:842f5ed06255 branch: 3.2 parent: 71297:cd40ea4087b0 user: Benjamin Peterson date: Tue Jul 12 19:21:42 2011 -0500 summary: this can be done without a custom dict (also fixes #12544) files: Lib/unittest/case.py | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -202,27 +202,6 @@ .format(exc_name)) -class _TypeEqualityDict(object): - - def __init__(self, testcase): - self.testcase = testcase - self._store = {} - - def __setitem__(self, key, value): - self._store[key] = value - - def __getitem__(self, key): - value = self._store[key] - if isinstance(value, str): - return getattr(self.testcase, value) - return value - - def get(self, key, default=None): - if key in self._store: - return self[key] - return default - - class TestCase(object): """A class whose instances are single test cases. @@ -294,7 +273,7 @@ # Map types to custom assertEqual functions that will compare # instances of said type in more detail to generate a more useful # error message. - self._type_equality_funcs = _TypeEqualityDict(self) + self._type_equality_funcs = {} self.addTypeEqualityFunc(dict, 'assertDictEqual') self.addTypeEqualityFunc(list, 'assertListEqual') self.addTypeEqualityFunc(tuple, 'assertTupleEqual') @@ -628,6 +607,8 @@ if type(first) is type(second): asserter = self._type_equality_funcs.get(type(first)) if asserter is not None: + if isinstance(asserter, str): + asserter = getattr(self, asserter) return asserter return self._baseAssertEqual -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 02:19:07 2011 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 13 Jul 2011 02:19:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKCMxMjU0NCk=?= Message-ID: http://hg.python.org/cpython/rev/47a36d2d2b44 changeset: 71302:47a36d2d2b44 parent: 71298:5992cbbedf59 parent: 71301:842f5ed06255 user: Benjamin Peterson date: Tue Jul 12 19:23:43 2011 -0500 summary: merge 3.2 (#12544) files: Lib/unittest/case.py | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -218,27 +218,6 @@ self._raiseFailure("{} not triggered".format(exc_name)) -class _TypeEqualityDict(object): - - def __init__(self, testcase): - self.testcase = testcase - self._store = {} - - def __setitem__(self, key, value): - self._store[key] = value - - def __getitem__(self, key): - value = self._store[key] - if isinstance(value, str): - return getattr(self.testcase, value) - return value - - def get(self, key, default=None): - if key in self._store: - return self[key] - return default - - class TestCase(object): """A class whose instances are single test cases. @@ -310,7 +289,7 @@ # Map types to custom assertEqual functions that will compare # instances of said type in more detail to generate a more useful # error message. - self._type_equality_funcs = _TypeEqualityDict(self) + self._type_equality_funcs = {} self.addTypeEqualityFunc(dict, 'assertDictEqual') self.addTypeEqualityFunc(list, 'assertListEqual') self.addTypeEqualityFunc(tuple, 'assertTupleEqual') @@ -643,6 +622,8 @@ if type(first) is type(second): asserter = self._type_equality_funcs.get(type(first)) if asserter is not None: + if isinstance(asserter, str): + asserter = getattr(self, asserter) return asserter return self._baseAssertEqual -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jul 13 05:14:39 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 13 Jul 2011 05:14:39 +0200 Subject: [Python-checkins] Daily reference leaks (47a36d2d2b44): sum=246 Message-ID: results for 47a36d2d2b44 on branch "default" -------------------------------------------- test_concurrent_futures leaked [-54, 54, -54] references, sum=-54 test_packaging leaked [100, 100, 100] references, sum=300 test_pydoc leaked [-323, 323, 0] references, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogGqddaK', '-x'] From python-checkins at python.org Wed Jul 13 10:44:59 2011 From: python-checkins at python.org (ezio.melotti) Date: Wed, 13 Jul 2011 10:44:59 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_=2312547=3A_Fix_import_and_?= =?utf8?q?output_in_nntplib_example=2E_Initial_patch_by_July?= Message-ID: http://hg.python.org/cpython/rev/e0cd35660ae9 changeset: 71303:e0cd35660ae9 user: Ezio Melotti date: Wed Jul 13 11:44:44 2011 +0300 summary: #12547: Fix import and output in nntplib example. Initial patch by July Tikhonov. files: Doc/whatsnew/3.3.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -117,10 +117,10 @@ connection when done:: >>> from nntplib import NNTP - >>> with nntplib.NNTP('news.gmane.org') as n: + >>> with NNTP('news.gmane.org') as n: ... n.group('gmane.comp.python.committers') ... - ('211 1454 1 1454 gmane.comp.python.committers', '1454', '1', '1454', 'gmane.comp.python.committers') + ('211 1754 1 1754 gmane.comp.python.committers', 1754, 1, 1754, 'gmane.comp.python.committers') >>> (Contributed by Giampaolo Rodol? in :issue:`9795`) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 15:59:47 2011 From: python-checkins at python.org (georg.brandl) Date: Wed, 13 Jul 2011 15:59:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Clarify_that_Py?= =?utf8?q?Err=5FNewException_creates_an_exception_*class*=2C_not_instance?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/9c6f7fe31d8e changeset: 71304:9c6f7fe31d8e branch: 3.2 parent: 71301:842f5ed06255 user: Georg Brandl date: Wed Jul 13 15:59:24 2011 +0200 summary: Clarify that PyErr_NewException creates an exception *class*, not instance. files: Doc/c-api/exceptions.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -354,10 +354,10 @@ .. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) - This utility function creates and returns a new exception object. The *name* + This utility function creates and returns a new exception class. The *name* argument must be the name of the new exception, a C string of the form - ``module.class``. The *base* and *dict* arguments are normally *NULL*. This - creates a class object derived from :exc:`Exception` (accessible in C as + ``module.classname``. The *base* and *dict* arguments are normally *NULL*. + This creates a class object derived from :exc:`Exception` (accessible in C as :c:data:`PyExc_Exception`). The :attr:`__module__` attribute of the new class is set to the first part (up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 15:59:48 2011 From: python-checkins at python.org (georg.brandl) Date: Wed, 13 Jul 2011 15:59:48 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_doc_change_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/8893fc8e885e changeset: 71305:8893fc8e885e parent: 71303:e0cd35660ae9 parent: 71304:9c6f7fe31d8e user: Georg Brandl date: Wed Jul 13 15:59:43 2011 +0200 summary: Merge doc change from 3.2. files: Doc/c-api/exceptions.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -354,10 +354,10 @@ .. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) - This utility function creates and returns a new exception object. The *name* + This utility function creates and returns a new exception class. The *name* argument must be the name of the new exception, a C string of the form - ``module.class``. The *base* and *dict* arguments are normally *NULL*. This - creates a class object derived from :exc:`Exception` (accessible in C as + ``module.classname``. The *base* and *dict* arguments are normally *NULL*. + This creates a class object derived from :exc:`Exception` (accessible in C as :c:data:`PyExc_Exception`). The :attr:`__module__` attribute of the new class is set to the first part (up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 16:35:47 2011 From: python-checkins at python.org (georg.brandl) Date: Wed, 13 Jul 2011 16:35:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Clarify_that_Py?= =?utf8?q?Err=5FNewException_creates_an_exception_*class*=2C_not_instance?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/488c6b481652 changeset: 71306:488c6b481652 branch: 2.7 parent: 71300:02a591131360 user: Georg Brandl date: Wed Jul 13 15:59:24 2011 +0200 summary: Clarify that PyErr_NewException creates an exception *class*, not instance. files: Doc/c-api/exceptions.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -352,10 +352,10 @@ .. cfunction:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) - This utility function creates and returns a new exception object. The *name* + This utility function creates and returns a new exception class. The *name* argument must be the name of the new exception, a C string of the form - ``module.class``. The *base* and *dict* arguments are normally *NULL*. This - creates a class object derived from :exc:`Exception` (accessible in C as + ``module.classname``. The *base* and *dict* arguments are normally *NULL*. + This creates a class object derived from :exc:`Exception` (accessible in C as :cdata:`PyExc_Exception`). The :attr:`__module__` attribute of the new class is set to the first part (up -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:04:07 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 13 Jul 2011 21:04:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Make_it_clear_t?= =?utf8?q?hat_PyNumber=5FAsSsize=5Ft=28=29_returns_-1_on_error=2E?= Message-ID: http://hg.python.org/cpython/rev/4105b0653bc3 changeset: 71307:4105b0653bc3 branch: 3.2 parent: 71304:9c6f7fe31d8e user: Antoine Pitrou date: Wed Jul 13 21:02:22 2011 +0200 summary: Make it clear that PyNumber_AsSsize_t() returns -1 on error. files: Doc/c-api/number.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst --- a/Doc/c-api/number.rst +++ b/Doc/c-api/number.rst @@ -249,7 +249,9 @@ .. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an - integer. If *o* can be converted to a Python int but the attempt to + integer. If the call fails, an exception is raised and -1 is returned. + + If *o* can be converted to a Python int but the attempt to convert to a Py_ssize_t value would raise an :exc:`OverflowError`, then the *exc* argument is the type of exception that will be raised (usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is *NULL*, then the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:04:08 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 13 Jul 2011 21:04:08 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Make_it_clear_that_PyNumber=5FAsSsize=5Ft=28=29_returns_-1_o?= =?utf8?q?n_error=2E?= Message-ID: http://hg.python.org/cpython/rev/0a5352cb19df changeset: 71308:0a5352cb19df parent: 71305:8893fc8e885e parent: 71307:4105b0653bc3 user: Antoine Pitrou date: Wed Jul 13 21:02:58 2011 +0200 summary: Make it clear that PyNumber_AsSsize_t() returns -1 on error. files: Doc/c-api/number.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst --- a/Doc/c-api/number.rst +++ b/Doc/c-api/number.rst @@ -249,7 +249,9 @@ .. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an - integer. If *o* can be converted to a Python int but the attempt to + integer. If the call fails, an exception is raised and -1 is returned. + + If *o* can be converted to a Python int but the attempt to convert to a Py_ssize_t value would raise an :exc:`OverflowError`, then the *exc* argument is the type of exception that will be raised (usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is *NULL*, then the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:10:05 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 13 Jul 2011 21:10:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Raise_ValueErro?= =?utf8?q?r_when_attempting_to_set_the_=5FCHUNK=5FSIZE_attribute_of_a?= Message-ID: http://hg.python.org/cpython/rev/2b97f5220940 changeset: 71309:2b97f5220940 branch: 3.2 parent: 71307:4105b0653bc3 user: Antoine Pitrou date: Wed Jul 13 21:07:49 2011 +0200 summary: Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. files: Misc/NEWS | 3 +++ Modules/_io/textio.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a + TextIOWrapper to a huge value, not TypeError. + - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors if the process has only one pipe. diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2556,7 +2556,7 @@ { Py_ssize_t n; CHECK_INITIALIZED_INT(self); - n = PyNumber_AsSsize_t(arg, PyExc_TypeError); + n = PyNumber_AsSsize_t(arg, PyExc_ValueError); if (n == -1 && PyErr_Occurred()) return -1; if (n <= 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:10:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 13 Jul 2011 21:10:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Raise_ValueError_when_attempting_to_set_the_=5FCHUNK=5FSIZE_?= =?utf8?q?attribute_of_a?= Message-ID: http://hg.python.org/cpython/rev/9648b63af5fa changeset: 71310:9648b63af5fa parent: 71308:0a5352cb19df parent: 71309:2b97f5220940 user: Antoine Pitrou date: Wed Jul 13 21:08:56 2011 +0200 summary: Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. files: Misc/NEWS | 3 +++ Modules/_io/textio.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a + TextIOWrapper to a huge value, not TypeError. + - Issue #12504: Close file handles in a timely manner in packaging.database. This fixes a bug with the remove (uninstall) feature on Windows. diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2618,7 +2618,7 @@ { Py_ssize_t n; CHECK_INITIALIZED_INT(self); - n = PyNumber_AsSsize_t(arg, PyExc_TypeError); + n = PyNumber_AsSsize_t(arg, PyExc_ValueError); if (n == -1 && PyErr_Occurred()) return -1; if (n <= 0) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:48:26 2011 From: python-checkins at python.org (victor.stinner) Date: Wed, 13 Jul 2011 21:48:26 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogQ2xvc2UgIzQzNzY6?= =?utf8?q?_ctypes_now_supports_nested_structures_in_a_endian_different_tha?= =?utf8?q?n?= Message-ID: http://hg.python.org/cpython/rev/72e73fa03124 changeset: 71311:72e73fa03124 branch: 3.2 parent: 71309:2b97f5220940 user: Victor Stinner date: Wed Jul 13 21:43:18 2011 +0200 summary: Close #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. files: Lib/ctypes/_endian.py | 16 +++++--- Lib/ctypes/test/test_byteswap.py | 36 +++++++++++++------ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Lib/ctypes/_endian.py b/Lib/ctypes/_endian.py --- a/Lib/ctypes/_endian.py +++ b/Lib/ctypes/_endian.py @@ -7,14 +7,18 @@ """Return the type with the 'other' byte order. Simple types like c_int and so on already have __ctype_be__ and __ctype_le__ attributes which contain the types, for more complicated types - only arrays are supported. + arrays and structures are supported. """ - try: + # check _OTHER_ENDIAN attribute (present if typ is primitive type) + if hasattr(typ, _OTHER_ENDIAN): return getattr(typ, _OTHER_ENDIAN) - except AttributeError: - if type(typ) == _array_type: - return _other_endian(typ._type_) * typ._length_ - raise TypeError("This type does not support other endian: %s" % typ) + # if typ is array + if isinstance(typ, _array_type): + return _other_endian(typ._type_) * typ._length_ + # if typ is structure + if issubclass(typ, Structure): + return typ + raise TypeError("This type does not support other endian: %s" % typ) class _swapped_meta(type(Structure)): def __setattr__(self, attrname, value): diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -185,18 +185,32 @@ self.assertRaises(TypeError, setattr, T, "_fields_", [("x", typ)]) def test_struct_struct(self): - # Nested structures with different byte order not (yet) supported - if sys.byteorder == "little": - base = BigEndianStructure - else: - base = LittleEndianStructure + # nested structures with different byteorders - class T(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - class S(base): - pass - self.assertRaises(TypeError, setattr, S, "_fields_", [("s", T)]) + # create nested structures with given byteorders and set memory to data + def set_structures(endianness, nested_endianness, data): + class NestedStructure(nested_endianness): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(endianness): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + return cast(data, POINTER(TestStructure))[0] + + for nested, data in ( + (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), + (LittleEndianStructure, b'\1\0\0\0\2\0\0\0'), + ): + for parent in ( + BigEndianStructure, + LittleEndianStructure, + Structure, + ): + s = set_structures(parent, nested, data) + self.assertEqual(s.point.x, 1) + self.assertEqual(s.point.y, 2) def test_struct_fields_2(self): # standard packing in struct uses no alignment. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -735,6 +735,7 @@ Armin Rigo Nicholas Riley Jean-Claude Rimbault +Vlad Riscutia Juan M. Bello Rivas Davide Rizzo Anthony Roach diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Issue #4376: ctypes now supports nested structures in a endian different than + the parent structure. Patch by Vlad Riscutia. + - Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:48:27 2011 From: python-checkins at python.org (victor.stinner) Date: Wed, 13 Jul 2011 21:48:27 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Close_=234376=3A_ctypes_now_supports_neste?= =?utf8?q?d_structures_in_a_endian?= Message-ID: http://hg.python.org/cpython/rev/637210b9d054 changeset: 71312:637210b9d054 parent: 71310:9648b63af5fa parent: 71311:72e73fa03124 user: Victor Stinner date: Wed Jul 13 21:45:16 2011 +0200 summary: (merge 3.2) Close #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. files: Lib/ctypes/_endian.py | 16 +++++--- Lib/ctypes/test/test_byteswap.py | 36 +++++++++++++------ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Lib/ctypes/_endian.py b/Lib/ctypes/_endian.py --- a/Lib/ctypes/_endian.py +++ b/Lib/ctypes/_endian.py @@ -7,14 +7,18 @@ """Return the type with the 'other' byte order. Simple types like c_int and so on already have __ctype_be__ and __ctype_le__ attributes which contain the types, for more complicated types - only arrays are supported. + arrays and structures are supported. """ - try: + # check _OTHER_ENDIAN attribute (present if typ is primitive type) + if hasattr(typ, _OTHER_ENDIAN): return getattr(typ, _OTHER_ENDIAN) - except AttributeError: - if type(typ) == _array_type: - return _other_endian(typ._type_) * typ._length_ - raise TypeError("This type does not support other endian: %s" % typ) + # if typ is array + if isinstance(typ, _array_type): + return _other_endian(typ._type_) * typ._length_ + # if typ is structure + if issubclass(typ, Structure): + return typ + raise TypeError("This type does not support other endian: %s" % typ) class _swapped_meta(type(Structure)): def __setattr__(self, attrname, value): diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -185,18 +185,32 @@ self.assertRaises(TypeError, setattr, T, "_fields_", [("x", typ)]) def test_struct_struct(self): - # Nested structures with different byte order not (yet) supported - if sys.byteorder == "little": - base = BigEndianStructure - else: - base = LittleEndianStructure + # nested structures with different byteorders - class T(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - class S(base): - pass - self.assertRaises(TypeError, setattr, S, "_fields_", [("s", T)]) + # create nested structures with given byteorders and set memory to data + def set_structures(endianness, nested_endianness, data): + class NestedStructure(nested_endianness): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(endianness): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + return cast(data, POINTER(TestStructure))[0] + + for nested, data in ( + (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), + (LittleEndianStructure, b'\1\0\0\0\2\0\0\0'), + ): + for parent in ( + BigEndianStructure, + LittleEndianStructure, + Structure, + ): + s = set_structures(parent, nested, data) + self.assertEqual(s.point.x, 1) + self.assertEqual(s.point.y, 2) def test_struct_fields_2(self): # standard packing in struct uses no alignment. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -784,6 +784,7 @@ Armin Rigo Nicholas Riley Jean-Claude Rimbault +Vlad Riscutia Juan M. Bello Rivas Davide Rizzo Anthony Roach diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Issue #4376: ctypes now supports nested structures in a endian different than + the parent structure. Patch by Vlad Riscutia. + - Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a TextIOWrapper to a huge value, not TypeError. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 21:48:28 2011 From: python-checkins at python.org (victor.stinner) Date: Wed, 13 Jul 2011 21:48:28 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogQ2xvc2UgIzQzNzY6?= =?utf8?q?_ctypes_now_supports_nested_structures_in_a_endian_different_tha?= =?utf8?q?n?= Message-ID: http://hg.python.org/cpython/rev/a9d0fab19d5e changeset: 71313:a9d0fab19d5e branch: 2.7 parent: 71306:488c6b481652 user: Victor Stinner date: Wed Jul 13 21:47:31 2011 +0200 summary: Close #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. files: Lib/ctypes/_endian.py | 16 +++++--- Lib/ctypes/test/test_byteswap.py | 36 +++++++++++++------ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Lib/ctypes/_endian.py b/Lib/ctypes/_endian.py --- a/Lib/ctypes/_endian.py +++ b/Lib/ctypes/_endian.py @@ -10,14 +10,18 @@ """Return the type with the 'other' byte order. Simple types like c_int and so on already have __ctype_be__ and __ctype_le__ attributes which contain the types, for more complicated types - only arrays are supported. + arrays and structures are supported. """ - try: + # check _OTHER_ENDIAN attribute (present if typ is primitive type) + if hasattr(typ, _OTHER_ENDIAN): return getattr(typ, _OTHER_ENDIAN) - except AttributeError: - if type(typ) == _array_type: - return _other_endian(typ._type_) * typ._length_ - raise TypeError("This type does not support other endian: %s" % typ) + # if typ is array + if isinstance(typ, _array_type): + return _other_endian(typ._type_) * typ._length_ + # if typ is structure + if issubclass(typ, Structure): + return typ + raise TypeError("This type does not support other endian: %s" % typ) class _swapped_meta(type(Structure)): def __setattr__(self, attrname, value): diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -185,18 +185,32 @@ self.assertRaises(TypeError, setattr, T, "_fields_", [("x", typ)]) def test_struct_struct(self): - # Nested structures with different byte order not (yet) supported - if sys.byteorder == "little": - base = BigEndianStructure - else: - base = LittleEndianStructure + # nested structures with different byteorders - class T(Structure): - _fields_ = [("a", c_int), - ("b", c_int)] - class S(base): - pass - self.assertRaises(TypeError, setattr, S, "_fields_", [("s", T)]) + # create nested structures with given byteorders and set memory to data + def set_structures(endianness, nested_endianness, data): + class NestedStructure(nested_endianness): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(endianness): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + return cast(data, POINTER(TestStructure))[0] + + for nested, data in ( + (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), + (LittleEndianStructure, b'\1\0\0\0\2\0\0\0'), + ): + for parent in ( + BigEndianStructure, + LittleEndianStructure, + Structure, + ): + s = set_structures(parent, nested, data) + self.assertEqual(s.point.x, 1) + self.assertEqual(s.point.y, 2) def test_struct_fields_2(self): # standard packing in struct uses no alignment. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -685,6 +685,7 @@ Armin Rigo Nicholas Riley Jean-Claude Rimbault +Vlad Riscutia Juan M. Bello Rivas Davide Rizzo Anthony Roach diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,9 @@ Library ------- +- Issue #4376: ctypes now supports nested structures in a endian different than + the parent structure. Patch by Vlad Riscutia. + - Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors if the process has only one pipe. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 23:40:23 2011 From: python-checkins at python.org (victor.stinner) Date: Wed, 13 Jul 2011 23:40:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312550=3A_Add_chain?= =?utf8?q?_optional_argument_to_faulthandler=2Eregister=28=29?= Message-ID: http://hg.python.org/cpython/rev/39873557ff4f changeset: 71314:39873557ff4f parent: 71312:637210b9d054 user: Victor Stinner date: Wed Jul 13 23:39:53 2011 +0200 summary: Issue #12550: Add chain optional argument to faulthandler.register() Call the previous signal handler if chain is True. files: Doc/library/faulthandler.rst | 4 +- Lib/test/test_faulthandler.py | 31 +++++++- Modules/faulthandler.c | 92 +++++++++++++++-------- 3 files changed, 90 insertions(+), 37 deletions(-) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -92,11 +92,11 @@ Dump the traceback on a user signal ----------------------------------- -.. function:: register(signum, file=sys.stderr, all_threads=True) +.. function:: register(signum, file=sys.stderr, all_threads=True, chain=False) Register a user signal: install a handler for the *signum* signal to dump the traceback of all threads, or of the current thread if *all_threads* is - ``False``, into *file*. + ``False``, into *file*. Call the previous handler if chain is ``True``. Not available on Windows. diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -452,11 +452,13 @@ @unittest.skipIf(not hasattr(faulthandler, "register"), "need faulthandler.register") def check_register(self, filename=False, all_threads=False, - unregister=False): + unregister=False, chain=False): """ Register a handler displaying the traceback on a user signal. Raise the signal and check the written traceback. + If chain is True, check that the previous signal handler is called. + Raise an error if the output doesn't match the expected format. """ signum = signal.SIGUSR1 @@ -464,22 +466,41 @@ import faulthandler import os import signal +import sys def func(signum): os.kill(os.getpid(), signum) +def handler(signum, frame): + handler.called = True +handler.called = False + +exitcode = 0 signum = {signum} unregister = {unregister} +chain = {chain} + if {has_filename}: file = open({filename}, "wb") else: file = None -faulthandler.register(signum, file=file, all_threads={all_threads}) +if chain: + signal.signal(signum, handler) +faulthandler.register(signum, file=file, + all_threads={all_threads}, chain={chain}) if unregister: faulthandler.unregister(signum) func(signum) +if chain and not handler.called: + if file is not None: + output = file + else: + output = sys.stderr + print("Error: signal handler not called!", file=output) + exitcode = 1 if file is not None: file.close() +sys.exit(exitcode) """.strip() code = code.format( filename=repr(filename), @@ -487,6 +508,7 @@ all_threads=all_threads, signum=signum, unregister=unregister, + chain=chain, ) trace, exitcode = self.get_output(code, filename) trace = '\n'.join(trace) @@ -495,7 +517,7 @@ regex = 'Current thread XXX:\n' else: regex = 'Traceback \(most recent call first\):\n' - regex = expected_traceback(6, 17, regex) + regex = expected_traceback(7, 28, regex) self.assertRegex(trace, regex) else: self.assertEqual(trace, '') @@ -517,6 +539,9 @@ def test_register_threads(self): self.check_register(all_threads=True) + def test_register_chain(self): + self.check_register(chain=True) + def test_main(): support.run_unittest(FaultHandlerTests) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -8,7 +8,6 @@ #include #endif - /* Allocate at maximum 100 MB of the stack to raise the stack overflow */ #define STACK_OVERFLOW_MAX_SIZE (100*1024*1024) @@ -72,6 +71,7 @@ PyObject *file; int fd; int all_threads; + int chain; _Py_sighandler_t previous; PyInterpreterState *interp; } user_signal_t; @@ -94,6 +94,7 @@ # endif #endif +static void faulthandler_user(int signum); #endif /* FAULTHANDLER_USER */ @@ -259,9 +260,9 @@ /* restore the previous handler */ #ifdef HAVE_SIGACTION - (void)sigaction(handler->signum, &handler->previous, NULL); + (void)sigaction(signum, &handler->previous, NULL); #else - (void)signal(handler->signum, handler->previous); + (void)signal(signum, handler->previous); #endif handler->enabled = 0; @@ -587,6 +588,39 @@ #endif /* FAULTHANDLER_LATER */ #ifdef FAULTHANDLER_USER +static int +faulthandler_register(int signum, int chain, _Py_sighandler_t *p_previous) +{ +#ifdef HAVE_SIGACTION + struct sigaction action; + action.sa_handler = faulthandler_user; + sigemptyset(&action.sa_mask); + /* if the signal is received while the kernel is executing a system + call, try to restart the system call instead of interrupting it and + return EINTR. */ + action.sa_flags = SA_RESTART; + if (chain) { + /* do not prevent the signal from being received from within its + own signal handler */ + action.sa_flags = SA_NODEFER; + } +#ifdef HAVE_SIGALTSTACK + if (stack.ss_sp != NULL) { + /* Call the signal handler on an alternate signal stack + provided by sigaltstack() */ + action.sa_flags |= SA_ONSTACK; + } +#endif + return sigaction(signum, &action, p_previous); +#else + _Py_sighandler_t previous; + previous = signal(signum, faulthandler_user); + if (p_previous != NULL) + *p_previous = previous; + return (previous == SIG_ERR); +#endif +} + /* Handler of user signals (e.g. SIGUSR1). Dump the traceback of the current thread, or of all threads if @@ -621,6 +655,19 @@ return; _Py_DumpTraceback(user->fd, tstate); } +#ifdef HAVE_SIGACTION + if (user->chain) { + (void)sigaction(signum, &user->previous, NULL); + /* call the previous signal handler */ + raise(signum); + (void)faulthandler_register(signum, user->chain, NULL); + } +#else + if (user->chain) { + /* call the previous signal handler */ + user->previous(signum); + } +#endif errno = save_errno; } @@ -646,25 +693,23 @@ } static PyObject* -faulthandler_register(PyObject *self, - PyObject *args, PyObject *kwargs) +faulthandler_register_py(PyObject *self, + PyObject *args, PyObject *kwargs) { - static char *kwlist[] = {"signum", "file", "all_threads", NULL}; + static char *kwlist[] = {"signum", "file", "all_threads", "chain", NULL}; int signum; PyObject *file = NULL; int all_threads = 1; + int chain = 0; int fd; user_signal_t *user; _Py_sighandler_t previous; -#ifdef HAVE_SIGACTION - struct sigaction action; -#endif PyThreadState *tstate; int err; if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "i|Oi:register", kwlist, - &signum, &file, &all_threads)) + "i|Oii:register", kwlist, + &signum, &file, &all_threads, &chain)) return NULL; if (!check_signum(signum)) @@ -686,25 +731,7 @@ user = &user_signals[signum]; if (!user->enabled) { -#ifdef HAVE_SIGACTION - action.sa_handler = faulthandler_user; - sigemptyset(&action.sa_mask); - /* if the signal is received while the kernel is executing a system - call, try to restart the system call instead of interrupting it and - return EINTR */ - action.sa_flags = SA_RESTART; -#ifdef HAVE_SIGALTSTACK - if (stack.ss_sp != NULL) { - /* Call the signal handler on an alternate signal stack - provided by sigaltstack() */ - action.sa_flags |= SA_ONSTACK; - } -#endif - err = sigaction(signum, &action, &previous); -#else - previous = signal(signum, faulthandler_user); - err = (previous == SIG_ERR); -#endif + err = faulthandler_register(signum, chain, &previous); if (err) { PyErr_SetFromErrno(PyExc_OSError); return NULL; @@ -716,6 +743,7 @@ user->file = file; user->fd = fd; user->all_threads = all_threads; + user->chain = chain; user->previous = previous; user->interp = tstate->interp; user->enabled = 1; @@ -947,8 +975,8 @@ #ifdef FAULTHANDLER_USER {"register", - (PyCFunction)faulthandler_register, METH_VARARGS|METH_KEYWORDS, - PyDoc_STR("register(signum, file=sys.stderr, all_threads=True): " + (PyCFunction)faulthandler_register_py, METH_VARARGS|METH_KEYWORDS, + PyDoc_STR("register(signum, file=sys.stderr, all_threads=True, chain=False): " "register an handler for the signal 'signum': dump the " "traceback of the current thread, or of all threads if " "all_threads is True, into file")}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 13 23:49:42 2011 From: python-checkins at python.org (victor.stinner) Date: Wed, 13 Jul 2011 23:49:42 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312550=3A_regrtest_?= =?utf8?q?displays_the_Python_traceback_on_SIGALRM_or_SIGUSR1?= Message-ID: http://hg.python.org/cpython/rev/30f91fbfc8b3 changeset: 71315:30f91fbfc8b3 user: Victor Stinner date: Wed Jul 13 23:47:21 2011 +0200 summary: Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1 files: Lib/test/regrtest.py | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -172,6 +172,7 @@ import platform import random import re +import signal import sys import sysconfig import tempfile @@ -266,9 +267,18 @@ on the command line. """ - # Display the Python traceback fatal errors (e.g. segfault) + # Display the Python traceback on fatal errors (e.g. segfault) faulthandler.enable(all_threads=True) + # Display the Python traceback on SIGALRM or SIGUSR1 signal + signals = [] + if hasattr(signal, 'SIGALRM'): + signals.append(signal.SIGALRM) + if hasattr(signal, 'SIGUSR1'): + signals.append(signal.SIGUSR1) + for signum in signals: + faulthandler.register(signum, chain=True) + replace_stdout() support.record_original_stdout(sys.stdout) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 00:10:36 2011 From: python-checkins at python.org (ned.deily) Date: Thu, 14 Jul 2011 00:10:36 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTQ5?= =?utf8?q?=3A_Correct_test=5Fplatform_to_not_fail_when_OS_X_returns_=27x86?= =?utf8?q?=5F64=27?= Message-ID: http://hg.python.org/cpython/rev/0a53a978a160 changeset: 71316:0a53a978a160 branch: 2.7 parent: 71313:a9d0fab19d5e user: Ned Deily date: Wed Jul 13 15:05:31 2011 -0700 summary: Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. Also fix NameError in fallback _mac_ver_gestalt function. And remove out-of-date URL in docs. files: Doc/library/platform.rst | 3 --- Lib/platform.py | 1 + Lib/test/test_platform.py | 2 +- Misc/NEWS | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -233,9 +233,6 @@ Entries which cannot be determined are set to ``''``. All tuple entries are strings. - Documentation for the underlying :cfunc:`gestalt` API is available online at - http://www.rgaros.nl/gestalt/. - Unix Platforms -------------- diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -765,6 +765,7 @@ 0x2: 'PowerPC', 0xa: 'i386'}.get(sysa,'') + versioninfo=('', '', '') return release,versioninfo,machine def _mac_ver_xml(): diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -191,7 +191,7 @@ self.assertEqual(res[1], ('', '', '')) if sys.byteorder == 'little': - self.assertEqual(res[2], 'i386') + self.assertIn(res[2], ('i386', 'x86_64')) else: self.assertEqual(res[2], 'PowerPC') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -101,6 +101,9 @@ Tests ----- +- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' + as the processor type on some Mac systems. + - Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 00:10:37 2011 From: python-checkins at python.org (ned.deily) Date: Thu, 14 Jul 2011 00:10:37 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTQ5?= =?utf8?q?=3A_Correct_test=5Fplatform_to_not_fail_when_OS_X_returns_=27x86?= =?utf8?q?=5F64=27?= Message-ID: http://hg.python.org/cpython/rev/d050c8c9a3b3 changeset: 71317:d050c8c9a3b3 branch: 3.2 parent: 71311:72e73fa03124 user: Ned Deily date: Wed Jul 13 15:07:04 2011 -0700 summary: Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. Also fix NameError in fallback _mac_ver_gestalt function. And remove out-of-date URL in docs. files: Doc/library/platform.rst | 3 --- Lib/platform.py | 1 + Lib/test/test_platform.py | 2 +- Misc/NEWS | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -228,9 +228,6 @@ Entries which cannot be determined are set to ``''``. All tuple entries are strings. - Documentation for the underlying :c:func:`gestalt` API is available online at - http://www.rgaros.nl/gestalt/. - Unix Platforms -------------- diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -758,6 +758,7 @@ 0x2: 'PowerPC', 0xa: 'i386'}.get(sysa,'') + versioninfo=('', '', '') return release,versioninfo,machine def _mac_ver_xml(): diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -194,7 +194,7 @@ self.assertEqual(res[1], ('', '', '')) if sys.byteorder == 'little': - self.assertEqual(res[2], 'i386') + self.assertIn(res[2], ('i386', 'x86_64')) else: self.assertEqual(res[2], 'PowerPC') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -56,6 +56,9 @@ Tests ----- +- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' + as the processor type on some Mac systems. + - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 00:10:37 2011 From: python-checkins at python.org (ned.deily) Date: Thu, 14 Jul 2011 00:10:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312549=3A_Correct_test=5Fplatform_to_not_fail_when_O?= =?utf8?q?S_X_returns_=27x86=5F64=27?= Message-ID: http://hg.python.org/cpython/rev/0025ce38fbd0 changeset: 71318:0025ce38fbd0 parent: 71315:30f91fbfc8b3 parent: 71317:d050c8c9a3b3 user: Ned Deily date: Wed Jul 13 15:09:49 2011 -0700 summary: Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. files: Doc/library/platform.rst | 3 --- Lib/platform.py | 1 + Lib/test/test_platform.py | 2 +- Misc/NEWS | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -232,9 +232,6 @@ Entries which cannot be determined are set to ``''``. All tuple entries are strings. - Documentation for the underlying :c:func:`gestalt` API is available online at - http://www.rgaros.nl/gestalt/. - Unix Platforms -------------- diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -679,6 +679,7 @@ 0x2: 'PowerPC', 0xa: 'i386'}.get(sysa,'') + versioninfo=('', '', '') return release,versioninfo,machine def _mac_ver_xml(): diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -191,7 +191,7 @@ self.assertEqual(res[1], ('', '', '')) if sys.byteorder == 'little': - self.assertEqual(res[2], 'i386') + self.assertIn(res[2], ('i386', 'x86_64')) else: self.assertEqual(res[2], 'PowerPC') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1020,6 +1020,9 @@ Tests ----- +- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' + as the processor type on some Mac systems. + - Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary failure in name resolution. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 00:15:16 2011 From: python-checkins at python.org (vinay.sajip) Date: Thu, 14 Jul 2011 00:15:16 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Closes_=2312536=3A_Unused_l?= =?utf8?q?ogger_removed_from_lib2to3=2E?= Message-ID: http://hg.python.org/cpython/rev/dd004e85e299 changeset: 71319:dd004e85e299 user: Vinay Sajip date: Wed Jul 13 23:15:07 2011 +0100 summary: Closes #12536: Unused logger removed from lib2to3. files: Lib/lib2to3/fixer_base.py | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Lib/lib2to3/fixer_base.py b/Lib/lib2to3/fixer_base.py --- a/Lib/lib2to3/fixer_base.py +++ b/Lib/lib2to3/fixer_base.py @@ -27,7 +27,6 @@ pattern_tree = None # Tree representation of the pattern options = None # Options object passed to initializer filename = None # The filename (set by set_filename) - logger = None # A logger (set by set_filename) numbers = itertools.count(1) # For new_name() used_names = set() # A set of all used NAMEs order = "post" # Does the fixer prefer pre- or post-order traversal @@ -70,12 +69,11 @@ with_tree=True) def set_filename(self, filename): - """Set the filename, and a logger derived from it. + """Set the filename. The main refactoring tool should call this. """ self.filename = filename - self.logger = logging.getLogger(filename) def match(self, node): """Returns match for a given parse tree node. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 00:27:50 2011 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 14 Jul 2011 00:27:50 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Update_status_of_implementatio?= =?utf8?q?n?= Message-ID: http://hg.python.org/peps/rev/1a45340a65d5 changeset: 3897:1a45340a65d5 user: Antoine Pitrou date: Thu Jul 14 00:26:46 2011 +0200 summary: Update status of implementation files: pep-3151.txt | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pep-3151.txt b/pep-3151.txt --- a/pep-3151.txt +++ b/pep-3151.txt @@ -501,13 +501,14 @@ Implementation ============== -A reference implementation has been started in +A reference implementation is available in http://hg.python.org/features/pep-3151/ in branch ``pep-3151``. -For now only `Step 1`_ is implemented, and without the deprecation warnings. -However, it shows that coalescing the exception types doesn't produce any -significant annoyance in the standard library. +Its current state is that all semantic changes and additions are implemented, +but the `deprecation of names`_ mechanism isn't. It has been successfully +tested on a variety of systems: Linux, Windows, OpenIndiana and FreeBSD +buildbots. -One source of trouble is with the respective constructors of ``IOError`` +One source of trouble has been with the respective constructors of ``IOError`` and ``WindowsError``, which were incompatible. The way it is solved is by keeping the ``IOError`` signature and adding a fourth optional argument to allow passing the Windows error code (which is different from the POSIX -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 14 00:28:26 2011 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 14 Jul 2011 00:28:26 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Remove_outdated_mention_of_the?= =?utf8?q?_moratorium?= Message-ID: http://hg.python.org/peps/rev/1e05ea2ad880 changeset: 3898:1e05ea2ad880 user: Antoine Pitrou date: Thu Jul 14 00:27:22 2011 +0200 summary: Remove outdated mention of the moratorium files: pep-3151.txt | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/pep-3151.txt b/pep-3151.txt --- a/pep-3151.txt +++ b/pep-3151.txt @@ -7,7 +7,7 @@ Type: Standards Track Content-Type: text/x-rst Created: 2010-07-21 -Python-Version: 3.2 or 3.3 +Python-Version: 3.3 Post-History: Resolution: TBD @@ -491,13 +491,6 @@ aliasing with OSError. -Moratorium -========== - -The moratorium in effect on language builtins means this PEP has little -chance to be accepted for Python 3.2. - - Implementation ============== -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 14 00:33:54 2011 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 14 Jul 2011 00:33:54 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_link_to_bug_tracker_entry?= Message-ID: http://hg.python.org/peps/rev/93806897eedf changeset: 3899:93806897eedf user: Antoine Pitrou date: Thu Jul 14 00:32:50 2011 +0200 summary: Add link to bug tracker entry files: pep-3151.txt | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/pep-3151.txt b/pep-3151.txt --- a/pep-3151.txt +++ b/pep-3151.txt @@ -495,7 +495,8 @@ ============== A reference implementation is available in -http://hg.python.org/features/pep-3151/ in branch ``pep-3151``. +http://hg.python.org/features/pep-3151/ in branch ``pep-3151``. It is +also tracked on the bug tracker at http://bugs.python.org/issue12555. Its current state is that all semantic changes and additions are implemented, but the `deprecation of names`_ mechanism isn't. It has been successfully tested on a variety of systems: Linux, Windows, OpenIndiana and FreeBSD -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Thu Jul 14 05:10:07 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 14 Jul 2011 05:10:07 +0200 Subject: [Python-checkins] Daily reference leaks (dd004e85e299): sum=1818 Message-ID: results for dd004e85e299 on branch "default" -------------------------------------------- test_concurrent_futures leaked [0, 162, 0] references, sum=162 test_ctypes leaked [552, 552, 552] references, sum=1656 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogWTlJKq', '-x'] From python-checkins at python.org Thu Jul 14 06:06:30 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 06:06:30 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_carefully_clean?= =?utf8?q?up_pointer_cache_after_creating_struct_pointers?= Message-ID: http://hg.python.org/cpython/rev/b82237a29824 changeset: 71320:b82237a29824 branch: 3.2 parent: 71317:d050c8c9a3b3 user: Benjamin Peterson date: Wed Jul 13 23:09:30 2011 -0500 summary: carefully cleanup pointer cache after creating struct pointers files: Lib/ctypes/test/test_byteswap.py | 24 ++++++++++---------- 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -1,4 +1,4 @@ -import sys, unittest, struct, math +import sys, unittest, struct, math, ctypes from binascii import hexlify from ctypes import * @@ -188,16 +188,6 @@ # nested structures with different byteorders # create nested structures with given byteorders and set memory to data - def set_structures(endianness, nested_endianness, data): - class NestedStructure(nested_endianness): - _fields_ = [("x", c_uint32), - ("y", c_uint32)] - - class TestStructure(endianness): - _fields_ = [("point", NestedStructure)] - - self.assertEqual(len(data), sizeof(TestStructure)) - return cast(data, POINTER(TestStructure))[0] for nested, data in ( (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), @@ -208,7 +198,17 @@ LittleEndianStructure, Structure, ): - s = set_structures(parent, nested, data) + class NestedStructure(nested): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(parent): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + ptr = POINTER(TestStructure) + s = cast(data, ptr)[0] + del ctypes._pointer_type_cache[TestStructure] self.assertEqual(s.point.x, 1) self.assertEqual(s.point.y, 2) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 06:06:31 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 06:06:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f45823977d4b changeset: 71321:f45823977d4b parent: 71319:dd004e85e299 parent: 71320:b82237a29824 user: Benjamin Peterson date: Wed Jul 13 23:11:14 2011 -0500 summary: merge 3.2 files: Lib/ctypes/test/test_byteswap.py | 24 ++++++++++---------- 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -1,4 +1,4 @@ -import sys, unittest, struct, math +import sys, unittest, struct, math, ctypes from binascii import hexlify from ctypes import * @@ -188,16 +188,6 @@ # nested structures with different byteorders # create nested structures with given byteorders and set memory to data - def set_structures(endianness, nested_endianness, data): - class NestedStructure(nested_endianness): - _fields_ = [("x", c_uint32), - ("y", c_uint32)] - - class TestStructure(endianness): - _fields_ = [("point", NestedStructure)] - - self.assertEqual(len(data), sizeof(TestStructure)) - return cast(data, POINTER(TestStructure))[0] for nested, data in ( (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), @@ -208,7 +198,17 @@ LittleEndianStructure, Structure, ): - s = set_structures(parent, nested, data) + class NestedStructure(nested): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(parent): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + ptr = POINTER(TestStructure) + s = cast(data, ptr)[0] + del ctypes._pointer_type_cache[TestStructure] self.assertEqual(s.point.x, 1) self.assertEqual(s.point.y, 2) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 06:07:46 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 06:07:46 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_carefully_clean?= =?utf8?q?up_pointer_cache_after_creating_struct_pointers?= Message-ID: http://hg.python.org/cpython/rev/70ff32bd5e95 changeset: 71322:70ff32bd5e95 branch: 2.7 parent: 71316:0a53a978a160 user: Benjamin Peterson date: Wed Jul 13 23:09:30 2011 -0500 summary: carefully cleanup pointer cache after creating struct pointers files: Lib/ctypes/test/test_byteswap.py | 24 ++++++++++---------- 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/ctypes/test/test_byteswap.py b/Lib/ctypes/test/test_byteswap.py --- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -1,4 +1,4 @@ -import sys, unittest, struct, math +import sys, unittest, struct, math, ctypes from binascii import hexlify from ctypes import * @@ -188,16 +188,6 @@ # nested structures with different byteorders # create nested structures with given byteorders and set memory to data - def set_structures(endianness, nested_endianness, data): - class NestedStructure(nested_endianness): - _fields_ = [("x", c_uint32), - ("y", c_uint32)] - - class TestStructure(endianness): - _fields_ = [("point", NestedStructure)] - - self.assertEqual(len(data), sizeof(TestStructure)) - return cast(data, POINTER(TestStructure))[0] for nested, data in ( (BigEndianStructure, b'\0\0\0\1\0\0\0\2'), @@ -208,7 +198,17 @@ LittleEndianStructure, Structure, ): - s = set_structures(parent, nested, data) + class NestedStructure(nested): + _fields_ = [("x", c_uint32), + ("y", c_uint32)] + + class TestStructure(parent): + _fields_ = [("point", NestedStructure)] + + self.assertEqual(len(data), sizeof(TestStructure)) + ptr = POINTER(TestStructure) + s = cast(data, ptr)[0] + del ctypes._pointer_type_cache[TestStructure] self.assertEqual(s.point.x, 1) self.assertEqual(s.point.y, 2) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 08:41:54 2011 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 14 Jul 2011 08:41:54 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_It_is_really_a_?= =?utf8?q?suffix_=3A-=29?= Message-ID: http://hg.python.org/cpython/rev/84379c94a525 changeset: 71323:84379c94a525 branch: 2.7 user: Raymond Hettinger date: Thu Jul 14 14:41:43 2011 +0800 summary: It is really a suffix :-) files: Doc/library/2to3.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -230,7 +230,7 @@ .. 2to3fixer:: long - Strips the ``L`` prefix on long literals and renames :class:`long` to + Strips the ``L`` suffix on long literals and renames :class:`long` to :class:`int`. .. 2to3fixer:: map -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 14:57:24 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 14 Jul 2011 14:57:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Restore_the_glo?= =?utf8?q?bal_state_of_the_log_vars=2C_so_that_test=5Fcgi_can_be_run_twice?= Message-ID: http://hg.python.org/cpython/rev/530ba6c7e578 changeset: 71324:530ba6c7e578 branch: 3.2 parent: 71320:b82237a29824 user: Ezio Melotti date: Thu Jul 14 15:18:57 2011 +0300 summary: Restore the global state of the log vars, so that test_cgi can be run twice without failures. files: Lib/test/test_cgi.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -155,7 +155,13 @@ cgi.logfp = None cgi.logfile = "/dev/null" cgi.initlog("%s", "Testing log 3") - self.addCleanup(cgi.logfp.close) + def log_cleanup(): + """Restore the global state of the log vars.""" + cgi.logfile = '' + cgi.logfp.close() + cgi.logfp = None + cgi.log = cgi.initlog + self.addCleanup(log_cleanup) cgi.log("Testing log 4") def test_fieldstorage_readline(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 14:57:25 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 14 Jul 2011 14:57:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/ac1c3291a689 changeset: 71325:ac1c3291a689 parent: 71321:f45823977d4b parent: 71324:530ba6c7e578 user: Ezio Melotti date: Thu Jul 14 15:57:12 2011 +0300 summary: Merge with 3.2. files: Lib/test/test_cgi.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -155,7 +155,13 @@ cgi.logfp = None cgi.logfile = "/dev/null" cgi.initlog("%s", "Testing log 3") - self.addCleanup(cgi.logfp.close) + def log_cleanup(): + """Restore the global state of the log vars.""" + cgi.logfile = '' + cgi.logfp.close() + cgi.logfp = None + cgi.log = cgi.initlog + self.addCleanup(log_cleanup) cgi.log("Testing log 4") def test_fieldstorage_readline(self): -- Repository URL: http://hg.python.org/cpython From ezio.melotti at gmail.com Thu Jul 14 14:57:48 2011 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Thu, 14 Jul 2011 15:57:48 +0300 Subject: [Python-checkins] cpython (merge 3.2 -> default): Merge with 3.2. In-Reply-To: References: Message-ID: <4E1EE7CC.7070906@gmail.com> An HTML attachment was scrubbed... URL: From python-checkins at python.org Thu Jul 14 15:41:09 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 14 Jul 2011 15:41:09 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMjUw?= =?utf8?q?=3A_test=5Fsocketserver_uses_a_timeout_of_60_seconds_instead_of_?= =?utf8?q?20?= Message-ID: http://hg.python.org/cpython/rev/d3cebbd500aa changeset: 71326:d3cebbd500aa branch: 2.7 parent: 71323:84379c94a525 user: Victor Stinner date: Thu Jul 14 14:53:24 2011 +0200 summary: Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20 test_shutdown() may fail on very slow buildbots like FreeBSD 6.4 just because of the arbitrary timeout. files: Lib/test/test_socketserver.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -66,7 +66,7 @@ """Test all socket servers.""" def setUp(self): - signal_alarm(20) # Kill deadlocks after 20 seconds. + signal_alarm(60) # Kill deadlocks after 60 seconds. self.port_seed = 0 self.test_files = [] @@ -281,4 +281,3 @@ if __name__ == "__main__": test_main() - signal_alarm(3) # Shutdown shouldn't take more than 3 seconds. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 15:41:10 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 14 Jul 2011 15:41:10 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMjUw?= =?utf8?q?=3A_test=5Fsocketserver_uses_a_timeout_of_60_seconds_instead_of_?= =?utf8?q?20?= Message-ID: http://hg.python.org/cpython/rev/05dfed82457a changeset: 71327:05dfed82457a branch: 3.2 parent: 71324:530ba6c7e578 user: Victor Stinner date: Thu Jul 14 14:53:24 2011 +0200 summary: Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20 test_shutdown() may fail on very slow buildbots like FreeBSD 6.4 just because of the arbitrary timeout. files: Lib/test/test_socketserver.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -66,7 +66,7 @@ """Test all socket servers.""" def setUp(self): - signal_alarm(20) # Kill deadlocks after 20 seconds. + signal_alarm(60) # Kill deadlocks after 60 seconds. self.port_seed = 0 self.test_files = [] @@ -283,4 +283,3 @@ if __name__ == "__main__": test_main() - signal_alarm(3) # Shutdown shouldn't take more than 3 seconds. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 15:41:11 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 14 Jul 2011 15:41:11 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=28merge_3=2E2=29_Issue_=2312250=3A_test=5Fsocketserver_uses?= =?utf8?q?_a_timeout_of_60_seconds?= Message-ID: http://hg.python.org/cpython/rev/a609b2a44f92 changeset: 71328:a609b2a44f92 parent: 71325:ac1c3291a689 parent: 71327:05dfed82457a user: Victor Stinner date: Thu Jul 14 15:36:16 2011 +0200 summary: (merge 3.2) Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20 test_shutdown() may fail on very slow buildbots like FreeBSD 6.4 just because of the arbitrary timeout. files: Lib/test/test_socketserver.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -66,7 +66,7 @@ """Test all socket servers.""" def setUp(self): - signal_alarm(20) # Kill deadlocks after 20 seconds. + signal_alarm(60) # Kill deadlocks after 60 seconds. self.port_seed = 0 self.test_files = [] @@ -283,4 +283,3 @@ if __name__ == "__main__": test_main() - signal_alarm(3) # Shutdown shouldn't take more than 3 seconds. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 16:59:09 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 16:59:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_this_should_be_?= =?utf8?q?an_identity_test?= Message-ID: http://hg.python.org/cpython/rev/3e3958828160 changeset: 71329:3e3958828160 branch: 3.2 parent: 71327:05dfed82457a user: Benjamin Peterson date: Thu Jul 14 10:03:35 2011 -0500 summary: this should be an identity test files: Lib/test/test_http_cookiejar.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py --- a/Lib/test/test_http_cookiejar.py +++ b/Lib/test/test_http_cookiejar.py @@ -257,7 +257,7 @@ "filename should not exist") except IOError as exc: # exactly IOError, not LoadError - self.assertEqual(exc.__class__, IOError) + self.assertIs(exc.__class__, IOError) else: self.fail("expected IOError for invalid filename") # Invalid contents of cookies file (eg. bad magic string) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 16:59:10 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 16:59:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/cecbd77544f9 changeset: 71330:cecbd77544f9 parent: 71328:a609b2a44f92 parent: 71329:3e3958828160 user: Benjamin Peterson date: Thu Jul 14 10:03:53 2011 -0500 summary: merge 3.2 files: Lib/test/test_http_cookiejar.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py --- a/Lib/test/test_http_cookiejar.py +++ b/Lib/test/test_http_cookiejar.py @@ -257,7 +257,7 @@ "filename should not exist") except IOError as exc: # exactly IOError, not LoadError - self.assertEqual(exc.__class__, IOError) + self.assertIs(exc.__class__, IOError) else: self.fail("expected IOError for invalid filename") # Invalid contents of cookies file (eg. bad magic string) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 19:43:40 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 19:43:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_add_a_contextmanager_to_dis?= =?utf8?q?able_the_gc?= Message-ID: http://hg.python.org/cpython/rev/527a52d682f6 changeset: 71331:527a52d682f6 user: Benjamin Peterson date: Thu Jul 14 12:48:01 2011 -0500 summary: add a contextmanager to disable the gc files: Lib/test/support.py | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1005,6 +1005,16 @@ gc.collect() gc.collect() + at contextlib.contextmanager +def disable_gc(): + have_gc = gc.isenabled() + gc.disable() + try: + yield + finally: + if have_gc: + gc.enable() + def python_is_optimized(): """Find if Python was built with optimizations.""" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 19:43:40 2011 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 14 Jul 2011 19:43:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_test_that_TestCase_doesn=27?= =?utf8?q?t_get_cycles?= Message-ID: http://hg.python.org/cpython/rev/d37e44c917f5 changeset: 71332:d37e44c917f5 user: Benjamin Peterson date: Thu Jul 14 12:48:25 2011 -0500 summary: test that TestCase doesn't get cycles files: Lib/unittest/test/test_case.py | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -4,6 +4,7 @@ import re import sys import warnings +import weakref import inspect from copy import deepcopy @@ -1304,3 +1305,11 @@ klass('test_something').run(result) self.assertEqual(len(result.errors), 1) self.assertEqual(result.testsRun, 1) + + @support.cpython_only + def testNoCycles(self): + case = unittest.TestCase() + wr = weakref.ref(case) + with support.disable_gc(): + del case + self.assertFalse(wr()) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 19:49:16 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 14 Jul 2011 19:49:16 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTAy?= =?utf8?q?=3A_asyncore=3A_fix_polling_loop_with_AF=5FUNIX_sockets=2E?= Message-ID: http://hg.python.org/cpython/rev/16bc59d37866 changeset: 71333:16bc59d37866 branch: 2.7 parent: 71326:d3cebbd500aa user: Charles-Fran?ois Natali date: Thu Jul 14 19:49:02 2011 +0200 summary: Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. files: Lib/asyncore.py | 6 ++++-- Misc/NEWS | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/asyncore.py b/Lib/asyncore.py --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -132,7 +132,8 @@ is_w = obj.writable() if is_r: r.append(fd) - if is_w: + # accepting sockets should not be writable + if is_w and not obj.accepting: w.append(fd) if is_r or is_w: e.append(fd) @@ -179,7 +180,8 @@ flags = 0 if obj.readable(): flags |= select.POLLIN | select.POLLPRI - if obj.writable(): + # accepting sockets should not be writable + if obj.writable() and not obj.accepting: flags |= select.POLLOUT if flags: # Only check for exceptions if object was either readable diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,8 @@ Library ------- +- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. + - Issue #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 19:54:05 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 14 Jul 2011 19:54:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4xKTogSXNzdWUgIzEyNTAy?= =?utf8?q?=3A_asyncore=3A_fix_polling_loop_with_AF=5FUNIX_sockets=2E?= Message-ID: http://hg.python.org/cpython/rev/42ec507815d2 changeset: 71334:42ec507815d2 branch: 3.1 parent: 71126:0d4ca1e77205 user: Charles-Fran?ois Natali date: Thu Jul 14 19:53:38 2011 +0200 summary: Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. files: Lib/asyncore.py | 6 ++++-- Misc/NEWS | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/asyncore.py b/Lib/asyncore.py --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -130,7 +130,8 @@ is_w = obj.writable() if is_r: r.append(fd) - if is_w: + # accepting sockets should not be writable + if is_w and not obj.accepting: w.append(fd) if is_r or is_w: e.append(fd) @@ -177,7 +178,8 @@ flags = 0 if obj.readable(): flags |= select.POLLIN | select.POLLPRI - if obj.writable(): + # accepting sockets should not be writable + if obj.writable() and not obj.accepting: flags |= select.POLLOUT if flags: # Only check for exceptions if object was either readable diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,8 @@ Library ------- +- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. + - Issue #12009: Fixed regression in netrc file comment handling. Extension Modules -- Repository URL: http://hg.python.org/cpython From benjamin at python.org Thu Jul 14 19:55:08 2011 From: benjamin at python.org (Benjamin Peterson) Date: Thu, 14 Jul 2011 12:55:08 -0500 Subject: [Python-checkins] cpython (3.1): Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. In-Reply-To: References: Message-ID: 2011/7/14 charles-francois.natali : > http://hg.python.org/cpython/rev/42ec507815d2 > changeset: ? 71334:42ec507815d2 > branch: ? ? ?3.1 > parent: ? ? ?71126:0d4ca1e77205 > user: ? ? ? ?Charles-Fran?ois Natali > date: ? ? ? ?Thu Jul 14 19:53:38 2011 +0200 > summary: > ?Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. Please do not apply bugfixes to 3.1. -- Regards, Benjamin From python-checkins at python.org Thu Jul 14 19:57:40 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 14 Jul 2011 19:57:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Merge_-_Issue_?= =?utf8?q?=2312502=3A_asyncore=3A_fix_polling_loop_with_AF=5FUNIX_sockets?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/ed90c1c8ee62 changeset: 71335:ed90c1c8ee62 branch: 3.2 parent: 71329:3e3958828160 user: Charles-Fran?ois Natali date: Thu Jul 14 19:57:35 2011 +0200 summary: Merge - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. files: Lib/asyncore.py | 6 ++++-- Misc/NEWS | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/asyncore.py b/Lib/asyncore.py --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -132,7 +132,8 @@ is_w = obj.writable() if is_r: r.append(fd) - if is_w: + # accepting sockets should not be writable + if is_w and not obj.accepting: w.append(fd) if is_r or is_w: e.append(fd) @@ -179,7 +180,8 @@ flags = 0 if obj.readable(): flags |= select.POLLIN | select.POLLPRI - if obj.writable(): + # accepting sockets should not be writable + if obj.writable() and not obj.accepting: flags |= select.POLLOUT if flags: # Only check for exceptions if object was either readable diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,8 @@ Library ------- +- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. + - Issue #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 20:00:38 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 14 Jul 2011 20:00:38 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Merge_-_Issue_=2312502=3A_a?= =?utf8?q?syncore=3A_fix_polling_loop_with_AF=5FUNIX_sockets=2E?= Message-ID: http://hg.python.org/cpython/rev/ca077f2672e3 changeset: 71336:ca077f2672e3 parent: 71332:d37e44c917f5 user: Charles-Fran?ois Natali date: Thu Jul 14 20:00:49 2011 +0200 summary: Merge - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. files: Lib/asyncore.py | 6 ++++-- Misc/NEWS | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/asyncore.py b/Lib/asyncore.py --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -132,7 +132,8 @@ is_w = obj.writable() if is_r: r.append(fd) - if is_w: + # accepting sockets should not be writable + if is_w and not obj.accepting: w.append(fd) if is_r or is_w: e.append(fd) @@ -179,7 +180,8 @@ flags = 0 if obj.readable(): flags |= select.POLLIN | select.POLLPRI - if obj.writable(): + # accepting sockets should not be writable + if obj.writable() and not obj.accepting: flags |= select.POLLOUT if flags: # Only check for exceptions if object was either readable diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,8 @@ Library ------- +- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. + - Issue #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 22:31:56 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 14 Jul 2011 22:31:56 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_cgi=2Ecloselog=28=29_fu?= =?utf8?q?nction_to_close_the_log_file?= Message-ID: http://hg.python.org/cpython/rev/66e519792e4c changeset: 71337:66e519792e4c user: Victor Stinner date: Thu Jul 14 22:28:36 2011 +0200 summary: Add cgi.closelog() function to close the log file files: Lib/cgi.py | 11 ++++++++++- Lib/test/test_cgi.py | 8 +------- Misc/NEWS | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Lib/cgi.py b/Lib/cgi.py --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -76,7 +76,7 @@ send an error message). """ - global logfp, log + global log, logfile, logfp if logfile and not logfp: try: logfp = open(logfile, "a") @@ -96,6 +96,15 @@ """Dummy function, assigned to log when logging is disabled.""" pass +def closelog(): + """Close the log file.""" + global log, logfile, logfp + logfile = '' + if logfp: + logfp.close() + logfp = None + log = initlog + log = initlog # The current logging function diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -155,13 +155,7 @@ cgi.logfp = None cgi.logfile = "/dev/null" cgi.initlog("%s", "Testing log 3") - def log_cleanup(): - """Restore the global state of the log vars.""" - cgi.logfile = '' - cgi.logfp.close() - cgi.logfp = None - cgi.log = cgi.initlog - self.addCleanup(log_cleanup) + self.addCleanup(cgi.closelog) cgi.log("Testing log 4") def test_fieldstorage_readline(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,8 @@ Library ------- +- Add cgi.closelog() function to close the log file. + - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #4376: ctypes now supports nested structures in a endian different than -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 14 23:08:41 2011 From: python-checkins at python.org (victor.stinner) Date: Thu, 14 Jul 2011 23:08:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Close_=236755=3A_Add_get=5F?= =?utf8?q?wch=28=29_method_to_curses=2Ewindow_class?= Message-ID: http://hg.python.org/cpython/rev/dec10ad41b2a changeset: 71338:dec10ad41b2a user: Victor Stinner date: Thu Jul 14 23:07:44 2011 +0200 summary: Close #6755: Add get_wch() method to curses.window class Patch by I?igo Serna. files: Doc/library/curses.rst | 8 +++++++ Doc/whatsnew/3.3.rst | 8 +++++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ Modules/_cursesmodule.c | 33 +++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 0 deletions(-) diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -846,6 +846,14 @@ until a key is pressed. +.. method:: window.get_wch([y, x]) + + Get a wide character. Like :meth:`getch`, but the integer returned is the + Unicode code point for the key pressed, so it can be passed to :func:`chr`. + + .. versionadded:: 3.3 + + .. method:: window.getkey([y, x]) Get a character, returning a string instead of an integer, as :meth:`getch` diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -91,6 +91,14 @@ (:issue:`12100`) +curses +------ + +The :class:`curses.window` class has a new :class:`~curses.window.get_wch` +method to a wide character. Patch by I?igo Serna. + +(:issue:`6755`) + faulthandler ------------ diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -851,6 +851,7 @@ Yury Selivanov Fred Sells Jiwon Seo +I?igo Serna Roger D. Serwy Jerry Seutter Denis Severson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Issue #6755: Add get_wch() method to curses.window class. Patch by I?igo + Serna. + - Add cgi.closelog() function to close the log file. - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -907,6 +907,38 @@ } static PyObject * +PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args) +{ + int x, y; + int ct; + wint_t rtn; + + switch (PyTuple_Size(args)) { + case 0: + Py_BEGIN_ALLOW_THREADS + ct = wget_wch(self->win,&rtn); + Py_END_ALLOW_THREADS + break; + case 2: + if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x)) + return NULL; + Py_BEGIN_ALLOW_THREADS + ct = mvwget_wch(self->win,y,x,&rtn); + Py_END_ALLOW_THREADS + break; + default: + PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments"); + return NULL; + } + if (ct == ERR) { + /* get_wch() returns ERR in nodelay mode */ + PyErr_SetString(PyCursesError, "no input"); + return NULL; + } + return PyLong_FromLong(rtn); +} + +static PyObject * PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args) { int x, y, n; @@ -1604,6 +1636,7 @@ {"getbkgd", (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS}, {"getch", (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS}, {"getkey", (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS}, + {"get_wch", (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS}, {"getmaxyx", (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS}, {"getparyx", (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS}, {"getstr", (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 01:43:51 2011 From: python-checkins at python.org (victor.stinner) Date: Fri, 15 Jul 2011 01:43:51 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbjogUHlfQnVpbGRWYWx1ZSgiQyIp?= =?utf8?q?_supports_non-BMP_characters_on_narrow_build?= Message-ID: http://hg.python.org/cpython/rev/2d6d75eaf98c changeset: 71339:2d6d75eaf98c user: Victor Stinner date: Fri Jul 15 01:13:24 2011 +0200 summary: Py_BuildValue("C") supports non-BMP characters on narrow build Py_BuildValue("C") doesn't have to check the code point, PyUnicode_FromOrdinal() checks its input and now supports non-BMP characters (range U+10000-U+10FFFF). files: Python/modsupport.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -292,11 +292,6 @@ case 'C': { int i = va_arg(*p_va, int); - if (i < 0 || i > PyUnicode_GetMax()) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000)"); - return NULL; - } return PyUnicode_FromOrdinal(i); } -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jul 15 05:09:26 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 15 Jul 2011 05:09:26 +0200 Subject: [Python-checkins] Daily reference leaks (2d6d75eaf98c): sum=-54 Message-ID: results for 2d6d75eaf98c on branch "default" -------------------------------------------- test_concurrent_futures leaked [-162, 108, 0] references, sum=-54 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogE2zLFK', '-x'] From python-checkins at python.org Fri Jul 15 17:54:59 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 15 Jul 2011 17:54:59 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Clear_packaging=2Edatabase_?= =?utf8?q?caches_in_place?= Message-ID: http://hg.python.org/cpython/rev/935b49a08295 changeset: 71340:935b49a08295 user: ?ric Araujo date: Fri Jul 15 17:47:46 2011 +0200 summary: Clear packaging.database caches in place files: Lib/packaging/database.py | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Lib/packaging/database.py b/Lib/packaging/database.py --- a/Lib/packaging/database.py +++ b/Lib/packaging/database.py @@ -61,13 +61,12 @@ def clear_cache(): """ Clears the internal cache. """ - global _cache_name, _cache_name_egg, _cache_path, _cache_path_egg, \ - _cache_generated, _cache_generated_egg + global _cache_generated, _cache_generated_egg - _cache_name = {} - _cache_name_egg = {} - _cache_path = {} - _cache_path_egg = {} + _cache_name.clear() + _cache_name_egg.clear() + _cache_path.clear() + _cache_path_egg.clear() _cache_generated = False _cache_generated_egg = False -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 17:55:00 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 15 Jul 2011 17:55:00 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_=3Afile=3A_constructs_i?= =?utf8?q?n_packaging=2Edatabase_docs?= Message-ID: http://hg.python.org/cpython/rev/acade94e5cea changeset: 71341:acade94e5cea user: ?ric Araujo date: Fri Jul 15 17:48:20 2011 +0200 summary: Fix :file: constructs in packaging.database docs files: Doc/library/packaging.database.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/packaging.database.rst b/Doc/library/packaging.database.rst --- a/Doc/library/packaging.database.rst +++ b/Doc/library/packaging.database.rst @@ -33,7 +33,7 @@ .. method:: get_distinfo_file(path, binary=False) Return a read-only file object for a file located at - :file:`{project-version}.dist-info/path}`. *path* should be a + :file:`{project}-{version}.dist-info/{path}`. *path* should be a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; if it is an absolute path and doesn't start with the path to the :file:`.dist-info` directory, a :class:`PackagingError` is raised. @@ -72,7 +72,7 @@ .. attribute:: metadata Instance of :class:`packaging.metadata.Metadata` filled with the contents - of the :file:`{project-version}.dist-info/METADATA` file. + of the :file:`{project}-{version}.dist-info/METADATA` file. .. attribute:: name -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 17:55:01 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 15 Jul 2011 17:55:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Silence_2to3_warnings_in_pa?= =?utf8?q?ckaging_tests?= Message-ID: http://hg.python.org/cpython/rev/412fa90e8339 changeset: 71342:412fa90e8339 user: ?ric Araujo date: Fri Jul 15 17:49:20 2011 +0200 summary: Silence 2to3 warnings in packaging tests files: Lib/packaging/tests/support.py | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py --- a/Lib/packaging/tests/support.py +++ b/Lib/packaging/tests/support.py @@ -28,13 +28,11 @@ """ import os -import errno import shutil import logging import weakref import tempfile -from packaging import logger from packaging.dist import Distribution from packaging.tests import unittest from test.support import requires_zlib, unlink @@ -44,6 +42,10 @@ 'skip_unless_symlink', 'requires_zlib'] +logger = logging.getLogger('packaging') +logger2to3 = logging.getLogger('RefactoringTool') + + class _TestHandler(logging.handlers.BufferingHandler): # stolen and adapted from test.support @@ -74,9 +76,10 @@ def setUp(self): super(LoggingCatcher, self).setUp() self.loghandler = handler = _TestHandler() - self.old_level = logger.level + self._old_levels = logger.level, logger2to3.level logger.addHandler(handler) logger.setLevel(logging.DEBUG) # we want all messages + logger2to3.setLevel(logging.CRITICAL) # we don't want 2to3 messages def tearDown(self): handler = self.loghandler @@ -87,7 +90,8 @@ for ref in weakref.getweakrefs(handler): logging._removeHandlerRef(ref) del self.loghandler - logger.setLevel(self.old_level) + logger.setLevel(self._old_levels[0]) + logger2to3.setLevel(self._old_levels[1]) super(LoggingCatcher, self).tearDown() def get_logs(self, *levels): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 17:55:01 2011 From: python-checkins at python.org (eric.araujo) Date: Fri, 15 Jul 2011 17:55:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Always_use_repr_for_regrtes?= =?utf8?q?t_resources_names?= Message-ID: http://hg.python.org/cpython/rev/cdb0ae616d58 changeset: 71343:cdb0ae616d58 user: ?ric Araujo date: Fri Jul 15 17:50:15 2011 +0200 summary: Always use repr for regrtest resources names files: Lib/test/support.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -289,7 +289,7 @@ return if not is_resource_enabled(resource): if msg is None: - msg = "Use of the `%s' resource not enabled" % resource + msg = "Use of the %r resource not enabled" % resource raise ResourceDenied(msg) def requires_linux_version(*min_version): @@ -665,7 +665,7 @@ f = check_valid_file(fn) if f is not None: return f - raise TestFailed('invalid resource "%s"' % fn) + raise TestFailed('invalid resource %r' % fn) class WarningsRecorder(object): @@ -916,7 +916,7 @@ ('WSANO_DATA', 11004), ] - denied = ResourceDenied("Resource '%s' is not available" % resource_name) + denied = ResourceDenied("Resource %r is not available" % resource_name) captured_errnos = errnos gai_errnos = [] if not captured_errnos: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 19:09:40 2011 From: python-checkins at python.org (georg.brandl) Date: Fri, 15 Jul 2011 19:09:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_duplicate_=22numbere?= =?utf8?q?d=22_options_for_toctrees=2E?= Message-ID: http://hg.python.org/cpython/rev/e79b21476fef changeset: 71344:e79b21476fef user: Georg Brandl date: Fri Jul 15 19:09:49 2011 +0200 summary: Remove duplicate "numbered" options for toctrees. files: Doc/distutils/index.rst | 1 - Doc/library/packaging.rst | 3 --- 2 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -20,7 +20,6 @@ .. toctree:: :maxdepth: 2 - :numbered: introduction.rst setupscript.rst diff --git a/Doc/library/packaging.rst b/Doc/library/packaging.rst --- a/Doc/library/packaging.rst +++ b/Doc/library/packaging.rst @@ -23,7 +23,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging-misc packaging.version @@ -42,7 +41,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging.dist packaging.command @@ -55,7 +53,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging.util packaging.tests.pypi_server -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 20:28:24 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 20:28:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Make_sure_to_re?= =?utf8?q?ap_worker_threads_and_processes_at_the_end_of?= Message-ID: http://hg.python.org/cpython/rev/a19e99625c8a changeset: 71345:a19e99625c8a branch: 3.2 parent: 71335:ed90c1c8ee62 user: Antoine Pitrou date: Fri Jul 15 20:25:20 2011 +0200 summary: Make sure to reap worker threads and processes at the end of test_concurrent_futures files: Lib/test/test_concurrent_futures.py | 22 ++++++++++------ 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -598,16 +598,20 @@ self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) + at test.support.reap_threads def test_main(): - test.support.run_unittest(ProcessPoolExecutorTest, - ThreadPoolExecutorTest, - ProcessPoolWaitTests, - ThreadPoolWaitTests, - ProcessPoolAsCompletedTests, - ThreadPoolAsCompletedTests, - FutureTests, - ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + try: + test.support.run_unittest(ProcessPoolExecutorTest, + ThreadPoolExecutorTest, + ProcessPoolWaitTests, + ThreadPoolWaitTests, + ProcessPoolAsCompletedTests, + ThreadPoolAsCompletedTests, + FutureTests, + ProcessPoolShutdownTest, + ThreadPoolShutdownTest) + finally: + test.support.reap_children() if __name__ == "__main__": test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 20:28:25 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 20:28:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Make_sure_to_reap_worker_threads_and_processes_at_the_end_of?= Message-ID: http://hg.python.org/cpython/rev/88de447abd0d changeset: 71346:88de447abd0d parent: 71344:e79b21476fef parent: 71345:a19e99625c8a user: Antoine Pitrou date: Fri Jul 15 20:26:35 2011 +0200 summary: Make sure to reap worker threads and processes at the end of test_concurrent_futures files: Lib/test/test_concurrent_futures.py | 22 ++++++++++------ 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -623,16 +623,20 @@ self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) + at test.support.reap_threads def test_main(): - test.support.run_unittest(ProcessPoolExecutorTest, - ThreadPoolExecutorTest, - ProcessPoolWaitTests, - ThreadPoolWaitTests, - ProcessPoolAsCompletedTests, - ThreadPoolAsCompletedTests, - FutureTests, - ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + try: + test.support.run_unittest(ProcessPoolExecutorTest, + ThreadPoolExecutorTest, + ProcessPoolWaitTests, + ThreadPoolWaitTests, + ProcessPoolAsCompletedTests, + ThreadPoolAsCompletedTests, + FutureTests, + ProcessPoolShutdownTest, + ThreadPoolShutdownTest) + finally: + test.support.reap_children() if __name__ == "__main__": test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:03:24 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:03:24 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExMzIx?= =?utf8?q?=3A_Fix_a_crash_with_multiple_imports_of_the_=5Fpickle_module_wh?= =?utf8?q?en?= Message-ID: http://hg.python.org/cpython/rev/1ae0b7b8de0b changeset: 71347:1ae0b7b8de0b branch: 3.2 parent: 71345:a19e99625c8a user: Antoine Pitrou date: Fri Jul 15 21:01:21 2011 +0200 summary: Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. files: Misc/NEWS | 3 +++ Modules/_pickle.c | 2 ++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas St?hrk. + - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #4376: ctypes now supports nested structures in a endian different than diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6321,8 +6321,10 @@ if (m == NULL) return NULL; + Py_INCREF(&Pickler_Type); if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0) return NULL; + Py_INCREF(&Unpickler_Type); if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:03:25 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:03:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2311321=3A_Fix_a_crash_with_multiple_imports_of_the_?= =?utf8?q?=5Fpickle_module_when?= Message-ID: http://hg.python.org/cpython/rev/6674272754da changeset: 71348:6674272754da parent: 71346:88de447abd0d parent: 71347:1ae0b7b8de0b user: Antoine Pitrou date: Fri Jul 15 21:02:09 2011 +0200 summary: Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. files: Misc/NEWS | 3 +++ Modules/_pickle.c | 2 ++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas St?hrk. + - Issue #6755: Add get_wch() method to curses.window class. Patch by I?igo Serna. diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6338,8 +6338,10 @@ if (m == NULL) return NULL; + Py_INCREF(&Pickler_Type); if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0) return NULL; + Py_INCREF(&Unpickler_Type); if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:07:03 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:07:03 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_catch_nasty_exc?= =?utf8?q?eption_classes_with_=5F=5Fnew=5F=5F_that_doesn=27t_return_a_exce?= =?utf8?q?ption?= Message-ID: http://hg.python.org/cpython/rev/8d05f697acd4 changeset: 71349:8d05f697acd4 branch: 3.2 parent: 71335:ed90c1c8ee62 user: Benjamin Peterson date: Fri Jul 15 14:09:26 2011 -0500 summary: catch nasty exception classes with __new__ that doesn't return a exception (closes #11627) Patch from Andreas St?hrk. files: Lib/test/test_raise.py | 9 +++++++++ Misc/NEWS | 3 +++ Python/ceval.c | 7 +++++++ 3 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -121,6 +121,15 @@ else: self.fail("No exception raised") + def test_new_returns_invalid_instance(self): + # See issue #11627. + class MyException(Exception): + def __new__(cls, *args): + return object() + + with self.assertRaises(TypeError): + raise MyException + class TestCause(unittest.TestCase): def test_invalid_cause(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception + class. + - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3413,6 +3413,13 @@ value = PyObject_CallObject(exc, NULL); if (value == NULL) goto raise_error; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto raise_error; + } } else if (PyExceptionInstance_Check(exc)) { value = exc; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:07:03 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:07:03 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKCMxMTYyNyk=?= Message-ID: http://hg.python.org/cpython/rev/bc1fbd6f667a changeset: 71350:bc1fbd6f667a parent: 71343:cdb0ae616d58 parent: 71349:8d05f697acd4 user: Benjamin Peterson date: Fri Jul 15 14:10:35 2011 -0500 summary: merge 3.2 (#11627) files: Lib/test/test_raise.py | 9 +++++++++ Misc/NEWS | 3 +++ Python/ceval.c | 7 +++++++ 3 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -121,6 +121,15 @@ else: self.fail("No exception raised") + def test_new_returns_invalid_instance(self): + # See issue #11627. + class MyException(Exception): + def __new__(cls, *args): + return object() + + with self.assertRaises(TypeError): + raise MyException + class TestCause(unittest.TestCase): def test_invalid_cause(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception + class. + - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3494,6 +3494,13 @@ value = PyObject_CallObject(exc, NULL); if (value == NULL) goto raise_error; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto raise_error; + } } else if (PyExceptionInstance_Check(exc)) { value = exc; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:07:04 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:07:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/14e56b7d67c7 changeset: 71351:14e56b7d67c7 parent: 71350:bc1fbd6f667a parent: 71348:6674272754da user: Benjamin Peterson date: Fri Jul 15 14:10:59 2011 -0500 summary: merge heads files: Doc/distutils/index.rst | 1 - Doc/library/packaging.rst | 3 -- Lib/test/test_concurrent_futures.py | 22 ++++++++++------ Misc/NEWS | 3 ++ Modules/_pickle.c | 2 + 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -20,7 +20,6 @@ .. toctree:: :maxdepth: 2 - :numbered: introduction.rst setupscript.rst diff --git a/Doc/library/packaging.rst b/Doc/library/packaging.rst --- a/Doc/library/packaging.rst +++ b/Doc/library/packaging.rst @@ -23,7 +23,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging-misc packaging.version @@ -42,7 +41,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging.dist packaging.command @@ -55,7 +53,6 @@ .. toctree:: :maxdepth: 2 - :numbered: packaging.util packaging.tests.pypi_server diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -623,16 +623,20 @@ self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) + at test.support.reap_threads def test_main(): - test.support.run_unittest(ProcessPoolExecutorTest, - ThreadPoolExecutorTest, - ProcessPoolWaitTests, - ThreadPoolWaitTests, - ProcessPoolAsCompletedTests, - ThreadPoolAsCompletedTests, - FutureTests, - ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + try: + test.support.run_unittest(ProcessPoolExecutorTest, + ThreadPoolExecutorTest, + ProcessPoolWaitTests, + ThreadPoolWaitTests, + ProcessPoolAsCompletedTests, + ThreadPoolAsCompletedTests, + FutureTests, + ProcessPoolShutdownTest, + ThreadPoolShutdownTest) + finally: + test.support.reap_children() if __name__ == "__main__": test_main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas St?hrk. + - Issue #6755: Add get_wch() method to curses.window class. Patch by I?igo Serna. diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6338,8 +6338,10 @@ if (m == NULL) return NULL; + Py_INCREF(&Pickler_Type); if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0) return NULL; + Py_INCREF(&Unpickler_Type); if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:07:05 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:07:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/13fbfe6308e2 changeset: 71352:13fbfe6308e2 branch: 3.2 parent: 71349:8d05f697acd4 parent: 71347:1ae0b7b8de0b user: Benjamin Peterson date: Fri Jul 15 14:11:23 2011 -0500 summary: merge heads files: Lib/test/test_concurrent_futures.py | 22 ++++++++++------ Misc/NEWS | 3 ++ Modules/_pickle.c | 2 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -598,16 +598,20 @@ self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) + at test.support.reap_threads def test_main(): - test.support.run_unittest(ProcessPoolExecutorTest, - ThreadPoolExecutorTest, - ProcessPoolWaitTests, - ThreadPoolWaitTests, - ProcessPoolAsCompletedTests, - ThreadPoolAsCompletedTests, - FutureTests, - ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + try: + test.support.run_unittest(ProcessPoolExecutorTest, + ThreadPoolExecutorTest, + ProcessPoolWaitTests, + ThreadPoolWaitTests, + ProcessPoolAsCompletedTests, + ThreadPoolAsCompletedTests, + FutureTests, + ProcessPoolShutdownTest, + ThreadPoolShutdownTest) + finally: + test.support.reap_children() if __name__ == "__main__": test_main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,9 @@ Library ------- +- Issue #11321: Fix a crash with multiple imports of the _pickle module when + embedding Python. Patch by Andreas St?hrk. + - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #4376: ctypes now supports nested structures in a endian different than diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6321,8 +6321,10 @@ if (m == NULL) return NULL; + Py_INCREF(&Pickler_Type); if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0) return NULL; + Py_INCREF(&Unpickler_Type); if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:07:05 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:07:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/7aaccab7a915 changeset: 71353:7aaccab7a915 parent: 71351:14e56b7d67c7 parent: 71352:13fbfe6308e2 user: Benjamin Peterson date: Fri Jul 15 14:11:45 2011 -0500 summary: merge 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:10:55 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 21:10:55 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_port_8d05f697ac?= =?utf8?b?ZDQgKCMxMTYyNyk=?= Message-ID: http://hg.python.org/cpython/rev/45b1ae1ef318 changeset: 71354:45b1ae1ef318 branch: 2.7 parent: 71333:16bc59d37866 user: Benjamin Peterson date: Fri Jul 15 14:15:40 2011 -0500 summary: port 8d05f697acd4 (#11627) files: Lib/test/test_exceptions.py | 8 ++++++++ Misc/NEWS | 3 +++ Python/ceval.c | 12 ++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -464,6 +464,14 @@ self.assertTrue(e is RuntimeError, e) self.assertIn("maximum recursion depth exceeded", str(v)) + def test_new_returns_invalid_instance(self): + # See issue #11627. + class MyException(Exception): + def __new__(cls, *args): + return object() + + with self.assertRaises(TypeError): + raise MyException # Helper class used by TestSameStrAndUnicodeMsg diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception + class. + - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance and its type get caught in a reference cycle, and the instance's diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3515,9 +3515,17 @@ Py_DECREF(tmp); } - if (PyExceptionClass_Check(type)) + if (PyExceptionClass_Check(type)) { PyErr_NormalizeException(&type, &value, &tb); - + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %s() should have returned an instance of " + "BaseException, not '%s'", + ((PyTypeObject *)type)->tp_name, + Py_TYPE(value)->tp_name); + goto raise_error; + } + } else if (PyExceptionInstance_Check(type)) { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:21:04 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:21:04 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4xKTogSXNzdWUgIzExNjAz?= =?utf8?q?=3A_Fix_a_crash_when_=5F=5Fstr=5F=5F_is_rebound_as_=5F=5Frepr=5F?= =?utf8?b?Xy4=?= Message-ID: http://hg.python.org/cpython/rev/b488e027c952 changeset: 71355:b488e027c952 branch: 3.1 parent: 71334:42ec507815d2 user: Antoine Pitrou date: Fri Jul 15 21:15:07 2011 +0200 summary: Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4252,6 +4252,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + What's New in Python 3.1.4? =========================== diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2821,7 +2821,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:21:05 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:21:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4xIC0+IDMuMik6?= =?utf8?q?_Issue_=2311603=3A_Fix_a_crash_when_=5F=5Fstr=5F=5F_is_rebound_a?= =?utf8?b?cyBfX3JlcHJfXy4=?= Message-ID: http://hg.python.org/cpython/rev/8b52ac4a0c9f changeset: 71356:8b52ac4a0c9f branch: 3.2 parent: 71347:1ae0b7b8de0b parent: 71355:b488e027c952 user: Antoine Pitrou date: Fri Jul 15 21:17:14 2011 +0200 summary: Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4252,6 +4252,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2890,7 +2890,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:21:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:21:06 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2311603=3A_Fix_a_crash_when_=5F=5Fstr=5F=5F_is_reboun?= =?utf8?b?ZCBhcyBfX3JlcHJfXy4=?= Message-ID: http://hg.python.org/cpython/rev/0a040aa9bb34 changeset: 71357:0a040aa9bb34 parent: 71348:6674272754da parent: 71356:8b52ac4a0c9f user: Antoine Pitrou date: Fri Jul 15 21:18:18 2011 +0200 summary: Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4247,6 +4247,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2968,7 +2968,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:21:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:21:06 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_Merge?= Message-ID: http://hg.python.org/cpython/rev/64e35f3bcda5 changeset: 71358:64e35f3bcda5 branch: 3.2 parent: 71352:13fbfe6308e2 parent: 71356:8b52ac4a0c9f user: Antoine Pitrou date: Fri Jul 15 21:19:02 2011 +0200 summary: Merge files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4252,6 +4252,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2890,7 +2890,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:21:07 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:21:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/04feda56cab4 changeset: 71359:04feda56cab4 parent: 71353:7aaccab7a915 parent: 71357:0a040aa9bb34 user: Antoine Pitrou date: Fri Jul 15 21:19:27 2011 +0200 summary: Merge files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4247,6 +4247,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2968,7 +2968,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:24:02 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 21:24:02 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExNjAz?= =?utf8?q?=3A_Fix_a_crash_when_=5F=5Fstr=5F=5F_is_rebound_as_=5F=5Frepr=5F?= =?utf8?b?Xy4=?= Message-ID: http://hg.python.org/cpython/rev/cd9eca1bf531 changeset: 71360:cd9eca1bf531 branch: 2.7 parent: 71354:45b1ae1ef318 user: Antoine Pitrou date: Fri Jul 15 21:22:50 2011 +0200 summary: Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. files: Lib/test/test_descr.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/typeobject.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4581,6 +4581,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo(object): + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -33,6 +33,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - Issue #4376: ctypes now supports nested structures in a endian different than diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2980,7 +2980,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 21:26:11 2011 From: python-checkins at python.org (local-hg) Date: Fri, 15 Jul 2011 21:26:11 +0200 Subject: [Python-checkins] =?utf8?q?hooks=3A_Fix_hook_failure_after_hg_upg?= =?utf8?q?rade?= Message-ID: http://hg.python.org/hooks/rev/f778b7c966c5 changeset: 74:f778b7c966c5 user: Antoine Pitrou date: Fri Jul 15 21:26:11 2011 +0200 summary: Fix hook failure after hg upgrade files: mail.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mail.py b/mail.py --- a/mail.py +++ b/mail.py @@ -108,7 +108,7 @@ subj = prefixes + desc send(subj, sender, to, '\n'.join(body) + '\n') - print 'notified %s of incoming changeset %s' % (to, ctx) + ui.status('notified %s of incoming changeset %s\n' % (to, ctx)) return False def incoming(ui, repo, **kwargs): -- Repository URL: http://hg.python.org/hooks From python-checkins at python.org Fri Jul 15 21:27:08 2011 From: python-checkins at python.org (local-hg) Date: Fri, 15 Jul 2011 21:27:08 +0200 Subject: [Python-checkins] =?utf8?q?hooks=3A_Make_it_clear_that_these_mess?= =?utf8?q?ages_are_from_the_buildbot_hook?= Message-ID: http://hg.python.org/hooks/rev/0de36ab240f0 changeset: 75:0de36ab240f0 user: Antoine Pitrou date: Fri Jul 15 21:27:08 2011 +0200 summary: Make it clear that these messages are from the buildbot hook files: hgbuildbot.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hgbuildbot.py b/hgbuildbot.py --- a/hgbuildbot.py +++ b/hgbuildbot.py @@ -122,5 +122,5 @@ sys.stdout = old_stdout new_stdout.seek(0) for s in new_stdout: - ui.status(s) + ui.status("buildbot: " + s) -- Repository URL: http://hg.python.org/hooks From python-checkins at python.org Fri Jul 15 22:16:51 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:16:51 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTcz?= =?utf8?q?=3A_Add_resource_checks_for_dangling_Thread_and_Process_objects?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/2bedea96de60 changeset: 71361:2bedea96de60 branch: 3.2 parent: 71358:64e35f3bcda5 user: Antoine Pitrou date: Fri Jul 15 22:12:24 2011 +0200 summary: Issue #12573: Add resource checks for dangling Thread and Process objects. files: Lib/multiprocessing/process.py | 5 ++ Lib/test/regrtest.py | 37 +++++++++++++++++++++- Lib/threading.py | 4 ++ Misc/NEWS | 2 + 4 files changed, 47 insertions(+), 1 deletions(-) diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -42,6 +42,7 @@ import sys import signal import itertools +from _weakrefset import WeakSet # # @@ -105,6 +106,7 @@ self._kwargs = dict(kwargs) self._name = name or type(self).__name__ + '-' + \ ':'.join(str(i) for i in self._identity) + _dangling.add(self) def run(self): ''' @@ -328,3 +330,6 @@ for name, signum in list(signal.__dict__.items()): if name[:3]=='SIG' and '_' not in name: _exitcode_to_name[-signum] = name + +# For debug and leak testing +_dangling = WeakSet() diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -172,6 +172,15 @@ import warnings from inspect import isabstract +try: + import threading +except ImportError: + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + # Some times __path__ and __file__ are not absolute (e.g. while running from # Lib/) and, if we change the CWD to run the tests in a temporary dir, some @@ -864,7 +873,8 @@ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', 'warnings.filters', 'asyncore.socket_map', 'logging._handlers', 'logging._handlerList', - 'sys.warnoptions') + 'sys.warnoptions', 'threading._dangling', + 'multiprocessing.process._dangling') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -952,6 +962,31 @@ sys.warnoptions = saved_options[1] sys.warnoptions[:] = saved_options[2] + # Controlling dangling references to Thread objects can make it easier + # to track reference leaks. + def get_threading__dangling(self): + if not threading: + return None + # This copies the weakrefs without making any strong reference + return threading._dangling.copy() + def restore_threading__dangling(self, saved): + if not threading: + return + threading._dangling.clear() + threading._dangling.update(saved) + + # Same for Process objects + def get_multiprocessing_process__dangling(self): + if not multiprocessing: + return None + # This copies the weakrefs without making any strong reference + return multiprocessing.process._dangling.copy() + def restore_multiprocessing_process__dangling(self, saved): + if not multiprocessing: + return + multiprocessing.process._dangling.clear() + multiprocessing.process._dangling.update(saved) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -6,6 +6,7 @@ from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque +from _weakrefset import WeakSet # Note regarding PEP 8 compliant names # This threading model was originally inspired by Java, and inherited @@ -606,6 +607,8 @@ _active = {} # maps thread id to Thread object _limbo = {} +# For debug and leak testing +_dangling = WeakSet() # Main class for threads @@ -640,6 +643,7 @@ # sys.stderr is not stored in the class like # sys.exc_info since it can be changed between instances self._stderr = _sys.stderr + _dangling.add(self) def _reset_internal_locks(self): # private! Called by _after_fork() to reset our internal locks as diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -67,6 +67,8 @@ Tests ----- +- Issue #12573: Add resource checks for dangling Thread and Process objects. + - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:16:51 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:16:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312573=3A_Add_resource_checks_for_dangling_Thread_an?= =?utf8?q?d_Process_objects=2E?= Message-ID: http://hg.python.org/cpython/rev/86dc49fbf4af changeset: 71362:86dc49fbf4af parent: 71359:04feda56cab4 parent: 71361:2bedea96de60 user: Antoine Pitrou date: Fri Jul 15 22:15:38 2011 +0200 summary: Issue #12573: Add resource checks for dangling Thread and Process objects. files: Lib/multiprocessing/process.py | 5 ++ Lib/test/regrtest.py | 37 +++++++++++++++++++++- Lib/threading.py | 4 ++ Misc/NEWS | 2 + 4 files changed, 47 insertions(+), 1 deletions(-) diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -42,6 +42,7 @@ import sys import signal import itertools +from _weakrefset import WeakSet # # @@ -109,6 +110,7 @@ self._kwargs = dict(kwargs) self._name = name or type(self).__name__ + '-' + \ ':'.join(str(i) for i in self._identity) + _dangling.add(self) def run(self): ''' @@ -344,3 +346,6 @@ for name, signum in list(signal.__dict__.items()): if name[:3]=='SIG' and '_' not in name: _exitcode_to_name[-signum] = name + +# For debug and leak testing +_dangling = WeakSet() diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -182,6 +182,15 @@ import warnings from inspect import isabstract +try: + import threading +except ImportError: + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + # Some times __path__ and __file__ are not absolute (e.g. while running from # Lib/) and, if we change the CWD to run the tests in a temporary dir, some @@ -930,7 +939,8 @@ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', 'warnings.filters', 'asyncore.socket_map', 'logging._handlers', 'logging._handlerList', 'sys.gettrace', - 'sys.warnoptions') + 'sys.warnoptions', 'threading._dangling', + 'multiprocessing.process._dangling') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -1023,6 +1033,31 @@ sys.warnoptions = saved_options[1] sys.warnoptions[:] = saved_options[2] + # Controlling dangling references to Thread objects can make it easier + # to track reference leaks. + def get_threading__dangling(self): + if not threading: + return None + # This copies the weakrefs without making any strong reference + return threading._dangling.copy() + def restore_threading__dangling(self, saved): + if not threading: + return + threading._dangling.clear() + threading._dangling.update(saved) + + # Same for Process objects + def get_multiprocessing_process__dangling(self): + if not multiprocessing: + return None + # This copies the weakrefs without making any strong reference + return multiprocessing.process._dangling.copy() + def restore_multiprocessing_process__dangling(self, saved): + if not multiprocessing: + return + multiprocessing.process._dangling.clear() + multiprocessing.process._dangling.update(saved) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -6,6 +6,7 @@ from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque +from _weakrefset import WeakSet # Note regarding PEP 8 compliant names # This threading model was originally inspired by Java, and inherited @@ -608,6 +609,8 @@ _active = {} # maps thread id to Thread object _limbo = {} +# For debug and leak testing +_dangling = WeakSet() # Main class for threads @@ -645,6 +648,7 @@ # sys.stderr is not stored in the class like # sys.exc_info since it can be changed between instances self._stderr = _sys.stderr + _dangling.add(self) def _reset_internal_locks(self): # private! Called by _after_fork() to reset our internal locks as diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1036,6 +1036,8 @@ Tests ----- +- Issue #12573: Add resource checks for dangling Thread and Process objects. + - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:23:09 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 22:23:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_comment_which_is_not_applic?= =?utf8?q?able_anymore?= Message-ID: http://hg.python.org/cpython/rev/f8199dea7ed3 changeset: 71363:f8199dea7ed3 parent: 71353:7aaccab7a915 user: Benjamin Peterson date: Fri Jul 15 15:27:34 2011 -0500 summary: comment which is not applicable anymore files: Parser/Python.asdl | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Parser/Python.asdl b/Parser/Python.asdl --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -99,7 +99,6 @@ comprehension = (expr target, expr iter, expr* ifs) - -- not sure what to call the first argument for raise and except excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) attributes (int lineno, int col_offset) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:23:10 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 15 Jul 2011 22:23:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/cd43d57f64db changeset: 71364:cd43d57f64db parent: 71363:f8199dea7ed3 parent: 71362:86dc49fbf4af user: Benjamin Peterson date: Fri Jul 15 15:27:58 2011 -0500 summary: merge heads files: Lib/multiprocessing/process.py | 5 ++ Lib/test/regrtest.py | 37 +++++++++++++++++++++- Lib/test/test_descr.py | 8 ++++ Lib/threading.py | 4 ++ Misc/NEWS | 5 ++ Objects/typeobject.c | 2 +- 6 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -42,6 +42,7 @@ import sys import signal import itertools +from _weakrefset import WeakSet # # @@ -109,6 +110,7 @@ self._kwargs = dict(kwargs) self._name = name or type(self).__name__ + '-' + \ ':'.join(str(i) for i in self._identity) + _dangling.add(self) def run(self): ''' @@ -344,3 +346,6 @@ for name, signum in list(signal.__dict__.items()): if name[:3]=='SIG' and '_' not in name: _exitcode_to_name[-signum] = name + +# For debug and leak testing +_dangling = WeakSet() diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -182,6 +182,15 @@ import warnings from inspect import isabstract +try: + import threading +except ImportError: + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + # Some times __path__ and __file__ are not absolute (e.g. while running from # Lib/) and, if we change the CWD to run the tests in a temporary dir, some @@ -930,7 +939,8 @@ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', 'warnings.filters', 'asyncore.socket_map', 'logging._handlers', 'logging._handlerList', 'sys.gettrace', - 'sys.warnoptions') + 'sys.warnoptions', 'threading._dangling', + 'multiprocessing.process._dangling') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -1023,6 +1033,31 @@ sys.warnoptions = saved_options[1] sys.warnoptions[:] = saved_options[2] + # Controlling dangling references to Thread objects can make it easier + # to track reference leaks. + def get_threading__dangling(self): + if not threading: + return None + # This copies the weakrefs without making any strong reference + return threading._dangling.copy() + def restore_threading__dangling(self, saved): + if not threading: + return + threading._dangling.clear() + threading._dangling.update(saved) + + # Same for Process objects + def get_multiprocessing_process__dangling(self): + if not multiprocessing: + return None + # This copies the weakrefs without making any strong reference + return multiprocessing.process._dangling.copy() + def restore_multiprocessing_process__dangling(self, saved): + if not multiprocessing: + return + multiprocessing.process._dangling.clear() + multiprocessing.process._dangling.update(saved) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4247,6 +4247,14 @@ with self.assertRaises(TypeError): str.__add__(fake_str, "abc") + def test_repr_as_str(self): + # Issue #11603: crash or infinite loop when rebinding __str__ as + # __repr__. + class Foo: + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -6,6 +6,7 @@ from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque +from _weakrefset import WeakSet # Note regarding PEP 8 compliant names # This threading model was originally inspired by Java, and inherited @@ -608,6 +609,8 @@ _active = {} # maps thread id to Thread object _limbo = {} +# For debug and leak testing +_dangling = WeakSet() # Main class for threads @@ -645,6 +648,7 @@ # sys.stderr is not stored in the class like # sys.exc_info since it can be changed between instances self._stderr = _sys.stderr + _dangling.add(self) def _reset_internal_locks(self): # private! Called by _after_fork() to reset our internal locks as diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by + Andreas St?hrk. + - Issue #11321: Fix a crash with multiple imports of the _pickle module when embedding Python. Patch by Andreas St?hrk. @@ -1033,6 +1036,8 @@ Tests ----- +- Issue #12573: Add resource checks for dangling Thread and Process objects. + - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' as the processor type on some Mac systems. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2968,7 +2968,7 @@ unaryfunc f; f = Py_TYPE(self)->tp_repr; - if (f == NULL) + if (f == NULL || f == object_str) f = object_repr; return f(self); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:45:19 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:45:19 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Try_harder_to_r?= =?utf8?q?eap_dangling_threads_in_test=2Esupport=2Ereap=5Fthreads=28=29=2E?= Message-ID: http://hg.python.org/cpython/rev/6a221b6b81ee changeset: 71365:6a221b6b81ee branch: 3.2 parent: 71361:2bedea96de60 user: Antoine Pitrou date: Fri Jul 15 22:29:44 2011 +0200 summary: Try harder to reap dangling threads in test.support.reap_threads(). files: Lib/test/support.py | 19 +++++++++++++------ Misc/NEWS | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -24,9 +24,15 @@ import logging.handlers try: - import _thread + import _thread, threading except ImportError: _thread = None + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + __all__ = [ "Error", "TestFailed", "ResourceDenied", "import_module", @@ -1275,19 +1281,20 @@ def threading_setup(): if _thread: - return _thread._count(), + return _thread._count(), threading._dangling.copy() else: - return 1, + return 1, () -def threading_cleanup(nb_threads): +def threading_cleanup(*original_values): if not _thread: return _MAX_COUNT = 10 for count in range(_MAX_COUNT): - n = _thread._count() - if n == nb_threads: + values = _thread._count(), threading._dangling + if values == original_values: break time.sleep(0.1) + gc_collect() # XXX print a warning in case of failure? def reap_threads(func): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -67,6 +67,8 @@ Tests ----- +- Try harder to reap dangling threads in test.support.reap_threads(). + - Issue #12573: Add resource checks for dangling Thread and Process objects. - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:45:19 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:45:19 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_test=5Fpydoc_ne?= =?utf8?q?eds_to_cleanup_after_itself?= Message-ID: http://hg.python.org/cpython/rev/08edf24e8267 changeset: 71366:08edf24e8267 branch: 3.2 user: Antoine Pitrou date: Fri Jul 15 22:32:25 2011 +0200 summary: test_pydoc needs to cleanup after itself files: Lib/test/test_pydoc.py | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -15,8 +15,10 @@ from io import StringIO from collections import namedtuple from contextlib import contextmanager -from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \ - reap_children, captured_output, captured_stdout, unlink +from test.support import ( + TESTFN, forget, rmtree, EnvironmentVarGuard, + reap_children, reap_threads, captured_output, captured_stdout, unlink +) from test import pydoc_mod @@ -205,11 +207,8 @@ output of pydoc. """ cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - try: - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - return output.strip() - finally: - reap_children() + output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + return output.strip() def get_pydoc_html(module): "Returns pydoc generated output as html" @@ -488,13 +487,17 @@ self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist)) + at reap_threads def test_main(): - test.support.run_unittest(PydocDocTest, - TestDescriptions, - PydocServerTest, - PydocUrlHandlerTest, - TestHelper, - ) + try: + test.support.run_unittest(PydocDocTest, + TestDescriptions, + PydocServerTest, + PydocUrlHandlerTest, + TestHelper, + ) + finally: + reap_children() if __name__ == "__main__": test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:45:20 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:45:20 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Use_test=2Escri?= =?utf8?q?pt=5Fhelper_in_test=5Fpydoc?= Message-ID: http://hg.python.org/cpython/rev/59a536cace4c changeset: 71367:59a536cace4c branch: 3.2 user: Antoine Pitrou date: Fri Jul 15 22:42:12 2011 +0200 summary: Use test.script_helper in test_pydoc files: Lib/test/test_pydoc.py | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -15,11 +15,12 @@ from io import StringIO from collections import namedtuple from contextlib import contextmanager + +from test.script_helper import assert_python_ok from test.support import ( TESTFN, forget, rmtree, EnvironmentVarGuard, reap_children, reap_threads, captured_output, captured_stdout, unlink ) - from test import pydoc_mod try: @@ -201,14 +202,14 @@ # output pattern for module with bad imports badimport_pattern = "problem in %s - ImportError: No module named %s" -def run_pydoc(module_name, *args): +def run_pydoc(module_name, *args, **env): """ Runs pydoc on the specified module. Returns the stripped output of pydoc. """ - cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - return output.strip() + args = args + (module_name,) + rc, out, err = assert_python_ok(pydoc.__file__, *args, **env) + return out.strip() def get_pydoc_html(module): "Returns pydoc generated output as html" @@ -307,19 +308,20 @@ def newdirinpath(dir): os.mkdir(dir) sys.path.insert(0, dir) - yield - sys.path.pop(0) - rmtree(dir) + try: + yield + finally: + sys.path.pop(0) + rmtree(dir) - with newdirinpath(TESTFN), EnvironmentVarGuard() as env: - env['PYTHONPATH'] = TESTFN + with newdirinpath(TESTFN): fullmodname = os.path.join(TESTFN, modname) sourcefn = fullmodname + os.extsep + "py" for importstring, expectedinmsg in testpairs: with open(sourcefn, 'w') as f: f.write("import {}\n".format(importstring)) try: - result = run_pydoc(modname).decode("ascii") + result = run_pydoc(modname, PYTHONPATH=TESTFN).decode("ascii") finally: forget(modname) expected = badimport_pattern % (modname, expectedinmsg) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 22:45:21 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 22:45:21 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/60f10f33506e changeset: 71368:60f10f33506e parent: 71364:cd43d57f64db parent: 71367:59a536cace4c user: Antoine Pitrou date: Fri Jul 15 22:43:33 2011 +0200 summary: Merge from 3.2 files: Lib/test/support.py | 19 ++++++++--- Lib/test/test_pydoc.py | 47 ++++++++++++++++------------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -24,9 +24,15 @@ import logging.handlers try: - import _thread + import _thread, threading except ImportError: _thread = None + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + try: import zlib @@ -1358,19 +1364,20 @@ def threading_setup(): if _thread: - return _thread._count(), + return _thread._count(), threading._dangling.copy() else: - return 1, + return 1, () -def threading_cleanup(nb_threads): +def threading_cleanup(*original_values): if not _thread: return _MAX_COUNT = 10 for count in range(_MAX_COUNT): - n = _thread._count() - if n == nb_threads: + values = _thread._count(), threading._dangling + if values == original_values: break time.sleep(0.1) + gc_collect() # XXX print a warning in case of failure? def reap_threads(func): diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -15,9 +15,12 @@ from io import StringIO from collections import namedtuple from contextlib import contextmanager -from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \ - reap_children, captured_output, captured_stdout, unlink +from test.script_helper import assert_python_ok +from test.support import ( + TESTFN, forget, rmtree, EnvironmentVarGuard, + reap_children, reap_threads, captured_output, captured_stdout, unlink +) from test import pydoc_mod try: @@ -199,17 +202,14 @@ # output pattern for module with bad imports badimport_pattern = "problem in %s - ImportError: No module named %r" -def run_pydoc(module_name, *args): +def run_pydoc(module_name, *args, **env): """ Runs pydoc on the specified module. Returns the stripped output of pydoc. """ - cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - try: - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - return output.strip() - finally: - reap_children() + args = args + (module_name,) + rc, out, err = assert_python_ok(pydoc.__file__, *args, **env) + return out.strip() def get_pydoc_html(module): "Returns pydoc generated output as html" @@ -312,19 +312,20 @@ def newdirinpath(dir): os.mkdir(dir) sys.path.insert(0, dir) - yield - sys.path.pop(0) - rmtree(dir) + try: + yield + finally: + sys.path.pop(0) + rmtree(dir) - with newdirinpath(TESTFN), EnvironmentVarGuard() as env: - env['PYTHONPATH'] = TESTFN + with newdirinpath(TESTFN): fullmodname = os.path.join(TESTFN, modname) sourcefn = fullmodname + os.extsep + "py" for importstring, expectedinmsg in testpairs: with open(sourcefn, 'w') as f: f.write("import {}\n".format(importstring)) try: - result = run_pydoc(modname).decode("ascii") + result = run_pydoc(modname, PYTHONPATH=TESTFN).decode("ascii") finally: forget(modname) expected = badimport_pattern % (modname, expectedinmsg) @@ -494,13 +495,17 @@ self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist)) + at reap_threads def test_main(): - test.support.run_unittest(PydocDocTest, - TestDescriptions, - PydocServerTest, - PydocUrlHandlerTest, - TestHelper, - ) + try: + test.support.run_unittest(PydocDocTest, + TestDescriptions, + PydocServerTest, + PydocUrlHandlerTest, + TestHelper, + ) + finally: + reap_children() if __name__ == "__main__": test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 23:02:07 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 23:02:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_test=5Fos_needs_to_reap_thr?= =?utf8?q?eads?= Message-ID: http://hg.python.org/cpython/rev/090f926c7a80 changeset: 71369:090f926c7a80 user: Antoine Pitrou date: Fri Jul 15 23:00:56 2011 +0200 summary: test_os needs to reap threads files: Lib/test/test_os.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1506,6 +1506,7 @@ raise + at support.reap_threads def test_main(): support.run_unittest( FileTests, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 23:11:08 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 23:11:08 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_test=5Fthreaded=5Fimport_mu?= =?utf8?q?st_clean_up_after_itself?= Message-ID: http://hg.python.org/cpython/rev/9242333a8d0d changeset: 71370:9242333a8d0d user: Antoine Pitrou date: Fri Jul 15 23:09:13 2011 +0200 summary: test_threaded_import must clean up after itself files: Lib/test/test_threaded_import.py | 11 +++++++---- Lib/test/threaded_import_hangers.py | 14 +++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -11,8 +11,8 @@ import time import shutil import unittest -from test.support import verbose, import_module, run_unittest, TESTFN -thread = import_module('_thread') +from test.support import ( + verbose, import_module, run_unittest, TESTFN, reap_threads) threading = import_module('threading') def task(N, done, done_tasks, errors): @@ -62,7 +62,7 @@ def __init__(self): self.numcalls = 0 self.x = 0 - self.lock = thread.allocate_lock() + self.lock = threading.Lock() def find_module(self, name, path=None): # Simulate some thread-unsafe behaviour. If calls to find_module() @@ -113,7 +113,9 @@ done_tasks = [] done.clear() for i in range(N): - thread.start_new_thread(task, (N, done, done_tasks, errors,)) + t = threading.Thread(target=task, + args=(N, done, done_tasks, errors,)) + t.start() done.wait(60) self.assertFalse(errors) if verbose: @@ -203,6 +205,7 @@ self.assertEqual(set(results), {'a', 'b'}) + at reap_threads def test_main(): run_unittest(ThreadedImportTests) diff --git a/Lib/test/threaded_import_hangers.py b/Lib/test/threaded_import_hangers.py --- a/Lib/test/threaded_import_hangers.py +++ b/Lib/test/threaded_import_hangers.py @@ -35,8 +35,12 @@ ("os.path.abspath", os.path.abspath, ('.',)), ]: - t = Worker(func, args) - t.start() - t.join(TIMEOUT) - if t.is_alive(): - errors.append("%s appeared to hang" % name) + try: + t = Worker(func, args) + t.start() + t.join(TIMEOUT) + if t.is_alive(): + errors.append("%s appeared to hang" % name) + finally: + del t + -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 23:11:08 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 23:11:08 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_whitespace?= Message-ID: http://hg.python.org/cpython/rev/d725ff44ae34 changeset: 71371:d725ff44ae34 user: Antoine Pitrou date: Fri Jul 15 23:09:58 2011 +0200 summary: Fix whitespace files: Lib/test/threaded_import_hangers.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/test/threaded_import_hangers.py b/Lib/test/threaded_import_hangers.py --- a/Lib/test/threaded_import_hangers.py +++ b/Lib/test/threaded_import_hangers.py @@ -43,4 +43,3 @@ errors.append("%s appeared to hang" % name) finally: del t - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 15 23:27:40 2011 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 15 Jul 2011 23:27:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_test=5Fpackaging_should_cle?= =?utf8?q?an_up_after_itself_=28but_it_doesn=27t_really=29?= Message-ID: http://hg.python.org/cpython/rev/420a27e0183c changeset: 71372:420a27e0183c user: Antoine Pitrou date: Fri Jul 15 23:26:19 2011 +0200 summary: test_packaging should clean up after itself (but it doesn't really) files: Lib/packaging/tests/__main__.py | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Lib/packaging/tests/__main__.py b/Lib/packaging/tests/__main__.py --- a/Lib/packaging/tests/__main__.py +++ b/Lib/packaging/tests/__main__.py @@ -5,15 +5,18 @@ import os import sys import unittest -from test.support import run_unittest, reap_children +from test.support import run_unittest, reap_children, reap_threads + at reap_threads def test_main(): - start_dir = os.path.dirname(__file__) - top_dir = os.path.dirname(os.path.dirname(start_dir)) - test_loader = unittest.TestLoader() - run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir)) - reap_children() + try: + start_dir = os.path.dirname(__file__) + top_dir = os.path.dirname(os.path.dirname(start_dir)) + test_loader = unittest.TestLoader() + run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir)) + finally: + reap_children() if __name__ == '__main__': -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 01:18:20 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 16 Jul 2011 01:18:20 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_potential_resource_leak?= =?utf8?q?s_in_concurrent=2Efutures=2EProcessPoolExecutor?= Message-ID: http://hg.python.org/cpython/rev/0fe200e4f8b4 changeset: 71373:0fe200e4f8b4 user: Antoine Pitrou date: Sat Jul 16 01:13:34 2011 +0200 summary: Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor by joining all queues and processes when shutdown() is called. files: Lib/concurrent/futures/process.py | 5 ++++- Lib/test/test_concurrent_futures.py | 3 ++- Misc/NEWS | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -209,6 +209,8 @@ # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): p.join() + # Release resources held by the queue + call_queue.close() while True: _add_call_item_to_queue(pending_work_items, @@ -246,7 +248,8 @@ # Clean shutdown of a worker using its PID # (avoids marking the executor broken) assert shutting_down() - del processes[result_item] + p = processes.pop(result_item) + p.join() if not processes: shutdown_worker() return diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -634,7 +634,8 @@ ThreadPoolAsCompletedTests, FutureTests, ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + ThreadPoolShutdownTest, + ) finally: test.support.reap_children() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor + by joining all queues and processes when shutdown() is called. + - Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 01:53:50 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 16 Jul 2011 01:53:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Silence_spurious_=22broken_?= =?utf8?q?pipe=22_tracebacks_when_shutting_down_a?= Message-ID: http://hg.python.org/cpython/rev/dfaa3a149a92 changeset: 71374:dfaa3a149a92 user: Antoine Pitrou date: Sat Jul 16 01:51:58 2011 +0200 summary: Silence spurious "broken pipe" tracebacks when shutting down a ProcessPoolExecutor. files: Lib/concurrent/futures/process.py | 11 +++++++---- Lib/multiprocessing/queues.py | 9 +++++++-- Misc/NEWS | 3 +++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -205,12 +205,12 @@ nb_children_alive = sum(p.is_alive() for p in processes.values()) for i in range(0, nb_children_alive): call_queue.put_nowait(None) + # Release the queue's resources as soon as possible. + call_queue.close() # If .join() is not called on the created processes then # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): p.join() - # Release resources held by the queue - call_queue.close() while True: _add_call_item_to_queue(pending_work_items, @@ -241,8 +241,7 @@ # locks may be in a dirty state and block forever. for p in processes.values(): p.terminate() - for p in processes.values(): - p.join() + shutdown_worker() return if isinstance(result_item, int): # Clean shutdown of a worker using its PID @@ -337,6 +336,10 @@ # because futures in the call queue cannot be cancelled. self._call_queue = multiprocessing.Queue(self._max_workers + EXTRA_QUEUED_CALLS) + # Killed worker processes can produce spurious "broken pipe" + # tracebacks in the queue's own worker thread. But we detect killed + # processes anyway, so silence the tracebacks. + self._call_queue._ignore_epipe = True self._result_queue = SimpleQueue() self._work_ids = queue.Queue() self._queue_management_thread = None diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -41,6 +41,7 @@ import time import atexit import weakref +import errno from queue import Empty, Full import _multiprocessing @@ -67,6 +68,8 @@ else: self._wlock = Lock() self._sem = BoundedSemaphore(maxsize) + # For use by concurrent.futures + self._ignore_epipe = False self._after_fork() @@ -178,7 +181,7 @@ self._thread = threading.Thread( target=Queue._feed, args=(self._buffer, self._notempty, self._send, - self._wlock, self._writer.close), + self._wlock, self._writer.close, self._ignore_epipe), name='QueueFeederThread' ) self._thread.daemon = True @@ -229,7 +232,7 @@ notempty.release() @staticmethod - def _feed(buffer, notempty, send, writelock, close): + def _feed(buffer, notempty, send, writelock, close, ignore_epipe): debug('starting thread to feed data to pipe') from .util import is_exiting @@ -271,6 +274,8 @@ except IndexError: pass except Exception as e: + if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: + return # Since this runs in a daemon thread the resources it uses # may be become unusable while the process is cleaning up. # We ignore errors which happen after the process has diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Silence spurious "broken pipe" tracebacks when shutting down a + ProcessPoolExecutor. + - Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor by joining all queues and processes when shutdown() is called. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 04:06:04 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Jul 2011 04:06:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_remove_ast=2E=5F=5Fversion?= =?utf8?b?X18gKGNsb3NlcyAjMTIyNzMp?= Message-ID: http://hg.python.org/cpython/rev/b23ad0a6cf87 changeset: 71375:b23ad0a6cf87 parent: 71364:cd43d57f64db user: Benjamin Peterson date: Fri Jul 15 21:10:13 2011 -0500 summary: remove ast.__version__ (closes #12273) files: Doc/library/ast.rst | 3 --- Lib/ast.py | 1 - Misc/NEWS | 3 +++ Parser/asdl_c.py | 29 ----------------------------- Python/Python-ast.c | 11 ----------- 5 files changed, 3 insertions(+), 44 deletions(-) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -96,9 +96,6 @@ Abstract Grammar ---------------- -The module defines a string constant ``__version__`` which is the Mercurial -revision of the file shown below. - The abstract grammar is currently defined as follows: .. literalinclude:: ../../Parser/Python.asdl diff --git a/Lib/ast.py b/Lib/ast.py --- a/Lib/ast.py +++ b/Lib/ast.py @@ -25,7 +25,6 @@ :license: Python License. """ from _ast import * -from _ast import __version__ def parse(source, filename='', mode='exec'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12273: Remove ast.__version__. AST changes can be accounted for by + checking sys.version_info or sys._mercurial. + - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -900,10 +900,6 @@ self.emit('if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return NULL;', 1) self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1) self.emit("return NULL;", 2) - # Value of version: "$Revision$" - self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' - % (mod.version,), 1) - self.emit("return NULL;", 2) for dfn in mod.dfns: self.visit(dfn) self.emit("return m;", 1) @@ -1124,29 +1120,6 @@ common_msg = "/* File automatically generated by %s. */\n\n" -c_file_msg = """ -/* - __version__ %s. - - This module must be committed separately after each AST grammar change; - The __version__ number is set to the revision number of the commit - containing the grammar change. -*/ - -""" - - -def get_file_revision(f): - """Fish out the last change to a file in hg.""" - args = ["hg", "log", "--template", "{node|short}", "--limit", "1", f] - p = subprocess.Popen(args, stdout=subprocess.PIPE) - out = p.communicate()[0] - if p.returncode: - print >> sys.stderr, "error return code from hg" - sys.exit(1) - return out - - def main(srcfile): argv0 = sys.argv[0] components = argv0.split(os.sep) @@ -1155,7 +1128,6 @@ mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) - mod.version = get_file_revision(srcfile) if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) f = open(p, "w") @@ -1175,7 +1147,6 @@ p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "w") f.write(auto_gen_msg) - f.write(c_file_msg % (mod.version,)) f.write('#include "Python.h"\n') f.write('#include "%s-ast.h"\n' % mod.name) f.write('\n') diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -1,14 +1,5 @@ /* File automatically generated by Parser/asdl_c.py. */ - -/* - __version__ e0e663132363. - - This module must be committed separately after each AST grammar change; - The __version__ number is set to the revision number of the commit - containing the grammar change. -*/ - #include "Python.h" #include "Python-ast.h" @@ -6750,8 +6741,6 @@ NULL; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return NULL; - if (PyModule_AddStringConstant(m, "__version__", "e0e663132363") < 0) - return NULL; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return NULL; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 04:06:05 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Jul 2011 04:06:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/db88cc5a4f6e changeset: 71376:db88cc5a4f6e parent: 71375:b23ad0a6cf87 parent: 71374:dfaa3a149a92 user: Benjamin Peterson date: Fri Jul 15 21:10:44 2011 -0500 summary: merge heads files: Lib/concurrent/futures/process.py | 12 +++- Lib/multiprocessing/queues.py | 9 ++- Lib/packaging/tests/__main__.py | 15 +++-- Lib/test/support.py | 19 ++++-- Lib/test/test_concurrent_futures.py | 3 +- Lib/test/test_os.py | 1 + Lib/test/test_pydoc.py | 47 +++++++++------- Lib/test/test_threaded_import.py | 11 ++- Lib/test/threaded_import_hangers.py | 13 ++- Misc/NEWS | 6 ++ 10 files changed, 88 insertions(+), 48 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -205,6 +205,8 @@ nb_children_alive = sum(p.is_alive() for p in processes.values()) for i in range(0, nb_children_alive): call_queue.put_nowait(None) + # Release the queue's resources as soon as possible. + call_queue.close() # If .join() is not called on the created processes then # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): @@ -239,14 +241,14 @@ # locks may be in a dirty state and block forever. for p in processes.values(): p.terminate() - for p in processes.values(): - p.join() + shutdown_worker() return if isinstance(result_item, int): # Clean shutdown of a worker using its PID # (avoids marking the executor broken) assert shutting_down() - del processes[result_item] + p = processes.pop(result_item) + p.join() if not processes: shutdown_worker() return @@ -334,6 +336,10 @@ # because futures in the call queue cannot be cancelled. self._call_queue = multiprocessing.Queue(self._max_workers + EXTRA_QUEUED_CALLS) + # Killed worker processes can produce spurious "broken pipe" + # tracebacks in the queue's own worker thread. But we detect killed + # processes anyway, so silence the tracebacks. + self._call_queue._ignore_epipe = True self._result_queue = SimpleQueue() self._work_ids = queue.Queue() self._queue_management_thread = None diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -41,6 +41,7 @@ import time import atexit import weakref +import errno from queue import Empty, Full import _multiprocessing @@ -67,6 +68,8 @@ else: self._wlock = Lock() self._sem = BoundedSemaphore(maxsize) + # For use by concurrent.futures + self._ignore_epipe = False self._after_fork() @@ -178,7 +181,7 @@ self._thread = threading.Thread( target=Queue._feed, args=(self._buffer, self._notempty, self._send, - self._wlock, self._writer.close), + self._wlock, self._writer.close, self._ignore_epipe), name='QueueFeederThread' ) self._thread.daemon = True @@ -229,7 +232,7 @@ notempty.release() @staticmethod - def _feed(buffer, notempty, send, writelock, close): + def _feed(buffer, notempty, send, writelock, close, ignore_epipe): debug('starting thread to feed data to pipe') from .util import is_exiting @@ -271,6 +274,8 @@ except IndexError: pass except Exception as e: + if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: + return # Since this runs in a daemon thread the resources it uses # may be become unusable while the process is cleaning up. # We ignore errors which happen after the process has diff --git a/Lib/packaging/tests/__main__.py b/Lib/packaging/tests/__main__.py --- a/Lib/packaging/tests/__main__.py +++ b/Lib/packaging/tests/__main__.py @@ -5,15 +5,18 @@ import os import sys import unittest -from test.support import run_unittest, reap_children +from test.support import run_unittest, reap_children, reap_threads + at reap_threads def test_main(): - start_dir = os.path.dirname(__file__) - top_dir = os.path.dirname(os.path.dirname(start_dir)) - test_loader = unittest.TestLoader() - run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir)) - reap_children() + try: + start_dir = os.path.dirname(__file__) + top_dir = os.path.dirname(os.path.dirname(start_dir)) + test_loader = unittest.TestLoader() + run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir)) + finally: + reap_children() if __name__ == '__main__': diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -24,9 +24,15 @@ import logging.handlers try: - import _thread + import _thread, threading except ImportError: _thread = None + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + try: import zlib @@ -1358,19 +1364,20 @@ def threading_setup(): if _thread: - return _thread._count(), + return _thread._count(), threading._dangling.copy() else: - return 1, + return 1, () -def threading_cleanup(nb_threads): +def threading_cleanup(*original_values): if not _thread: return _MAX_COUNT = 10 for count in range(_MAX_COUNT): - n = _thread._count() - if n == nb_threads: + values = _thread._count(), threading._dangling + if values == original_values: break time.sleep(0.1) + gc_collect() # XXX print a warning in case of failure? def reap_threads(func): diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -634,7 +634,8 @@ ThreadPoolAsCompletedTests, FutureTests, ProcessPoolShutdownTest, - ThreadPoolShutdownTest) + ThreadPoolShutdownTest, + ) finally: test.support.reap_children() diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1506,6 +1506,7 @@ raise + at support.reap_threads def test_main(): support.run_unittest( FileTests, diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -15,9 +15,12 @@ from io import StringIO from collections import namedtuple from contextlib import contextmanager -from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \ - reap_children, captured_output, captured_stdout, unlink +from test.script_helper import assert_python_ok +from test.support import ( + TESTFN, forget, rmtree, EnvironmentVarGuard, + reap_children, reap_threads, captured_output, captured_stdout, unlink +) from test import pydoc_mod try: @@ -199,17 +202,14 @@ # output pattern for module with bad imports badimport_pattern = "problem in %s - ImportError: No module named %r" -def run_pydoc(module_name, *args): +def run_pydoc(module_name, *args, **env): """ Runs pydoc on the specified module. Returns the stripped output of pydoc. """ - cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - try: - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - return output.strip() - finally: - reap_children() + args = args + (module_name,) + rc, out, err = assert_python_ok(pydoc.__file__, *args, **env) + return out.strip() def get_pydoc_html(module): "Returns pydoc generated output as html" @@ -312,19 +312,20 @@ def newdirinpath(dir): os.mkdir(dir) sys.path.insert(0, dir) - yield - sys.path.pop(0) - rmtree(dir) + try: + yield + finally: + sys.path.pop(0) + rmtree(dir) - with newdirinpath(TESTFN), EnvironmentVarGuard() as env: - env['PYTHONPATH'] = TESTFN + with newdirinpath(TESTFN): fullmodname = os.path.join(TESTFN, modname) sourcefn = fullmodname + os.extsep + "py" for importstring, expectedinmsg in testpairs: with open(sourcefn, 'w') as f: f.write("import {}\n".format(importstring)) try: - result = run_pydoc(modname).decode("ascii") + result = run_pydoc(modname, PYTHONPATH=TESTFN).decode("ascii") finally: forget(modname) expected = badimport_pattern % (modname, expectedinmsg) @@ -494,13 +495,17 @@ self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist)) + at reap_threads def test_main(): - test.support.run_unittest(PydocDocTest, - TestDescriptions, - PydocServerTest, - PydocUrlHandlerTest, - TestHelper, - ) + try: + test.support.run_unittest(PydocDocTest, + TestDescriptions, + PydocServerTest, + PydocUrlHandlerTest, + TestHelper, + ) + finally: + reap_children() if __name__ == "__main__": test_main() diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -11,8 +11,8 @@ import time import shutil import unittest -from test.support import verbose, import_module, run_unittest, TESTFN -thread = import_module('_thread') +from test.support import ( + verbose, import_module, run_unittest, TESTFN, reap_threads) threading = import_module('threading') def task(N, done, done_tasks, errors): @@ -62,7 +62,7 @@ def __init__(self): self.numcalls = 0 self.x = 0 - self.lock = thread.allocate_lock() + self.lock = threading.Lock() def find_module(self, name, path=None): # Simulate some thread-unsafe behaviour. If calls to find_module() @@ -113,7 +113,9 @@ done_tasks = [] done.clear() for i in range(N): - thread.start_new_thread(task, (N, done, done_tasks, errors,)) + t = threading.Thread(target=task, + args=(N, done, done_tasks, errors,)) + t.start() done.wait(60) self.assertFalse(errors) if verbose: @@ -203,6 +205,7 @@ self.assertEqual(set(results), {'a', 'b'}) + at reap_threads def test_main(): run_unittest(ThreadedImportTests) diff --git a/Lib/test/threaded_import_hangers.py b/Lib/test/threaded_import_hangers.py --- a/Lib/test/threaded_import_hangers.py +++ b/Lib/test/threaded_import_hangers.py @@ -35,8 +35,11 @@ ("os.path.abspath", os.path.abspath, ('.',)), ]: - t = Worker(func, args) - t.start() - t.join(TIMEOUT) - if t.is_alive(): - errors.append("%s appeared to hang" % name) + try: + t = Worker(func, args) + t.start() + t.join(TIMEOUT) + if t.is_alive(): + errors.append("%s appeared to hang" % name) + finally: + del t diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -231,6 +231,12 @@ Library ------- +- Silence spurious "broken pipe" tracebacks when shutting down a + ProcessPoolExecutor. + +- Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor + by joining all queues and processes when shutdown() is called. + - Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 04:06:45 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 16 Jul 2011 04:06:45 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_put_in_correct_section?= Message-ID: http://hg.python.org/cpython/rev/1dd6908df8f5 changeset: 71377:1dd6908df8f5 user: Benjamin Peterson date: Fri Jul 15 21:11:35 2011 -0500 summary: put in correct section files: Misc/NEWS | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,9 +10,6 @@ Core and Builtins ----------------- -- Issue #12273: Remove ast.__version__. AST changes can be accounted for by - checking sys.version_info or sys._mercurial. - - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. @@ -231,6 +228,9 @@ Library ------- +- Issue #12273: Remove ast.__version__. AST changes can be accounted for by + checking sys.version_info or sys._mercurial. + - Silence spurious "broken pipe" tracebacks when shutting down a ProcessPoolExecutor. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jul 16 05:27:37 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 16 Jul 2011 05:27:37 +0200 Subject: [Python-checkins] Daily reference leaks (dfaa3a149a92): sum=0 Message-ID: results for dfaa3a149a92 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog6pjGY6', '-x'] From python-checkins at python.org Sat Jul 16 23:58:00 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 16 Jul 2011 23:58:00 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Close_the_call_?= =?utf8?q?queue_in_concurrent=2Efutures=2EProcessPoolExecutor_when?= Message-ID: http://hg.python.org/cpython/rev/362556f980ac changeset: 71378:362556f980ac branch: 3.2 parent: 71367:59a536cace4c user: Antoine Pitrou date: Sat Jul 16 23:52:02 2011 +0200 summary: Close the call queue in concurrent.futures.ProcessPoolExecutor when shutdown() is called, without waiting for the garbage collector to kick in. files: Lib/concurrent/futures/process.py | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -232,6 +232,7 @@ # X. for p in processes: p.join() + call_queue.close() return else: # Start shutting down by telling a process it can exit. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,9 @@ Library ------- +- Close the call queue in concurrent.futures.ProcessPoolExecutor when + shutdown() is called, without waiting for the garbage collector to kick in. + - Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 23:58:01 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 16 Jul 2011 23:58:01 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Dummy_merge?= Message-ID: http://hg.python.org/cpython/rev/547897c3571a changeset: 71379:547897c3571a parent: 71374:dfaa3a149a92 parent: 71378:362556f980ac user: Antoine Pitrou date: Sat Jul 16 23:52:42 2011 +0200 summary: Dummy merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 16 23:58:04 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 16 Jul 2011 23:58:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/6446fc0a0a99 changeset: 71380:6446fc0a0a99 parent: 71379:547897c3571a parent: 71377:1dd6908df8f5 user: Antoine Pitrou date: Sat Jul 16 23:56:45 2011 +0200 summary: Merge files: Doc/library/ast.rst | 3 --- Lib/ast.py | 1 - Misc/NEWS | 3 +++ Parser/asdl_c.py | 29 ----------------------------- Python/Python-ast.c | 11 ----------- 5 files changed, 3 insertions(+), 44 deletions(-) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -96,9 +96,6 @@ Abstract Grammar ---------------- -The module defines a string constant ``__version__`` which is the Mercurial -revision of the file shown below. - The abstract grammar is currently defined as follows: .. literalinclude:: ../../Parser/Python.asdl diff --git a/Lib/ast.py b/Lib/ast.py --- a/Lib/ast.py +++ b/Lib/ast.py @@ -25,7 +25,6 @@ :license: Python License. """ from _ast import * -from _ast import __version__ def parse(source, filename='', mode='exec'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -228,6 +228,9 @@ Library ------- +- Issue #12273: Remove ast.__version__. AST changes can be accounted for by + checking sys.version_info or sys._mercurial. + - Silence spurious "broken pipe" tracebacks when shutting down a ProcessPoolExecutor. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -900,10 +900,6 @@ self.emit('if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return NULL;', 1) self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1) self.emit("return NULL;", 2) - # Value of version: "$Revision$" - self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' - % (mod.version,), 1) - self.emit("return NULL;", 2) for dfn in mod.dfns: self.visit(dfn) self.emit("return m;", 1) @@ -1124,29 +1120,6 @@ common_msg = "/* File automatically generated by %s. */\n\n" -c_file_msg = """ -/* - __version__ %s. - - This module must be committed separately after each AST grammar change; - The __version__ number is set to the revision number of the commit - containing the grammar change. -*/ - -""" - - -def get_file_revision(f): - """Fish out the last change to a file in hg.""" - args = ["hg", "log", "--template", "{node|short}", "--limit", "1", f] - p = subprocess.Popen(args, stdout=subprocess.PIPE) - out = p.communicate()[0] - if p.returncode: - print >> sys.stderr, "error return code from hg" - sys.exit(1) - return out - - def main(srcfile): argv0 = sys.argv[0] components = argv0.split(os.sep) @@ -1155,7 +1128,6 @@ mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) - mod.version = get_file_revision(srcfile) if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) f = open(p, "w") @@ -1175,7 +1147,6 @@ p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "w") f.write(auto_gen_msg) - f.write(c_file_msg % (mod.version,)) f.write('#include "Python.h"\n') f.write('#include "%s-ast.h"\n' % mod.name) f.write('\n') diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -1,14 +1,5 @@ /* File automatically generated by Parser/asdl_c.py. */ - -/* - __version__ e0e663132363. - - This module must be committed separately after each AST grammar change; - The __version__ number is set to the revision number of the commit - containing the grammar change. -*/ - #include "Python.h" #include "Python-ast.h" @@ -6750,8 +6741,6 @@ NULL; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return NULL; - if (PyModule_AddStringConstant(m, "__version__", "e0e663132363") < 0) - return NULL; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return NULL; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 04:54:52 2011 From: python-checkins at python.org (eli.bendersky) Date: Sun, 17 Jul 2011 04:54:52 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTc0?= =?utf8?q?=3A_correct_capitalization_of_the_Queue_module=2E_Patch_by_Rafe_?= =?utf8?q?Kettler?= Message-ID: http://hg.python.org/cpython/rev/60ce5f279a5e changeset: 71381:60ce5f279a5e branch: 2.7 parent: 71360:cd9eca1bf531 user: Eli Bendersky date: Sun Jul 17 05:54:06 2011 +0300 summary: Issue #12574: correct capitalization of the Queue module. Patch by Rafe Kettler files: Doc/library/queue.rst | 4 ++-- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst --- a/Doc/library/queue.rst +++ b/Doc/library/queue.rst @@ -1,4 +1,4 @@ -:mod:`queue` --- A synchronized queue class +:mod:`Queue` --- A synchronized queue class =========================================== .. module:: Queue @@ -26,7 +26,7 @@ .. seealso:: - Latest version of the `queue module Python source code + Latest version of the `Queue module Python source code `_. The :mod:`Queue` module defines the following classes and exceptions: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -432,6 +432,7 @@ Randall Kern Magnus Kessler Lawrence Kesteloot +Rafe Kettler Vivek Khera Akira Kitada Mads Kiilerich -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 11:32:23 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 11:32:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_Issu?= =?utf8?q?e11436_-_Minor_clarification_to_struct_documentation_for_=27s=27?= Message-ID: http://hg.python.org/cpython/rev/90cdf403132e changeset: 71382:90cdf403132e branch: 3.2 parent: 71378:362556f980ac user: Senthil Kumaran date: Sun Jul 17 17:29:17 2011 +0800 summary: Fix closes Issue11436 - Minor clarification to struct documentation for 's' format character. files: Doc/library/struct.rst | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -240,10 +240,11 @@ For the ``'s'`` format character, the count is interpreted as the length of the bytes, not a repeat count like for the other format characters; for example, ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters. -For packing, the string is truncated or padded with null bytes as appropriate to -make it fit. For unpacking, the resulting bytes object always has exactly the -specified number of bytes. As a special case, ``'0s'`` means a single, empty -string (while ``'0c'`` means 0 characters). +If a count is not given, it defaults to 1. For packing, the string is +truncated or padded with null bytes as appropriate to make it fit. For +unpacking, the resulting bytes object always has exactly the specified number +of bytes. As a special case, ``'0s'`` means a single, empty string (while +``'0c'`` means 0 characters). When packing a value ``x`` using one of the integer formats (``'b'``, ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 11:32:24 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 11:32:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2=2E?= Message-ID: http://hg.python.org/cpython/rev/4d5c2843c71e changeset: 71383:4d5c2843c71e branch: 2.7 parent: 71381:60ce5f279a5e user: Senthil Kumaran date: Sun Jul 17 17:31:51 2011 +0800 summary: merge from 3.2. files: Doc/library/struct.rst | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -257,10 +257,11 @@ For the ``'s'`` format character, the count is interpreted as the size of the string, not a repeat count like for the other format characters; for example, ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters. -For packing, the string is truncated or padded with null bytes as appropriate to -make it fit. For unpacking, the resulting string always has exactly the -specified number of bytes. As a special case, ``'0s'`` means a single, empty -string (while ``'0c'`` means 0 characters). +If a count is not given, it defaults to 1. For packing, the string is +truncated or padded with null bytes as appropriate to make it fit. For +unpacking, the resulting string always has exactly the specified number of +bytes. As a special case, ``'0s'`` means a single, empty string (while +``'0c'`` means 0 characters). The ``'p'`` format character encodes a "Pascal string", meaning a short variable-length string stored in a *fixed number of bytes*, given by the count. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 11:32:25 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 11:32:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/74e7c838b4a8 changeset: 71384:74e7c838b4a8 parent: 71380:6446fc0a0a99 parent: 71382:90cdf403132e user: Senthil Kumaran date: Sun Jul 17 17:32:06 2011 +0800 summary: merge from 3.2 files: Doc/library/struct.rst | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -240,10 +240,11 @@ For the ``'s'`` format character, the count is interpreted as the length of the bytes, not a repeat count like for the other format characters; for example, ``'10s'`` means a single 10-byte string, while ``'10c'`` means 10 characters. -For packing, the string is truncated or padded with null bytes as appropriate to -make it fit. For unpacking, the resulting bytes object always has exactly the -specified number of bytes. As a special case, ``'0s'`` means a single, empty -string (while ``'0c'`` means 0 characters). +If a count is not given, it defaults to 1. For packing, the string is +truncated or padded with null bytes as appropriate to make it fit. For +unpacking, the resulting bytes object always has exactly the specified number +of bytes. As a special case, ``'0s'`` means a single, empty string (while +``'0c'`` means 0 characters). When packing a value ``x`` using one of the integer formats (``'b'``, ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 13:06:18 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 13:06:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_Issue10403_?= =?utf8?q?-_datetime_documentation_clarification_based_on_review_in_the?= Message-ID: http://hg.python.org/cpython/rev/05f0ffe4e0b3 changeset: 71385:05f0ffe4e0b3 branch: 3.2 parent: 71382:90cdf403132e user: Senthil Kumaran date: Sun Jul 17 19:01:14 2011 +0800 summary: Fix Issue10403 - datetime documentation clarification based on review in the reitveld by Alexendar belopolsky. files: Doc/library/datetime.rst | 38 ++++++++++++++------------- 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -25,8 +25,8 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information attribute, :attr:`tzinfo`, that can contain -an instance of a subclass of the abstract :class:`tzinfo` class. These +have an optional time zone information attribute, :attr:`tzinfo`, that can be +set to an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only one concrete :class:`tzinfo` class, the :class:`timezone` class, is supplied by the @@ -732,11 +732,13 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date attributes are equal to the - given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are - equal to the given :class:`time` object's. For any :class:`datetime` object - *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a - :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. + Return a new :class:`datetime` object whose date components are equal to the + given :class:`date` object's, and whose time components and :attr:`tzinfo` + attributes are equal to the given :class:`time` object's. For any + :class:`datetime` object *d*, + ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time components and :attr:`tzinfo` attributes + are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -908,13 +910,13 @@ Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive datetime from an aware - datetime with no conversion of date and time attributes. + datetime with no conversion of date and time data. .. method:: datetime.astimezone(tz) Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, - adjusting the date and time attributes so the result is the same UTC time as + adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its @@ -923,18 +925,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time attributes is performed. Else the result is local + adjustment of date or time data is performed. Else the result is local time in time zone *tz*, representing the same UTC time as *self*: after ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have - the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + the same date and time data as ``dt - dt.utcoffset()``. The discussion of class :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries where this cannot be achieved (an issue only if *tz* models both standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. + conversion of date and time data, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1270,7 +1272,7 @@ Return a :class:`time` with the same value, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive :class:`time` from an - aware :class:`time`, without conversion of the time attributes. + aware :class:`time`, without conversion of the time data. .. method:: time.isoformat() @@ -1477,10 +1479,10 @@ .. method:: tzinfo.fromutc(dt) - This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time - attributes are to be viewed as expressing a UTC time. The purpose of - :meth:`fromutc` is to adjust the date and time attributes, returning an + This is called from the default :class:`datetime.astimezone()` + implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s + date and time data are to be viewed as expressing a UTC time. The purpose + of :meth:`fromutc` is to adjust the date and time data, returning an equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 13:06:19 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 13:06:19 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/dca12bc78326 changeset: 71386:dca12bc78326 parent: 71384:74e7c838b4a8 parent: 71385:05f0ffe4e0b3 user: Senthil Kumaran date: Sun Jul 17 19:06:03 2011 +0800 summary: merge from 3.2 files: Doc/library/datetime.rst | 38 ++++++++++++++------------- 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -25,8 +25,8 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information attribute, :attr:`tzinfo`, that can contain -an instance of a subclass of the abstract :class:`tzinfo` class. These +have an optional time zone information attribute, :attr:`tzinfo`, that can be +set to an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that only one concrete :class:`tzinfo` class, the :class:`timezone` class, is supplied by the @@ -748,11 +748,13 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date attributes are equal to the - given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are - equal to the given :class:`time` object's. For any :class:`datetime` object - *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a - :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. + Return a new :class:`datetime` object whose date components are equal to the + given :class:`date` object's, and whose time components and :attr:`tzinfo` + attributes are equal to the given :class:`time` object's. For any + :class:`datetime` object *d*, + ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time components and :attr:`tzinfo` attributes + are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -924,13 +926,13 @@ Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive datetime from an aware - datetime with no conversion of date and time attributes. + datetime with no conversion of date and time data. .. method:: datetime.astimezone(tz) Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, - adjusting the date and time attributes so the result is the same UTC time as + adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its @@ -939,18 +941,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time attributes is performed. Else the result is local + adjustment of date or time data is performed. Else the result is local time in time zone *tz*, representing the same UTC time as *self*: after ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have - the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + the same date and time data as ``dt - dt.utcoffset()``. The discussion of class :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries where this cannot be achieved (an issue only if *tz* models both standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. + conversion of date and time data, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1286,7 +1288,7 @@ Return a :class:`time` with the same value, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive :class:`time` from an - aware :class:`time`, without conversion of the time attributes. + aware :class:`time`, without conversion of the time data. .. method:: time.isoformat() @@ -1493,10 +1495,10 @@ .. method:: tzinfo.fromutc(dt) - This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time - attributes are to be viewed as expressing a UTC time. The purpose of - :meth:`fromutc` is to adjust the date and time attributes, returning an + This is called from the default :class:`datetime.astimezone()` + implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s + date and time data are to be viewed as expressing a UTC time. The purpose + of :meth:`fromutc` is to adjust the date and time data, returning an equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 17 13:10:31 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 17 Jul 2011 13:10:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Issue10403__-_datetime_module_documentation_changes_based_on?= Message-ID: http://hg.python.org/cpython/rev/3935a1fb1db2 changeset: 71387:3935a1fb1db2 branch: 2.7 parent: 71383:4d5c2843c71e user: Senthil Kumaran date: Sun Jul 17 19:10:10 2011 +0800 summary: merge from 3.2 - Issue10403 - datetime module documentation changes based on review. files: Doc/library/datetime.rst | 38 ++++++++++++++------------- 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -27,8 +27,8 @@ work with, at the cost of ignoring some aspects of reality. For applications requiring more, :class:`datetime` and :class:`time` objects -have an optional time zone information attribute, :attr:`tzinfo`, that can contain -an instance of a subclass of the abstract :class:`tzinfo` class. These +have an optional time zone information attribute, :attr:`tzinfo`, that can be +set to an instance of a subclass of the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that no concrete :class:`tzinfo` classes are supplied by the :mod:`datetime` module. @@ -696,11 +696,13 @@ .. classmethod:: datetime.combine(date, time) - Return a new :class:`datetime` object whose date attributes are equal to the - given :class:`date` object's, and whose time and :attr:`tzinfo` attributes are - equal to the given :class:`time` object's. For any :class:`datetime` object - *d*, ``d == datetime.combine(d.date(), d.timetz())``. If date is a - :class:`datetime` object, its time and :attr:`tzinfo` attributes are ignored. + Return a new :class:`datetime` object whose date components are equal to the + given :class:`date` object's, and whose time components and :attr:`tzinfo` + attributes are equal to the given :class:`time` object's. For any + :class:`datetime` object *d*, + ``d == datetime.combine(d.date(), d.timetz())``. If date is a + :class:`datetime` object, its time components and :attr:`tzinfo` attributes + are ignored. .. classmethod:: datetime.strptime(date_string, format) @@ -873,13 +875,13 @@ Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive datetime from an aware - datetime with no conversion of date and time attributes. + datetime with no conversion of date and time data. .. method:: datetime.astimezone(tz) Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, - adjusting the date and time attributes so the result is the same UTC time as + adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*'s local time. *tz* must be an instance of a :class:`tzinfo` subclass, and its @@ -888,18 +890,18 @@ not return ``None``). If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no - adjustment of date or time attributes is performed. Else the result is local + adjustment of date or time data is performed. Else the result is local time in time zone *tz*, representing the same UTC time as *self*: after ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will usually have - the same date and time attributes as ``dt - dt.utcoffset()``. The discussion + the same date and time data as ``dt - dt.utcoffset()``. The discussion of class :class:`tzinfo` explains the cases at Daylight Saving Time transition boundaries where this cannot be achieved (an issue only if *tz* models both standard and daylight time). If you merely want to attach a time zone object *tz* to a datetime *dt* without - adjustment of date and time attributes, use ``dt.replace(tzinfo=tz)``. If you + adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime *dt* without - conversion of date and time attributes, use ``dt.replace(tzinfo=None)``. + conversion of date and time data, use ``dt.replace(tzinfo=None)``. Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. @@ -1235,7 +1237,7 @@ Return a :class:`time` with the same value, except for those attributes given new values by whichever keyword arguments are specified. Note that ``tzinfo=None`` can be specified to create a naive :class:`time` from an - aware :class:`time`, without conversion of the time attributes. + aware :class:`time`, without conversion of the time data. .. method:: time.isoformat() @@ -1440,10 +1442,10 @@ .. method:: tzinfo.fromutc(self, dt) - This is called from the default :class:`datetime.astimezone()` implementation. - When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time - attributes are to be viewed as expressing a UTC time. The purpose of - :meth:`fromutc` is to adjust the date and time attributes, returning an + This is called from the default :class:`datetime.astimezone()` + implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s + date and time data are to be viewed as expressing a UTC time. The purpose + of :meth:`fromutc` is to adjust the date and time data, returning an equivalent datetime in *self*'s local time. Most :class:`tzinfo` subclasses should be able to inherit the default -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 00:44:37 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 00:44:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_Issu?= =?utf8?q?e12479_-_Add_HTTPErrorProcessor_class_definition_-_Patch_by?= Message-ID: http://hg.python.org/cpython/rev/8d64d47569cb changeset: 71388:8d64d47569cb branch: 3.2 parent: 71385:05f0ffe4e0b3 user: Senthil Kumaran date: Mon Jul 18 06:42:46 2011 +0800 summary: Fix closes Issue12479 - Add HTTPErrorProcessor class definition - Patch by Sandro Tosi files: Doc/library/urllib.request.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -313,6 +313,11 @@ A catch-all class to handle unknown URLs. +.. class:: HTTPErrorProcessor() + + Process HTTP error responses. + + .. _request-objects: Request Objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 00:44:38 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 00:44:38 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_closes_Issue12479_-_Add_HTTPErrorProc?= =?utf8?q?essor_class?= Message-ID: http://hg.python.org/cpython/rev/b2125a6deb96 changeset: 71389:b2125a6deb96 parent: 71386:dca12bc78326 parent: 71388:8d64d47569cb user: Senthil Kumaran date: Mon Jul 18 06:43:25 2011 +0800 summary: merge from 3.2 - Fix closes Issue12479 - Add HTTPErrorProcessor class definition - Patch by Sandro Tosi files: Doc/library/urllib.request.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -323,6 +323,11 @@ A catch-all class to handle unknown URLs. +.. class:: HTTPErrorProcessor() + + Process HTTP error responses. + + .. _request-objects: Request Objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 00:44:39 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 00:44:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Fix_closes_Issue12479_-_Add_HTTPErrorProcessor_class?= Message-ID: http://hg.python.org/cpython/rev/b9ae6be1874d changeset: 71390:b9ae6be1874d branch: 2.7 parent: 71387:3935a1fb1db2 user: Senthil Kumaran date: Mon Jul 18 06:44:11 2011 +0800 summary: merge from 3.2 - Fix closes Issue12479 - Add HTTPErrorProcessor class definition - Patch by Sandro Tosi files: Doc/library/urllib2.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -297,6 +297,11 @@ A catch-all class to handle unknown URLs. +.. class:: HTTPErrorProcessor() + + Process HTTP error responses. + + .. _request-objects: Request Objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:11 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:11 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_Issu?= =?utf8?q?e12478_-_HTTPErrorProcess_=27s_methods_are_http=5Fresponse_and?= Message-ID: http://hg.python.org/cpython/rev/70983e8b114a changeset: 71391:70983e8b114a branch: 3.2 parent: 71388:8d64d47569cb user: Senthil Kumaran date: Mon Jul 18 07:12:40 2011 +0800 summary: Fix closes Issue12478 - HTTPErrorProcess 's methods are http_response and https_response. files: Doc/library/urllib.request.rst | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -921,7 +921,7 @@ HTTPErrorProcessor Objects -------------------------- -.. method:: HTTPErrorProcessor.unknown_open() +.. method:: HTTPErrorProcessor.http_response() Process HTTP error responses. @@ -933,6 +933,13 @@ :exc:`HTTPError` if no other handler handles the error. +.. method:: HTTPErrorProcessor.https_response() + + Process HTTPS error responses. + + The behavior is same as :meth:`http_response`. + + .. _urllib-request-examples: Examples -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:11 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:11 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_closes_Issue12478_-_HTTPErrorProcess_?= =?utf8?q?=27s_methods_are?= Message-ID: http://hg.python.org/cpython/rev/04541e33364d changeset: 71392:04541e33364d parent: 71389:b2125a6deb96 parent: 71391:70983e8b114a user: Senthil Kumaran date: Mon Jul 18 07:13:21 2011 +0800 summary: merge from 3.2 - Fix closes Issue12478 - HTTPErrorProcess 's methods are http_response and https_response. files: Doc/library/urllib.request.rst | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -931,7 +931,7 @@ HTTPErrorProcessor Objects -------------------------- -.. method:: HTTPErrorProcessor.unknown_open() +.. method:: HTTPErrorProcessor.http_response() Process HTTP error responses. @@ -943,6 +943,13 @@ :exc:`HTTPError` if no other handler handles the error. +.. method:: HTTPErrorProcessor.https_response() + + Process HTTPS error responses. + + The behavior is same as :meth:`http_response`. + + .. _urllib-request-examples: Examples -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:12 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:12 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Fix_closes_Issue12478_-_HTTPErrorProcess_=27s_methods_are?= Message-ID: http://hg.python.org/cpython/rev/edf238312baa changeset: 71393:edf238312baa branch: 2.7 parent: 71390:b9ae6be1874d user: Senthil Kumaran date: Mon Jul 18 07:16:02 2011 +0800 summary: merge from 3.2 - Fix closes Issue12478 - HTTPErrorProcess 's methods are http_response and https_response. files: Doc/library/urllib2.rst | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -886,7 +886,7 @@ .. versionadded:: 2.4 -.. method:: HTTPErrorProcessor.unknown_open() +.. method:: HTTPErrorProcessor.http_response() Process HTTP error responses. @@ -898,6 +898,12 @@ :class:`urllib2.HTTPDefaultErrorHandler` will raise an :exc:`HTTPError` if no other handler handles the error. +.. method:: HTTPErrorProcessor.https_response() + + Process HTTPS error responses. + + The behavior is same as :meth:`http_response`. + .. _urllib2-examples: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:13 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_fix_whitespace_?= =?utf8?q?nit=2E?= Message-ID: http://hg.python.org/cpython/rev/53a69930f605 changeset: 71394:53a69930f605 branch: 3.2 parent: 71391:70983e8b114a user: Senthil Kumaran date: Mon Jul 18 07:17:20 2011 +0800 summary: fix whitespace nit. files: Doc/library/urllib.request.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -935,8 +935,8 @@ .. method:: HTTPErrorProcessor.https_response() - Process HTTPS error responses. - + Process HTTPS error responses. + The behavior is same as :meth:`http_response`. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:13 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:13 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_fix_whitespace_in_rst=2E?= Message-ID: http://hg.python.org/cpython/rev/3cd88ae348db changeset: 71395:3cd88ae348db parent: 71392:04541e33364d parent: 71394:53a69930f605 user: Senthil Kumaran date: Mon Jul 18 07:18:11 2011 +0800 summary: fix whitespace in rst. files: Doc/library/urllib.request.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -945,8 +945,8 @@ .. method:: HTTPErrorProcessor.https_response() - Process HTTPS error responses. - + Process HTTPS error responses. + The behavior is same as :meth:`http_response`. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:19:14 2011 From: python-checkins at python.org (senthil.kumaran) Date: Mon, 18 Jul 2011 01:19:14 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_fix_whitespace_?= =?utf8?q?in_rst=2E?= Message-ID: http://hg.python.org/cpython/rev/3aff0a3419a3 changeset: 71396:3aff0a3419a3 branch: 2.7 parent: 71393:edf238312baa user: Senthil Kumaran date: Mon Jul 18 07:18:40 2011 +0800 summary: fix whitespace in rst. files: Doc/library/urllib2.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -900,8 +900,8 @@ .. method:: HTTPErrorProcessor.https_response() - Process HTTPS error responses. - + Process HTTPS error responses. + The behavior is same as :meth:`http_response`. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:26:10 2011 From: python-checkins at python.org (alex.gaynor) Date: Mon, 18 Jul 2011 01:26:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Mark_itertools_tests_of_tup?= =?utf8?q?le_reuse_as_being_specific_to_CPython=2E?= Message-ID: http://hg.python.org/cpython/rev/2eb8789e30e7 changeset: 71397:2eb8789e30e7 parent: 71389:b2125a6deb96 user: Alex Gaynor date: Sun Jul 17 16:21:30 2011 -0700 summary: Mark itertools tests of tuple reuse as being specific to CPython. files: Lib/test/test_itertools.py | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -168,7 +168,8 @@ self.assertEqual(result, list(combinations2(values, r))) # matches second pure python version self.assertEqual(result, list(combinations3(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_tuple_reuse(self): self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 1) @@ -238,7 +239,9 @@ self.assertEqual(result, list(cwr1(values, r))) # matches first pure python version self.assertEqual(result, list(cwr2(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_with_replacement_tuple_reuse(self): + cwr = combinations_with_replacement self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1) @@ -302,7 +305,8 @@ self.assertEqual(result, list(permutations(values, None))) # test r as None self.assertEqual(result, list(permutations(values))) # test default r - # Test implementation detail: tuple re-use + @support.impl_detail("tuple resuse is CPython specific") + def test_permutations_tuple_reuse(self): self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1) @@ -566,11 +570,13 @@ self.assertEqual(list(zip()), lzip()) self.assertRaises(TypeError, zip, 3) self.assertRaises(TypeError, zip, range(3), 3) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in zip('abc', 'def')], lzip('abc', 'def')) self.assertEqual([pair for pair in zip('abc', 'def')], lzip('abc', 'def')) + + @support.impl_detail("tuple reuse is specific to CPython") + def test_zip_tuple_reuse(self): ids = list(map(id, zip('abc', 'def'))) self.assertEqual(min(ids), max(ids)) ids = list(map(id, list(zip('abc', 'def')))) @@ -613,11 +619,13 @@ else: self.fail('Did not raise Type in: ' + stmt) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in zip_longest('abc', 'def')], list(zip('abc', 'def'))) self.assertEqual([pair for pair in zip_longest('abc', 'def')], list(zip('abc', 'def'))) + + @support.impl_detail("tuple reuse is specific to CPython") + def test_zip_longest_tuple_reuse(self): ids = list(map(id, zip_longest('abc', 'def'))) self.assertEqual(min(ids), max(ids)) ids = list(map(id, list(zip_longest('abc', 'def')))) @@ -721,7 +729,8 @@ args = map(iter, args) self.assertEqual(len(list(product(*args))), expected_len) - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_product_tuple_reuse(self): self.assertEqual(len(set(map(id, product('abc', 'def')))), 1) self.assertNotEqual(len(set(map(id, list(product('abc', 'def'))))), 1) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:26:11 2011 From: python-checkins at python.org (alex.gaynor) Date: Mon, 18 Jul 2011 01:26:11 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merged_upstream=2E?= Message-ID: http://hg.python.org/cpython/rev/e5e8796b68b8 changeset: 71398:e5e8796b68b8 parent: 71397:2eb8789e30e7 parent: 71395:3cd88ae348db user: Alex Gaynor date: Sun Jul 17 16:22:05 2011 -0700 summary: Merged upstream. files: Doc/library/urllib.request.rst | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -931,7 +931,7 @@ HTTPErrorProcessor Objects -------------------------- -.. method:: HTTPErrorProcessor.unknown_open() +.. method:: HTTPErrorProcessor.http_response() Process HTTP error responses. @@ -943,6 +943,13 @@ :exc:`HTTPError` if no other handler handles the error. +.. method:: HTTPErrorProcessor.https_response() + + Process HTTPS error responses. + + The behavior is same as :meth:`http_response`. + + .. _urllib-request-examples: Examples -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 01:44:37 2011 From: python-checkins at python.org (alex.gaynor) Date: Mon, 18 Jul 2011 01:44:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Backport_2eb878?= =?utf8?q?9e30e7=2E?= Message-ID: http://hg.python.org/cpython/rev/5c8a84ab86f2 changeset: 71399:5c8a84ab86f2 branch: 2.7 parent: 71396:3aff0a3419a3 user: Alex Gaynor date: Sun Jul 17 16:44:31 2011 -0700 summary: Backport 2eb8789e30e7. files: Lib/test/test_itertools.py | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -137,7 +137,8 @@ self.assertEqual(result, list(combinations2(values, r))) # matches second pure python version self.assertEqual(result, list(combinations3(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @test_support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_tuple_reuse(self): self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 1) @@ -207,7 +208,9 @@ self.assertEqual(result, list(cwr1(values, r))) # matches first pure python version self.assertEqual(result, list(cwr2(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @test_support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_with_replacement_tuple_reuse(self): + cwr = combinations_with_replacement self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1) @@ -271,7 +274,8 @@ self.assertEqual(result, list(permutations(values, None))) # test r as None self.assertEqual(result, list(permutations(values))) # test default r - # Test implementation detail: tuple re-use + @test_support.impl_detail("tuple resuse is CPython specific") + def test_permutations_tuple_reuse(self): self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1) @@ -526,11 +530,13 @@ self.assertEqual(list(izip()), zip()) self.assertRaises(TypeError, izip, 3) self.assertRaises(TypeError, izip, range(3), 3) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in izip('abc', 'def')], zip('abc', 'def')) self.assertEqual([pair for pair in izip('abc', 'def')], zip('abc', 'def')) + + @test_support.impl_detail("tuple reuse is specific to CPython") + def test_izip_tuple_resuse(self): ids = map(id, izip('abc', 'def')) self.assertEqual(min(ids), max(ids)) ids = map(id, list(izip('abc', 'def'))) @@ -575,11 +581,13 @@ else: self.fail('Did not raise Type in: ' + stmt) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in izip_longest('abc', 'def')], zip('abc', 'def')) self.assertEqual([pair for pair in izip_longest('abc', 'def')], zip('abc', 'def')) + + @test_support.impl_detail("tuple reuse is specific to CPython") + def test_izip_longest_tuple_reuse(self): ids = map(id, izip_longest('abc', 'def')) self.assertEqual(min(ids), max(ids)) ids = map(id, list(izip_longest('abc', 'def'))) @@ -683,7 +691,8 @@ args = map(iter, args) self.assertEqual(len(list(product(*args))), expected_len) - # Test implementation detail: tuple re-use + @test_support.impl_detail("tuple reuse is specific to CPython") + def test_product_tuple_reuse(self): self.assertEqual(len(set(map(id, product('abc', 'def')))), 1) self.assertNotEqual(len(set(map(id, list(product('abc', 'def'))))), 1) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 02:18:13 2011 From: python-checkins at python.org (brett.cannon) Date: Mon, 18 Jul 2011 02:18:13 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Update_to_remove_the_100=25_br?= =?utf8?q?anch_coverage_requirement_to_simply_say?= Message-ID: http://hg.python.org/peps/rev/8cf77317ebb1 changeset: 3900:8cf77317ebb1 user: Brett Cannon date: Sun Jul 17 17:18:06 2011 -0700 summary: Update to remove the 100% branch coverage requirement to simply say comprehensive coverage is needed. Also mention how more abstract C APIs should be used over type-specific ones to make sure APIs in C code do not restrict to a specific type when not needed. files: pep-0399.txt | 87 ++++++++++----------------------------- 1 files changed, 23 insertions(+), 64 deletions(-) diff --git a/pep-0399.txt b/pep-0399.txt --- a/pep-0399.txt +++ b/pep-0399.txt @@ -8,7 +8,7 @@ Content-Type: text/x-rst Created: 04-Apr-2011 Python-Version: 3.3 -Post-History: 04-Apr-2011, 12-Apr-2011 +Post-History: 04-Apr-2011, 12-Apr-2011, 17-Jul-2011 Abstract ======== @@ -17,28 +17,28 @@ of modules implemented in both pure Python and C (either entirely or partially). This PEP requires that in these instances that the C code *must* pass the test suite used for the pure Python code -so as to act as much as a drop-in replacement as possible +so as to act as much as a drop-in replacement as reasonably possible (C- and VM-specific tests are exempt). It is also required that new C-based modules lacking a pure Python equivalent implementation get -special permissions to be added to the standard library. +special permission to be added to the standard library. Rationale ========= Python has grown beyond the CPython virtual machine (VM). IronPython_, -Jython_, and PyPy_ all currently being viable alternatives to the -CPython VM. This VM ecosystem that has sprung up around the Python +Jython_, and PyPy_ are all currently viable alternatives to the +CPython VM. The VM ecosystem that has sprung up around the Python programming language has led to Python being used in many different areas where CPython cannot be used, e.g., Jython allowing Python to be used in Java applications. A problem all of the VMs other than CPython face is handling modules from the standard library that are implemented (to some extent) in C. -Since they do not typically support the entire `C API of CPython`_ +Since other VMs do not typically support the entire `C API of CPython`_ they are unable to use the code used to create the module. Often times this leads these other VMs to either re-implement the modules in pure -Python or in the programming language used to implement the VM +Python or in the programming language used to implement the VM itself (e.g., in C# for IronPython). This duplication of effort between CPython, PyPy, Jython, and IronPython is extremely unfortunate as implementing a module *at least* in pure Python would help mitigate @@ -56,45 +56,8 @@ of CPython) is still allowed for performance reasons, but any such accelerated code must pass the same test suite (sans VM- or C-specific tests) to verify semantics and prevent divergence. To accomplish this, -the test suite for the module must have 100% branch coverage of the +the test suite for the module must have comprehensive coverage of the pure Python implementation before the acceleration code may be added. -This is to prevent users from accidentally relying -on semantics that are specific to the C code and are not reflected in -the pure Python implementation that other VMs rely upon. For example, -in CPython 3.2.0, ``heapq.heappop()`` does an explicit type -check in its accelerated C code while the Python code uses duck -typing:: - - from test.support import import_fresh_module - - c_heapq = import_fresh_module('heapq', fresh=['_heapq']) - py_heapq = import_fresh_module('heapq', blocked=['_heapq']) - - - class Spam: - """Tester class which defines no other magic methods but - __len__().""" - def __len__(self): - return 0 - - - try: - c_heapq.heappop(Spam()) - except TypeError: - # Explicit type check failure: "heap argument must be a list" - pass - - try: - py_heapq.heappop(Spam()) - except AttributeError: - # Duck typing failure: "'Foo' object has no attribute 'pop'" - pass - -This kind of divergence is a problem for users as they unwittingly -write code that is CPython-specific. This is also an issue for other -VM teams as they have to deal with bug reports from users thinking -that they incorrectly implemented the module when in fact it was -caused by an untested case. Details @@ -128,13 +91,8 @@ if people do volunteer to provide and maintain a pure Python equivalent (e.g., the PyPy team volunteering their pure Python implementation of the ``csv`` module and maintaining it) then such -code will be accepted. - -This requirement does not apply to modules already existing as only C -code in the standard library. It is acceptable to retroactively add a -pure Python implementation of a module implemented entirely in C, but -in those instances the C version is considered the reference -implementation in terms of expected semantics. +code will be accepted. In those instances the C version is considered +the reference implementation in terms of expected semantics. Any new accelerated code must act as a drop-in replacement as close to the pure Python implementation as reasonable. Technical details of @@ -143,16 +101,8 @@ verify that the Python and equivalent C code operate as similarly as possible, both code bases must be tested using the same tests which apply to the pure Python code (tests specific to the C code or any VM -do not follow under this requirement). To make sure that the test -suite is thorough enough to cover all relevant semantics, the tests -must have 100% branch coverage for the Python code being replaced by -C code. This will make sure that the new acceleration code will -operate as much like a drop-in replacement for the Python code is as -possible. Testing should still be done for issues that come up when -working with C code even if it is not explicitly required to meet the -coverage requirement, e.g., Tests should be aware that C code typically -has special paths for things such as built-in types, subclasses of -built-in types, etc. +do not follow under this requirement). The test suite is expected to +be extensive in order to verify expected semantics. Acting as a drop-in replacement also dictates that no public API be provided in accelerated code that does not exist in the pure Python @@ -214,13 +164,22 @@ test_main() -If this test were to provide 100% branch coverage for +If this test were to provide extensive coverage for ``heapq.heappop()`` in the pure Python implementation then the accelerated C code would be allowed to be added to CPython's standard library. If it did not, then the test suite would need to be updated -until 100% branch coverage was provided before the accelerated C code +until proper coverage was provided before the accelerated C code could be added. +To also help with compatibility, C code should use abstract APIs on +objects to prevent accidental dependence on specific types. For +instance, if a function accepts a sequence then the C code should +default to using `PyObject_GetItem()` instead of something like +`PyList_GetItem()`. C code is allowed to have a fast path if the +proper `PyList_Check()` is used, but otherwise APIs should work with +any object that duck types to the proper interface instead of a +specific type. + Copyright ========= -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Mon Jul 18 04:18:04 2011 From: python-checkins at python.org (brett.cannon) Date: Mon, 18 Jul 2011 04:18:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Make_warnings_accept_a_call?= =?utf8?q?able_for_showwarnings_instead_of?= Message-ID: http://hg.python.org/cpython/rev/aaced3dcb858 changeset: 71400:aaced3dcb858 parent: 71398:e5e8796b68b8 user: Brett Cannon date: Sun Jul 17 19:17:55 2011 -0700 summary: Make warnings accept a callable for showwarnings instead of restricting itself to just functions and methods (which allows built-in functions to be used, etc.). Closes issue #10271. Thanks to lekma for the bug report. files: Lib/test/test_warnings.py | 14 ++++++++------ Python/_warnings.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -512,12 +512,11 @@ def test_showwarning_not_callable(self): with original_warnings.catch_warnings(module=self.module): self.module.filterwarnings("always", category=UserWarning) - old_showwarning = self.module.showwarning + self.module.showwarning = print + with support.captured_output('stdout'): + self.module.warn('Warning!') self.module.showwarning = 23 - try: - self.assertRaises(TypeError, self.module.warn, "Warning!") - finally: - self.module.showwarning = old_showwarning + self.assertRaises(TypeError, self.module.warn, "Warning!") def test_show_warning_output(self): # With showarning() missing, make sure that output is okay. @@ -547,10 +546,13 @@ globals_dict = globals() oldfile = globals_dict['__file__'] try: - with original_warnings.catch_warnings(module=self.module) as w: + catch = original_warnings.catch_warnings(record=True, + module=self.module) + with catch as w: self.module.filterwarnings("always", category=UserWarning) globals_dict['__file__'] = None original_warnings.warn('test', UserWarning) + self.assertTrue(len(w)) finally: globals_dict['__file__'] = oldfile diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -409,10 +409,10 @@ else { PyObject *res; - if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) { + if (!PyCallable_Check(show_fxn)) { PyErr_SetString(PyExc_TypeError, "warnings.showwarning() must be set to a " - "function or method"); + "callable"); Py_DECREF(show_fxn); goto cleanup; } -- Repository URL: http://hg.python.org/cpython From brett at python.org Mon Jul 18 04:21:12 2011 From: brett at python.org (Brett Cannon) Date: Sun, 17 Jul 2011 19:21:12 -0700 Subject: [Python-checkins] cpython: Make warnings accept a callable for showwarnings instead of In-Reply-To: References: Message-ID: Just realized I missed the Misc/NEWS entry, so I'm on it. And I also realized I am sneaking in a minor tweak to an unrelated test, but it was simply easier to do this than revert the change and do a separate commit. May the buildbots be kind to me. =) On Sun, Jul 17, 2011 at 19:18, brett.cannon wrote: > http://hg.python.org/cpython/rev/aaced3dcb858 > changeset: 71400:aaced3dcb858 > parent: 71398:e5e8796b68b8 > user: Brett Cannon > date: Sun Jul 17 19:17:55 2011 -0700 > summary: > Make warnings accept a callable for showwarnings instead of > restricting itself to just functions and methods (which allows > built-in functions to be used, etc.). > > Closes issue #10271. Thanks to lekma for the bug report. > > files: > Lib/test/test_warnings.py | 14 ++++++++------ > Python/_warnings.c | 4 ++-- > 2 files changed, 10 insertions(+), 8 deletions(-) > > > diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py > --- a/Lib/test/test_warnings.py > +++ b/Lib/test/test_warnings.py > @@ -512,12 +512,11 @@ > def test_showwarning_not_callable(self): > with original_warnings.catch_warnings(module=self.module): > self.module.filterwarnings("always", category=UserWarning) > - old_showwarning = self.module.showwarning > + self.module.showwarning = print > + with support.captured_output('stdout'): > + self.module.warn('Warning!') > self.module.showwarning = 23 > - try: > - self.assertRaises(TypeError, self.module.warn, "Warning!") > - finally: > - self.module.showwarning = old_showwarning > + self.assertRaises(TypeError, self.module.warn, "Warning!") > > def test_show_warning_output(self): > # With showarning() missing, make sure that output is okay. > @@ -547,10 +546,13 @@ > globals_dict = globals() > oldfile = globals_dict['__file__'] > try: > - with original_warnings.catch_warnings(module=self.module) as > w: > + catch = original_warnings.catch_warnings(record=True, > + module=self.module) > + with catch as w: > self.module.filterwarnings("always", category=UserWarning) > globals_dict['__file__'] = None > original_warnings.warn('test', UserWarning) > + self.assertTrue(len(w)) > finally: > globals_dict['__file__'] = oldfile > > diff --git a/Python/_warnings.c b/Python/_warnings.c > --- a/Python/_warnings.c > +++ b/Python/_warnings.c > @@ -409,10 +409,10 @@ > else { > PyObject *res; > > - if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) > { > + if (!PyCallable_Check(show_fxn)) { > PyErr_SetString(PyExc_TypeError, > "warnings.showwarning() must be set to a " > - "function or method"); > + "callable"); > Py_DECREF(show_fxn); > goto cleanup; > } > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Mon Jul 18 04:25:59 2011 From: python-checkins at python.org (brett.cannon) Date: Mon, 18 Jul 2011 04:25:59 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_Misc/NEWS_entry_and_rel?= =?utf8?q?evant_doc_change_for_issue_10271=2E?= Message-ID: http://hg.python.org/cpython/rev/eaefb34fc3a1 changeset: 71401:eaefb34fc3a1 user: Brett Cannon date: Sun Jul 17 19:25:50 2011 -0700 summary: Add Misc/NEWS entry and relevant doc change for issue 10271. files: Doc/library/warnings.rst | 3 +-- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -339,8 +339,7 @@ Write a warning to a file. The default implementation calls ``formatwarning(message, category, filename, lineno, line)`` and writes the resulting string to *file*, which defaults to ``sys.stderr``. You may replace - this function with an alternative implementation by assigning to - ``warnings.showwarning``. + this function with any callable by assigning to ``warnings.showwarning``. *line* is a line of source code to be included in the warning message; if *line* is not supplied, :func:`showwarning` will try to read the line specified by *filename* and *lineno*. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #10271: Allow warnings.showwarning() be any callable. + - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jul 18 05:23:43 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 18 Jul 2011 05:23:43 +0200 Subject: [Python-checkins] Daily reference leaks (e5e8796b68b8): sum=24 Message-ID: results for e5e8796b68b8 on branch "default" -------------------------------------------- test_multiprocessing leaked [0, 24, 0] references, sum=24 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog5PPirE', '-x'] From python-checkins at python.org Mon Jul 18 05:45:17 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Jul 2011 05:45:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_excise_the_remains_of_STOP?= =?utf8?q?=5FCODE=2C_which_hasn=27t_done_anything_useful_for_years?= Message-ID: http://hg.python.org/cpython/rev/d30b54ffd5e8 changeset: 71402:d30b54ffd5e8 parent: 71386:dca12bc78326 user: Benjamin Peterson date: Sun Jul 17 22:49:50 2011 -0500 summary: excise the remains of STOP_CODE, which hasn't done anything useful for years files: Doc/library/dis.rst | 5 ----- Include/opcode.h | 1 - Lib/opcode.py | 1 - Lib/test/test_dis.py | 2 +- Python/ceval.c | 2 -- Python/makeopcodetargets.py | 3 --- 6 files changed, 1 insertions(+), 13 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -171,11 +171,6 @@ **General instructions** -.. opcode:: STOP_CODE - - Indicates end-of-code to the compiler, not used by the interpreter. - - .. opcode:: NOP Do nothing code. Used as a placeholder by the bytecode optimizer. diff --git a/Include/opcode.h b/Include/opcode.h --- a/Include/opcode.h +++ b/Include/opcode.h @@ -7,7 +7,6 @@ /* Instruction opcodes for compiled code */ -#define STOP_CODE 0 #define POP_TOP 1 #define ROT_TWO 2 #define ROT_THREE 3 diff --git a/Lib/opcode.py b/Lib/opcode.py --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -43,7 +43,6 @@ # Instruction opcodes for compiled code # Blank lines correspond to available opcodes -def_op('STOP_CODE', 0) def_op('POP_TOP', 1) def_op('ROT_TWO', 2) def_op('ROT_THREE', 3) diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -200,7 +200,7 @@ lines))) def test_opmap(self): - self.assertEqual(dis.opmap["STOP_CODE"], 0) + self.assertEqual(dis.opmap["NOP"], 9) self.assertIn(dis.opmap["LOAD_CONST"], dis.hasconst) self.assertIn(dis.opmap["STORE_NAME"], dis.hasname) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1347,8 +1347,6 @@ x to NULL, err to nonzero, or why to anything but WHY_NOT, and that no operation that succeeds does this! */ - /* case STOP_CODE: this is an error! */ - TARGET(NOP) FAST_DISPATCH(); diff --git a/Python/makeopcodetargets.py b/Python/makeopcodetargets.py --- a/Python/makeopcodetargets.py +++ b/Python/makeopcodetargets.py @@ -23,9 +23,6 @@ opcode = find_module("opcode") targets = ['_unknown_opcode'] * 256 for opname, op in opcode.opmap.items(): - if opname == "STOP_CODE": - # XXX opcode not implemented - continue targets[op] = "TARGET_%s" % opname f.write("static void *opcode_targets[256] = {\n") f.write(",\n".join([" &&%s" % s for s in targets])) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 05:45:17 2011 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 18 Jul 2011 05:45:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/7520f1bf0a81 changeset: 71403:7520f1bf0a81 parent: 71402:d30b54ffd5e8 parent: 71401:eaefb34fc3a1 user: Benjamin Peterson date: Sun Jul 17 22:50:12 2011 -0500 summary: merge heads files: Doc/library/urllib.request.rst | 14 +++++++++++++- Doc/library/warnings.rst | 3 +-- Lib/test/test_itertools.py | 21 +++++++++++++++------ Lib/test/test_warnings.py | 14 ++++++++------ Misc/NEWS | 2 ++ Python/_warnings.c | 4 ++-- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -323,6 +323,11 @@ A catch-all class to handle unknown URLs. +.. class:: HTTPErrorProcessor() + + Process HTTP error responses. + + .. _request-objects: Request Objects @@ -926,7 +931,7 @@ HTTPErrorProcessor Objects -------------------------- -.. method:: HTTPErrorProcessor.unknown_open() +.. method:: HTTPErrorProcessor.http_response() Process HTTP error responses. @@ -938,6 +943,13 @@ :exc:`HTTPError` if no other handler handles the error. +.. method:: HTTPErrorProcessor.https_response() + + Process HTTPS error responses. + + The behavior is same as :meth:`http_response`. + + .. _urllib-request-examples: Examples diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -339,8 +339,7 @@ Write a warning to a file. The default implementation calls ``formatwarning(message, category, filename, lineno, line)`` and writes the resulting string to *file*, which defaults to ``sys.stderr``. You may replace - this function with an alternative implementation by assigning to - ``warnings.showwarning``. + this function with any callable by assigning to ``warnings.showwarning``. *line* is a line of source code to be included in the warning message; if *line* is not supplied, :func:`showwarning` will try to read the line specified by *filename* and *lineno*. diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -168,7 +168,8 @@ self.assertEqual(result, list(combinations2(values, r))) # matches second pure python version self.assertEqual(result, list(combinations3(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_tuple_reuse(self): self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 1) @@ -238,7 +239,9 @@ self.assertEqual(result, list(cwr1(values, r))) # matches first pure python version self.assertEqual(result, list(cwr2(values, r))) # matches second pure python version - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_combinations_with_replacement_tuple_reuse(self): + cwr = combinations_with_replacement self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1) @@ -302,7 +305,8 @@ self.assertEqual(result, list(permutations(values, None))) # test r as None self.assertEqual(result, list(permutations(values))) # test default r - # Test implementation detail: tuple re-use + @support.impl_detail("tuple resuse is CPython specific") + def test_permutations_tuple_reuse(self): self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1) self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1) @@ -566,11 +570,13 @@ self.assertEqual(list(zip()), lzip()) self.assertRaises(TypeError, zip, 3) self.assertRaises(TypeError, zip, range(3), 3) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in zip('abc', 'def')], lzip('abc', 'def')) self.assertEqual([pair for pair in zip('abc', 'def')], lzip('abc', 'def')) + + @support.impl_detail("tuple reuse is specific to CPython") + def test_zip_tuple_reuse(self): ids = list(map(id, zip('abc', 'def'))) self.assertEqual(min(ids), max(ids)) ids = list(map(id, list(zip('abc', 'def')))) @@ -613,11 +619,13 @@ else: self.fail('Did not raise Type in: ' + stmt) - # Check tuple re-use (implementation detail) self.assertEqual([tuple(list(pair)) for pair in zip_longest('abc', 'def')], list(zip('abc', 'def'))) self.assertEqual([pair for pair in zip_longest('abc', 'def')], list(zip('abc', 'def'))) + + @support.impl_detail("tuple reuse is specific to CPython") + def test_zip_longest_tuple_reuse(self): ids = list(map(id, zip_longest('abc', 'def'))) self.assertEqual(min(ids), max(ids)) ids = list(map(id, list(zip_longest('abc', 'def')))) @@ -721,7 +729,8 @@ args = map(iter, args) self.assertEqual(len(list(product(*args))), expected_len) - # Test implementation detail: tuple re-use + @support.impl_detail("tuple reuse is specific to CPython") + def test_product_tuple_reuse(self): self.assertEqual(len(set(map(id, product('abc', 'def')))), 1) self.assertNotEqual(len(set(map(id, list(product('abc', 'def'))))), 1) diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -512,12 +512,11 @@ def test_showwarning_not_callable(self): with original_warnings.catch_warnings(module=self.module): self.module.filterwarnings("always", category=UserWarning) - old_showwarning = self.module.showwarning + self.module.showwarning = print + with support.captured_output('stdout'): + self.module.warn('Warning!') self.module.showwarning = 23 - try: - self.assertRaises(TypeError, self.module.warn, "Warning!") - finally: - self.module.showwarning = old_showwarning + self.assertRaises(TypeError, self.module.warn, "Warning!") def test_show_warning_output(self): # With showarning() missing, make sure that output is okay. @@ -547,10 +546,13 @@ globals_dict = globals() oldfile = globals_dict['__file__'] try: - with original_warnings.catch_warnings(module=self.module) as w: + catch = original_warnings.catch_warnings(record=True, + module=self.module) + with catch as w: self.module.filterwarnings("always", category=UserWarning) globals_dict['__file__'] = None original_warnings.warn('test', UserWarning) + self.assertTrue(len(w)) finally: globals_dict['__file__'] = oldfile diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #10271: Allow warnings.showwarning() be any callable. + - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -409,10 +409,10 @@ else { PyObject *res; - if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) { + if (!PyCallable_Check(show_fxn)) { PyErr_SetString(PyExc_TypeError, "warnings.showwarning() must be set to a " - "function or method"); + "callable"); Py_DECREF(show_fxn); goto cleanup; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 10:40:46 2011 From: python-checkins at python.org (georg.brandl) Date: Mon, 18 Jul 2011 10:40:46 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Add_missing_=22?= =?utf8?b?YSIu?= Message-ID: http://hg.python.org/cpython/rev/f8e7fe70c075 changeset: 71404:f8e7fe70c075 branch: 2.7 parent: 71399:5c8a84ab86f2 user: Georg Brandl date: Mon Jul 18 10:39:55 2011 +0200 summary: Add missing "a". files: Doc/howto/doanddont.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/doanddont.rst b/Doc/howto/doanddont.rst --- a/Doc/howto/doanddont.rst +++ b/Doc/howto/doanddont.rst @@ -113,7 +113,7 @@ This is a "don't" which is much weaker than the previous "don't"s but is still something you should not do if you don't have good reasons to do that. The -reason it is usually bad idea is because you suddenly have an object which lives +reason it is usually a bad idea is because you suddenly have an object which lives in two separate namespaces. When the binding in one namespace changes, the binding in the other will not, so there will be a discrepancy between them. This happens when, for example, one module is reloaded, or changes the definition of -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 18:40:17 2011 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Jul 2011 18:40:17 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Better_English?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/4d5a546b6186 changeset: 71405:4d5a546b6186 branch: 3.2 parent: 71394:53a69930f605 user: R David Murray date: Mon Jul 18 12:38:03 2011 -0400 summary: Better English. files: Doc/distutils/setupscript.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/setupscript.rst b/Doc/distutils/setupscript.rst --- a/Doc/distutils/setupscript.rst +++ b/Doc/distutils/setupscript.rst @@ -72,7 +72,7 @@ promising that the Distutils will find a file :file:`foo/__init__.py` (which might be spelled differently on your system, but you get the idea) relative to the directory where your setup script lives. If you break this promise, the -Distutils will issue a warning but still process the broken package anyways. +Distutils will issue a warning but still process the broken package anyway. If you use a different convention to lay out your source directory, that's no problem: you just have to supply the :option:`package_dir` option to tell the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 18:40:18 2011 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Jul 2011 18:40:18 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_English_fix=2E?= Message-ID: http://hg.python.org/cpython/rev/ce1068d7bd17 changeset: 71406:ce1068d7bd17 parent: 71403:7520f1bf0a81 parent: 71405:4d5a546b6186 user: R David Murray date: Mon Jul 18 12:38:48 2011 -0400 summary: Merge English fix. files: Doc/distutils/setupscript.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/setupscript.rst b/Doc/distutils/setupscript.rst --- a/Doc/distutils/setupscript.rst +++ b/Doc/distutils/setupscript.rst @@ -72,7 +72,7 @@ promising that the Distutils will find a file :file:`foo/__init__.py` (which might be spelled differently on your system, but you get the idea) relative to the directory where your setup script lives. If you break this promise, the -Distutils will issue a warning but still process the broken package anyways. +Distutils will issue a warning but still process the broken package anyway. If you use a different convention to lay out your source directory, that's no problem: you just have to supply the :option:`package_dir` option to tell the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 18:40:20 2011 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Jul 2011 18:40:20 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_English_in_packaging=2C?= =?utf8?q?_too=2E?= Message-ID: http://hg.python.org/cpython/rev/375c99d53058 changeset: 71407:375c99d53058 user: R David Murray date: Mon Jul 18 12:39:18 2011 -0400 summary: Fix English in packaging, too. files: Doc/packaging/setupscript.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/packaging/setupscript.rst b/Doc/packaging/setupscript.rst --- a/Doc/packaging/setupscript.rst +++ b/Doc/packaging/setupscript.rst @@ -70,7 +70,7 @@ promising that the Distutils will find a file :file:`foo/__init__.py` (which might be spelled differently on your system, but you get the idea) relative to the directory where your setup script lives. If you break this promise, the -Distutils will issue a warning but still process the broken package anyways. +Distutils will issue a warning but still process the broken package anyway. If you use a different convention to lay out your source directory, that's no problem: you just have to supply the :option:`package_dir` option to tell the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 18:40:21 2011 From: python-checkins at python.org (r.david.murray) Date: Mon, 18 Jul 2011 18:40:21 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Better_English?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/5c7520e02d5a changeset: 71408:5c7520e02d5a branch: 2.7 parent: 71404:f8e7fe70c075 user: R David Murray date: Mon Jul 18 12:39:54 2011 -0400 summary: Better English. files: Doc/distutils/setupscript.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/setupscript.rst b/Doc/distutils/setupscript.rst --- a/Doc/distutils/setupscript.rst +++ b/Doc/distutils/setupscript.rst @@ -72,7 +72,7 @@ promising that the Distutils will find a file :file:`foo/__init__.py` (which might be spelled differently on your system, but you get the idea) relative to the directory where your setup script lives. If you break this promise, the -Distutils will issue a warning but still process the broken package anyways. +Distutils will issue a warning but still process the broken package anyway. If you use a different convention to lay out your source directory, that's no problem: you just have to supply the :option:`package_dir` option to tell the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 20:03:52 2011 From: python-checkins at python.org (eric.smith) Date: Mon, 18 Jul 2011 20:03:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2312579?= =?utf8?q?=2E_Positional_fields_with_str=2Eformat=5Fmap=28=29_now_raise_a_?= =?utf8?q?ValueError?= Message-ID: http://hg.python.org/cpython/rev/f6d074a7bbd4 changeset: 71409:f6d074a7bbd4 branch: 3.2 parent: 71405:4d5a546b6186 user: Eric V. Smith date: Mon Jul 18 14:03:41 2011 -0400 summary: Closes #12579. Positional fields with str.format_map() now raise a ValueError instead of SystemError. files: Lib/test/test_unicode.py | 5 +++++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ Objects/stringlib/string_format.h | 10 ++++++++++ 4 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -736,6 +736,11 @@ self.assertRaises(TypeError, '{a'.format_map) self.assertRaises(TypeError, '}a'.format_map) + # issue #12579: can't supply positional params to format_map + self.assertRaises(ValueError, '{}'.format_map, {'a' : 2}) + self.assertRaises(ValueError, '{}'.format_map, 'a') + self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1}) + def test_format_auto_numbering(self): class C: def __init__(self, x=100): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -78,6 +78,7 @@ Andrew Bennetts Andy Bensky Michel Van den Bergh +Julian Berman Eric Beser Steven Bethard Stephen Bevan diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #12579: str.format_map() now raises a ValueError if used on a + format string that contains positional fields. Initial patch by + Julian Berman. + - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -511,6 +511,16 @@ Py_DECREF(key); } else { + /* If args is NULL, we have a format string with a positional field + with only kwargs to retrieve it from. This can only happen when + used with format_map(), where positional arguments are not + allowed. */ + if (args == NULL) { + PyErr_SetString(PyExc_ValueError, "Format string contains " + "positional fields"); + goto error; + } + /* look up in args */ obj = PySequence_GetItem(args, index); if (obj == NULL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 18 20:09:04 2011 From: python-checkins at python.org (eric.smith) Date: Mon, 18 Jul 2011 20:09:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/5a1bb8d4afd7 changeset: 71410:5a1bb8d4afd7 parent: 71407:375c99d53058 parent: 71409:f6d074a7bbd4 user: Eric V. Smith date: Mon Jul 18 14:08:55 2011 -0400 summary: Merge from 3.2. files: Lib/test/test_unicode.py | 5 +++++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ Objects/stringlib/string_format.h | 10 ++++++++++ 4 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -736,6 +736,11 @@ self.assertRaises(TypeError, '{a'.format_map) self.assertRaises(TypeError, '}a'.format_map) + # issue #12579: can't supply positional params to format_map + self.assertRaises(ValueError, '{}'.format_map, {'a' : 2}) + self.assertRaises(ValueError, '{}'.format_map, 'a') + self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1}) + def test_format_auto_numbering(self): class C: def __init__(self, x=100): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -82,6 +82,7 @@ Andrew Bennetts Andy Bensky Michel Van den Bergh +Julian Berman Eric Beser Steven Bethard Stephen Bevan diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #12579: str.format_map() now raises a ValueError if used on a + format string that contains positional fields. Initial patch by + Julian Berman. + - Issue #10271: Allow warnings.showwarning() be any callable. - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -511,6 +511,16 @@ Py_DECREF(key); } else { + /* If args is NULL, we have a format string with a positional field + with only kwargs to retrieve it from. This can only happen when + used with format_map(), where positional arguments are not + allowed. */ + if (args == NULL) { + PyErr_SetString(PyExc_ValueError, "Format string contains " + "positional fields"); + goto error; + } + /* look up in args */ obj = PySequence_GetItem(args, index); if (obj == NULL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 01:30:35 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 19 Jul 2011 01:30:35 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzY0NzY6?= =?utf8?q?_Document_that_os=2Espawnle_and_os=2Espawnve_are_not_thread-safe?= =?utf8?q?_under?= Message-ID: http://hg.python.org/cpython/rev/3fa7581f6d46 changeset: 71411:3fa7581f6d46 branch: 2.7 parent: 71408:5c7520e02d5a user: Antoine Pitrou date: Tue Jul 19 01:26:58 2011 +0200 summary: Issue #6476: Document that os.spawnle and os.spawnve are not thread-safe under Windows. files: Doc/library/os.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2052,7 +2052,9 @@ os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` - and :func:`spawnvpe` are not available on Windows. + and :func:`spawnvpe` are not available on Windows. :func:`spawnle` and + :func:`spawnve` are not thread-safe on Windows; we advise you to use the + :mod:`subprocess` module instead. .. versionadded:: 1.6 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 01:30:36 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 19 Jul 2011 01:30:36 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzY0NzY6?= =?utf8?q?_Document_that_os=2Espawnle_and_os=2Espawnve_are_not_thread-safe?= =?utf8?q?_under?= Message-ID: http://hg.python.org/cpython/rev/a01ba3c32a4b changeset: 71412:a01ba3c32a4b branch: 3.2 parent: 71409:f6d074a7bbd4 user: Antoine Pitrou date: Tue Jul 19 01:26:58 2011 +0200 summary: Issue #6476: Document that os.spawnle and os.spawnve are not thread-safe under Windows. files: Doc/library/os.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1930,7 +1930,9 @@ os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` - and :func:`spawnvpe` are not available on Windows. + and :func:`spawnvpe` are not available on Windows. :func:`spawnle` and + :func:`spawnve` are not thread-safe on Windows; we advise you to use the + :mod:`subprocess` module instead. .. data:: P_NOWAIT -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 01:30:37 2011 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 19 Jul 2011 01:30:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=236476=3A_Document_that_os=2Espawnle_and_os=2Espawnve?= =?utf8?q?_are_not_thread-safe_under?= Message-ID: http://hg.python.org/cpython/rev/aee7c27ea7df changeset: 71413:aee7c27ea7df parent: 71410:5a1bb8d4afd7 parent: 71412:a01ba3c32a4b user: Antoine Pitrou date: Tue Jul 19 01:29:18 2011 +0200 summary: Issue #6476: Document that os.spawnle and os.spawnve are not thread-safe under Windows. files: Doc/library/os.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2438,7 +2438,9 @@ os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` - and :func:`spawnvpe` are not available on Windows. + and :func:`spawnvpe` are not available on Windows. :func:`spawnle` and + :func:`spawnve` are not thread-safe on Windows; we advise you to use the + :mod:`subprocess` module instead. .. data:: P_NOWAIT -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 02:06:04 2011 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Jul 2011 02:06:04 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12577_-_clarify_shutil=2Emove_documentation=2E_Patch_suggestion?= =?utf8?q?_by?= Message-ID: http://hg.python.org/cpython/rev/62048a6eb43c changeset: 71414:62048a6eb43c branch: 3.2 parent: 71412:a01ba3c32a4b user: Senthil Kumaran date: Tue Jul 19 08:03:02 2011 +0800 summary: Fix closes issue12577 - clarify shutil.move documentation. Patch suggestion by Catalin Iacob files: Doc/library/shutil.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -161,8 +161,10 @@ Recursively move a file or directory to another location. - If the destination is on the current filesystem, then simply use rename. - Otherwise, copy src (with :func:`copy2`) to the dst and then remove src. + Uses :func:`os.rename` to perform the move. If it fails, for reasons such as + when *src* and *dst* are on different filesystems or in case of windows where + rename is not supported when *dst* exists, fallback to copying *src* (with + :func:`copy2`) to the *dst* and then remove *src*. .. exception:: Error -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 02:06:05 2011 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Jul 2011 02:06:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_closes_issue12577_-_clarify_shutil=2E?= =?utf8?q?move_documentation=2E?= Message-ID: http://hg.python.org/cpython/rev/912b97ee40a7 changeset: 71415:912b97ee40a7 parent: 71413:aee7c27ea7df parent: 71414:62048a6eb43c user: Senthil Kumaran date: Tue Jul 19 08:03:55 2011 +0800 summary: merge from 3.2 - Fix closes issue12577 - clarify shutil.move documentation. Patch suggestion by Catalin Iacob files: Doc/library/shutil.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -161,8 +161,10 @@ Recursively move a file or directory to another location. - If the destination is on the current filesystem, then simply use rename. - Otherwise, copy src (with :func:`copy2`) to the dst and then remove src. + Uses :func:`os.rename` to perform the move. If it fails, for reasons such as + when *src* and *dst* are on different filesystems or in case of windows where + rename is not supported when *dst* exists, fallback to copying *src* (with + :func:`copy2`) to the *dst* and then remove *src*. .. function:: disk_usage(path) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 02:06:05 2011 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 19 Jul 2011 02:06:05 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Fix_closes_issue12577_-_clarify_shutil=2Emove_documentation?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/33f09733612e changeset: 71416:33f09733612e branch: 2.7 parent: 71411:3fa7581f6d46 user: Senthil Kumaran date: Tue Jul 19 08:05:44 2011 +0800 summary: merge from 3.2 - Fix closes issue12577 - clarify shutil.move documentation. Patch suggestion by Catalin Iacob files: Doc/library/shutil.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -163,8 +163,10 @@ Recursively move a file or directory to another location. - If the destination is on the current filesystem, then simply use rename. - Otherwise, copy src (with :func:`copy2`) to the dst and then remove src. + Uses :func:`os.rename` to perform the move. If it fails, for reasons such as + when *src* and *dst* are on different filesystems or in case of windows where + rename is not supported when *dst* exists, fallback to copying *src* (with + :func:`copy2`) to the *dst* and then remove *src*. .. versionadded:: 2.3 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 03:43:50 2011 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Jul 2011 03:43:50 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzc0ODQ6IG5vIG1v?= =?utf8?q?re_=3C=3E_around_addresses_in_VRFY_or_EXPN?= Message-ID: http://hg.python.org/cpython/rev/c4d884d5d86c changeset: 71417:c4d884d5d86c branch: 2.7 user: R David Murray date: Mon Jul 18 21:34:04 2011 -0400 summary: #7484: no more <> around addresses in VRFY or EXPN The RFC doesn't say that they are allowed; apparently many mailers accept them, but not postfix. Contributions to this patch were made by Felipe Cruz and Catalin Iacob. files: Lib/smtplib.py | 11 +++++++++-- Lib/test/test_smtplib.py | 11 +++++------ Misc/NEWS | 3 +++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -149,6 +149,13 @@ else: return "<%s>" % m +def _addr_only(addrstring): + displayname, addr = email.utils.parseaddr(addrstring) + if (displayname, addr) == ('', ''): + # parseaddr couldn't parse it, so use it as is. + return addrstring + return addr + def quotedata(data): """Quote data for email. @@ -497,14 +504,14 @@ def verify(self, address): """SMTP 'verify' command -- checks for address validity.""" - self.putcmd("vrfy", quoteaddr(address)) + self.putcmd("vrfy", _addr_only(address)) return self.getreply() # a.k.a. vrfy = verify def expn(self, address): """SMTP 'expn' command -- expands a mailing list.""" - self.putcmd("expn", quoteaddr(address)) + self.putcmd("expn", _addr_only(address)) return self.getreply() # some useful methods diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -330,15 +330,14 @@ self.push(resp) def smtp_VRFY(self, arg): - raw_addr = email.utils.parseaddr(arg)[1] - quoted_addr = smtplib.quoteaddr(arg) - if raw_addr in sim_users: - self.push('250 %s %s' % (sim_users[raw_addr], quoted_addr)) + # For max compatibility smtplib should be sending the raw address. + if arg in sim_users: + self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg))) else: self.push('550 No such user: %s' % arg) def smtp_EXPN(self, arg): - list_name = email.utils.parseaddr(arg)[1].lower() + list_name = arg.lower() if list_name in sim_lists: user_list = sim_lists[list_name] for n, user_email in enumerate(user_list): @@ -454,7 +453,7 @@ self.assertEqual(smtp.vrfy(email), expected_known) u = 'nobody at nowhere.com' - expected_unknown = (550, 'No such user: %s' % smtplib.quoteaddr(u)) + expected_unknown = (550, 'No such user: %s' % u) self.assertEqual(smtp.vrfy(u), expected_unknown) smtp.quit() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -33,6 +33,9 @@ Library ------- +- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN + commands; they aren't required and in fact postfix doesn't support that form. + - Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 03:43:50 2011 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Jul 2011 03:43:50 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzc0ODQ6IG5vIG1v?= =?utf8?q?re_=3C=3E_around_addresses_in_VRFY_or_EXPN?= Message-ID: http://hg.python.org/cpython/rev/f8c4ac9aa9e2 changeset: 71418:f8c4ac9aa9e2 branch: 3.2 parent: 71414:62048a6eb43c user: R David Murray date: Mon Jul 18 21:38:54 2011 -0400 summary: #7484: no more <> around addresses in VRFY or EXPN The RFC doesn't say that they are allowed; apparently many mailers accept them, but not postfix. Contributions to this patch were made by Felipe Cruz and Catalin Iacob. The changeset also adds additional indirect tests for quoteaddr (null address and IDNA-encoded address). files: Lib/smtplib.py | 11 +++++++- Lib/test/test_smtplib.py | 33 ++++++++++++++++++++------- Misc/NEWS | 3 ++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -152,6 +152,13 @@ else: return "<%s>" % m +def _addr_only(addrstring): + displayname, addr = email.utils.parseaddr(addrstring) + if (displayname, addr) == ('', ''): + # parseaddr couldn't parse it, so use it as is. + return addrstring + return addr + # Legacy method kept for backward compatibility. def quotedata(data): """Quote data for email. @@ -514,14 +521,14 @@ def verify(self, address): """SMTP 'verify' command -- checks for address validity.""" - self.putcmd("vrfy", quoteaddr(address)) + self.putcmd("vrfy", _addr_only(address)) return self.getreply() # a.k.a. vrfy = verify def expn(self, address): """SMTP 'expn' command -- expands a mailing list.""" - self.putcmd("expn", quoteaddr(address)) + self.putcmd("expn", _addr_only(address)) return self.getreply() # some useful methods diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -293,6 +293,23 @@ mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) self.assertEqual(self.output.getvalue(), mexpect) + def testSendNullSender(self): + m = 'A test message' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.sendmail('<>', 'Sally', m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: <>$", re.MULTILINE) + self.assertRegex(debugout, sender) + def testSendMessage(self): m = email.mime.text.MIMEText('A test message') smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) @@ -523,7 +540,7 @@ sim_users = {'Mr.A at somewhere.com':'John A', - 'Ms.B at somewhere.com':'Sally B', + 'Ms.B at xn--fo-fka.com':'Sally B', 'Mrs.C at somewhereesle.com':'Ruth C', } @@ -539,7 +556,7 @@ sim_auth_login_password = 'C29TZXBHC3N3B3JK' sim_lists = {'list-1':['Mr.A at somewhere.com','Mrs.C at somewhereesle.com'], - 'list-2':['Ms.B at somewhere.com',], + 'list-2':['Ms.B at xn--fo-fka.com',], } # Simulated SMTP channel & server @@ -560,15 +577,14 @@ self.push(resp) def smtp_VRFY(self, arg): - raw_addr = email.utils.parseaddr(arg)[1] - quoted_addr = smtplib.quoteaddr(arg) - if raw_addr in sim_users: - self.push('250 %s %s' % (sim_users[raw_addr], quoted_addr)) + # For max compatibility smtplib should be sending the raw address. + if arg in sim_users: + self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg))) else: self.push('550 No such user: %s' % arg) def smtp_EXPN(self, arg): - list_name = email.utils.parseaddr(arg)[1].lower() + list_name = arg.lower() if list_name in sim_lists: user_list = sim_lists[list_name] for n, user_email in enumerate(user_list): @@ -688,8 +704,7 @@ self.assertEqual(smtp.vrfy(email), expected_known) u = 'nobody at nowhere.com' - expected_unknown = (550, ('No such user: %s' - % smtplib.quoteaddr(u)).encode('ascii')) + expected_unknown = (550, ('No such user: %s' % u).encode('ascii')) self.assertEqual(smtp.vrfy(u), expected_unknown) smtp.quit() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,9 @@ Library ------- +- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN + commands; they aren't required and in fact postfix doesn't support that form. + - Close the call queue in concurrent.futures.ProcessPoolExecutor when shutdown() is called, without waiting for the garbage collector to kick in. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 03:43:51 2011 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Jul 2011 03:43:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_=237484=3A_no_more_=3C=3E_around_addresses_in_VRFY_or_?= =?utf8?q?EXPN?= Message-ID: http://hg.python.org/cpython/rev/0d9216de8f05 changeset: 71419:0d9216de8f05 parent: 71415:912b97ee40a7 parent: 71418:f8c4ac9aa9e2 user: R David Murray date: Mon Jul 18 21:42:28 2011 -0400 summary: Merge #7484: no more <> around addresses in VRFY or EXPN files: Lib/smtplib.py | 11 +++++++- Lib/test/test_smtplib.py | 33 ++++++++++++++++++++------- Misc/NEWS | 3 ++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -152,6 +152,13 @@ else: return "<%s>" % m +def _addr_only(addrstring): + displayname, addr = email.utils.parseaddr(addrstring) + if (displayname, addr) == ('', ''): + # parseaddr couldn't parse it, so use it as is. + return addrstring + return addr + # Legacy method kept for backward compatibility. def quotedata(data): """Quote data for email. @@ -507,14 +514,14 @@ def verify(self, address): """SMTP 'verify' command -- checks for address validity.""" - self.putcmd("vrfy", quoteaddr(address)) + self.putcmd("vrfy", _addr_only(address)) return self.getreply() # a.k.a. vrfy = verify def expn(self, address): """SMTP 'expn' command -- expands a mailing list.""" - self.putcmd("expn", quoteaddr(address)) + self.putcmd("expn", _addr_only(address)) return self.getreply() # some useful methods diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -293,6 +293,23 @@ mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) self.assertEqual(self.output.getvalue(), mexpect) + def testSendNullSender(self): + m = 'A test message' + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp.sendmail('<>', 'Sally', m) + # XXX (see comment in testSend) + time.sleep(0.01) + smtp.quit() + + self.client_evt.set() + self.serv_evt.wait() + self.output.flush() + mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END) + self.assertEqual(self.output.getvalue(), mexpect) + debugout = smtpd.DEBUGSTREAM.getvalue() + sender = re.compile("^sender: <>$", re.MULTILINE) + self.assertRegex(debugout, sender) + def testSendMessage(self): m = email.mime.text.MIMEText('A test message') smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) @@ -523,7 +540,7 @@ sim_users = {'Mr.A at somewhere.com':'John A', - 'Ms.B at somewhere.com':'Sally B', + 'Ms.B at xn--fo-fka.com':'Sally B', 'Mrs.C at somewhereesle.com':'Ruth C', } @@ -539,7 +556,7 @@ sim_auth_login_password = 'C29TZXBHC3N3B3JK' sim_lists = {'list-1':['Mr.A at somewhere.com','Mrs.C at somewhereesle.com'], - 'list-2':['Ms.B at somewhere.com',], + 'list-2':['Ms.B at xn--fo-fka.com',], } # Simulated SMTP channel & server @@ -563,15 +580,14 @@ self.push(resp) def smtp_VRFY(self, arg): - raw_addr = email.utils.parseaddr(arg)[1] - quoted_addr = smtplib.quoteaddr(arg) - if raw_addr in sim_users: - self.push('250 %s %s' % (sim_users[raw_addr], quoted_addr)) + # For max compatibility smtplib should be sending the raw address. + if arg in sim_users: + self.push('250 %s %s' % (sim_users[arg], smtplib.quoteaddr(arg))) else: self.push('550 No such user: %s' % arg) def smtp_EXPN(self, arg): - list_name = email.utils.parseaddr(arg)[1].lower() + list_name = arg.lower() if list_name in sim_lists: user_list = sim_lists[list_name] for n, user_email in enumerate(user_list): @@ -703,8 +719,7 @@ self.assertEqual(smtp.vrfy(email), expected_known) u = 'nobody at nowhere.com' - expected_unknown = (550, ('No such user: %s' - % smtplib.quoteaddr(u)).encode('ascii')) + expected_unknown = (550, ('No such user: %s' % u).encode('ascii')) self.assertEqual(smtp.vrfy(u), expected_unknown) smtp.quit() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,9 @@ Library ------- +- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN + commands; they aren't required and in fact postfix doesn't support that form. + - Issue #12273: Remove ast.__version__. AST changes can be accounted for by checking sys.version_info or sys._mercurial. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 04:00:09 2011 From: python-checkins at python.org (r.david.murray) Date: Tue, 19 Jul 2011 04:00:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_=237484=3A_simplify_quotead?= =?utf8?q?dr=3A_if_parseaddr_throws_an_error_it_is_a_bug=2E?= Message-ID: http://hg.python.org/cpython/rev/50b6c3053c30 changeset: 71420:50b6c3053c30 user: R David Murray date: Mon Jul 18 21:59:53 2011 -0400 summary: #7484: simplify quoteaddr: if parseaddr throws an error it is a bug. As far as I can tell, the try/except was ancient code, from before the email package rewrite where the philosophy of never throwing parsing errors was adopted. files: Lib/smtplib.py | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -133,24 +133,18 @@ combination provided. """ -def quoteaddr(addr): +def quoteaddr(addrstring): """Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything email.utils.parseaddr can handle. """ - m = (None, None) - try: - m = email.utils.parseaddr(addr)[1] - except AttributeError: - pass - if m == (None, None): # Indicates parse failure or AttributeError - # something weird here.. punt -ddm - return "<%s>" % addr - elif m is None: - # the sender wants an empty return address - return "<>" - else: - return "<%s>" % m + displayname, addr = email.utils.parseaddr(addrstring) + if (displayname, addr) == ('', ''): + # parseaddr couldn't parse it, use it as is and hope for the best. + if addrstring.strip().startswith('<'): + return addrstring + return "<%s>" % addrstring + return "<%s>" % addr def _addr_only(addrstring): displayname, addr = email.utils.parseaddr(addrstring) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jul 19 05:24:54 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 19 Jul 2011 05:24:54 +0200 Subject: [Python-checkins] Daily reference leaks (912b97ee40a7): sum=0 Message-ID: results for 912b97ee40a7 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog_5mT8P', '-x'] From python-checkins at python.org Tue Jul 19 10:35:43 2011 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 19 Jul 2011 10:35:43 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_A_number_of_sma?= =?utf8?q?ll_fixups_for_the_sorting_howto_guide=2E?= Message-ID: http://hg.python.org/cpython/rev/df639f5b1fe8 changeset: 71421:df639f5b1fe8 branch: 2.7 parent: 71417:c4d884d5d86c user: Raymond Hettinger date: Tue Jul 19 01:35:35 2011 -0700 summary: A number of small fixups for the sorting howto guide. files: Doc/howto/sorting.rst | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -111,6 +111,15 @@ >>> sorted(student_objects, key=attrgetter('grade', 'age')) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] +The :func:`operator.methodcaller` function makes method calls with fixed +parameters for each object being sorted. For example, the :meth:`str.count` +method could be used to compute message priority by counting the +number of exclamation marks in a message: + + >>> messages = ['critical!!!', 'hurry!', 'standby', 'immediate!!'] + >>> sorted(messages, key=methodcaller('count', '!')) + ['standby', 'hurry!', 'immediate!!', 'critical!!!'] + Ascending and Descending ======================== @@ -259,8 +268,8 @@ * For locale aware sorting, use :func:`locale.strxfrm` for a key function or :func:`locale.strcoll` for a comparison function. -* The *reverse* parameter still maintains sort stability (i.e. records with - equal keys retain the original order). Interestingly, that effect can be +* The *reverse* parameter still maintains sort stability (so that records with + equal keys retain their original order). Interestingly, that effect can be simulated without the parameter by using the builtin :func:`reversed` function twice: @@ -275,12 +284,16 @@ >>> sorted(student_objects) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] + For general purpose comparisons, the recommended approach is to define all six + rich comparison operators. The :func:`functools.total_ordering` class + decorator makes this easy to implement. + * Key functions need not depend directly on the objects being sorted. A key function can also access external resources. For instance, if the student grades are stored in a dictionary, they can be used to sort a separate list of student names: >>> students = ['dave', 'john', 'jane'] - >>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'} - >>> sorted(students, key=newgrades.__getitem__) + >>> grades = {'john': 'F', 'jane':'A', 'dave': 'C'} + >>> sorted(students, key=grades.__getitem__) ['jane', 'dave', 'john'] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 20:59:31 2011 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 19 Jul 2011 20:59:31 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Improve_docstri?= =?utf8?q?ng_for_divmod=28=29?= Message-ID: http://hg.python.org/cpython/rev/b57ace63286b changeset: 71422:b57ace63286b branch: 2.7 user: Raymond Hettinger date: Tue Jul 19 11:59:20 2011 -0700 summary: Improve docstring for divmod() files: Python/bltinmodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -604,7 +604,7 @@ } PyDoc_STRVAR(divmod_doc, -"divmod(x, y) -> (div, mod)\n\ +"divmod(x, y) -> (quotient, remainder)\n\ \n\ Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x."); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jul 19 22:55:03 2011 From: python-checkins at python.org (ezio.melotti) Date: Tue, 19 Jul 2011 22:55:03 +0200 (CEST) Subject: [Python-checkins] r88866 - in tracker/instances/python-dev/extensions: local_replace.py test/local_replace_data.txt Message-ID: <3RJYXl3SHRzMfX@mail.python.org> Author: ezio.melotti Date: Tue Jul 19 22:55:03 2011 New Revision: 88866 Log: #407: tweak the regex for revisions to require at least 4 digits. Modified: tracker/instances/python-dev/extensions/local_replace.py tracker/instances/python-dev/extensions/test/local_replace_data.txt Modified: tracker/instances/python-dev/extensions/local_replace.py ============================================================================== --- tracker/instances/python-dev/extensions/local_replace.py (original) +++ tracker/instances/python-dev/extensions/local_replace.py Tue Jul 19 22:55:03 2011 @@ -80,7 +80,7 @@ r'\g'), # r12345, r 12345, rev12345, rev 12345, revision12345, revision 12345 - (re.compile(r'\b(?r(ev(ision)?)?\s*)(?P\d+)'), + (re.compile(r'\b(?r(ev(ision)?)?\s*)(?P\d{4,})'), r'\g\g'), # Lib/somefile.py, Lib/somefile.py:123, Modules/somemodule.c:123, ... Modified: tracker/instances/python-dev/extensions/test/local_replace_data.txt ============================================================================== --- tracker/instances/python-dev/extensions/test/local_replace_data.txt (original) +++ tracker/instances/python-dev/extensions/test/local_replace_data.txt Tue Jul 19 22:55:03 2011 @@ -2,22 +2,24 @@ ## lines starting with '##' are ignored, but they have to be in an even number ## ## revisions - r12345, r 12345, rev12345, rev 12345, revision12345, revision 12345 -r222 -r222 - r222 - r222 - r 222 - r 222 - rev222 - rev222 - rev 222 - rev 222 - revision222 - revision222 - revision 222 - revision 222 -wordthatendswithr 222 -wordthatendswithr 222 +r2222 +r2222 + r2222 + r2222 + r 2222 + r 2222 + rev2222 + rev2222 + rev 2222 + rev 2222 + revision2222 + revision2222 + revision 2222 + revision 2222 +wordthatendswithr 2222 +wordthatendswithr 2222 +I uploaded http://pypi.python.org/pypi/ctypesgen/0.r125 +I uploaded http://pypi.python.org/pypi/ctypesgen/0.r125 ## ## issues - the lowest issue id on bugs.python.org is #1000, the highest is #1779871 #1 From python-checkins at python.org Wed Jul 20 00:29:45 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 20 Jul 2011 00:29:45 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTcx?= =?utf8?q?=3A_Add_a_plat-linux3_directory_mirroring_the_plat-linux2_direct?= =?utf8?q?ory=2C?= Message-ID: http://hg.python.org/cpython/rev/69dd70e70cc8 changeset: 71423:69dd70e70cc8 branch: 2.7 user: Antoine Pitrou date: Wed Jul 20 00:26:23 2011 +0200 summary: Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. files: Lib/plat-linux2/CDROM.py | Bin Lib/plat-linux2/DLFCN.py | Bin Lib/plat-linux2/IN.py | Bin Lib/plat-linux2/TYPES.py | Bin Lib/plat-linux2/regen | Bin Misc/NEWS | 4 ++++ 6 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/plat-linux2/CDROM.py b/Lib/plat-linux3/CDROM.py copy from Lib/plat-linux2/CDROM.py copy to Lib/plat-linux3/CDROM.py diff --git a/Lib/plat-linux2/DLFCN.py b/Lib/plat-linux3/DLFCN.py copy from Lib/plat-linux2/DLFCN.py copy to Lib/plat-linux3/DLFCN.py diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux3/IN.py copy from Lib/plat-linux2/IN.py copy to Lib/plat-linux3/IN.py diff --git a/Lib/plat-linux2/TYPES.py b/Lib/plat-linux3/TYPES.py copy from Lib/plat-linux2/TYPES.py copy to Lib/plat-linux3/TYPES.py diff --git a/Lib/plat-linux2/regen b/Lib/plat-linux3/regen copy from Lib/plat-linux2/regen copy to Lib/plat-linux3/regen diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -33,6 +33,10 @@ Library ------- +- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 + directory, so that "import DLFCN" and other similar imports work on + Linux 3.0. + - Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN commands; they aren't required and in fact postfix doesn't support that form. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 00:29:46 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 20 Jul 2011 00:29:46 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTcx?= =?utf8?q?=3A_Add_a_plat-linux3_directory_mirroring_the_plat-linux2_direct?= =?utf8?q?ory=2C?= Message-ID: http://hg.python.org/cpython/rev/9e3b28a7898f changeset: 71424:9e3b28a7898f branch: 3.2 parent: 71418:f8c4ac9aa9e2 user: Antoine Pitrou date: Wed Jul 20 00:26:23 2011 +0200 summary: Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. files: Lib/plat-linux2/CDROM.py | Bin Lib/plat-linux2/DLFCN.py | Bin Lib/plat-linux2/IN.py | Bin Lib/plat-linux2/TYPES.py | Bin Lib/plat-linux2/regen | Bin Misc/NEWS | 4 ++++ 6 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/plat-linux2/CDROM.py b/Lib/plat-linux3/CDROM.py copy from Lib/plat-linux2/CDROM.py copy to Lib/plat-linux3/CDROM.py diff --git a/Lib/plat-linux2/DLFCN.py b/Lib/plat-linux3/DLFCN.py copy from Lib/plat-linux2/DLFCN.py copy to Lib/plat-linux3/DLFCN.py diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux3/IN.py copy from Lib/plat-linux2/IN.py copy to Lib/plat-linux3/IN.py diff --git a/Lib/plat-linux2/TYPES.py b/Lib/plat-linux3/TYPES.py copy from Lib/plat-linux2/TYPES.py copy to Lib/plat-linux3/TYPES.py diff --git a/Lib/plat-linux2/regen b/Lib/plat-linux3/regen copy from Lib/plat-linux2/regen copy to Lib/plat-linux3/regen diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,10 @@ Library ------- +- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 + directory, so that "import DLFCN" and other similar imports work on + Linux 3.0. + - Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN commands; they aren't required and in fact postfix doesn't support that form. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 00:29:46 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 20 Jul 2011 00:29:46 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312571=3A_Add_a_plat-linux3_directory_mirroring_the_?= =?utf8?q?plat-linux2_directory=2C?= Message-ID: http://hg.python.org/cpython/rev/0c52098a13c6 changeset: 71425:0c52098a13c6 parent: 71420:50b6c3053c30 parent: 71424:9e3b28a7898f user: Antoine Pitrou date: Wed Jul 20 00:28:21 2011 +0200 summary: Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. files: Lib/plat-linux2/CDROM.py | Bin Lib/plat-linux2/DLFCN.py | Bin Lib/plat-linux2/IN.py | Bin Lib/plat-linux2/TYPES.py | Bin Lib/plat-linux2/regen | Bin Misc/NEWS | 4 ++++ 6 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/plat-linux2/CDROM.py b/Lib/plat-linux3/CDROM.py copy from Lib/plat-linux2/CDROM.py copy to Lib/plat-linux3/CDROM.py diff --git a/Lib/plat-linux2/DLFCN.py b/Lib/plat-linux3/DLFCN.py copy from Lib/plat-linux2/DLFCN.py copy to Lib/plat-linux3/DLFCN.py diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux3/IN.py copy from Lib/plat-linux2/IN.py copy to Lib/plat-linux3/IN.py diff --git a/Lib/plat-linux2/TYPES.py b/Lib/plat-linux3/TYPES.py copy from Lib/plat-linux2/TYPES.py copy to Lib/plat-linux3/TYPES.py diff --git a/Lib/plat-linux2/regen b/Lib/plat-linux3/regen copy from Lib/plat-linux2/regen copy to Lib/plat-linux3/regen diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,10 @@ Library ------- +- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 + directory, so that "import DLFCN" and other similar imports work on + Linux 3.0. + - Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN commands; they aren't required and in fact postfix doesn't support that form. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:19:07 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 20 Jul 2011 01:19:07 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTg3?= =?utf8?q?=3A_Correct_faulty_test_file_and_reference_in_test=5Ftokenize=2E?= Message-ID: http://hg.python.org/cpython/rev/0c254698e0ed changeset: 71426:0c254698e0ed branch: 3.2 parent: 71424:9e3b28a7898f user: Ned Deily date: Tue Jul 19 16:15:27 2011 -0700 summary: Issue #12587: Correct faulty test file and reference in test_tokenize. (Patch by Robert Xiao) files: Lib/test/test_tokenize.py | 2 +- Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt | 2 +- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -649,7 +649,7 @@ return roundtrip(open(path, 'rb')) def test_utf8_coding_cookie_and_no_utf8_bom(self): - f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt' + f = 'tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt' self.assertTrue(self._testFile(f)) def test_latin1_coding_cookie_and_utf8_bom(self): diff --git a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt --- a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt +++ b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt @@ -1,4 +1,4 @@ -?# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # IMPORTANT: unlike the other test_tokenize-*.txt files, this file # does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start # of it. Make sure this is not added inadvertently by your editor diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -973,6 +973,7 @@ Thomas Wouters Heiko Wundram Doug Wyatt +Robert Xiao Florent Xicluna Hirokazu Yamamoto Ka-Ping Yee diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -81,6 +81,9 @@ Tests ----- +- Issue #12587: Correct faulty test file and reference in test_tokenize. + (Patch by Robert Xiao) + - Try harder to reap dangling threads in test.support.reap_threads(). - Issue #12573: Add resource checks for dangling Thread and Process objects. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:19:07 2011 From: python-checkins at python.org (ned.deily) Date: Wed, 20 Jul 2011 01:19:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312587=3A_Correct_faulty_test_file_and_reference_in_?= =?utf8?q?test=5Ftokenize=2E?= Message-ID: http://hg.python.org/cpython/rev/c1d2b6b337c5 changeset: 71427:c1d2b6b337c5 parent: 71425:0c52098a13c6 parent: 71426:0c254698e0ed user: Ned Deily date: Tue Jul 19 16:18:11 2011 -0700 summary: Issue #12587: Correct faulty test file and reference in test_tokenize. (Patch by Robert Xiao) files: Lib/test/test_tokenize.py | 2 +- Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt | 2 +- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -649,7 +649,7 @@ return roundtrip(open(path, 'rb')) def test_utf8_coding_cookie_and_no_utf8_bom(self): - f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt' + f = 'tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt' self.assertTrue(self._testFile(f)) def test_latin1_coding_cookie_and_utf8_bom(self): diff --git a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt --- a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt +++ b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt @@ -1,4 +1,4 @@ -?# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # IMPORTANT: unlike the other test_tokenize-*.txt files, this file # does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start # of it. Make sure this is not added inadvertently by your editor diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1030,6 +1030,7 @@ Thomas Wouters Heiko Wundram Doug Wyatt +Robert Xiao Florent Xicluna Hirokazu Yamamoto Ka-Ping Yee diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1058,6 +1058,9 @@ Tests ----- +- Issue #12587: Correct faulty test file and reference in test_tokenize. + (Patch by Robert Xiao) + - Issue #12573: Add resource checks for dangling Thread and Process objects. - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:36 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:36 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_-_Issue_=231030?= =?utf8?q?9=3A_Define_=5FGNU=5FSOURCE_so_that_mremap=28=29_gets_the_proper?= Message-ID: http://hg.python.org/cpython/rev/8f3cc8ffc3ff changeset: 71428:8f3cc8ffc3ff branch: 2.7 parent: 71422:b57ace63286b user: Barry Warsaw date: Tue Jul 19 17:06:30 2011 -0400 summary: - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper signature. Without this, architectures where sizeof void* != sizeof int are broken. Patch given by Hallvard B Furuseth. files: Misc/NEWS | 26 +++++++++----- Modules/_ctypes/libffi/src/dlmalloc.c | 5 ++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,8 +9,8 @@ Core and Builtins ----------------- -- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception - class. +- Issue #11627: Fix segfault when __new__ on a exception returns a + non-exception class. - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance @@ -28,7 +28,8 @@ the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c. -- dict_proxy objects now display their contents rather than just the class name. +- dict_proxy objects now display their contents rather than just the class + name. Library ------- @@ -90,17 +91,24 @@ - Named tuples now work correctly with vars(). -- sys.setcheckinterval() now updates the current ticker count as well as updating - the check interval, so if the user decreases the check interval, the ticker - doesn't have to wind down to zero from the old starting point before the new - interval takes effect. And if the user increases the interval, it makes sure - the new limit takes effect right away rather have an early task switch before - recognizing the new interval. +- sys.setcheckinterval() now updates the current ticker count as well as + updating the check interval, so if the user decreases the check interval, + the ticker doesn't have to wind down to zero from the old starting point + before the new interval takes effect. And if the user increases the + interval, it makes sure the new limit takes effect right away rather have an + early task switch before recognizing the new interval. - Issue #12085: Fix an attribute error in subprocess.Popen destructor if the constructor has failed, e.g. because of an undeclared keyword argument. Patch written by Oleg Oshmyan. +Extension Modules +----------------- + +- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper + signature. Without this, architectures where sizeof void* != sizeof int are + broken. Patch given by Hallvard B Furuseth. + Build ----- diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +/* mremap() on Linux requires this via sys/mman.h + * See roundup issue 10309 + */ +#define _GNU_SOURCE 1 #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:37 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:37 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_-_Issue_=231030?= =?utf8?q?9=3A_Define_=5FGNU=5FSOURCE_so_that_mremap=28=29_gets_the_proper?= Message-ID: http://hg.python.org/cpython/rev/cc00e09404e6 changeset: 71429:cc00e09404e6 branch: 3.2 parent: 71418:f8c4ac9aa9e2 user: Barry Warsaw date: Tue Jul 19 18:28:30 2011 -0400 summary: - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper signature. Without this, architectures where sizeof void* != sizeof int are broken. Patch given by Hallvard B Furuseth. files: Misc/NEWS | 11 +++++++++-- Modules/_ctypes/libffi/src/dlmalloc.c | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,8 +14,8 @@ format string that contains positional fields. Initial patch by Julian Berman. -- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception - class. +- Issue #11627: Fix segfault when __new__ on a exception returns a + non-exception class. - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance @@ -71,6 +71,13 @@ - Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. +Extension Modules +----------------- + +- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper + signature. Without this, architectures where sizeof void* != sizeof int are + broken. Patch given by Hallvard B Furuseth. + C-API ----- diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +/* mremap() on Linux requires this via sys/mman.h + * See roundup issue 10309 + */ +#define _GNU_SOURCE 1 #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:38 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:38 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_-_Issue_=2310309=3A_Define_=5FGNU=5FSOURCE_so_that_mremap=28?= =?utf8?q?=29_gets_the_proper?= Message-ID: http://hg.python.org/cpython/rev/9986fff720a2 changeset: 71430:9986fff720a2 parent: 71420:50b6c3053c30 parent: 71429:cc00e09404e6 user: Barry Warsaw date: Tue Jul 19 19:23:56 2011 -0400 summary: - Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper signature. Without this, architectures where sizeof void* != sizeof int are broken. Patch given by Hallvard B Furuseth. files: Misc/NEWS | 8 ++++++-- Modules/_ctypes/libffi/src/dlmalloc.c | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,8 +16,8 @@ - Issue #10271: Allow warnings.showwarning() be any callable. -- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception - class. +- Issue #11627: Fix segfault when __new__ on a exception returns a + non-exception class. - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance @@ -1040,6 +1040,10 @@ Extension Modules ----------------- +- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper + signature. Without this, architectures where sizeof void* != sizeof int are + broken. Patch given by Hallvard B Furuseth. + - Issue #12221: Replace pyexpat.__version__ with the Python version. - Issue #12051: Fix segfault in json.dumps() while encoding highly-nested diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +/* mremap() on Linux requires this via sys/mman.h + * See roundup issue 10309 + */ +#define _GNU_SOURCE 1 #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:39 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Upstream_merge=2E?= Message-ID: http://hg.python.org/cpython/rev/331fe5c561d2 changeset: 71431:331fe5c561d2 parent: 71430:9986fff720a2 parent: 71427:c1d2b6b337c5 user: Barry Warsaw date: Tue Jul 19 19:25:25 2011 -0400 summary: Upstream merge. files: Lib/plat-linux2/CDROM.py | Bin Lib/plat-linux2/DLFCN.py | Bin Lib/plat-linux2/IN.py | Bin Lib/plat-linux2/TYPES.py | Bin Lib/plat-linux2/regen | Bin Lib/test/test_tokenize.py | 2 +- Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt | 2 +- Misc/ACKS | 1 + Misc/NEWS | 7 +++++++ 9 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/plat-linux2/CDROM.py b/Lib/plat-linux3/CDROM.py copy from Lib/plat-linux2/CDROM.py copy to Lib/plat-linux3/CDROM.py diff --git a/Lib/plat-linux2/DLFCN.py b/Lib/plat-linux3/DLFCN.py copy from Lib/plat-linux2/DLFCN.py copy to Lib/plat-linux3/DLFCN.py diff --git a/Lib/plat-linux2/IN.py b/Lib/plat-linux3/IN.py copy from Lib/plat-linux2/IN.py copy to Lib/plat-linux3/IN.py diff --git a/Lib/plat-linux2/TYPES.py b/Lib/plat-linux3/TYPES.py copy from Lib/plat-linux2/TYPES.py copy to Lib/plat-linux3/TYPES.py diff --git a/Lib/plat-linux2/regen b/Lib/plat-linux3/regen copy from Lib/plat-linux2/regen copy to Lib/plat-linux3/regen diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -649,7 +649,7 @@ return roundtrip(open(path, 'rb')) def test_utf8_coding_cookie_and_no_utf8_bom(self): - f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt' + f = 'tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt' self.assertTrue(self._testFile(f)) def test_latin1_coding_cookie_and_utf8_bom(self): diff --git a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt --- a/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt +++ b/Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt @@ -1,4 +1,4 @@ -?# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # IMPORTANT: unlike the other test_tokenize-*.txt files, this file # does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start # of it. Make sure this is not added inadvertently by your editor diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1030,6 +1030,7 @@ Thomas Wouters Heiko Wundram Doug Wyatt +Robert Xiao Florent Xicluna Hirokazu Yamamoto Ka-Ping Yee diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,10 @@ Library ------- +- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 + directory, so that "import DLFCN" and other similar imports work on + Linux 3.0. + - Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN commands; they aren't required and in fact postfix doesn't support that form. @@ -1058,6 +1062,9 @@ Tests ----- +- Issue #12587: Correct faulty test file and reference in test_tokenize. + (Patch by Robert Xiao) + - Issue #12573: Add resource checks for dangling Thread and Process objects. - Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:39 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:39 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_Upstream_merge?= Message-ID: http://hg.python.org/cpython/rev/908efa044c2e changeset: 71432:908efa044c2e branch: 3.2 parent: 71426:0c254698e0ed parent: 71429:cc00e09404e6 user: Barry Warsaw date: Tue Jul 19 19:25:56 2011 -0400 summary: Upstream merge files: Misc/NEWS | 11 +++++++++-- Modules/_ctypes/libffi/src/dlmalloc.c | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,8 +14,8 @@ format string that contains positional fields. Initial patch by Julian Berman. -- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception - class. +- Issue #11627: Fix segfault when __new__ on a exception returns a + non-exception class. - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance @@ -75,6 +75,13 @@ - Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead of the text mode (using the locale encoding) to avoid encoding issues. +Extension Modules +----------------- + +- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper + signature. Without this, architectures where sizeof void* != sizeof int are + broken. Patch given by Hallvard B Furuseth. + C-API ----- diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +/* mremap() on Linux requires this via sys/mman.h + * See roundup issue 10309 + */ +#define _GNU_SOURCE 1 #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:40 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Upstream_merge=2E?= Message-ID: http://hg.python.org/cpython/rev/e653265948ae changeset: 71433:e653265948ae parent: 71431:331fe5c561d2 parent: 71432:908efa044c2e user: Barry Warsaw date: Tue Jul 19 19:27:21 2011 -0400 summary: Upstream merge. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 01:28:41 2011 From: python-checkins at python.org (barry.warsaw) Date: Wed, 20 Jul 2011 01:28:41 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf8?q?_Upstream_merge=2E?= Message-ID: http://hg.python.org/cpython/rev/213a28b1f346 changeset: 71434:213a28b1f346 branch: 2.7 parent: 71423:69dd70e70cc8 parent: 71428:8f3cc8ffc3ff user: Barry Warsaw date: Tue Jul 19 19:28:16 2011 -0400 summary: Upstream merge. files: Misc/NEWS | 26 +++++++++----- Modules/_ctypes/libffi/src/dlmalloc.c | 5 ++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,8 +9,8 @@ Core and Builtins ----------------- -- Issue #11627: Fix segfault when __new__ on a exception returns a non-exception - class. +- Issue #11627: Fix segfault when __new__ on a exception returns a + non-exception class. - Issue #12149: Update the method cache after a type's dictionnary gets cleared by the garbage collector. This fixes a segfault when an instance @@ -28,7 +28,8 @@ the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c. -- dict_proxy objects now display their contents rather than just the class name. +- dict_proxy objects now display their contents rather than just the class + name. Library ------- @@ -94,17 +95,24 @@ - Named tuples now work correctly with vars(). -- sys.setcheckinterval() now updates the current ticker count as well as updating - the check interval, so if the user decreases the check interval, the ticker - doesn't have to wind down to zero from the old starting point before the new - interval takes effect. And if the user increases the interval, it makes sure - the new limit takes effect right away rather have an early task switch before - recognizing the new interval. +- sys.setcheckinterval() now updates the current ticker count as well as + updating the check interval, so if the user decreases the check interval, + the ticker doesn't have to wind down to zero from the old starting point + before the new interval takes effect. And if the user increases the + interval, it makes sure the new limit takes effect right away rather have an + early task switch before recognizing the new interval. - Issue #12085: Fix an attribute error in subprocess.Popen destructor if the constructor has failed, e.g. because of an undeclared keyword argument. Patch written by Oleg Oshmyan. +Extension Modules +----------------- + +- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper + signature. Without this, architectures where sizeof void* != sizeof int are + broken. Patch given by Hallvard B Furuseth. + Build ----- diff --git a/Modules/_ctypes/libffi/src/dlmalloc.c b/Modules/_ctypes/libffi/src/dlmalloc.c --- a/Modules/_ctypes/libffi/src/dlmalloc.c +++ b/Modules/_ctypes/libffi/src/dlmalloc.c @@ -457,6 +457,11 @@ #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#elif !defined _GNU_SOURCE +/* mremap() on Linux requires this via sys/mman.h + * See roundup issue 10309 + */ +#define _GNU_SOURCE 1 #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 02:02:57 2011 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 20 Jul 2011 02:02:57 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_test=5Fmultiprocessing_?= =?utf8?q?failure_under_Windows=2E?= Message-ID: http://hg.python.org/cpython/rev/6f9d917df541 changeset: 71435:6f9d917df541 parent: 71433:e653265948ae user: Antoine Pitrou date: Wed Jul 20 02:01:39 2011 +0200 summary: Fix test_multiprocessing failure under Windows. (followup to dfaa3a149a92) files: Lib/multiprocessing/queues.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -78,11 +78,11 @@ def __getstate__(self): assert_spawning(self) - return (self._maxsize, self._reader, self._writer, + return (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) def __setstate__(self, state): - (self._maxsize, self._reader, self._writer, + (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) = state self._after_fork() -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jul 20 05:26:17 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 20 Jul 2011 05:26:17 +0200 Subject: [Python-checkins] Daily reference leaks (6f9d917df541): sum=0 Message-ID: results for 6f9d917df541 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogHKt2xi', '-x'] From python-checkins at python.org Wed Jul 20 10:23:39 2011 From: python-checkins at python.org (nick.coghlan) Date: Wed, 20 Jul 2011 10:23:39 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Update_based_on_Kerrick=27s_la?= =?utf8?q?test_changes?= Message-ID: http://hg.python.org/peps/rev/711c6edbd69c changeset: 3901:711c6edbd69c user: Nick Coghlan date: Wed Jul 20 18:23:25 2011 +1000 summary: Update based on Kerrick's latest changes files: pep-0394.txt | 69 +++++++++++++++++++++------------------ 1 files changed, 37 insertions(+), 32 deletions(-) diff --git a/pep-0394.txt b/pep-0394.txt --- a/pep-0394.txt +++ b/pep-0394.txt @@ -1,5 +1,5 @@ PEP: 394 -Title: The "python" command on Unix-Like Systems +Title: The "python" Command on Unix-Like Systems Version: $Revision$ Last-Modified: $Date$ Author: Kerrick Staley , @@ -8,7 +8,7 @@ Type: Informational Content-Type: text/x-rst Created: 02-Mar-2011 -Post-History: 04-Mar-2011 +Post-History: 04-Mar-2011, 20-Jul-2011 Abstract @@ -40,6 +40,11 @@ * For the time being, it is recommended that ``python`` should refer to ``python2`` (however, some distributions have already chosen otherwise; see Notes below). +* The Python 2.x ``idle``, ``pydoc``, and ``python-config`` commands should + likewise be available as ``idle2``, ``pydoc2``, and ``python2-config``, + with the original commands invoking these versions by default, but possibly + invoking the Python 3.x versions instead if configured to do so by the + system administrator. * In order to tolerate differences across platforms, all new code that needs to invoke the Python interpreter should not specify ``python``, but rather should specify either ``python2`` or ``python3`` (or the more specific @@ -55,9 +60,9 @@ interpreter location remains the preferred approach. These recommendations are the outcome of the relevant python-dev discussion in -March 2011 [1] (NOTE: More accurately, they will be such once that "Draft" -status disappears from the PEP header, it has been moved into the "Other -Informational PEP" section in PEP 0 and this note has been deleted) +March and July 2011 [1][2] (NOTE: More accurately, they will be such once the +"Draft" status disappears from the PEP header, it has been moved into the +"Other Informational PEP" section in PEP 0 and this note has been deleted) Rationale @@ -142,13 +147,25 @@ Application to the CPython Reference Interpreter ================================================ -While technically a new feature, the ``make install`` command and the Mac OS -X installer in the 2.7 version of CPython will be adjusted to create the -new ``python2`` command in addition to the existing ``python`` and -``python2.7`` commands. This feature will first appear in CPython 2.7.2. +While technically a new feature, the ``make install`` command in the 2.7 +version of CPython will be adjusted to create the ``python2.7``, ``idle2.7``, +``pydoc2.7``, and ``python2.7-config`` binaries, with ``python2``, ``idle2``, +``pydoc2``, and ``python2-config`` as hard links to the respective binaries, +and ``python``, ``idle``, ``pydoc``, and ``python-config`` as symbolic links +to the respective hard links. This feature will first appear in CPython +2.7.3. -The ``make install`` command in the CPython 3.x series will continue to -install only the ``python3`` symlink for the foreseeable future. +The ``make install`` command in the CPython 3.x series will similarly install +the ``python3.x``, ``idle3.x``, ``pydoc3.x``, and ``python3.x-config`` +binaries (with appropriate ``x``), and ``python3``, ``idle3``, ``pydoc3``, +and ``python3-config`` as hard links. This feature will first appear in +CPython 3.3. + +Similar adjustments will be made to the Mac OS X binary installer. + +As implementation of these features in the default installers does not alter +the recommendations in this PEP, the implementation progress is managed on the +tracker as issue . Impact on PYTHON* Environment Variables @@ -163,28 +180,13 @@ direct use of ``PYTHONPATH``. -Exclusions of MS Windows -======================== +Exclusion of MS Windows +======================= -This PEP deliberately excludes any proposals relating to Microsoft Windows. -The use of parallel installs on Windows suffers from numerous issues, -including the "last installed wins" behaviour for handling of file -associations, a lack of universal robust symlink support for easy aliasing of -commands, the fact that the Python executable is not available on ``PATH`` by -default, the fact that the ``python.exe`` and ``pythonw.exe`` names are -used for both Python 2 and Python 3 binaries and the lack of distinction -between the different Python versions when the Start menu shortcuts are -divorced from their containing folders (e.g. when they appear in the -"Recently Used" list. - -While these questions are well worth addressing, they do not have easy -answers. The authors of this particular PEP aren't inclined to even begin -trying to answer them, but anyone that wants to tackle them should feel free -to start working on their own PEP. - -Note that, while the topic has been excluded from this PEP, there is plenty of -material in the linked python-dev discussion that may be useful in the design -and implementation of a Windows-specific solution. +This PEP deliberately excludes any proposals relating to Microsoft Windows, as +devising an equivalent solution for Windows was deemed too complex to handle +here. PEP 397 and the related discussion on the python-dev mailing list +address this issue. References @@ -193,6 +195,9 @@ [1] Support the /usr/bin/python2 symlink upstream (with bonus grammar class!) (http://mail.python.org/pipermail/python-dev/2011-March/108491.html) +[2] Rebooting PEP 394 (aka Support the /usr/bin/python2 symlink upstream) + (http://mail.python.org/pipermail/python-dev/2011-July/112322.html) + Copyright =========== -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Jul 20 10:43:53 2011 From: python-checkins at python.org (nick.coghlan) Date: Wed, 20 Jul 2011 10:43:53 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_PEP_402?= Message-ID: http://hg.python.org/peps/rev/f1032cec47ce changeset: 3902:f1032cec47ce user: Nick Coghlan date: Wed Jul 20 18:43:40 2011 +1000 summary: Add PEP 402 files: pep-0402.txt | 585 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 585 insertions(+), 0 deletions(-) diff --git a/pep-0402.txt b/pep-0402.txt new file mode 100644 --- /dev/null +++ b/pep-0402.txt @@ -0,0 +1,585 @@ +PEP: 402 +Title: Simplified Package Layout and Partitioning +Version: $Revision$ +Last-Modified: $Date$ +Author: P.J. Eby +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 12-Jul-2011 +Python-Version: 3.3 +Post-History: 20-Jul-2011 +Replaces: 382 + +Abstract +======== + +This PEP proposes an enhancement to Python's package importing +to: + +* Surprise users of other languages less, +* Make it easier to convert a module into a package, and +* Support dividing packages into separately installed components + (ala "namespace packages", as described in PEP 382) + +The proposed enhancements do not change the semantics of any +currently-importable directory layouts, but make it possible for +packages to use a simplified directory layout (that is not importable +currently). + +However, the proposed changes do NOT add any performance overhead to +the importing of existing modules or packages, and performance for the +new directory layout should be about the same as that of previous +"namespace package" solutions (such as ``pkgutil.extend_path()``). + + +The Problem +=========== + +.. epigraph:: + + "Most packages are like modules. Their contents are highly + interdependent and can't be pulled apart. [However,] some + packages exist to provide a separate namespace. ... It should + be possible to distribute sub-packages or submodules of these + [namespace packages] independently." + + -- Jim Fulton, shortly before the release of Python 2.3 [1]_ + + +When new users come to Python from other languages, they are often +confused by Python's packaging semantics. At Google, for example, +Guido received complaints from "a large crowd with pitchforks" [2]_ +that the requirement for packages to contain an ``__init__`` module +was a "misfeature", and should be dropped. + +In addition, users coming from languages like Java or Perl are +sometimes confused by a difference in Python's import path searching. + +In most other languages that have a similar path mechanism to Python's +``sys.path``, a package is merely a namespace that contains modules +or classes, and can thus be spread across multiple directories in +the language's path. In Perl, for instance, a ``Foo::Bar`` module +will be searched for in ``Foo/`` subdirectories all along the module +include path, not just in the first such subdirectory found. + +Worse, this is not just a problem for new users: it prevents *anyone* +from easily splitting a package into separately-installable +components. In Perl terms, it would be as if every possible ``Net::`` +module on CPAN had to be bundled up and shipped in a single tarball! + +For that reason, various workarounds for this latter limitation exist, +circulated under the term "namespace packages". The Python standard +library has provided one such workaround since Python 2.3 (via the +``pkgutil.extend_path()`` function), and the "setuptools" package +provides another (via ``pkg_resources.declare_namespace()``). + +The workarounds themselves, however, fall prey to a *third* issue with +Python's way of laying out packages in the filesystem. + +Because a package *must* contain an ``__init__`` module, any attempt +to distribute modules for that package must necessarily include that +``__init__`` module, if those modules are to be importable. + +However, the very fact that each distribution of modules for a package +must contain this (duplicated) ``__init__`` module, means that OS +vendors who package up these module distributions must somehow handle +the conflict caused by several module distributions installing that +``__init__`` module to the same location in the filesystem. + +This led to the proposing of PEP 382 ("Namespace Packages") - a way +to signal to Python's import machinery that a directory was +importable, using unique filenames per module distribution. + +However, there was more than one downside to this approach. +Performance for all import operations would be affected, and the +process of designating a package became even more complex. New +terminology had to be invented to explain the solution, and so on. + +As terminology discussions continued on the Import-SIG, it soon became +apparent that the main reason it was so difficult to explain the +concepts related to "namespace packages" was because Python's +current way of handling packages is somewhat underpowered, when +compared to other languages. + +That is, in other popular languages with package systems, no special +term is needed to describe "namespace packages", because *all* +packages generally behave in the desired fashion. + +Rather than being an isolated single directory with a special marker +module (as in Python), packages in other languages are typically just +the *union* of appropriately-named directories across the *entire* +import or inclusion path. + +In Perl, for example, the module ``Foo`` is always found in a +``Foo.pm`` file, and a module ``Foo::Bar`` is always found in a +``Foo/Bar.pm`` file. (In other words, there is One Obvious Way to +find the location of a particular module.) + +This is because Perl considers a module to be *different* from a +package: the package is purely a *namespace* in which other modules +may reside, and is only *coincidentally* the name of a module as well. + +In current versions of Python, however, the module and the package are +more tightly bound together. ``Foo`` is always a module -- whether it +is found in ``Foo.py`` or ``Foo/__init__.py`` -- and it is tightly +linked to its submodules (if any), which *must* reside in the exact +same directory where the ``__init__.py`` was found. + +On the positive side, this design choice means that a package is quite +self-contained, and can be installed, copied, etc. as a unit just by +performing an operation on the package's root directory. + +On the negative side, however, it is non-intuitive for beginners, and +requires a more complex step to turn a module into a package. If +``Foo`` begins its life as ``Foo.py``, then it must be moved and +renamed to ``Foo/__init__.py``. + +Conversely, if you intend to create a ``Foo.Bar`` module from the +start, but have no particular module contents to put in ``Foo`` +itself, then you have to create an empty and seemingly-irrelevant +``Foo/__init__.py`` file, just so that ``Foo.Bar`` can be imported. + +(And these issues don't just confuse newcomers to the language, +either: they annoy many experienced developers as well.) + +So, after some discussion on the Import-SIG, this PEP was created +as an alternative to PEP \382, in an attempt to solve *all* of the +above problems, not just the "namespace package" use cases. + +And, as a delightful side effect, the solution proposed in this PEP +does not affect the import performance of ordinary modules or +self-contained (i.e. ``__init__``-based) packages. + + +The Solution +============ + +In the past, various proposals have been made to allow more intuitive +approaches to package directory layout. However, most of them failed +because of an apparent backward-compatibility problem. + +That is, if the requirement for an ``__init__`` module were simply +dropped, it would open up the possibility for a directory named, say, +``string`` on ``sys.path``, to block importing of the standard library +``string`` module. + +Paradoxically, however, the failure of this approach does *not* arise +from the elimination of the ``__init__`` requirement! + +Rather, the failure arises because the underlying approach takes for +granted that a package is just ONE thing, instead of two. + +In truth, a package comprises two separate, but related entities: a +module (with its own, optional contents), and a *namespace* where +*other* modules or packages can be found. + +In current versions of Python, however, the module part (found in +``__init__``) and the namespace for submodule imports (represented +by the ``__path__`` attribute) are both initialized at the same time, +when the package is first imported. + +And, if you assume this is the *only* way to initialize these two +things, then there is no way to drop the need for an ``__init__`` +module, while still being backwards-compatible with existing directory +layouts. + +After all, as soon as you encounter a directory on ``sys.path`` +matching the desired name, that means you've "found" the package, and +must stop searching, right? + +Well, not quite. + + +A Thought Experiment +-------------------- + +Let's hop into the time machine for a moment, and pretend we're back +in the early 1990s, shortly before Python packages and ``__init__.py`` +have been invented. But, imagine that we *are* familiar with +Perl-like package imports, and we want to implement a similar system +in Python. + +We'd still have Python's *module* imports to build on, so we could +certainly conceive of having ``Foo.py`` as a parent ``Foo`` module +for a ``Foo`` package. But how would we implement submodule and +subpackage imports? + +Well, if we didn't have the idea of ``__path__`` attributes yet, +we'd probably just search ``sys.path`` looking for ``Foo/Bar.py``. + +But we'd *only* do it when someone actually tried to *import* +``Foo.Bar``. + +NOT when they imported ``Foo``. + +And *that* lets us get rid of the backwards-compatibility problem +of dropping the ``__init__`` requirement, back here in 2011. + +How? + +Well, when we ``import Foo``, we're not even *looking* for ``Foo/`` +directories on ``sys.path``, because we don't *care* yet. The only +point at which we care, is the point when somebody tries to actually +import a submodule or subpackage of ``Foo``. + +That means that if ``Foo`` is a standard library module (for example), +and I happen to have a ``Foo`` directory on ``sys.path`` (without +an ``__init__.py``, of course), then *nothing breaks*. The ``Foo`` +module is still just a module, and it's still imported normally. + + +Self-Contained vs. "Virtual" Packages +------------------------------------- + +Of course, in today's Python, trying to ``import Foo.Bar`` will +fail if ``Foo`` is just a ``Foo.py`` module (and thus lacks a +``__path__`` attribute). + +So, this PEP proposes to *dynamically* create a ``__path__``, in the +case where one is missing. + +That is, if I try to ``import Foo.Bar`` the proposed change to the +import machinery will notice that the ``Foo`` module lacks a +``__path__``, and will therefore try to *build* one before proceeding. + +And it will do this by making a list of all the existing ``Foo/`` +subdirectories of the directories listed in ``sys.path``. + +If the list is empty, the import will fail with ``ImportError``, just +like today. But if the list is *not* empty, then it is saved in +a new ``Foo.__path__`` attribute, making the module a "virtual +package". + +That is, because it now has a valid ``__path__``, we can proceed +to import submodules or subpackages in the normal way. + +Now, notice that this change does not affect "classic", self-contained +packages that have an ``__init__`` module in them. Such packages +already *have* a ``__path__`` attribute (initialized at import time) +so the import machinery won't try to create another one later. + +This means that (for example) the standard library ``email`` package +will not be affected in any way by you having a bunch of unrelated +directories named ``email`` on ``sys.path``. (Even if they contain +``*.py`` files.) + +But it *does* mean that if you want to turn your ``Foo`` module into +a ``Foo`` package, all you have to do is add a ``Foo/`` directory +somewhere on ``sys.path``, and start adding modules to it. + +But what if you only want a "namespace package"? That is, a package +that is *only* a namespace for various separately-distributed +submodules and subpackages? + +For example, if you're Zope Corporation, distributing dozens of +separate tools like ``zc.buildout``, each in packages under the ``zc`` +namespace, you don't want to have to make and include an empty +``zc.py`` in every tool you ship. (And, if you're a Linux or other +OS vendor, you don't want to deal with the package installation +conflicts created by trying to install ten copies of ``zc.py`` to the +same location!) + +No problem. All we have to do is make one more minor tweak to the +import process: if the "classic" import process fails to find a +self-contained module or package (e.g., if ``import zc`` fails to find +a ``zc.py`` or ``zc/__init__.py``), then we once more try to build a +``__path__`` by searching for all the ``zc/`` directories on +``sys.path``, and putting them in a list. + +If this list is empty, we raise ``ImportError``. But if it's +non-empty, we create an empty ``zc`` module, and put the list in +``zc.__path__``. Congratulations: ``zc`` is now a namespace-only, +"pure virtual" package! It has no module contents, but you can still +import submodules and subpackages from it, regardless of where they're +located on ``sys.path``. + +(By the way, both of these additions to the import protocol (i.e. the +dynamically-added ``__path__``, and dynamically-created modules) +apply recursively to child packages, using the parent package's +``__path__`` in place of ``sys.path`` as a basis for generating a +child ``__path__``. This means that self-contained and virtual +packages can contain each other without limitation, with the caveat +that if you put a virtual package inside a self-contained one, it's +gonna have a really short ``__path__``!) + + +Backwards Compatibility and Performance +--------------------------------------- + +Notice that these two changes *only* affect import operations that +today would result in ``ImportError``. As a result, the performance +of imports that do not involve virtual packages is unaffected, and +potential backward compatibility issues are very restricted. + +Today, if you try to import submodules or subpackages from a module +with no ``__path__``, it's an immediate error. And of course, if you +don't have a ``zc.py`` or ``zc/__init__.py`` somewhere on ``sys.path`` +today, ``import zc`` would likewise fail. + +Thus, the only potential backwards-compatibility issues are: + +1. Tools that expect package directories to have an ``__init__`` + module, that expect directories without an ``__init__`` module + to be unimportable, or that expect ``__path__`` attributes to be + static, will not recognize virtual packages as packages. + + (In practice, this just means that tools will need updating to + support virtual packages, e.g. by using ``pkgutil.walk_modules()`` + instead of using hardcoded filesystem searches.) + +2. Code that *expects* certain imports to fail may now do something + unexpected. This should be fairly rare in practice, as most sane, + non-test code does not import things that are expected not to + exist! + +The biggest likely exception to the above would be when a piece of +code tries to check whether some package is installed by importing +it. If this is done *only* by importing a top-level module (i.e., not +checking for a ``__version__`` or some other attribute), *and* there +is a directory of the same name as the sought-for package on +``sys.path`` somewhere, *and* the package is not actually installed, +then such code could *perhaps* be fooled into thinking a package is +installed that really isn't. + +However, even in the rare case where all these conditions line up to +happen at once, the failure is more likely to be annoying than +damaging. In most cases, after all, the code will simply fail a +little later on, when it actually tries to DO something with the +imported (but empty) module. (And code that checks ``__version__`` +attributes or for the presence of some desired function, class, or +module in the package will not see a false positive result in the +first place.) + +Meanwhile, tools that expect to locate packages and modules by +walking a directory tree can be updated to use the existing +``pkgutil.walk_modules()`` API, and tools that need to inspect +packages in memory should use the other APIs described in the +`Standard Library Changes/Additions`_ section below. + + +Specification +============= + +Two changes are made to the existing import process. + +First, the built-in ``__import__`` function must not raise an +``ImportError`` when importing a submodule of a module with no +``__path__``. Instead, it must attempt to *create* a ``__path__`` +attribute for the parent module first, as described in `__path__ +creation`_, below. + +Second, if searching ``sys.meta_path`` and ``sys.path`` (or a parent +package ``__path__``) fails to find a module being imported, the +import process must attempt to create a ``__path__`` attribute for +the missing module. If the attempt succeeds, an empty module is +created and its ``__path__`` is set. Otherwise, importing fails. + +In both of the above cases, if a non-empty ``__path__`` is created, +the name of the module whose ``__path__`` was created is added to +``sys.virtual_packages`` -- an initially-empty ``set()`` of package +names. + +(This way, code that extends ``sys.path`` at runtime can find out +what virtual packages are currently imported, and thereby add any +new subdirectories to those packages' ``__path__`` attributes. See +`Standard Library Changes/Additions`_ below for more details.) + +Conversely, if an empty ``__path__`` results, an ``ImportError`` +is immediately raised, and the module is not created or changed, nor +is its name added to ``sys.virtual_packages``. + + +``__path__`` Creation +--------------------- + +A virtual ``__path__`` is created by obtaining a PEP 302 "importer" +object for each of the path entries found in ``sys.path`` (for a +top-level module) or the parent ``__path__`` (for a submodule). + +(Note: because ``sys.meta_path`` importers are not associated with +``sys.path`` or ``__path__`` entry strings, such importers do *not* +participate in this process.) + +Each importer is checked for a ``get_subpath()`` method, and if +present, the method is called with the full name of the module/package +the ``__path__`` is being constructed for. The return value is either +a string representing a subdirectory for the requested package, or +``None`` if no such subdirectory exists. + +The strings returned by the importers are added to the ``__path__`` +being built, in the same order as they are found. (``None`` values +and missing ``get_subpath()`` methods are simply skipped.) + +In Python code, the algorithm would look something like this:: + + def get_virtual_path(modulename, parent_path=None): + + if parent_path is None: + parent_path = sys.path + + path = [] + + for entry in parent_path: + # Obtain a PEP 302 importer object - see pkgutil module + importer = pkgutil.get_importer(entry) + + if hasattr(importer, 'get_subpath'): + subpath = importer.get_subpath(modulename) + if subpath is not None: + path.append(subpath) + + return path + +And a function like this one should be exposed in the standard +library as e.g. ``imp.get_virtual_path()``, so that people creating +``__import__`` replacements or ``sys.meta_path`` hooks can reuse it. + + +Standard Library Changes/Additions +---------------------------------- + +The ``pkgutil`` module should be updated to handle this +specification appropriately, including any necessary changes to +``extend_path()``, ``iter_modules()``, etc. + +Specifically the proposed changes and additions to ``pkgutil`` are: + +* A new ``extend_virtual_paths(path_entry)`` function, to extend + existing, already-imported virtual packages' ``__path__`` attributes + to include any portions found in a new ``sys.path`` entry. This + function should be called by applications extending ``sys.path`` + at runtime, e.g. when adding a plugin directory or an egg to the + path. + + The implementation of this function does a simple top-down traversal + of ``sys.virtual_packages``, and performs any necessary + ``get_subpath()`` calls to identify what path entries need to + be added to each package's ``__path__``, given that `path_entry` + has been added to ``sys.path``. (Or, in the case of sub-packages, + adding a derived subpath entry, based on their parent namespace's + ``__path__``.) + +* A new ``iter_virtual_packages(parent='')`` function to allow + top-down traversal of virtual packages in ``sys.virtual_packages``, + by yielding the child virtual packages of `parent`. For example, + calling ``iter_virtual_packages("zope")`` might yield ``zope.app`` + and ``zope.products`` (if they are imported virtual packages listed + in ``sys.virtual_packages``), but **not** ``zope.foo.bar``. + (This function is needed to implement ``extend_virtual_paths()``, + but is also potentially useful for other code that needs to inspect + imported virtual packages.) + +* ``ImpImporter.iter_modules()`` should be changed to also detect and + yield the names of modules found in virtual packages. + +In addition to the above changes, the ``zipimport`` importer should +have its ``iter_modules()`` implementation similarly changed. (Note: +current versions of Python implement this via a shim in ``pkgutil``, +so technically this is also a change to ``pkgutil``.) + +Last, but not least, the ``imp`` module (or ``importlib``, if +appropriate) should expose the algorithm described in the `__path__ +creation`_ section above, as a +``get_virtual_path(modulename, parent_path=None)`` function, so that +creators of ``__import__`` replacements can use it. + + +Implementation Notes +-------------------- + +For users, developers, and distributors of virtual packages: + +* While virtual packages are easy to set up and use, there is still + a time and place for using self-contained packages. While it's not + strictly necessary, adding an ``__init__`` module to your + self-contained packages lets users of the package (and Python + itself) know that *all* of the package's code will be found in + that single subdirectory. In addition, it lets you define + ``__all__``, expose a public API, provide a package-level docstring, + and do other things that make more sense for a self-contained + project than for a mere "namespace" package. + +* ``sys.virtual_packages`` is allowed to contain non-existent or + not-yet-imported package names; code that uses its contents should + not assume that every name in this set is also present in + ``sys.modules`` or that importing the name will necessarily succeed. + +* If you are changing a currently self-contained package into a + virtual one, it's important to note that you can no longer use its + ``__file__`` attribute to locate data files stored in a package + directory. Instead, you must search ``__path__`` or use the + ``__file__`` of a submodule adjacent to the desired files, or + of a self-contained subpackage that contains the desired files. + + (Note: this caveat is already true for existing users of "namespace + packages" today. That is, it is an inherent result of being able + to partition a package, that you must know *which* partition the + desired data file lives in. We mention it here simply so that + *new* users converting from self-contained to virtual packages will + also be aware of it.) + +* XXX what is the __file__ of a "pure virtual" package? ``None``? + Some arbitrary string? The path of the first directory with a + trailing separator? No matter what we put, *some* code is + going to break, but the last choice might allow some code to + accidentally work. Is that good or bad? + + +For those implementing PEP \302 importer objects: + +* Importers that support the ``iter_modules()`` method (used by + ``pkgutil`` to locate importable modules and packages) and want to + add virtual package support should modify their ``iter_modules()`` + method so that it discovers and lists virtual packages as well as + standard modules and packages. To do this, the importer should + simply list all immediate subdirectory names in its jurisdiction + that are valid Python identifiers. + + XXX This might list a lot of not-really-packages. Should we + require importable contents to exist? If so, how deep do we + search, and how do we prevent e.g. link loops, or traversing onto + different filesystems, etc.? Ick. + +* "Meta" importers (i.e., importers placed on ``sys.meta_path``) do + not need to implement ``get_subpath()``, because the method + is only called on importers corresponding to ``sys.path`` entries + and ``__path__`` entries. If a meta importer wishes to support + virtual packages, it must do so entirely within its own + ``find_module()`` implementation. + + Unfortunately, it is unlikely that any such implementation will be + able to merge its package subpaths with those of other meta + importers or ``sys.path`` importers, so the meaning of "supporting + virtual packages" for a meta importer is currently undefined! + + (However, since the intended use case for meta importers is to + replace Python's normal import process entirely for some subset of + modules, and the number of such importers currently implemented is + quite small, this seems unlikely to be a big issue in practice.) + + +References +========== + +.. [1] "namespace" vs "module" packages (mailing list thread) + (http://mail.zope.org/pipermail/zope3-dev/2002-December/004251.html) + +.. [2] "Dropping __init__.py requirement for subpackages" + (http://mail.python.org/pipermail/python-dev/2006-April/064400.html) + + +Copyright +========= + +This document has been placed in the public domain. + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Jul 20 16:02:51 2011 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Jul 2011 16:02:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12524_-_update_http=2Eclient_POST_example_with_a_working_exampl?= =?utf8?q?e=2E?= Message-ID: http://hg.python.org/cpython/rev/ab4d403cb0c0 changeset: 71436:ab4d403cb0c0 branch: 3.2 parent: 71432:908efa044c2e user: Senthil Kumaran date: Wed Jul 20 21:56:24 2011 +0800 summary: Fix closes issue12524 - update http.client POST example with a working example. files: Doc/library/http.client.rst | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -592,15 +592,17 @@ Here is an example session that shows how to ``POST`` requests:: >>> import http.client, urllib.parse - >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) + >>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'}) >>> headers = {"Content-type": "application/x-www-form-urlencoded", ... "Accept": "text/plain"} - >>> conn = http.client.HTTPConnection("musi-cal.mojam.com:80") - >>> conn.request("POST", "/cgi-bin/query", params, headers) + >>> conn = http.client.HTTPConnection("bugs.python.org") + >>> conn.request("POST", "", params, headers) >>> response = conn.getresponse() >>> print(response.status, response.reason) - 200 OK + 302 Found >>> data = response.read() + >>> data + b'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 16:02:51 2011 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Jul 2011 16:02:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_closes_issue12524_-_update_http=2Ecli?= =?utf8?q?ent_POST_example_with_a?= Message-ID: http://hg.python.org/cpython/rev/bc71fff2b6c7 changeset: 71437:bc71fff2b6c7 parent: 71435:6f9d917df541 parent: 71436:ab4d403cb0c0 user: Senthil Kumaran date: Wed Jul 20 21:57:07 2011 +0800 summary: merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example. files: Doc/library/http.client.rst | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -592,15 +592,17 @@ Here is an example session that shows how to ``POST`` requests:: >>> import http.client, urllib.parse - >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) + >>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'}) >>> headers = {"Content-type": "application/x-www-form-urlencoded", ... "Accept": "text/plain"} - >>> conn = http.client.HTTPConnection("musi-cal.mojam.com:80") - >>> conn.request("POST", "/cgi-bin/query", params, headers) + >>> conn = http.client.HTTPConnection("bugs.python.org") + >>> conn.request("POST", "", params, headers) >>> response = conn.getresponse() >>> print(response.status, response.reason) - 200 OK + 302 Found >>> data = response.read() + >>> data + b'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 16:02:52 2011 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 20 Jul 2011 16:02:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Fix_closes_issue12524_-_update_http=2Eclient_POST_example_wi?= =?utf8?q?th_a?= Message-ID: http://hg.python.org/cpython/rev/b754641a429f changeset: 71438:b754641a429f branch: 2.7 parent: 71434:213a28b1f346 user: Senthil Kumaran date: Wed Jul 20 22:02:27 2011 +0800 summary: merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example. - Patch contributed by Bharadwaj files: Doc/library/httplib.rst | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Doc/library/httplib.rst b/Doc/library/httplib.rst --- a/Doc/library/httplib.rst +++ b/Doc/library/httplib.rst @@ -588,14 +588,16 @@ Here is an example session that shows how to ``POST`` requests:: >>> import httplib, urllib - >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) + >>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'}) >>> headers = {"Content-type": "application/x-www-form-urlencoded", ... "Accept": "text/plain"} - >>> conn = httplib.HTTPConnection("musi-cal.mojam.com:80") - >>> conn.request("POST", "/cgi-bin/query", params, headers) + >>> conn = httplib.HTTPConnection("bugs.python.org") + >>> conn.request("POST", "", params, headers) >>> response = conn.getresponse() >>> print response.status, response.reason - 200 OK + 302 Found >>> data = response.read() + >>> data + 'Redirecting to http://bugs.python.org/issue12524' >>> conn.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 16:03:28 2011 From: python-checkins at python.org (phillip.eby) Date: Wed, 20 Jul 2011 16:03:28 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Restore_whitespace_characters_?= =?utf8?q?lost_via_email_transmission=2E?= Message-ID: http://hg.python.org/peps/rev/728660b53208 changeset: 3903:728660b53208 user: pje date: Wed Jul 20 09:56:48 2011 -0400 summary: Restore whitespace characters lost via email transmission. files: pep-0402.txt | 56 ++++++++++++++++++++-------------------- 1 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pep-0402.txt b/pep-0402.txt --- a/pep-0402.txt +++ b/pep-0402.txt @@ -38,13 +38,13 @@ .. epigraph:: - "Most packages are like modules. Their contents are highly - interdependent and can't be pulled apart. [However,] some - packages exist to provide a separate namespace. ... It should - be possible to distribute sub-packages or submodules of these - [namespace packages] independently." + "Most packages are like modules. Their contents are highly + interdependent and can't be pulled apart. [However,] some + packages exist to provide a separate namespace. ... It should + be possible to distribute sub-packages or submodules of these + [namespace packages] independently." - -- Jim Fulton, shortly before the release of Python 2.3 [1]_ + -- Jim Fulton, shortly before the release of Python 2.3 [1]_ When new users come to Python from other languages, they are often @@ -413,23 +413,23 @@ In Python code, the algorithm would look something like this:: - def get_virtual_path(modulename, parent_path=None): + def get_virtual_path(modulename, parent_path=None): - if parent_path is None: - parent_path = sys.path + if parent_path is None: + parent_path = sys.path - path = [] + path = [] - for entry in parent_path: - # Obtain a PEP 302 importer object - see pkgutil module - importer = pkgutil.get_importer(entry) + for entry in parent_path: + # Obtain a PEP 302 importer object - see pkgutil module + importer = pkgutil.get_importer(entry) - if hasattr(importer, 'get_subpath'): - subpath = importer.get_subpath(modulename) - if subpath is not None: - path.append(subpath) + if hasattr(importer, 'get_subpath'): + subpath = importer.get_subpath(modulename) + if subpath is not None: + path.append(subpath) - return path + return path And a function like this one should be exposed in the standard library as e.g. ``imp.get_virtual_path()``, so that people creating @@ -563,10 +563,10 @@ ========== .. [1] "namespace" vs "module" packages (mailing list thread) - (http://mail.zope.org/pipermail/zope3-dev/2002-December/004251.html) + (http://mail.zope.org/pipermail/zope3-dev/2002-December/004251.html) .. [2] "Dropping __init__.py requirement for subpackages" - (http://mail.python.org/pipermail/python-dev/2006-April/064400.html) + (http://mail.python.org/pipermail/python-dev/2006-April/064400.html) Copyright @@ -574,12 +574,12 @@ This document has been placed in the public domain. - + .. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Jul 20 17:41:43 2011 From: python-checkins at python.org (r.david.murray) Date: Wed, 20 Jul 2011 17:41:43 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_=23665194=3A_support_roundt?= =?utf8?q?ripping_RFC2822_date_stamps_in_the_email=2Eutils_module?= Message-ID: http://hg.python.org/cpython/rev/5f7b03dcd523 changeset: 71439:5f7b03dcd523 parent: 71437:bc71fff2b6c7 user: R David Murray date: Wed Jul 20 11:41:21 2011 -0400 summary: #665194: support roundtripping RFC2822 date stamps in the email.utils module files: Doc/library/email.util.rst | 28 +++++++++++ Lib/email/_parseaddr.py | 19 +++++++- Lib/email/utils.py | 46 ++++++++++++++++-- Lib/test/test_email/test_utils.py | 45 ++++++++++++++++++ Misc/NEWS | 3 + 5 files changed, 133 insertions(+), 8 deletions(-) diff --git a/Doc/library/email.util.rst b/Doc/library/email.util.rst --- a/Doc/library/email.util.rst +++ b/Doc/library/email.util.rst @@ -81,6 +81,20 @@ indexes 6, 7, and 8 of the result tuple are not usable. +.. function:: parsedate_to_datetime(date) + + The inverse of :func:`format_datetime`. Performs the same function as + :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`. If + the input date has a timezone of ``-0000``, the ``datetime`` will be a naive + ``datetime``, and if the date is conforming to the RFCs it will represent a + time in UTC but with no indication of the actual source timezone of the + message the date comes from. If the input date has any other valid timezone + offset, the ``datetime`` will be an aware ``datetime`` with the + corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`. + + .. versionadded:: 3.3 + + .. function:: mktime_tz(tuple) Turn a 10-tuple as returned by :func:`parsedate_tz` into a UTC timestamp. It @@ -112,6 +126,20 @@ ``False``. The default is ``False``. +.. function:: format_datetime(dt, usegmt=False) + + Like ``formatdate``, but the input is a :mod:`datetime` instance. If it is + a naive datetime, it is assumed to be "UTC with no information about the + source timezone", and the conventional ``-0000`` is used for the timezone. + If it is an aware ``datetime``, then the numeric timezone offset is used. + If it is an aware timezone with offset zero, then *usegmt* may be set to + ``True``, in which case the string ``GMT`` is used instead of the numeric + timezone offset. This provides a way to generate standards conformant HTTP + date headers. + + .. versionadded:: 3.3 + + .. function:: make_msgid(idstring=None, domain=None) Returns a string suitable for an :rfc:`2822`\ -compliant diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -47,6 +47,21 @@ Accounts for military timezones. """ + res = _parsedate_tz(data) + if res[9] is None: + res[9] = 0 + return tuple(res) + +def _parsedate_tz(data): + """Convert date to extended time tuple. + + The last (additional) element is the time zone offset in seconds, except if + the timezone was specified as -0000. In that case the last element is + None. This indicates a UTC timestamp that explicitly declaims knowledge of + the source timezone, as opposed to a +0000 timestamp that indicates the + source timezone really was UTC. + + """ data = data.split() # The FWS after the comma after the day-of-week is optional, so search and # adjust for this. @@ -138,6 +153,8 @@ tzoffset = int(tz) except ValueError: pass + if tzoffset==0 and tz.startswith('-'): + tzoffset = None # Convert a timezone offset into seconds ; -0500 -> -18000 if tzoffset: if tzoffset < 0: @@ -147,7 +164,7 @@ tzsign = 1 tzoffset = tzsign * ( (tzoffset//100)*3600 + (tzoffset % 100)*60) # Daylight Saving Time flag is set to -1, since DST is unknown. - return yy, mm, dd, thh, tmm, tss, 0, 1, -1, tzoffset + return [yy, mm, dd, thh, tmm, tss, 0, 1, -1, tzoffset] def parsedate(data): diff --git a/Lib/email/utils.py b/Lib/email/utils.py --- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -11,12 +11,14 @@ 'encode_rfc2231', 'formataddr', 'formatdate', + 'format_datetime', 'getaddresses', 'make_msgid', 'mktime_tz', 'parseaddr', 'parsedate', 'parsedate_tz', + 'parsedate_to_datetime', 'unquote', ] @@ -26,6 +28,7 @@ import base64 import random import socket +import datetime import urllib.parse import warnings from io import StringIO @@ -37,6 +40,7 @@ # We need wormarounds for bugs in these methods in older Pythons (see below) from email._parseaddr import parsedate as _parsedate from email._parseaddr import parsedate_tz as _parsedate_tz +from email._parseaddr import _parsedate_tz as __parsedate_tz from quopri import decodestring as _qdecode @@ -110,6 +114,14 @@ ''', re.VERBOSE | re.IGNORECASE) +def _format_timetuple_and_zone(timetuple, zone): + return '%s, %02d %s %04d %02d:%02d:%02d %s' % ( + ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]], + timetuple[2], + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][timetuple[1] - 1], + timetuple[0], timetuple[3], timetuple[4], timetuple[5], + zone) def formatdate(timeval=None, localtime=False, usegmt=False): """Returns a date string as specified by RFC 2822, e.g.: @@ -154,14 +166,25 @@ zone = 'GMT' else: zone = '-0000' - return '%s, %02d %s %04d %02d:%02d:%02d %s' % ( - ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][now[6]], - now[2], - ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][now[1] - 1], - now[0], now[3], now[4], now[5], - zone) + return _format_timetuple_and_zone(now, zone) +def format_datetime(dt, usegmt=False): + """Turn a datetime into a date string as specified in RFC 2822. + + If usegmt is True, dt must be an aware datetime with an offset of zero. In + this case 'GMT' will be rendered instead of the normal +0000 required by + RFC2822. This is to support HTTP headers involving date stamps. + """ + now = dt.timetuple() + if usegmt: + if dt.tzinfo is None or dt.tzinfo != datetime.timezone.utc: + raise ValueError("usegmt option requires a UTC datetime") + zone = 'GMT' + elif dt.tzinfo is None: + zone = '-0000' + else: + zone = dt.strftime("%z") + return _format_timetuple_and_zone(now, zone) def make_msgid(idstring=None, domain=None): @@ -203,6 +226,15 @@ return None return _parsedate_tz(data) +def parsedate_to_datetime(data): + if not data: + return None + *dtuple, tz = __parsedate_tz(data) + if tz is None: + return datetime.datetime(*dtuple[:6]) + return datetime.datetime(*dtuple[:6], + tzinfo=datetime.timezone(datetime.timedelta(seconds=tz))) + def parseaddr(addr): addrs = _AddressList(addr).addresslist diff --git a/Lib/test/test_email/test_utils.py b/Lib/test/test_email/test_utils.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_email/test_utils.py @@ -0,0 +1,45 @@ +import datetime +from email import utils +import unittest + +class DateTimeTests(unittest.TestCase): + + datestring = 'Sun, 23 Sep 2001 20:10:55' + dateargs = (2001, 9, 23, 20, 10, 55) + offsetstring = ' -0700' + utcoffset = datetime.timedelta(hours=-7) + tz = datetime.timezone(utcoffset) + naive_dt = datetime.datetime(*dateargs) + aware_dt = datetime.datetime(*dateargs, tzinfo=tz) + + def test_naive_datetime(self): + self.assertEqual(utils.format_datetime(self.naive_dt), + self.datestring + ' -0000') + + def test_aware_datetime(self): + self.assertEqual(utils.format_datetime(self.aware_dt), + self.datestring + self.offsetstring) + + def test_usegmt(self): + utc_dt = datetime.datetime(*self.dateargs, + tzinfo=datetime.timezone.utc) + self.assertEqual(utils.format_datetime(utc_dt, usegmt=True), + self.datestring + ' GMT') + + def test_usegmt_with_naive_datetime_raises(self): + with self.assertRaises(ValueError): + utils.format_datetime(self.naive_dt, usegmt=True) + + def test_usegmt_with_non_utc_datetime_raises(self): + with self.assertRaises(ValueError): + utils.format_datetime(self.aware_dt, usegmt=True) + + def test_parsedate_to_datetime(self): + self.assertEqual( + utils.parsedate_to_datetime(self.datestring + self.offsetstring), + self.aware_dt) + + def test_parsedate_to_datetime_naive(self): + self.assertEqual( + utils.parsedate_to_datetime(self.datestring + ' -0000'), + self.naive_dt) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,9 @@ Library ------- +- Issue #665194: email.utils now has format_datetime and parsedate_to_datetime + functions, allowing for round tripping of RFC2822 format dates. + - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jul 20 21:51:33 2011 From: python-checkins at python.org (phillip.eby) Date: Wed, 20 Jul 2011 21:51:33 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Fix_backward-compatibility_hol?= =?utf8?q?e_described_by_Jeff_Hardy_in=3A?= Message-ID: http://hg.python.org/peps/rev/a6f02035c66c changeset: 3904:a6f02035c66c user: pje date: Wed Jul 20 14:48:00 2011 -0400 summary: Fix backward-compatibility hole described by Jeff Hardy in: http://mail.python.org/pipermail/python-dev/2011-July/112370.html Using the approach described here: http://mail.python.org/pipermail/python-dev/2011-July/112374.html This should now restrict backward-compatibility concerns to tool-support questions, unless somebody comes up with another way to break it. ;-) files: pep-0402.txt | 190 +++++++++++++++++++++++++++----------- 1 files changed, 135 insertions(+), 55 deletions(-) diff --git a/pep-0402.txt b/pep-0402.txt --- a/pep-0402.txt +++ b/pep-0402.txt @@ -339,17 +339,57 @@ checking for a ``__version__`` or some other attribute), *and* there is a directory of the same name as the sought-for package on ``sys.path`` somewhere, *and* the package is not actually installed, -then such code could *perhaps* be fooled into thinking a package is -installed that really isn't. +then such code could be fooled into thinking a package is installed +that really isn't. -However, even in the rare case where all these conditions line up to -happen at once, the failure is more likely to be annoying than -damaging. In most cases, after all, the code will simply fail a -little later on, when it actually tries to DO something with the -imported (but empty) module. (And code that checks ``__version__`` -attributes or for the presence of some desired function, class, or -module in the package will not see a false positive result in the -first place.) +For example, suppose someone writes a script (``datagen.py``) +containing the following code:: + + try: + import json + except ImportError: + import simplejson as json + +And runs it in a directory laid out like this:: + + datagen.py + json/ + foo.js + bar.js + +If ``import json`` succeeded due to the mere presence of the ``json/`` +subdirectory, the code would incorrectly believe that the ``json`` +module was available, and proceed to fail with an error. + +However, we can prevent corner cases like these from arising, simply +by making one small change to the algorithm presented so far. Instead +of allowing you to import a "pure virtual" package (like ``zc``), +we allow only importing of the *contents* of virtual packages. + +That is, a statement like ``import zc`` should raise ``ImportError`` +if there is no ``zc.py`` or ``zc/__init__.py`` on ``sys.path``. But, +doing ``import zc.buildout`` should still succeed, as long as there's +a ``zc/buildout.py`` or ``zc/buildout/__init__.py`` on ``sys.path``. + +In other words, we don't allow pure virtual packages to be imported +directly, only modules and self-contained packages. (This is an +acceptable limitation, because there is no *functional* value to +importing such a package by itself. After all, the module object +will have no *contents* until you import at least one of its +subpackages or submodules!) + +Once ``zc.buildout`` has been successfully imported, though, there +*will* be a ``zc`` module in ``sys.modules``, and trying to import it +will of course succeed. We are only preventing an *initial* import +from succeeding, in order to prevent false-positive import successes +when clashing subdirectories are present on ``sys.path``. + +So, with this slight change, the ``datagen.py`` example above will +work correctly. When it does ``import json``, the mere presence of a +``json/`` directory will simply not affect the import process at all, +even if it contains ``.py`` files. The ``json/`` directory will still +only be searched in the case where an import like ``import +json.converter`` is attempted. Meanwhile, tools that expect to locate packages and modules by walking a directory tree can be updated to use the existing @@ -361,41 +401,54 @@ Specification ============= -Two changes are made to the existing import process. +A change is made to the existing import process, when importing +names containing at least one ``.`` -- that is, imports of modules +that have a parent package. -First, the built-in ``__import__`` function must not raise an -``ImportError`` when importing a submodule of a module with no -``__path__``. Instead, it must attempt to *create* a ``__path__`` -attribute for the parent module first, as described in `__path__ -creation`_, below. +Specifically, if the parent package does not exist, or exists but +lacks a ``__path__`` attribute, an attempt is first made to create a +"virtual path" for the parent package (following the algorithm +described in the section on `virtual paths`_, below). -Second, if searching ``sys.meta_path`` and ``sys.path`` (or a parent -package ``__path__``) fails to find a module being imported, the -import process must attempt to create a ``__path__`` attribute for -the missing module. If the attempt succeeds, an empty module is -created and its ``__path__`` is set. Otherwise, importing fails. +If the computed "virtual path" is empty, an ``ImportError`` results, +just as it would today. However, if a non-empty virtual path is +obtained, the normal import of the submodule or subpackage proceeds, +using that virtual path to find the submodule or subpackage. (Just +as it would have with the parent's ``__path__``, if the parent package +had existed and had a ``__path__``.) -In both of the above cases, if a non-empty ``__path__`` is created, -the name of the module whose ``__path__`` was created is added to -``sys.virtual_packages`` -- an initially-empty ``set()`` of package -names. +When a submodule or subpackage is found (but not yet loaded), +the parent package is created and added to ``sys.modules`` (if it +didn't exist before), and its ``__path__`` is set to the computed +virtual path (if it wasn't already set). -(This way, code that extends ``sys.path`` at runtime can find out -what virtual packages are currently imported, and thereby add any -new subdirectories to those packages' ``__path__`` attributes. See -`Standard Library Changes/Additions`_ below for more details.) +In this way, when the actual loading of the submodule or subpackage +occurs, it will see a parent package existing, and any relative +imports will work correctly. However, if no submodule or subpackage +exists, then the parent package will *not* be created, nor will a +standalone module be converted into a package (by the addition of a +spurious ``__path__`` attribute). -Conversely, if an empty ``__path__`` results, an ``ImportError`` -is immediately raised, and the module is not created or changed, nor -is its name added to ``sys.virtual_packages``. +Note, by the way, that this change must be applied *recursively*: that +is, if ``foo`` and ``foo.bar`` are pure virtual packages, then +``import foo.bar.baz`` must wait until ``foo.bar.baz`` is found before +creating module objects for *both* ``foo`` and ``foo.bar``, and then +create both of them together, properly setting the ``foo`` module's +``.bar`` attrbute to point to the ``foo.bar``module. +In this way, pure virtual packages are never directly importable: +an ``import foo`` or ``import foo.bar`` by itself will fail, and the +corresponding modules will not appear in ``sys.modules`` until they +are needed to point to a *successfully* imported submodule or +self-contained subpackage. -``__path__`` Creation ---------------------- -A virtual ``__path__`` is created by obtaining a PEP 302 "importer" -object for each of the path entries found in ``sys.path`` (for a -top-level module) or the parent ``__path__`` (for a submodule). +Virtual Paths +------------- + +A virtual path is created by obtaining a PEP 302 "importer" object for +each of the path entries found in ``sys.path`` (for a top-level +module) or the parent ``__path__`` (for a submodule). (Note: because ``sys.meta_path`` importers are not associated with ``sys.path`` or ``__path__`` entry strings, such importers do *not* @@ -403,18 +456,34 @@ Each importer is checked for a ``get_subpath()`` method, and if present, the method is called with the full name of the module/package -the ``__path__`` is being constructed for. The return value is either -a string representing a subdirectory for the requested package, or +the path is being constructed for. The return value is either a +string representing a subdirectory for the requested package, or ``None`` if no such subdirectory exists. -The strings returned by the importers are added to the ``__path__`` +The strings returned by the importers are added to the path list being built, in the same order as they are found. (``None`` values and missing ``get_subpath()`` methods are simply skipped.) -In Python code, the algorithm would look something like this:: +The resulting list (whether empty or not) is then stored in a +``sys.virtual_package_paths`` dictionary, keyed by module name. + +This dictionary has two purposes. First, it serves as a cache, in +the event that more than one attempt is made to import a submodule +of a virtual package. + +Second, and more importantly, the dictionary can be used by code that +extends ``sys.path`` at runtime to *update* imported packages' +``__path__`` attributes accordingly. (See `Standard Library +Changes/Additions`_ below for more details.) + +In Python code, the virtual path construction algorithm would look +something like this:: def get_virtual_path(modulename, parent_path=None): + if modulename in sys.virtual_package_paths: + return sys.virtual_package_paths[modulename] + if parent_path is None: parent_path = sys.path @@ -429,6 +498,7 @@ if subpath is not None: path.append(subpath) + sys.virtual_package_paths[modulename] = path return path And a function like this one should be exposed in the standard @@ -453,19 +523,25 @@ path. The implementation of this function does a simple top-down traversal - of ``sys.virtual_packages``, and performs any necessary - ``get_subpath()`` calls to identify what path entries need to - be added to each package's ``__path__``, given that `path_entry` + of ``sys.virtual_package_paths``, and performs any necessary + ``get_subpath()`` calls to identify what path entries need to be + added to the virtual path for that package, given that `path_entry` has been added to ``sys.path``. (Or, in the case of sub-packages, - adding a derived subpath entry, based on their parent namespace's - ``__path__``.) + adding a derived subpath entry, based on their parent package's + virtual path.) + + (Note: this function must update both the path values in + ``sys.virtual_package_paths`` as well as the ``__path__`` attributes + of any corresponding modules in ``sys.modules``, even though in the + common case they will both be the same ``list`` object.) * A new ``iter_virtual_packages(parent='')`` function to allow - top-down traversal of virtual packages in ``sys.virtual_packages``, - by yielding the child virtual packages of `parent`. For example, - calling ``iter_virtual_packages("zope")`` might yield ``zope.app`` - and ``zope.products`` (if they are imported virtual packages listed - in ``sys.virtual_packages``), but **not** ``zope.foo.bar``. + top-down traversal of virtual packages from + ``sys.virtual_package_paths``, by yielding the child virtual + packages of `parent`. For example, calling + ``iter_virtual_packages("zope")`` might yield ``zope.app`` + and ``zope.products`` (if they are virtual packages listed in + ``sys.virtual_package_paths``), but **not** ``zope.foo.bar``. (This function is needed to implement ``extend_virtual_paths()``, but is also potentially useful for other code that needs to inspect imported virtual packages.) @@ -500,10 +576,11 @@ and do other things that make more sense for a self-contained project than for a mere "namespace" package. -* ``sys.virtual_packages`` is allowed to contain non-existent or - not-yet-imported package names; code that uses its contents should - not assume that every name in this set is also present in - ``sys.modules`` or that importing the name will necessarily succeed. +* ``sys.virtual_package_paths`` is allowed to contain entries for + non-existent or not-yet-imported package names; code that uses its + contents should not assume that every key in this dictionary is also + present in ``sys.modules`` or that importing the name will + necessarily succeed. * If you are changing a currently self-contained package into a virtual one, it's important to note that you can no longer use its @@ -539,7 +616,9 @@ XXX This might list a lot of not-really-packages. Should we require importable contents to exist? If so, how deep do we search, and how do we prevent e.g. link loops, or traversing onto - different filesystems, etc.? Ick. + different filesystems, etc.? Ick. Also, if virtual packages are + listed, they still can't be *imported*, which is a problem for the + way that ``pkgutil.walk_modules()`` is currently implemented. * "Meta" importers (i.e., importers placed on ``sys.meta_path``) do not need to implement ``get_subpath()``, because the method -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 21 01:12:49 2011 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 21 Jul 2011 01:12:49 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312551=3A_Provide_a?= =?utf8?q?_get=5Fchannel=5Fbinding=28=29_method_on_SSL_sockets_so_as?= Message-ID: http://hg.python.org/cpython/rev/cb44fef5ea1d changeset: 71440:cb44fef5ea1d user: Antoine Pitrou date: Thu Jul 21 01:11:30 2011 +0200 summary: Issue #12551: Provide a get_channel_binding() method on SSL sockets so as to get channel binding data for the current SSL session (only the "tls-unique" channel binding is implemented). This allows the implementation of certain authentication mechanisms such as SCRAM-SHA-1-PLUS. Patch by Jacek Konieczny. files: Doc/library/ssl.rst | 19 ++++++ Lib/ssl.py | 19 ++++++ Lib/test/test_ssl.py | 91 ++++++++++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 6 ++ Modules/_ssl.c | 60 +++++++++++++++++++++ 6 files changed, 196 insertions(+), 0 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -386,6 +386,13 @@ .. versionadded:: 3.2 +.. data:: CHANNEL_BINDING_TYPES + + List of supported TLS channel binding types. Strings in this list + can be used as arguments to :meth:`SSLSocket.get_channel_binding`. + + .. versionadded:: 3.3 + .. data:: OPENSSL_VERSION The version string of the OpenSSL library loaded by the interpreter:: @@ -495,6 +502,18 @@ version of the SSL protocol that defines its use, and the number of secret bits being used. If no connection has been established, returns ``None``. +.. method:: SSLSocket.get_channel_binding(cb_type="tls-unique") + + Get channel binding data for current connection, as a bytes object. Returns + ``None`` if not connected or the handshake has not been completed. + + The *cb_type* parameter allow selection of the desired channel binding + type. Valid channel binding types are listed in the + :data:`CHANNEL_BINDING_TYPES` list. Currently only the 'tls-unique' channel + binding, defined by :rfc:`5929`, is supported. :exc:`ValueError` will be + raised if an unsupported channel binding type is requested. + + .. versionadded:: 3.3 .. method:: SSLSocket.unwrap() diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -99,6 +99,10 @@ import traceback import errno +if _ssl.HAS_TLS_UNIQUE: + CHANNEL_BINDING_TYPES = ['tls-unique'] +else: + CHANNEL_BINDING_TYPES = [] class CertificateError(ValueError): pass @@ -495,6 +499,21 @@ self.do_handshake_on_connect), addr) + def get_channel_binding(self, cb_type="tls-unique"): + """Get channel binding data for current connection. Raise ValueError + if the requested `cb_type` is not supported. Return bytes of the data + or None if the data is not available (e.g. before the handshake). + """ + if cb_type not in CHANNEL_BINDING_TYPES: + raise ValueError("Unsupported channel binding type") + if cb_type != "tls-unique": + raise NotImplementedError( + "{0} channel binding type not implemented" + .format(cb_type)) + if self._sslobj is None: + return None + return self._sslobj.tls_unique_cb() + def __del__(self): # sys.stderr.write("__del__ on %s\n" % repr(self)) self._real_close() diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -321,6 +321,25 @@ self.assertRaises(ValueError, ctx.wrap_socket, sock, True, server_hostname="some.hostname") + def test_unknown_channel_binding(self): + # should raise ValueError for unknown type + s = socket.socket(socket.AF_INET) + ss = ssl.wrap_socket(s) + with self.assertRaises(ValueError): + ss.get_channel_binding("unknown-type") + + @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, + "'tls-unique' channel binding not available") + def test_tls_unique_channel_binding(self): + # unconnected should return None for known type + s = socket.socket(socket.AF_INET) + ss = ssl.wrap_socket(s) + self.assertIsNone(ss.get_channel_binding("tls-unique")) + # the same for server-side + s = socket.socket(socket.AF_INET) + ss = ssl.wrap_socket(s, server_side=True, certfile=CERTFILE) + self.assertIsNone(ss.get_channel_binding("tls-unique")) + class ContextTests(unittest.TestCase): @skip_if_broken_ubuntu_ssl @@ -826,6 +845,11 @@ self.sslconn = None if support.verbose and self.server.connectionchatty: sys.stdout.write(" server: connection is now unencrypted...\n") + elif stripped == b'CB tls-unique': + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read CB tls-unique from client, sending our CB data...\n") + data = self.sslconn.get_channel_binding("tls-unique") + self.write(repr(data).encode("us-ascii") + b"\n") else: if (support.verbose and self.server.connectionchatty): @@ -1625,6 +1649,73 @@ t.join() server.close() + @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, + "'tls-unique' channel binding not available") + def test_tls_unique_channel_binding(self): + """Test tls-unique channel binding.""" + if support.verbose: + sys.stdout.write("\n") + + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + s = ssl.wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + try: + # get the data + cb_data = s.get_channel_binding("tls-unique") + if support.verbose: + sys.stdout.write(" got channel binding data: {0!r}\n" + .format(cb_data)) + + # check if it is sane + self.assertIsNotNone(cb_data) + self.assertEqual(len(cb_data), 12) # True for TLSv1 + + # and compare with the peers version + s.write(b"CB tls-unique\n") + peer_data_repr = s.read().strip() + self.assertEqual(peer_data_repr, + repr(cb_data).encode("us-ascii")) + s.close() + + # now, again + s = ssl.wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + new_cb_data = s.get_channel_binding("tls-unique") + if support.verbose: + sys.stdout.write(" got another channel binding data: {0!r}\n" + .format(new_cb_data)) + # is it really unique + self.assertNotEqual(cb_data, new_cb_data) + self.assertIsNotNone(cb_data) + self.assertEqual(len(cb_data), 12) # True for TLSv1 + s.write(b"CB tls-unique\n") + peer_data_repr = s.read().strip() + self.assertEqual(peer_data_repr, + repr(new_cb_data).encode("us-ascii")) + s.close() + finally: + server.stop() + server.join() def test_main(verbose=False): if support.verbose: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -516,6 +516,7 @@ Pat Knight Greg Kochanski Damon Kohler +Jacek Konieczny ???? ????????? Vlad Korolev Joseph Koshy diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,12 @@ Library ------- +- Issue #12551: Provide a get_channel_binding() method on SSL sockets so as + to get channel binding data for the current SSL session (only the + "tls-unique" channel binding is implemented). This allows the implementation + of certain authentication mechanisms such as SCRAM-SHA-1-PLUS. Patch by + Jacek Konieczny. + - Issue #665194: email.utils now has format_datetime and parsedate_to_datetime functions, allowing for round tripping of RFC2822 format dates. diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -124,6 +124,17 @@ # undef HAVE_SSL_CTX_CLEAR_OPTIONS #endif +/* In case of 'tls-unique' it will be 12 bytes for TLS, 36 bytes for + * older SSL, but let's be safe */ +#define PySSL_CB_MAXLEN 128 + +/* SSL_get_finished got added to OpenSSL in 0.9.5 */ +#if OPENSSL_VERSION_NUMBER >= 0x0090500fL +# define HAVE_OPENSSL_FINISHED 1 +#else +# define HAVE_OPENSSL_FINISHED 0 +#endif + typedef struct { PyObject_HEAD SSL_CTX *ctx; @@ -135,6 +146,7 @@ SSL *ssl; X509 *peer_cert; int shutdown_seen_zero; + enum py_ssl_server_or_client socket_type; } PySSLSocket; static PyTypeObject PySSLContext_Type; @@ -328,6 +340,7 @@ SSL_set_accept_state(self->ssl); PySSL_END_ALLOW_THREADS + self->socket_type = socket_type; self->Socket = PyWeakref_NewRef((PyObject *) sock, NULL); return self; } @@ -1377,6 +1390,41 @@ Does the SSL shutdown handshake with the remote end, and returns\n\ the underlying socket object."); +#if HAVE_OPENSSL_FINISHED +static PyObject * +PySSL_tls_unique_cb(PySSLSocket *self) +{ + PyObject *retval = NULL; + char buf[PySSL_CB_MAXLEN]; + int len; + + if (SSL_session_reused(self->ssl) ^ !self->socket_type) { + /* if session is resumed XOR we are the client */ + len = SSL_get_finished(self->ssl, buf, PySSL_CB_MAXLEN); + } + else { + /* if a new session XOR we are the server */ + len = SSL_get_peer_finished(self->ssl, buf, PySSL_CB_MAXLEN); + } + + /* It cannot be negative in current OpenSSL version as of July 2011 */ + assert(len >= 0); + if (len == 0) + Py_RETURN_NONE; + + retval = PyBytes_FromStringAndSize(buf, len); + + return retval; +} + +PyDoc_STRVAR(PySSL_tls_unique_cb_doc, +"tls_unique_cb() -> bytes\n\ +\n\ +Returns the 'tls-unique' channel binding data, as defined by RFC 5929.\n\ +\n\ +If the TLS handshake is not yet complete, None is returned"); + +#endif /* HAVE_OPENSSL_FINISHED */ static PyMethodDef PySSLMethods[] = { {"do_handshake", (PyCFunction)PySSL_SSLdo_handshake, METH_NOARGS}, @@ -1391,6 +1439,10 @@ {"cipher", (PyCFunction)PySSL_cipher, METH_NOARGS}, {"shutdown", (PyCFunction)PySSL_SSLshutdown, METH_NOARGS, PySSL_SSLshutdown_doc}, +#if HAVE_OPENSSL_FINISHED + {"tls_unique_cb", (PyCFunction)PySSL_tls_unique_cb, METH_NOARGS, + PySSL_tls_unique_cb_doc}, +#endif {NULL, NULL} }; @@ -2221,6 +2273,14 @@ Py_INCREF(r); PyModule_AddObject(m, "HAS_SNI", r); +#if HAVE_OPENSSL_FINISHED + r = Py_True; +#else + r = Py_False; +#endif + Py_INCREF(r); + PyModule_AddObject(m, "HAS_TLS_UNIQUE", r); + /* OpenSSL version */ /* SSLeay() gives us the version of the library linked against, which could be different from the headers version. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Jul 21 05:28:48 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 21 Jul 2011 05:28:48 +0200 Subject: [Python-checkins] Daily reference leaks (cb44fef5ea1d): sum=0 Message-ID: results for cb44fef5ea1d on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogGRsOtX', '-x'] From python-checkins at python.org Thu Jul 21 08:20:07 2011 From: python-checkins at python.org (mark.hammond) Date: Thu, 21 Jul 2011 08:20:07 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_update_to_reflect_new_C_impl?= =?utf8?q?=2C_refer_some_impl_details_to_launcher_docs?= Message-ID: http://hg.python.org/peps/rev/d57869d87c57 changeset: 3905:d57869d87c57 user: Mark Hammond date: Thu Jul 21 16:19:40 2011 +1000 summary: update to reflect new C impl, refer some impl details to launcher docs files: pep-0397.txt | 185 +++++++++++++------------------------- 1 files changed, 66 insertions(+), 119 deletions(-) diff --git a/pep-0397.txt b/pep-0397.txt --- a/pep-0397.txt +++ b/pep-0397.txt @@ -7,7 +7,7 @@ Type: Standards Track Content-Type: text/plain Created: 15-Mar-2011 -Post-History: 17-May-2011, 15-Mar-2011 +Post-History: 21-July-2011, 17-May-2011, 15-Mar-2011 Abstract @@ -41,7 +41,7 @@ page describes a valid shebang line. Additionally, these operating systems provide symbolic-links to - Python executables in well-known directories. For example, many + Python executables in well-known directories. For example, many systems will have a link /usr/bin/python which references a particular version of Python installed under the operating-system. These symbolic links allow Python to be executed without regard for @@ -67,8 +67,8 @@ An overview of the launcher. This PEP outlines the general functionality and key guidelines of a - launcher for Windows. It is accompanied by a reference implementation - [3], written in Python, which defines the detailed implementation. Over + launcher for Windows. It is accompanied by an implementation [3], + written in C, which defines the detailed implementation. Over time, changes to the implementation may be desired - if the changes adhere to the guidelines in this PEP and have been made following the standard Python development model this PEP need not change. @@ -76,33 +76,26 @@ feature offered by the launcher but instead to offer guidelines the launcher should adhere to. - The actual implementation of the launcher will be written in C and - will not link directly or indirectly with Python, but the Python - based reference implementation should always remain the canonical - description of the functionality. Any changes proposed to the - launcher functionality should first be made and agreed to in the - Python implementation, after which time the C implementation can be - changed to reflect the new reference. Any deviations between the - functionality of the reference implementation versus the C - implementation due should imply the C implementation is in error - (although some exceptions will need to be made due to the nature of the - reference implementation being in Python) - - It is expected that 2 versions of the launcher will be needed - one - which is a console program and one which is a "windows" (ie., GUI) - program. These 2 launchers correspond to the 'python.exe' and - 'pythonw.exe' executables which currently ship with Python. The - console launcher will be named 'py.exe' and the Windows one named - 'pyw.exe'. The "windows" (ie., GUI) version of the launcher will attempt - to locate and launch pythonw.exe even if a virtual shebang line nominates - simply "python" - infact, the trailing 'w' notation will not be supported - in the virtual shebang line at all. + The launcher will come in 2 versions - one which is a console program and + one which is a "windows" (ie., GUI) program. These 2 launchers correspond + to the 'python.exe' and 'pythonw.exe' executables which currently ship + with Python. The console launcher will be named 'py.exe' and the Windows + one named 'pyw.exe'. The "windows" (ie., GUI) version of the launcher + will attempt to locate and launch pythonw.exe even if a virtual shebang + line nominates simply "python" - infact, the trailing 'w' notation will + not be supported in the virtual shebang line at all. The launcher will be distributed with all future versions of Python - and if possible, should be installed somewhere likely to already be - on the system PATH (eg., the Windows System32) directory. If installed, - the "console" version of the launcher should be associated with .py files - and the "windows" version associated with .pyw files. + and if possible, should be installed directly into the Windows directory + (note that the System32 directory is not a good option as this directory + is not on the default PATH for 32bit processes on a 64bit Windows.) If + the launcher can't be installed in the Windows directory, the installer + can suggest or choose an alternative, but it will be the responsibility + of the user to ensure this directory is on the PATH. + + Once installed, the "console" version of the launcher should be + associated with .py files and the "windows" version associated with .pyw + files. The launcher will not be tied to a specific version of Python - eg., a launcher distributed with Python 3.3 should be capable of locating and @@ -111,12 +104,12 @@ versions of Python can install an updated version of the launcher without impacting how the previously installed version of the launcher is used. - The launcher will offer some conveniences for Python developers working + The launcher may offer some conveniences for Python developers working interactively - for example, starting the launcher with no command-line arguments will launch the default Python with no command-line arguments. Further, command-line arguments will be supported to allow a specific Python version to be launched interactively - however, these conveniences - will not detract from the primary purpose of launching scripts and will + must not detract from the primary purpose of launching scripts and must be easy to avoid if desired. Guidelines for a Python launcher. @@ -130,7 +123,7 @@ in [1], including all restrictions listed. The launcher should support shebang lines commonly found on Unix. - For example, a shebang line of '!# /usr/bin/python' should work even + For example, a shebang line of '#! /usr/bin/python' should work even though there is unlikely to be an executable in the relative Windows directory "\usr\bin". This means that many scripts can use a single shebang line and be likely to work on both Unix and Windows without @@ -146,20 +139,21 @@ common links on Unix (such as "/usr/bin/jython") and the inability for the launcher to automatically locate the installation location of these implementations on Windows, the launcher will support this via - customization options. Scripts taking advantage of this will not be + customization options. Scripts taking advantage of this will not be portable (as these customization options must be set to reflect the configuration of the machine on which the launcher is running) but this ability is nonetheless considered worthwhile. On Unix, the user can control which specific version of Python is used by adjusting the links in /usr/bin to point to the desired version. As - the launcher on Windows will not use Windows links, environment variables - will be used to override the semantics for determining exactly what - version of Python will be used. For example, while a shebang line of - "/usr/bin/python2" will automatically locate a Python 2.x implementation, - an environment variable can override exactly which Python 2.x - implementation will be chosen. Similarly for "/usr/bin/python" and - "/usr/bin/python3". This is specified in detail later in this PEP. + the launcher on Windows will not use Windows links, cutomization options + (exposed via both environment variables and INI files) will be used to + override the semantics for determining what version of Python will be + used. For example, while a shebang line of "/usr/bin/python2" will + automatically locate a Python 2.x implementation, an environment variable + can override exactly which Python 2.x implementation will be chosen. + Similarly for "/usr/bin/python" and "/usr/bin/python3". This is + specified in detail later in this PEP. Shebang line parsing @@ -172,17 +166,19 @@ followed by a space character, the customized command will be used. See below for a description of customized commands. - * If the command starts with the strings '/usr/bin/python', - '/usr/bin/env python' or 'python' the command will be treated as a + * The launcher will define a set of strings which are considered Unix + compatible commands to launch Python, such as '/usr/bin/python' etc. + If a command matching one of these strings will be treated as a 'virtual command' and the rules described in Python Version Qualifiers (below) will be used to locate the executable to use. * Otherwise the command is assumed to be directly ready to execute - ie. - a fully-qualified path optionally followed by arguments. The contents - of the string will not be parsed - it will be passed directly to the - Windows CreateProcess function after appending the name of the script - and the launcher command-line arguments. This means that the rules used - by CreateProcess will be used, including how relative path names and + a fully-qualified path (or a reference to an executable on the PATH) + optionally followed by arguments. The contents of the string will not + be parsed - it will be passed directly to the Windows CreateProcess + function after appending the name of the script and the launcher + command-line arguments. This means that the rules used by + CreateProcess will be used, including how relative path names and executable references without extensions are treated. Notably, the Windows command processor will not be used, so special rules used by the command processor (such as automatic appending of extensions other than @@ -195,7 +191,7 @@ If the first argument can not be opened as a file or if no valid shebang line can be found, the launcher will act as if a shebang line of - '!#python' was found - ie., a default Python interpreter will be + '#!python' was found - ie., a default Python interpreter will be located and the arguments passed to that. However, if a valid shebang line is found but the process specified by that line can not be started, the default interpreter will not be started - the error @@ -204,8 +200,9 @@ Virtual commands in shebang lines: - Virtual Commands are shebang lines which start with the strings - '/usr/bin/python', '/usr/bin/env python' or 'python'. Optionally, the + Virtual Commands are shebang lines which start with strings which would + be expected to work on Unix platforms - examples include + '/usr/bin/python', '/usr/bin/env python' and 'python'. Optionally, the virtual command may be suffixed with a version qualifier (see below), such as '/usr/bin/python2' or '/usr/bin/python3.2'. The command executed is based on the rules described in Python Version Qualifiers below. @@ -227,13 +224,8 @@ result in the launcher using the command-line 'c:\bin\vpython.exe -foo doit.py' - Two .ini files will be searched by the launcher - 'py.ini' in the - current user's "application data" directory (ie, the directory returned - by calling the Windows function SHGetFolderPath with CSIDL_APPDATA) and - 'py.ini' in the same directory as the launcher. Commands specified - in the "application directory" will have precendence over the one next to - the executable, and the same .ini files will be used by both the Windows - and Console versions of the launcher. + The precise details about the names, locations and search order of the + .ini files is in the launcher documentation [4] Python Version Qualifiers @@ -246,19 +238,6 @@ the 32bit implementation of that version be used. Note that no "-64" qualifier is necessary as this is the default implementation (see below). - If no version qualifiers are found, the environment variable PY_PYTHON can - be set to specify the default version qualifier - the default value is - "2". Note this value could specify just a major version (eg., "2") or a - major.minor qualifier (eg., "2.6"), or even major.minor-32. - - If no minor version qualfiers are found, the environment variable - PY_PYTHON{major} (where {major} is the current major version qualifier - as determined above) can be set to specify the full version. If no such - option is found, the launcher will enumerate the installed Python - versions and use the latest minor release found for the major version, - which is likely, although not guaranteed, to be the most recently - installed version in that family. - On 64bit Windows with both 32bit and 64bit implementations of the same (major.minor) Python version installed, the 64bit version will always be preferred. This will be true for both 32bit and 64bit @@ -266,48 +245,15 @@ execute a 64bit Python installation of the specified version if available. This is so the behavior of the launcher can be predicted knowing only what versions are installed on the PC and without - regard to the order in which they were installed. As noted above, an - optional "-32" suffix can be used on a version specifier to change this - behaviour. + regard to the order in which they were installed (ie, without knowing + whether a 32 or 64bit version of Python and corresponding launcher was + installed last). As noted above, an optional "-32" suffix can be used + on a version specifier to change this behaviour. - Examples: - - * If no relevant options are set, the commands 'python' and - 'python2' will use the latest Python 2.x version installed and - the command 'python3' will use the lastest Python 3.x installed. - - * The commands 'python3.1' and 'python2.7' will not consult any - options at all as the versions are fully specified. - - * if 'PY_PYTHON=3', the commands 'python' and 'python3' will both use - the latest installed Python 3 version. - - * if 'PY_PYTHON=3.1-32', the command 'python' will use the 32bit - implementation of 3.1 whereas the command 'python3' will use the latest - installed Python (PY_PYTHON was not considered at all as a major - version was specified.) - - * if 'PY_PYTHON=3' and 'PY_PYTHON3=3.1', the commands - 'python' and 'python3' will both use specifically 3.1 - - In addition to environment variables, the same settings can be configured - in the .INI file used by the launcher. The section in the INI file will - be called '[defaults]' and the key name will be the same as the - environment variables without the leading 'PY_' prefix (and note that - the key names in the INI file are case insensitive. The contents of - an environment variable will override things specified in the INI file. - - For example: - * Setting 'PY_PYTHON=3.1' is equivilent to the INI file - containing: - [defaults] - python=3.1 - - * Setting 'PY_PYTHON=3' and 'PY_PYTHON3=3.1' is equivilent to the INI file - containing: - [defaults] - python=3 - python3=3.1 + The launcher will support various customization options to allow + fine-grained control over which specific Python version is chosen given + a partial or empty version qualifier - see the launcher documentation [4] + for details. Command-line handling @@ -316,10 +262,10 @@ If the only command-line argument is "-h" or "--help", the launcher will print a small banner and command-line usage, then pass the argument to - the default Python. This will cause help for the launcher being printed - followed by help for Python itself. The output from the launcher will - attempt to clearly indicate the extended help information is coming from - the launcher and not Python. + the default Python. This will cause help for the launcher being printed + followed by help for Python itself. The output from the launcher will + clearly indicate the extended help information is coming from the + launcher and not Python. As a concession to interactively launching Python, the launcher will support the first command-line argument optionally being a dash ("-") @@ -359,8 +305,7 @@ child is launched using the exact same version running the parent script. If sys.executable referred to the launcher the child would be likely executed using a Python 2.x version and would be likely to fail with a - SyntaxError. A solution for this would need to be found before this could - be considered. + SyntaxError. Another hurdle is the support for alternative Python implementations using the "customized commands" feature described above, where loading @@ -372,7 +317,7 @@ Given these considerations, the launcher will execute it's command in a child process, remaining alive while the child process is executing, then - terminate with the same exit code as returned by the child. To address the + terminate with the same exit code as returned by the child. To address concerns regarding the termination of the launcher not killing the child, the Win32 Job API will be used to arrange so that the child process is automatically killed when the parent is terminated (although children of @@ -386,7 +331,9 @@ [2] http://www.python.org/dev/peps/pep-0394/ - [3] http://bugs.python.org/issue11629 + [3] https://bitbucket.org/vinay.sajip/pylauncher + + [4] https://bitbucket.org/vinay.sajip/pylauncher/src/tip/Docs/launcher.rst Copyright -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 21 08:39:57 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 08:39:57 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzExNDM1OiBsaW5r?= =?utf8?q?_to_the_correct_branch=2E?= Message-ID: http://hg.python.org/cpython/rev/79d2682c4fc5 changeset: 71441:79d2682c4fc5 branch: 3.2 parent: 71436:ab4d403cb0c0 user: Ezio Melotti date: Thu Jul 21 09:35:19 2011 +0300 summary: #11435: link to the correct branch. files: Doc/tools/sphinxext/pyspecific.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -10,7 +10,7 @@ """ ISSUE_URI = 'http://bugs.python.org/issue%s' -SOURCE_URI = 'http://hg.python.org/cpython/file/default/%s' +SOURCE_URI = 'http://hg.python.org/cpython/file/3.2/%s' from docutils import nodes, utils from sphinx.util.nodes import split_explicit_title -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 08:39:58 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 08:39:58 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=2311435=3A_dummy_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/3028b5ab92c0 changeset: 71442:3028b5ab92c0 parent: 71440:cb44fef5ea1d parent: 71441:79d2682c4fc5 user: Ezio Melotti date: Thu Jul 21 09:37:38 2011 +0300 summary: #11435: dummy merge with 3.2. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 10:18:45 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 10:18:45 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEyNjAxOiBmaXgg?= =?utf8?q?typo=2E?= Message-ID: http://hg.python.org/cpython/rev/3bc80b6f7cd8 changeset: 71443:3bc80b6f7cd8 branch: 3.2 parent: 71441:79d2682c4fc5 user: Ezio Melotti date: Thu Jul 21 11:16:32 2011 +0300 summary: #12601: fix typo. files: Lib/webbrowser.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -232,7 +232,7 @@ stdout=(self.redirect_stdout and inout or None), stderr=inout, start_new_session=True) if remote: - # wait five secons. If the subprocess is not finished, the + # wait five seconds. If the subprocess is not finished, the # remote invocation has (hopefully) started a new instance. time.sleep(1) rc = p.poll() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 10:18:47 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 10:18:47 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=2312601=3A_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/d26c7b18fc9d changeset: 71444:d26c7b18fc9d parent: 71442:3028b5ab92c0 parent: 71443:3bc80b6f7cd8 user: Ezio Melotti date: Thu Jul 21 11:17:05 2011 +0300 summary: #12601: merge with 3.2. files: Lib/webbrowser.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -232,7 +232,7 @@ stdout=(self.redirect_stdout and inout or None), stderr=inout, start_new_session=True) if remote: - # wait five secons. If the subprocess is not finished, the + # wait five seconds. If the subprocess is not finished, the # remote invocation has (hopefully) started a new instance. time.sleep(1) rc = p.poll() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 10:18:48 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 10:18:48 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEyNjAxOiBmaXgg?= =?utf8?q?typo=2E?= Message-ID: http://hg.python.org/cpython/rev/0127716200c7 changeset: 71445:0127716200c7 branch: 2.7 parent: 71438:b754641a429f user: Ezio Melotti date: Thu Jul 21 11:18:18 2011 +0300 summary: #12601: fix typo. files: Lib/webbrowser.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -237,7 +237,7 @@ stdout=(self.redirect_stdout and inout or None), stderr=inout, preexec_fn=setsid) if remote: - # wait five secons. If the subprocess is not finished, the + # wait five seconds. If the subprocess is not finished, the # remote invocation has (hopefully) started a new instance. time.sleep(1) rc = p.poll() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 10:38:23 2011 From: python-checkins at python.org (ezio.melotti) Date: Thu, 21 Jul 2011 10:38:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_markup=2E?= Message-ID: http://hg.python.org/cpython/rev/3b8e2e892275 changeset: 71446:3b8e2e892275 branch: 2.7 user: Ezio Melotti date: Thu Jul 21 11:38:13 2011 +0300 summary: Fix markup. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -358,8 +358,8 @@ n += 1 .. versionadded:: 2.3 - .. versionadded:: 2.6 - The *start* parameter. + .. versionchanged:: 2.6 + The *start* parameter was added. .. function:: eval(expression[, globals[, locals]]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 10:50:15 2011 From: python-checkins at python.org (mark.hammond) Date: Thu, 21 Jul 2011 10:50:15 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_clarify_how_custom_commands_in?= =?utf8?q?_shebang_lines_are_terminated?= Message-ID: http://hg.python.org/peps/rev/be6002a866dd changeset: 3906:be6002a866dd user: Mark Hammond date: Thu Jul 21 18:49:34 2011 +1000 summary: clarify how custom commands in shebang lines are terminated files: pep-0397.txt | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pep-0397.txt b/pep-0397.txt --- a/pep-0397.txt +++ b/pep-0397.txt @@ -163,8 +163,9 @@ parsed, the command will be categorized according to the following rules: * If the command starts with the definition of a customized command - followed by a space character, the customized command will be used. - See below for a description of customized commands. + followed by a whitespace character (including a newline), the customized + command will be used. See below for a description of customized + commands. * The launcher will define a set of strings which are considered Unix compatible commands to launch Python, such as '/usr/bin/python' etc. -- Repository URL: http://hg.python.org/peps From ezio.melotti at gmail.com Thu Jul 21 11:16:24 2011 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Thu, 21 Jul 2011 12:16:24 +0300 Subject: [Python-checkins] devguide: Add a communications section to the devguide FAQ (closes #11690) In-Reply-To: References: Message-ID: <4E27EE68.4000801@gmail.com> Hi, On 19/06/2011 17.51, nick.coghlan wrote: > http://hg.python.org/devguide/rev/f1ebfb53437f > changeset: 431:f1ebfb53437f > user: Nick Coghlan > date: Mon Jun 20 00:46:57 2011 +1000 > summary: > Add a communications section to the devguide FAQ (closes #11690) > > files: > faq.rst | 102 +++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 101 insertions(+), 1 deletions(-) > > > diff --git a/faq.rst b/faq.rst > --- a/faq.rst > +++ b/faq.rst > @@ -8,8 +8,108 @@ > .. contents:: > :local: > > + > +Communications > +============== > + > + > +Where should I ask general Python questions? > +-------------------------------------------- > + > +General Python questions should still go to `python-list`_ or `python-tutor`_ > +or similar resources, such as StackOverflow_ or ``#python`` on IRC. FWIW you can make #python a link using either irc://chat.freenode.net/python (this will open the default IRC app, and I think Firefox even ask if you want to use a webchat) or http://webchat.freenode.net/?channels=python (for the freenode webchat). If you are going to do it, it might be worth mentioning that the channel requires registration. I agree with Victor that the network (Freenode or irc.freenode.net) should be specified. Also the #python-dev channel should be mentioned (it doesn't require registration, so links are fine here). Best Regards, Ezio Melotti From ncoghlan at gmail.com Thu Jul 21 13:08:40 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 21 Jul 2011 21:08:40 +1000 Subject: [Python-checkins] devguide: Add a communications section to the devguide FAQ (closes #11690) In-Reply-To: <4E27EE68.4000801@gmail.com> References: <4E27EE68.4000801@gmail.com> Message-ID: On Thu, Jul 21, 2011 at 7:16 PM, Ezio Melotti wrote: > > FWIW you can make #python a link using either irc://chat.freenode.net/python > (this will open the default IRC app, and I think Firefox even ask if you > want to use a webchat) or http://webchat.freenode.net/?channels=python (for > the freenode webchat). ?If you are going to do it, it might be worth > mentioning that the channel requires registration. > > I agree with Victor that the network (Freenode or irc.freenode.net) should > be specified. > Also the #python-dev channel should be mentioned (it doesn't require > registration, so links are fine here). If someone more knowledgeable on IRC matters than me could either commit a fix directly to the devguide repo or else put a patch on the tracker, that would be great. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Thu Jul 21 13:11:48 2011 From: python-checkins at python.org (mark.hammond) Date: Thu, 21 Jul 2011 13:11:48 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_fix_link_to_launcher_docs?= Message-ID: http://hg.python.org/peps/rev/a36fd0fa14d2 changeset: 3907:a36fd0fa14d2 user: Mark Hammond date: Thu Jul 21 21:10:55 2011 +1000 summary: fix link to launcher docs files: pep-0397.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0397.txt b/pep-0397.txt --- a/pep-0397.txt +++ b/pep-0397.txt @@ -334,7 +334,7 @@ [3] https://bitbucket.org/vinay.sajip/pylauncher - [4] https://bitbucket.org/vinay.sajip/pylauncher/src/tip/Docs/launcher.rst + [4] https://bitbucket.org/vinay.sajip/pylauncher/src/tip/Doc/launcher.rst Copyright -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Thu Jul 21 19:41:07 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 21 Jul 2011 19:41:07 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMzcy?= =?utf8?q?=3A_POSIX_semaphores_are_broken_on_AIX=3A_don=27t_use_them=2E?= Message-ID: http://hg.python.org/cpython/rev/f5a7d413638d changeset: 71447:f5a7d413638d branch: 2.7 user: Charles-Fran?ois Natali date: Thu Jul 21 19:41:04 2011 +0200 summary: Issue #12372: POSIX semaphores are broken on AIX: don't use them. files: Misc/NEWS | 2 ++ configure | 8 ++------ configure.in | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,8 @@ Library ------- +- Issue #12372: POSIX semaphores are broken on AIX: don't use them. + - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -8987,7 +8987,7 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) + SunOS/5.6) $as_echo "#define HAVE_PTHREAD_DESTRUCTOR 1" >>confdefs.h ;; @@ -8995,14 +8995,10 @@ $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/5) + AIX/*) $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/6) -$as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h - - ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2359,18 +2359,15 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, + SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, [Defined for Solaris 2.6 bug in pthread header.]) ;; SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, + AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/6) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, - Define if the Posix semaphores do not work on your system) - ;; esac AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 19:45:36 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 21 Jul 2011 19:45:36 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzcy?= =?utf8?q?=3A_POSIX_semaphores_are_broken_on_AIX=3A_don=27t_use_them=2E?= Message-ID: http://hg.python.org/cpython/rev/f0475f78d45c changeset: 71448:f0475f78d45c branch: 3.2 parent: 71443:3bc80b6f7cd8 user: Charles-Fran?ois Natali date: Thu Jul 21 19:45:31 2011 +0200 summary: Issue #12372: POSIX semaphores are broken on AIX: don't use them. files: Misc/NEWS | 2 ++ configure | 8 ++------ configure.in | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,8 @@ Library ------- +- Issue #12372: POSIX semaphores are broken on AIX: don't use them. + - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 directory, so that "import DLFCN" and other similar imports work on Linux 3.0. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -8868,7 +8868,7 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) + SunOS/5.6) $as_echo "#define HAVE_PTHREAD_DESTRUCTOR 1" >>confdefs.h ;; @@ -8876,14 +8876,10 @@ $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/5) + AIX/*) $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/6) -$as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h - - ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2239,18 +2239,15 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, + SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, [Defined for Solaris 2.6 bug in pthread header.]) ;; SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, + AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/6) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, - Define if the Posix semaphores do not work on your system) - ;; esac AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jul 21 19:49:42 2011 From: python-checkins at python.org (charles-francois.natali) Date: Thu, 21 Jul 2011 19:49:42 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_-_Issue_=2312372=3A_POSIX_semaphores_are_broken_on_AIX?= =?utf8?q?=3A_don=27t_use_them=2E?= Message-ID: http://hg.python.org/cpython/rev/44a02d6b74e4 changeset: 71449:44a02d6b74e4 parent: 71444:d26c7b18fc9d parent: 71448:f0475f78d45c user: Charles-Fran?ois Natali date: Thu Jul 21 19:49:47 2011 +0200 summary: Merge - Issue #12372: POSIX semaphores are broken on AIX: don't use them. files: Misc/NEWS | 2 ++ configure | 8 ++------ configure.in | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -234,6 +234,8 @@ Library ------- +- Issue #12372: POSIX semaphores are broken on AIX: don't use them. + - Issue #12551: Provide a get_channel_binding() method on SSL sockets so as to get channel binding data for the current SSL session (only the "tls-unique" channel binding is implemented). This allows the implementation diff --git a/configure b/configure --- a/configure +++ b/configure @@ -8792,7 +8792,7 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) + SunOS/5.6) $as_echo "#define HAVE_PTHREAD_DESTRUCTOR 1" >>confdefs.h ;; @@ -8800,14 +8800,10 @@ $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/5) + AIX/*) $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; - AIX/6) -$as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h - - ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2184,18 +2184,15 @@ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in - SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, + SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, [Defined for Solaris 2.6 bug in pthread header.]) ;; SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, + AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, [Define if the Posix semaphores do not work on your system]) ;; - AIX/6) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, - Define if the Posix semaphores do not work on your system) - ;; esac AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Thu Jul 21 21:08:15 2011 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 21 Jul 2011 15:08:15 -0400 Subject: [Python-checkins] devguide: Add a communications section to the devguide FAQ (closes #11690) In-Reply-To: References: <4E27EE68.4000801@gmail.com> Message-ID: <4E28791F.9010403@udel.edu> On 7/21/2011 7:08 AM, Nick Coghlan wrote: > On Thu, Jul 21, 2011 at 7:16 PM, Ezio Melotti wrote: >> >> FWIW you can make #python a link using either irc://chat.freenode.net/python I just tried this with FF 5. /python should be left off as #python requires registration and one is dumped in a dummy #python-unregistered even if registered, because the registration recognition process takes several seconds, and when it is complete, one explicitly join anyway. irc://chat.freenode.net/python-dev works fine. >> (this will open the default IRC app, and I think Firefox even ask if you >> want to use a webchat) FF3 did, FF 5 did not. or http://webchat.freenode.net/?channels=python This still requires a registered nickname + reading and echoing a slightly ambiguous 12 char captcha. It initially put me in me in #python and immediately flipped to python-unregistered, probably for the same timing issue, so it is useless. \>> the freenode webchat). If you are going to do it, it might be worth >> mentioning that the channel requires registration. Please include the baroque instructions, which I have forgotten but only remember as being unclear after following the instruction to visit #freenode for instructions. >> I agree with Victor that the network (Freenode or irc.freenode.net) should >> be specified. >> Also the #python-dev channel should be mentioned (it doesn't require >> registration, so links are fine here). The webchat like still asks for nickname + captcha. FF users should use (install?) chatzilla with a full menu include 'join'. Everyone should use proper chat client. > If someone more knowledgeable on IRC matters than me could either > commit a fix directly to the devguide repo or else put a patch on the > tracker, that would be great. And more knowledgeable than me. I can test ;-). Terry From raymond.hettinger at gmail.com Fri Jul 22 00:37:01 2011 From: raymond.hettinger at gmail.com (Raymond Hettinger) Date: Thu, 21 Jul 2011 15:37:01 -0700 Subject: [Python-checkins] devguide: Add a communications section to the devguide FAQ (closes #11690) In-Reply-To: References: <4E27EE68.4000801@gmail.com> Message-ID: <44F06A8A-8153-443C-A4FB-0E57ABCBFDA6@gmail.com> Please don't add the IRC link to the devguide. Based on conversations with Guido, he is against it being part of the core development process. Raymond On Jul 21, 2011, at 4:08 AM, Nick Coghlan wrote: > On Thu, Jul 21, 2011 at 7:16 PM, Ezio Melotti wrote: >> >> FWIW you can make #python a link using either irc://chat.freenode.net/python >> (this will open the default IRC app, and I think Firefox even ask if you >> want to use a webchat) or http://webchat.freenode.net/?channels=python (for >> the freenode webchat). If you are going to do it, it might be worth >> mentioning that the channel requires registration. >> >> I agree with Victor that the network (Freenode or irc.freenode.net) should >> be specified. >> Also the #python-dev channel should be mentioned (it doesn't require >> registration, so links are fine here). > > If someone more knowledgeable on IRC matters than me could either > commit a fix directly to the devguide repo or else put a patch on the > tracker, that would be great. > > Cheers, > Nick. > > -- > Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins From python-checkins at python.org Fri Jul 22 04:26:28 2011 From: python-checkins at python.org (phillip.eby) Date: Fri, 22 Jul 2011 04:26:28 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Fix_typo?= Message-ID: http://hg.python.org/peps/rev/4e80dedd1645 changeset: 3908:4e80dedd1645 user: pje date: Thu Jul 21 22:25:17 2011 -0400 summary: Fix typo files: pep-0402.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0402.txt b/pep-0402.txt --- a/pep-0402.txt +++ b/pep-0402.txt @@ -434,7 +434,7 @@ ``import foo.bar.baz`` must wait until ``foo.bar.baz`` is found before creating module objects for *both* ``foo`` and ``foo.bar``, and then create both of them together, properly setting the ``foo`` module's -``.bar`` attrbute to point to the ``foo.bar``module. +``.bar`` attrbute to point to the ``foo.bar`` module. In this way, pure virtual packages are never directly importable: an ``import foo`` or ``import foo.bar`` by itself will fail, and the -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jul 22 04:59:49 2011 From: python-checkins at python.org (phillip.eby) Date: Fri, 22 Jul 2011 04:59:49 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Fix_broken_internal_link=2E?= Message-ID: http://hg.python.org/peps/rev/93477047e71c changeset: 3909:93477047e71c user: pje date: Thu Jul 21 22:58:56 2011 -0400 summary: Fix broken internal link. files: pep-0402.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0402.txt b/pep-0402.txt --- a/pep-0402.txt +++ b/pep-0402.txt @@ -555,8 +555,8 @@ so technically this is also a change to ``pkgutil``.) Last, but not least, the ``imp`` module (or ``importlib``, if -appropriate) should expose the algorithm described in the `__path__ -creation`_ section above, as a +appropriate) should expose the algorithm described in the `virtual +paths`_ section above, as a ``get_virtual_path(modulename, parent_path=None)`` function, so that creators of ``__import__`` replacements can use it. -- Repository URL: http://hg.python.org/peps From solipsis at pitrou.net Fri Jul 22 05:27:37 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 22 Jul 2011 05:27:37 +0200 Subject: [Python-checkins] Daily reference leaks (44a02d6b74e4): sum=0 Message-ID: results for 44a02d6b74e4 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog8CE8pb', '-x'] From python-checkins at python.org Fri Jul 22 13:40:06 2011 From: python-checkins at python.org (eli.bendersky) Date: Fri, 22 Jul 2011 13:40:06 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNDM0?= =?utf8?q?=3A_make_StringIO=2Ewrite_error_message_consistent_with_Python_2?= =?utf8?q?=2E7?= Message-ID: http://hg.python.org/cpython/rev/0752215f9f91 changeset: 71450:0752215f9f91 branch: 2.7 parent: 71447:f5a7d413638d user: Eli Bendersky date: Fri Jul 22 14:39:55 2011 +0300 summary: Issue #12434: make StringIO.write error message consistent with Python 2.7 nomenclature files: Modules/_io/stringio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c --- a/Modules/_io/stringio.c +++ b/Modules/_io/stringio.c @@ -464,7 +464,7 @@ CHECK_INITIALIZED(self); if (!PyUnicode_Check(obj)) { - PyErr_Format(PyExc_TypeError, "string argument expected, got '%s'", + PyErr_Format(PyExc_TypeError, "unicode argument expected, got '%s'", Py_TYPE(obj)->tp_name); return NULL; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:22 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:22 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_hardcode_the_ol?= =?utf8?b?ZCBzdm4gX192ZXJzaW9uX18=?= Message-ID: http://hg.python.org/cpython/rev/daca32a1431f changeset: 71451:daca32a1431f branch: 2.7 user: Benjamin Peterson date: Fri Jul 22 10:39:12 2011 -0500 summary: hardcode the old svn __version__ files: Parser/asdl_c.py | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -903,9 +903,6 @@ self.emit("if (!%s_singleton) return 0;" % cons.name, 1) -def parse_version(mod): - return mod.version.value[12:-3] - class ASTModuleVisitor(PickleVisitor): def visitModule(self, mod): @@ -922,7 +919,7 @@ self.emit("return;", 2) # Value of version: "$Revision$" self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' - % parse_version(mod), 1) + % mod.version, 1) self.emit("return;", 2) for dfn in mod.dfns: self.visit(dfn) @@ -1160,6 +1157,7 @@ argv0 = os.sep.join(components[-2:]) auto_gen_msg = common_msg % argv0 mod = asdl.parse(srcfile) + mod.version = "82160" if not asdl.check(mod): sys.exit(1) if INC_DIR: @@ -1181,7 +1179,7 @@ p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "wb") f.write(auto_gen_msg) - f.write(c_file_msg % parse_version(mod)) + f.write(c_file_msg % mod.version) f.write('#include "Python.h"\n') f.write('#include "%s-ast.h"\n' % mod.name) f.write('\n') -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:23 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_verify_the_type?= =?utf8?q?s_of_AST_strings_and_identifiers_=28closes_=2312609_and_=2312610?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/a21829180423 changeset: 71452:a21829180423 branch: 2.7 user: Benjamin Peterson date: Fri Jul 22 10:39:50 2011 -0500 summary: verify the types of AST strings and identifiers (closes #12609 and #12610) files: Lib/test/test_ast.py | 14 ++++++++++++++ Parser/asdl_c.py | 21 +++++++++++++++++++-- Python/Python-ast.c | 25 +++++++++++++++++++++---- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -362,6 +362,20 @@ ast2 = mod.loads(mod.dumps(ast, protocol)) self.assertEqual(to_tuple(ast2), to_tuple(ast)) + def test_invalid_identitifer(self): + m = ast.Module([ast.Expr(ast.Name(u"x", ast.Load()))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("identifier must be of type str", str(cm.exception)) + + def test_invalid_string(self): + m = ast.Module([ast.Expr(ast.Str(43))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("string must be of type str or uni", str(cm.exception)) + class ASTHelpers_Test(unittest.TestCase): diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -800,8 +800,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + if (!PyString_CheckExact(obj)) { + PyErr_Format(PyExc_TypeError, + "AST identifier must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + if (!PyString_CheckExact(obj) && !PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, + "AST string must be of type str or unicode"); + return 1; + } + return obj2ast_object(obj, out, arena); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2,7 +2,7 @@ /* - __version__ 82160. + __version__ . This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -594,8 +594,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + if (!PyString_CheckExact(obj)) { + PyErr_Format(PyExc_TypeError, + "AST identifier must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + if (!PyString_CheckExact(obj) && !PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, + "AST string must be of type str or unicode"); + return 1; + } + return obj2ast_object(obj, out, arena); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { @@ -6570,7 +6587,7 @@ if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return; - if (PyModule_AddStringConstant(m, "__version__", "82160") < 0) + if (PyModule_AddStringConstant(m, "__version__", "") < 0) return; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:24 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_news_note?= Message-ID: http://hg.python.org/cpython/rev/c6e63c67efd5 changeset: 71453:c6e63c67efd5 branch: 2.7 user: Benjamin Peterson date: Fri Jul 22 10:41:44 2011 -0500 summary: news note files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issues #12610 and #12609: Verify that user generated AST has correct string + and identifier types before compiling. + - Issue #11627: Fix segfault when __new__ on a exception returns a non-exception class. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:24 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:24 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_type_check_AST_?= =?utf8?q?strings_and_identifiers?= Message-ID: http://hg.python.org/cpython/rev/3301689bd78d changeset: 71454:3301689bd78d branch: 3.2 parent: 71448:f0475f78d45c user: Benjamin Peterson date: Fri Jul 22 10:50:23 2011 -0500 summary: type check AST strings and identifiers This is related to a21829180423 as well as #12609 and #12610. files: Lib/test/test_ast.py | 14 ++++++++++++++ Misc/NEWS | 3 +++ Parser/asdl_c.py | 21 +++++++++++++++++++-- Python/Python-ast.c | 25 +++++++++++++++++++++---- 4 files changed, 57 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -364,6 +364,20 @@ compile(m, "", "exec") self.assertIn("but got <_ast.expr", str(cm.exception)) + def test_invalid_identitifer(self): + m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("identifier must be of type str", str(cm.exception)) + + def test_invalid_string(self): + m = ast.Module([ast.Expr(ast.Str(42))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("string must be of type str", str(cm.exception)) + class ASTHelpers_Test(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Verify the types of AST strings and identifiers provided by the user before + compiling them. + - Issue #12579: str.format_map() now raises a ValueError if used on a format string that contains positional fields. Initial patch by Julian Berman. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -794,8 +794,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, + const char *name) +{ + if (!PyUnicode_CheckExact(name)) { + PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "identifier"); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "string"); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2,7 +2,7 @@ /* - __version__ 82163. + __version__ . This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -600,8 +600,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, + const char *name) +{ + if (!PyUnicode_CheckExact(name)) { + PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "identifier"); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "string"); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { @@ -6739,7 +6756,7 @@ NULL; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return NULL; - if (PyModule_AddStringConstant(m, "__version__", "82163") < 0) + if (PyModule_AddStringConstant(m, "__version__", "") < 0) return NULL; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:25 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_hardcode_the_ol?= =?utf8?b?ZCBzdm4gX192ZXJzaW9uX18=?= Message-ID: http://hg.python.org/cpython/rev/08932ec9ddb1 changeset: 71455:08932ec9ddb1 branch: 3.2 user: Benjamin Peterson date: Fri Jul 22 10:39:12 2011 -0500 summary: hardcode the old svn __version__ files: Parser/asdl_c.py | 8 +++----- Python/Python-ast.c | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -899,9 +899,6 @@ self.emit("if (!%s_singleton) return 0;" % cons.name, 1) -def parse_version(mod): - return mod.version.value[12:-3] - class ASTModuleVisitor(PickleVisitor): def visitModule(self, mod): @@ -921,7 +918,7 @@ self.emit("return NULL;", 2) # Value of version: "$Revision$" self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' - % parse_version(mod), 1) + % mod.version, 1) self.emit("return NULL;", 2) for dfn in mod.dfns: self.visit(dfn) @@ -1160,6 +1157,7 @@ argv0 = os.sep.join(components[-2:]) auto_gen_msg = common_msg % argv0 mod = asdl.parse(srcfile) + mod.version = "82163" if not asdl.check(mod): sys.exit(1) if INC_DIR: @@ -1181,7 +1179,7 @@ p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "w") f.write(auto_gen_msg) - f.write(c_file_msg % parse_version(mod)) + f.write(c_file_msg % mod.version) f.write('#include "Python.h"\n') f.write('#include "%s-ast.h"\n' % mod.name) f.write('\n') diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2,7 +2,7 @@ /* - __version__ . + __version__ 82163. This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -6756,7 +6756,7 @@ NULL; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return NULL; - if (PyModule_AddStringConstant(m, "__version__", "") < 0) + if (PyModule_AddStringConstant(m, "__version__", "82163") < 0) return NULL; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:26 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:26 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/75d56cf3020c changeset: 71456:75d56cf3020c parent: 71449:44a02d6b74e4 parent: 71454:3301689bd78d user: Benjamin Peterson date: Fri Jul 22 10:55:02 2011 -0500 summary: merge 3.2 files: Lib/test/test_ast.py | 14 ++++++++++++++ Misc/NEWS | 3 +++ Parser/asdl_c.py | 21 +++++++++++++++++++-- Python/Python-ast.c | 21 +++++++++++++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -367,6 +367,20 @@ compile(m, "", "exec") self.assertIn("but got <_ast.expr", str(cm.exception)) + def test_invalid_identitifer(self): + m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("identifier must be of type str", str(cm.exception)) + + def test_invalid_string(self): + m = ast.Module([ast.Expr(ast.Str(42))]) + ast.fix_missing_locations(m) + with self.assertRaises(TypeError) as cm: + compile(m, "", "exec") + self.assertIn("string must be of type str", str(cm.exception)) + class ASTHelpers_Test(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Verify the types of AST strings and identifiers provided by the user before + compiling them. + - Issue #12579: str.format_map() now raises a ValueError if used on a format string that contains positional fields. Initial patch by Julian Berman. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -795,8 +795,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, + const char *name) +{ + if (!PyUnicode_CheckExact(name)) { + PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "identifier"); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "string"); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -592,8 +592,25 @@ return 0; } -#define obj2ast_identifier obj2ast_object -#define obj2ast_string obj2ast_object +static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, + const char *name) +{ + if (!PyUnicode_CheckExact(name)) { + PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + return 1; + } + return obj2ast_object(obj, out, arena); +} + +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "identifier"); +} + +static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) +{ + return obj2ast_stringlike(obj, out, arena, "string"); +} static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 17:55:27 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 17:55:27 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKG51bGwp?= Message-ID: http://hg.python.org/cpython/rev/34d0b02a01e4 changeset: 71457:34d0b02a01e4 parent: 71456:75d56cf3020c parent: 71455:08932ec9ddb1 user: Benjamin Peterson date: Fri Jul 22 10:55:25 2011 -0500 summary: merge 3.2 (null) files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 18:10:40 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 18:10:40 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_None_is_ok_for_?= =?utf8?q?identifiers_but_not_strings?= Message-ID: http://hg.python.org/cpython/rev/c9ebae3285e3 changeset: 71458:c9ebae3285e3 branch: 3.2 parent: 71455:08932ec9ddb1 user: Benjamin Peterson date: Fri Jul 22 11:09:07 2011 -0500 summary: None is ok for identifiers but not strings files: Parser/asdl_c.py | 18 ++++++++---------- Python/Python-ast.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -794,24 +794,22 @@ return 0; } -static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, - const char *name) +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyUnicode_CheckExact(name)) { - PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + if (!PyUnicode_CheckExact(obj) && obj != Py_None) { + PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str"); return 1; } return obj2ast_object(obj, out, arena); } -static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) -{ - return obj2ast_stringlike(obj, out, arena, "identifier"); -} - static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) { - return obj2ast_stringlike(obj, out, arena, "string"); + if (!PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); } static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -600,24 +600,22 @@ return 0; } -static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, - const char *name) +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyUnicode_CheckExact(name)) { - PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + if (!PyUnicode_CheckExact(obj) && obj != Py_None) { + PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str"); return 1; } return obj2ast_object(obj, out, arena); } -static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) -{ - return obj2ast_stringlike(obj, out, arena, "identifier"); -} - static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) { - return obj2ast_stringlike(obj, out, arena, "string"); + if (!PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); } static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 18:10:41 2011 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 22 Jul 2011 18:10:41 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/d3f0f72c31f8 changeset: 71459:d3f0f72c31f8 parent: 71457:34d0b02a01e4 parent: 71458:c9ebae3285e3 user: Benjamin Peterson date: Fri Jul 22 11:10:43 2011 -0500 summary: merge 3.2 files: Parser/asdl_c.py | 18 ++++++++---------- Python/Python-ast.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -795,24 +795,22 @@ return 0; } -static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, - const char *name) +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyUnicode_CheckExact(name)) { - PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + if (!PyUnicode_CheckExact(obj) && obj != Py_None) { + PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str"); return 1; } return obj2ast_object(obj, out, arena); } -static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) -{ - return obj2ast_stringlike(obj, out, arena, "identifier"); -} - static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) { - return obj2ast_stringlike(obj, out, arena, "string"); + if (!PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); } static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -592,24 +592,22 @@ return 0; } -static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena, - const char *name) +static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyUnicode_CheckExact(name)) { - PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name); + if (!PyUnicode_CheckExact(obj) && obj != Py_None) { + PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str"); return 1; } return obj2ast_object(obj, out, arena); } -static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) -{ - return obj2ast_stringlike(obj, out, arena, "identifier"); -} - static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) { - return obj2ast_stringlike(obj, out, arena, "string"); + if (!PyUnicode_CheckExact(obj)) { + PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); + return 1; + } + return obj2ast_object(obj, out, arena); } static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 23:44:05 2011 From: python-checkins at python.org (charles-francois.natali) Date: Fri, 22 Jul 2011 23:44:05 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTky?= =?utf8?q?=3A_Make_Python_build_on_OpenBSD_5_=28and_future_major_releases?= =?utf8?b?KS4=?= Message-ID: http://hg.python.org/cpython/rev/b24a2ccae56a changeset: 71460:b24a2ccae56a branch: 2.7 parent: 71453:c6e63c67efd5 user: Charles-Fran?ois Natali date: Fri Jul 22 23:43:42 2011 +0200 summary: Issue #12592: Make Python build on OpenBSD 5 (and future major releases). files: Misc/NEWS | 2 + configure | 597 ++++++++++++++++++-------------------- configure.in | 4 +- 3 files changed, 291 insertions(+), 312 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). + - Issue #12372: POSIX semaphores are broken on AIX: don't use them. - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for python 2.7. +# Generated by GNU Autoconf 2.67 for python 2.7. # # Report bugs to . # @@ -92,7 +92,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -218,18 +217,11 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1182,7 +1174,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1519,7 +1511,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 2.7 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1565,7 +1557,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1602,7 +1594,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1615,10 +1607,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1685,7 +1677,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1694,7 +1686,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel @@ -1735,7 +1727,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1749,7 +1741,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1767,7 +1759,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile @@ -1812,7 +1804,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1826,7 +1818,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1867,7 +1859,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type @@ -1880,7 +1872,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1920,7 +1912,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t @@ -1933,7 +1925,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1994,7 +1986,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_intX_t @@ -2171,7 +2163,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2184,7 +2176,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2239,7 +2231,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func @@ -2252,7 +2244,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2296,7 +2288,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_member @@ -2311,7 +2303,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2342,7 +2334,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2350,7 +2342,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 2.7, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2608,7 +2600,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -3026,7 +3018,7 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123456]) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.[0123456]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -3035,7 +3027,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h ;; - OpenBSD/4.[789]) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD @@ -3248,7 +3240,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3288,7 +3280,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3341,7 +3333,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3381,7 +3373,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3440,7 +3432,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3484,7 +3476,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3539,7 +3531,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3654,7 +3646,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3697,7 +3689,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3756,7 +3748,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3767,7 +3759,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3808,7 +3800,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3818,7 +3810,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3855,7 +3847,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3933,7 +3925,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4072,7 +4064,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4113,7 +4105,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4164,7 +4156,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4235,7 +4227,7 @@ CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4351,7 +4343,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4363,7 +4355,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4426,7 +4418,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4493,7 +4485,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4622,7 +4614,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : +if test "x$ac_cv_header_minix_config_h" = x""yes; then : MINIX=yes else MINIX= @@ -4644,7 +4636,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4988,7 +4980,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5028,7 +5020,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5082,7 +5074,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5132,7 +5124,7 @@ set dummy svnversion; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_SVNVERSION+:} false; then : +if test "${ac_cv_prog_SVNVERSION+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$SVNVERSION"; then @@ -5180,7 +5172,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_HG+:} false; then : +if test "${ac_cv_prog_HAS_HG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -5279,7 +5271,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5460,7 +5452,7 @@ $as_echo_n "checking whether $CC accepts -fno-strict-aliasing... " >&6; } ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" - if ${ac_cv_no_strict_aliasing_ok+:} false; then : + if test "${ac_cv_no_strict_aliasing_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5650,7 +5642,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -OPT:Olimit=0" >&5 $as_echo_n "checking whether $CC accepts -OPT:Olimit=0... " >&6; } -if ${ac_cv_opt_olimit_ok+:} false; then : +if test "${ac_cv_opt_olimit_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5692,7 +5684,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Olimit 1500" >&5 $as_echo_n "checking whether $CC accepts -Olimit 1500... " >&6; } - if ${ac_cv_olimit_ok+:} false; then : + if test "${ac_cv_olimit_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5770,7 +5762,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if ${ac_cv_pthread_is_default+:} false; then : +if test "${ac_cv_pthread_is_default+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5823,7 +5815,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if ${ac_cv_kpthread+:} false; then : +if test "${ac_cv_kpthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5872,7 +5864,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if ${ac_cv_kthread+:} false; then : +if test "${ac_cv_kthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5921,7 +5913,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if ${ac_cv_thread+:} false; then : +if test "${ac_cv_thread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -6006,7 +5998,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6145,7 +6137,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6185,7 +6177,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6219,11 +6211,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6242,7 +6234,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6276,11 +6268,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6300,7 +6292,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : +if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6328,7 +6320,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : +if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6338,7 +6330,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6358,7 +6350,7 @@ #endif " -if test "x$ac_cv_header_term_h" = xyes; then : +if test "x$ac_cv_header_term_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6380,7 +6372,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = xyes; then : +if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6543,7 +6535,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = x""yes; then : else @@ -6554,7 +6546,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = x""yes; then : else @@ -6565,7 +6557,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -6581,7 +6573,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = x""yes; then : else @@ -6593,7 +6585,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : +if test "${ac_cv_type_uid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6672,7 +6664,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = x""yes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6687,7 +6679,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : +if test "${ac_cv_sizeof_int+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6697,7 +6689,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -6720,7 +6712,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : +if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6730,7 +6722,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long=0 fi @@ -6753,7 +6745,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : +if test "${ac_cv_sizeof_void_p+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6763,7 +6755,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_void_p=0 fi @@ -6786,7 +6778,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if ${ac_cv_sizeof_short+:} false; then : +if test "${ac_cv_sizeof_short+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6796,7 +6788,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short=0 fi @@ -6819,7 +6811,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if ${ac_cv_sizeof_float+:} false; then : +if test "${ac_cv_sizeof_float+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6829,7 +6821,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_float=0 fi @@ -6852,7 +6844,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if ${ac_cv_sizeof_double+:} false; then : +if test "${ac_cv_sizeof_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6862,7 +6854,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_double=0 fi @@ -6885,7 +6877,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if ${ac_cv_sizeof_fpos_t+:} false; then : +if test "${ac_cv_sizeof_fpos_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6895,7 +6887,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_fpos_t=0 fi @@ -6918,7 +6910,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if ${ac_cv_sizeof_size_t+:} false; then : +if test "${ac_cv_sizeof_size_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6928,7 +6920,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_size_t=0 fi @@ -6951,7 +6943,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if ${ac_cv_sizeof_pid_t+:} false; then : +if test "${ac_cv_sizeof_pid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6961,7 +6953,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pid_t=0 fi @@ -7011,7 +7003,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : +if test "${ac_cv_sizeof_long_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -7021,7 +7013,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -7072,7 +7064,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if ${ac_cv_sizeof_long_double+:} false; then : +if test "${ac_cv_sizeof_long_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7082,7 +7074,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_double=0 fi @@ -7133,7 +7125,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if ${ac_cv_sizeof__Bool+:} false; then : +if test "${ac_cv_sizeof__Bool+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7143,7 +7135,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof__Bool=0 fi @@ -7169,7 +7161,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = xyes; then : +if test "x$ac_cv_type_uintptr_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7181,7 +7173,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if ${ac_cv_sizeof_uintptr_t+:} false; then : +if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7191,7 +7183,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7217,7 +7209,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if ${ac_cv_sizeof_off_t+:} false; then : +if test "${ac_cv_sizeof_off_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7232,7 +7224,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off_t=0 fi @@ -7276,7 +7268,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : +if test "${ac_cv_sizeof_time_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7294,7 +7286,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_time_t=0 fi @@ -7350,7 +7342,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if ${ac_cv_sizeof_pthread_t+:} false; then : +if test "${ac_cv_sizeof_pthread_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7365,7 +7357,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pthread_t=0 fi @@ -7877,7 +7869,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7911,7 +7903,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7922,7 +7914,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7956,7 +7948,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7970,7 +7962,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -8004,11 +7996,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_sem_init+:} false; then : + if test "${ac_cv_search_sem_init+set}" = set; then : break fi done -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : else ac_cv_search_sem_init=no @@ -8031,7 +8023,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if ${ac_cv_lib_intl_textdomain+:} false; then : +if test "${ac_cv_lib_intl_textdomain+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8065,7 +8057,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = xyes; then : +if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8112,7 +8104,7 @@ # BeOS' sockets are stashed in libnet. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_t_open+:} false; then : +if test "${ac_cv_lib_nsl_t_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8146,13 +8138,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = xyes; then : +if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : +if test "${ac_cv_lib_socket_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8186,7 +8178,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : +if test "x$ac_cv_lib_socket_socket" = x""yes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8195,7 +8187,7 @@ BeOS*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lnet" >&5 $as_echo_n "checking for socket in -lnet... " >&6; } -if ${ac_cv_lib_net_socket+:} false; then : +if test "${ac_cv_lib_net_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8229,7 +8221,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_socket" >&5 $as_echo "$ac_cv_lib_net_socket" >&6; } -if test "x$ac_cv_lib_net_socket" = xyes; then : +if test "x$ac_cv_lib_net_socket" = x""yes; then : LIBS="-lnet $LIBS" fi # BeOS @@ -8257,7 +8249,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8300,7 +8292,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8568,7 +8560,7 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h ac_fn_c_check_header_mongrel "$LINENO" "cthreads.h" "ac_cv_header_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_cthreads_h" = xyes; then : +if test "x$ac_cv_header_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8581,7 +8573,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = xyes; then : +if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8643,7 +8635,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = xyes; then : +if test "x$ac_cv_func_pthread_detach" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8651,7 +8643,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "atheos/threads.h" "ac_cv_header_atheos_threads_h" "$ac_includes_default" -if test "x$ac_cv_header_atheos_threads_h" = xyes; then : +if test "x$ac_cv_header_atheos_threads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h @@ -8661,7 +8653,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "kernel/OS.h" "ac_cv_header_kernel_OS_h" "$ac_includes_default" -if test "x$ac_cv_header_kernel_OS_h" = xyes; then : +if test "x$ac_cv_header_kernel_OS_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h @@ -8672,7 +8664,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if ${ac_cv_lib_pthreads_pthread_create+:} false; then : +if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8706,7 +8698,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8716,7 +8708,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_create+:} false; then : +if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8750,7 +8742,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8760,7 +8752,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : +if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8794,7 +8786,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8804,7 +8796,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if ${ac_cv_lib_cma_pthread_create+:} false; then : +if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8838,7 +8830,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : +if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8878,7 +8870,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if ${ac_cv_lib_mpc_usconfig+:} false; then : +if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8912,7 +8904,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : +if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8924,7 +8916,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : +if test "${ac_cv_lib_thread_thr_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8958,7 +8950,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : +if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -9003,7 +8995,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if ${ac_cv_pthread_system_supported+:} false; then : + if test "${ac_cv_pthread_system_supported+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9046,7 +9038,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = xyes; then : +if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9436,7 +9428,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9480,7 +9472,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9810,7 +9802,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if ${ac_cv_flock_decl+:} false; then : +if test "${ac_cv_flock_decl+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9840,7 +9832,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = xyes; then : +if test "x$ac_cv_func_flock" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9848,7 +9840,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_flock+:} false; then : +if test "${ac_cv_lib_bsd_flock+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9882,7 +9874,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = xyes; then : +if test "x$ac_cv_lib_bsd_flock" = x""yes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9931,7 +9923,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_TRUE+:} false; then : +if test "${ac_cv_prog_TRUE+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9971,7 +9963,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if ${ac_cv_lib_c_inet_aton+:} false; then : +if test "${ac_cv_lib_c_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10005,12 +9997,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = xyes; then : +if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if ${ac_cv_lib_resolv_inet_aton+:} false; then : +if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10044,7 +10036,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -10061,7 +10053,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if ${ac_cv_have_chflags+:} false; then : +if test "${ac_cv_have_chflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10095,7 +10087,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = xyes; then : +if test "x$ac_cv_func_chflags" = x""yes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -10110,7 +10102,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if ${ac_cv_have_lchflags+:} false; then : +if test "${ac_cv_have_lchflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10144,7 +10136,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = xyes; then : +if test "x$ac_cv_func_lchflags" = x""yes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -10168,7 +10160,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if ${ac_cv_lib_z_inflateCopy+:} false; then : +if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10202,7 +10194,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : +if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10345,7 +10337,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = xyes; then : +if test "x$ac_cv_func_openpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10353,7 +10345,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if ${ac_cv_lib_util_openpty+:} false; then : +if test "${ac_cv_lib_util_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10387,13 +10379,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = xyes; then : +if test "x$ac_cv_lib_util_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_openpty+:} false; then : +if test "${ac_cv_lib_bsd_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10427,7 +10419,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = xyes; then : +if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10442,7 +10434,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = xyes; then : +if test "x$ac_cv_func_forkpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10450,7 +10442,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if ${ac_cv_lib_util_forkpty+:} false; then : +if test "${ac_cv_lib_util_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10484,13 +10476,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = xyes; then : +if test "x$ac_cv_lib_util_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_forkpty+:} false; then : +if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10524,7 +10516,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : +if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10541,7 +10533,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : +if test "x$ac_cv_func_memmove" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10565,7 +10557,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes; then : +if test "x$ac_cv_func_dup2" = x""yes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10578,7 +10570,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : +if test "x$ac_cv_func_getcwd" = x""yes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10591,7 +10583,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = xyes; then : +if test "x$ac_cv_func_strdup" = x""yes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10607,7 +10599,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = xyes; then : +if test "x$ac_cv_func_getpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10635,7 +10627,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = xyes; then : +if test "x$ac_cv_func_setpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10663,7 +10655,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : +if test "x$ac_cv_func_gettimeofday" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10765,7 +10757,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if ${ac_cv_buggy_getaddrinfo+:} false; then : + if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10894,7 +10886,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = xyes; then : +if test "x$ac_cv_func_getnameinfo" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10906,7 +10898,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10941,7 +10933,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : +if test "${ac_cv_struct_tm+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10978,7 +10970,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10994,7 +10986,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11006,7 +10998,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11042,7 +11034,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -11052,7 +11044,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -11062,7 +11054,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -11072,7 +11064,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -11082,7 +11074,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -11092,7 +11084,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -11114,7 +11106,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if ${ac_cv_header_time_altzone+:} false; then : +if test "${ac_cv_header_time_altzone+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11178,7 +11170,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if ${ac_cv_struct_addrinfo+:} false; then : +if test "${ac_cv_struct_addrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11210,7 +11202,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if ${ac_cv_struct_sockaddr_storage+:} false; then : +if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11246,7 +11238,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if ${ac_cv_c_char_unsigned+:} false; then : +if test "${ac_cv_c_char_unsigned+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11278,7 +11270,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11566,7 +11558,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes; then : +if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11697,7 +11689,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11719,12 +11711,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = xyes; then : +if test "x$ac_cv_func___fpu_control" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if ${ac_cv_lib_ieee___fpu_control+:} false; then : +if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11758,7 +11750,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11853,7 +11845,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_little_endian_double+:} false; then : +if test "${ac_cv_little_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11895,7 +11887,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_big_endian_double+:} false; then : +if test "${ac_cv_big_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11941,7 +11933,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_mixed_endian_double+:} false; then : +if test "${ac_cv_mixed_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12089,7 +12081,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if ${ac_cv_tanh_preserves_zero_sign+:} false; then : +if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12157,7 +12149,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = xyes; then : +if test "x$ac_cv_have_decl_isinf" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12168,7 +12160,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = xyes; then : +if test "x$ac_cv_have_decl_isnan" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12179,7 +12171,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = xyes; then : +if test "x$ac_cv_have_decl_isfinite" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12199,7 +12191,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if ${ac_cv_posix_semaphores_enabled+:} false; then : +if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12250,7 +12242,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if ${ac_cv_broken_sem_getvalue+:} false; then : +if test "${ac_cv_broken_sem_getvalue+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12315,7 +12307,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12333,7 +12325,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes; then : +if test "x$ac_cv_header_wchar_h" = x""yes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12356,7 +12348,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if ${ac_cv_sizeof_wchar_t+:} false; then : +if test "${ac_cv_sizeof_wchar_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12367,7 +12359,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_wchar_t=0 fi @@ -12422,7 +12414,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if ${ac_cv_wchar_t_signed+:} false; then : + if test "${ac_cv_wchar_t_signed+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12486,7 +12478,7 @@ $as_echo "#define Py_UNICODE_SIZE 4" >>confdefs.h ;; -*) as_fn_error $? "invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)." "$LINENO" 5 ;; +*) as_fn_error $? "invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)." "$LINENO" 5 ;; esac @@ -12533,7 +12525,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : +if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12752,7 +12744,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12760,7 +12752,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if ${ac_cv_rshift_extends_sign+:} false; then : +if test "${ac_cv_rshift_extends_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12799,7 +12791,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if ${ac_cv_have_getc_unlocked+:} false; then : +if test "${ac_cv_have_getc_unlocked+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12897,7 +12889,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : +if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12931,7 +12923,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12983,7 +12975,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13017,7 +13009,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -13027,7 +13019,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13061,7 +13053,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -13071,7 +13063,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13105,7 +13097,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13146,7 +13138,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if ${ac_cv_broken_nice+:} false; then : +if test "${ac_cv_broken_nice+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13187,7 +13179,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if ${ac_cv_broken_poll+:} false; then : +if test "${ac_cv_broken_poll+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13242,7 +13234,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13258,7 +13250,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13270,7 +13262,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13309,7 +13301,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if ${ac_cv_working_tzset+:} false; then : +if test "${ac_cv_working_tzset+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13406,7 +13398,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec+:} false; then : +if test "${ac_cv_stat_tv_nsec+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13443,7 +13435,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec2+:} false; then : +if test "${ac_cv_stat_tv_nsec2+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13480,7 +13472,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if ${ac_cv_mvwdelch_is_expression+:} false; then : +if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13517,7 +13509,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if ${ac_cv_window_has_flags+:} false; then : +if test "${ac_cv_window_has_flags+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13665,7 +13657,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if ${ac_cv_have_long_long_format+:} false; then : + if test "${ac_cv_have_long_long_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13736,7 +13728,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if ${ac_cv_have_size_t_format+:} false; then : +if test "${ac_cv_have_size_t_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13809,7 +13801,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = xyes; then : +if test "x$ac_cv_type_socklen_t" = x""yes; then : else @@ -13914,21 +13906,10 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -13961,7 +13942,7 @@ -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14062,7 +14043,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14370,7 +14350,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 2.7, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14432,7 +14412,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 2.7 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14564,7 +14544,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -14586,10 +14566,9 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14597,13 +14576,12 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14625,7 +14603,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -14653,7 +14631,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14701,7 +14679,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14733,7 +14711,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14767,7 +14745,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14779,8 +14757,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14881,7 +14859,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14900,7 +14878,7 @@ for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -14909,7 +14887,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -14935,8 +14913,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15066,22 +15044,21 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15092,20 +15069,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -317,14 +317,14 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) ;; - OpenBSD/4.@<:@789@:>@) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 23:48:36 2011 From: python-checkins at python.org (charles-francois.natali) Date: Fri, 22 Jul 2011 23:48:36 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTky?= =?utf8?q?=3A_Make_Python_build_on_OpenBSD_5_=28and_future_major_releases?= =?utf8?b?KS4=?= Message-ID: http://hg.python.org/cpython/rev/9c7f9d5841ff changeset: 71461:9c7f9d5841ff branch: 3.2 parent: 71458:c9ebae3285e3 user: Charles-Fran?ois Natali date: Fri Jul 22 23:48:44 2011 +0200 summary: Issue #12592: Make Python build on OpenBSD 5 (and future major releases). files: Misc/NEWS | 2 + configure | 597 ++++++++++++++++++-------------------- configure.in | 4 +- 3 files changed, 291 insertions(+), 312 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). + - Issue #12372: POSIX semaphores are broken on AIX: don't use them. - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for python 3.2. +# Generated by GNU Autoconf 2.67 for python 3.2. # # Report bugs to . # @@ -92,7 +92,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -218,18 +217,11 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1186,7 +1178,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1524,7 +1516,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 3.2 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1570,7 +1562,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1616,7 +1608,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1653,7 +1645,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1666,10 +1658,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1736,7 +1728,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1745,7 +1737,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel @@ -1786,7 +1778,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1800,7 +1792,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1818,7 +1810,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile @@ -1831,7 +1823,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1872,7 +1864,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type @@ -1885,7 +1877,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1925,7 +1917,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t @@ -1938,7 +1930,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1999,7 +1991,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_intX_t @@ -2176,7 +2168,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2189,7 +2181,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2244,7 +2236,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func @@ -2257,7 +2249,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2301,7 +2293,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_member @@ -2316,7 +2308,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2347,7 +2339,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2355,7 +2347,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 3.2, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2613,7 +2605,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -3019,7 +3011,7 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123456]) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.[0123456]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -3028,7 +3020,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h ;; - OpenBSD/4.[789]) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD @@ -3202,7 +3194,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3242,7 +3234,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3295,7 +3287,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3335,7 +3327,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3394,7 +3386,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3438,7 +3430,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3493,7 +3485,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3608,7 +3600,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3651,7 +3643,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3710,7 +3702,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3721,7 +3713,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3762,7 +3754,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3772,7 +3764,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3809,7 +3801,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3887,7 +3879,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4022,7 +4014,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4063,7 +4055,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4114,7 +4106,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4215,7 +4207,7 @@ CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4331,7 +4323,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4343,7 +4335,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4406,7 +4398,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4473,7 +4465,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4602,7 +4594,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : +if test "x$ac_cv_header_minix_config_h" = x""yes; then : MINIX=yes else MINIX= @@ -4624,7 +4616,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4817,7 +4809,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : +if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -5018,7 +5010,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5058,7 +5050,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5112,7 +5104,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5162,7 +5154,7 @@ set dummy svnversion; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_SVNVERSION+:} false; then : +if test "${ac_cv_prog_SVNVERSION+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$SVNVERSION"; then @@ -5213,7 +5205,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_HG+:} false; then : +if test "${ac_cv_prog_HAS_HG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -5267,7 +5259,7 @@ set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_PYTHON+:} false; then : +if test "${ac_cv_prog_HAS_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_PYTHON"; then @@ -5361,7 +5353,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5547,7 +5539,7 @@ ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" save_CFLAGS="$CFLAGS" - if ${ac_cv_no_strict_aliasing+:} false; then : + if test "${ac_cv_no_strict_aliasing+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5803,7 +5795,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if ${ac_cv_pthread_is_default+:} false; then : +if test "${ac_cv_pthread_is_default+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5856,7 +5848,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if ${ac_cv_kpthread+:} false; then : +if test "${ac_cv_kpthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5905,7 +5897,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if ${ac_cv_kthread+:} false; then : +if test "${ac_cv_kthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5954,7 +5946,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if ${ac_cv_thread+:} false; then : +if test "${ac_cv_thread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -6039,7 +6031,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6178,7 +6170,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6218,7 +6210,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6252,11 +6244,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6275,7 +6267,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6309,11 +6301,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6333,7 +6325,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : +if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6361,7 +6353,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : +if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6371,7 +6363,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6391,7 +6383,7 @@ #endif " -if test "x$ac_cv_header_term_h" = xyes; then : +if test "x$ac_cv_header_term_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6413,7 +6405,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = xyes; then : +if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6579,7 +6571,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = x""yes; then : else @@ -6590,7 +6582,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = x""yes; then : else @@ -6601,7 +6593,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -6617,7 +6609,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = x""yes; then : else @@ -6629,7 +6621,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : +if test "${ac_cv_type_uid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6708,7 +6700,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = x""yes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6723,7 +6715,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : +if test "${ac_cv_sizeof_int+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6733,7 +6725,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -6756,7 +6748,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : +if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6766,7 +6758,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long=0 fi @@ -6789,7 +6781,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : +if test "${ac_cv_sizeof_void_p+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6799,7 +6791,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_void_p=0 fi @@ -6822,7 +6814,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if ${ac_cv_sizeof_short+:} false; then : +if test "${ac_cv_sizeof_short+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6832,7 +6824,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short=0 fi @@ -6855,7 +6847,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if ${ac_cv_sizeof_float+:} false; then : +if test "${ac_cv_sizeof_float+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6865,7 +6857,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_float=0 fi @@ -6888,7 +6880,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if ${ac_cv_sizeof_double+:} false; then : +if test "${ac_cv_sizeof_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6898,7 +6890,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_double=0 fi @@ -6921,7 +6913,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if ${ac_cv_sizeof_fpos_t+:} false; then : +if test "${ac_cv_sizeof_fpos_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6931,7 +6923,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_fpos_t=0 fi @@ -6954,7 +6946,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if ${ac_cv_sizeof_size_t+:} false; then : +if test "${ac_cv_sizeof_size_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6964,7 +6956,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_size_t=0 fi @@ -6987,7 +6979,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if ${ac_cv_sizeof_pid_t+:} false; then : +if test "${ac_cv_sizeof_pid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6997,7 +6989,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pid_t=0 fi @@ -7047,7 +7039,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : +if test "${ac_cv_sizeof_long_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -7057,7 +7049,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -7108,7 +7100,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if ${ac_cv_sizeof_long_double+:} false; then : +if test "${ac_cv_sizeof_long_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7118,7 +7110,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_double=0 fi @@ -7170,7 +7162,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if ${ac_cv_sizeof__Bool+:} false; then : +if test "${ac_cv_sizeof__Bool+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7180,7 +7172,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof__Bool=0 fi @@ -7206,7 +7198,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = xyes; then : +if test "x$ac_cv_type_uintptr_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7218,7 +7210,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if ${ac_cv_sizeof_uintptr_t+:} false; then : +if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7228,7 +7220,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7254,7 +7246,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if ${ac_cv_sizeof_off_t+:} false; then : +if test "${ac_cv_sizeof_off_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7269,7 +7261,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off_t=0 fi @@ -7313,7 +7305,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : +if test "${ac_cv_sizeof_time_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7331,7 +7323,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_time_t=0 fi @@ -7388,7 +7380,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if ${ac_cv_sizeof_pthread_t+:} false; then : +if test "${ac_cv_sizeof_pthread_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7403,7 +7395,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pthread_t=0 fi @@ -7835,7 +7827,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7869,7 +7861,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7880,7 +7872,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7914,7 +7906,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7928,7 +7920,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -7962,11 +7954,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_sem_init+:} false; then : + if test "${ac_cv_search_sem_init+set}" = set; then : break fi done -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : else ac_cv_search_sem_init=no @@ -7989,7 +7981,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if ${ac_cv_lib_intl_textdomain+:} false; then : +if test "${ac_cv_lib_intl_textdomain+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8023,7 +8015,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = xyes; then : +if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8070,7 +8062,7 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_t_open+:} false; then : +if test "${ac_cv_lib_nsl_t_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8104,13 +8096,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = xyes; then : +if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : +if test "${ac_cv_lib_socket_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8144,7 +8136,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : +if test "x$ac_cv_lib_socket_socket" = x""yes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8170,7 +8162,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8213,7 +8205,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8495,7 +8487,7 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h ac_fn_c_check_header_mongrel "$LINENO" "cthreads.h" "ac_cv_header_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_cthreads_h" = xyes; then : +if test "x$ac_cv_header_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8508,7 +8500,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = xyes; then : +if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8552,7 +8544,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = xyes; then : +if test "x$ac_cv_func_pthread_detach" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8561,7 +8553,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if ${ac_cv_lib_pthreads_pthread_create+:} false; then : +if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8595,7 +8587,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8605,7 +8597,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_create+:} false; then : +if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8639,7 +8631,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8649,7 +8641,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : +if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8683,7 +8675,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8693,7 +8685,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if ${ac_cv_lib_cma_pthread_create+:} false; then : +if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8727,7 +8719,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : +if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8759,7 +8751,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if ${ac_cv_lib_mpc_usconfig+:} false; then : +if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8793,7 +8785,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : +if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8805,7 +8797,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : +if test "${ac_cv_lib_thread_thr_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8839,7 +8831,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : +if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -8884,7 +8876,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if ${ac_cv_pthread_system_supported+:} false; then : + if test "${ac_cv_pthread_system_supported+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -8927,7 +8919,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = xyes; then : +if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9319,7 +9311,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9341,7 +9333,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9668,7 +9660,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if ${ac_cv_flock_decl+:} false; then : +if test "${ac_cv_flock_decl+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9698,7 +9690,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = xyes; then : +if test "x$ac_cv_func_flock" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9706,7 +9698,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_flock+:} false; then : +if test "${ac_cv_lib_bsd_flock+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9740,7 +9732,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = xyes; then : +if test "x$ac_cv_lib_bsd_flock" = x""yes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9789,7 +9781,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_TRUE+:} false; then : +if test "${ac_cv_prog_TRUE+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9829,7 +9821,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if ${ac_cv_lib_c_inet_aton+:} false; then : +if test "${ac_cv_lib_c_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9863,12 +9855,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = xyes; then : +if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if ${ac_cv_lib_resolv_inet_aton+:} false; then : +if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9902,7 +9894,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -9919,7 +9911,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if ${ac_cv_have_chflags+:} false; then : +if test "${ac_cv_have_chflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9953,7 +9945,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = xyes; then : +if test "x$ac_cv_func_chflags" = x""yes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -9968,7 +9960,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if ${ac_cv_have_lchflags+:} false; then : +if test "${ac_cv_have_lchflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10002,7 +9994,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = xyes; then : +if test "x$ac_cv_func_lchflags" = x""yes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -10026,7 +10018,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if ${ac_cv_lib_z_inflateCopy+:} false; then : +if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10060,7 +10052,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : +if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10203,7 +10195,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = xyes; then : +if test "x$ac_cv_func_openpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10211,7 +10203,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if ${ac_cv_lib_util_openpty+:} false; then : +if test "${ac_cv_lib_util_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10245,13 +10237,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = xyes; then : +if test "x$ac_cv_lib_util_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_openpty+:} false; then : +if test "${ac_cv_lib_bsd_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10285,7 +10277,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = xyes; then : +if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10300,7 +10292,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = xyes; then : +if test "x$ac_cv_func_forkpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10308,7 +10300,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if ${ac_cv_lib_util_forkpty+:} false; then : +if test "${ac_cv_lib_util_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10342,13 +10334,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = xyes; then : +if test "x$ac_cv_lib_util_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_forkpty+:} false; then : +if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10382,7 +10374,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : +if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10399,7 +10391,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : +if test "x$ac_cv_func_memmove" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10423,7 +10415,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes; then : +if test "x$ac_cv_func_dup2" = x""yes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10436,7 +10428,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : +if test "x$ac_cv_func_getcwd" = x""yes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10449,7 +10441,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = xyes; then : +if test "x$ac_cv_func_strdup" = x""yes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10465,7 +10457,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = xyes; then : +if test "x$ac_cv_func_getpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10493,7 +10485,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = xyes; then : +if test "x$ac_cv_func_setpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10521,7 +10513,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : +if test "x$ac_cv_func_gettimeofday" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10623,7 +10615,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if ${ac_cv_buggy_getaddrinfo+:} false; then : + if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10752,7 +10744,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = xyes; then : +if test "x$ac_cv_func_getnameinfo" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10764,7 +10756,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10799,7 +10791,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : +if test "${ac_cv_struct_tm+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10836,7 +10828,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10852,7 +10844,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -10864,7 +10856,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10900,7 +10892,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -10910,7 +10902,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -10920,7 +10912,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -10930,7 +10922,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -10940,7 +10932,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -10950,7 +10942,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -10972,7 +10964,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if ${ac_cv_header_time_altzone+:} false; then : +if test "${ac_cv_header_time_altzone+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11036,7 +11028,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if ${ac_cv_struct_addrinfo+:} false; then : +if test "${ac_cv_struct_addrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11068,7 +11060,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if ${ac_cv_struct_sockaddr_storage+:} false; then : +if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11104,7 +11096,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if ${ac_cv_c_char_unsigned+:} false; then : +if test "${ac_cv_c_char_unsigned+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11136,7 +11128,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11424,7 +11416,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes; then : +if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11555,7 +11547,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11577,12 +11569,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = xyes; then : +if test "x$ac_cv_func___fpu_control" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if ${ac_cv_lib_ieee___fpu_control+:} false; then : +if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11616,7 +11608,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11710,7 +11702,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_little_endian_double+:} false; then : +if test "${ac_cv_little_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11752,7 +11744,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_big_endian_double+:} false; then : +if test "${ac_cv_big_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11798,7 +11790,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_mixed_endian_double+:} false; then : +if test "${ac_cv_mixed_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11968,7 +11960,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = xyes; then : +if test "x$ac_cv_have_decl_isinf" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11979,7 +11971,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = xyes; then : +if test "x$ac_cv_have_decl_isnan" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11990,7 +11982,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = xyes; then : +if test "x$ac_cv_have_decl_isfinite" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12005,7 +11997,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if ${ac_cv_tanh_preserves_zero_sign+:} false; then : +if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12053,7 +12045,7 @@ # -0. See issue #9920. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether log1p drops the sign of negative zero" >&5 $as_echo_n "checking whether log1p drops the sign of negative zero... " >&6; } - if ${ac_cv_log1p_drops_zero_sign+:} false; then : + if test "${ac_cv_log1p_drops_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12105,7 +12097,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if ${ac_cv_posix_semaphores_enabled+:} false; then : +if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12156,7 +12148,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if ${ac_cv_broken_sem_getvalue+:} false; then : +if test "${ac_cv_broken_sem_getvalue+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12221,7 +12213,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12239,7 +12231,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes; then : +if test "x$ac_cv_header_wchar_h" = x""yes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12262,7 +12254,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if ${ac_cv_sizeof_wchar_t+:} false; then : +if test "${ac_cv_sizeof_wchar_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12273,7 +12265,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_wchar_t=0 fi @@ -12328,7 +12320,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if ${ac_cv_wchar_t_signed+:} false; then : + if test "${ac_cv_wchar_t_signed+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12424,7 +12416,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : +if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12643,7 +12635,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12715,7 +12707,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if ${ac_cv_rshift_extends_sign+:} false; then : +if test "${ac_cv_rshift_extends_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12754,7 +12746,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if ${ac_cv_have_getc_unlocked+:} false; then : +if test "${ac_cv_have_getc_unlocked+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12852,7 +12844,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : +if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12886,7 +12878,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12938,7 +12930,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12972,7 +12964,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -12982,7 +12974,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13016,7 +13008,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -13026,7 +13018,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13060,7 +13052,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13101,7 +13093,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if ${ac_cv_broken_nice+:} false; then : +if test "${ac_cv_broken_nice+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13142,7 +13134,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if ${ac_cv_broken_poll+:} false; then : +if test "${ac_cv_broken_poll+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13197,7 +13189,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13213,7 +13205,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13225,7 +13217,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13264,7 +13256,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if ${ac_cv_working_tzset+:} false; then : +if test "${ac_cv_working_tzset+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13361,7 +13353,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec+:} false; then : +if test "${ac_cv_stat_tv_nsec+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13398,7 +13390,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec2+:} false; then : +if test "${ac_cv_stat_tv_nsec2+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13435,7 +13427,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if ${ac_cv_mvwdelch_is_expression+:} false; then : +if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13472,7 +13464,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if ${ac_cv_window_has_flags+:} false; then : +if test "${ac_cv_window_has_flags+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13620,7 +13612,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if ${ac_cv_have_long_long_format+:} false; then : + if test "${ac_cv_have_long_long_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13690,7 +13682,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if ${ac_cv_have_size_t_format+:} false; then : +if test "${ac_cv_have_size_t_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13763,7 +13755,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = xyes; then : +if test "x$ac_cv_type_socklen_t" = x""yes; then : else @@ -13774,7 +13766,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken mbstowcs" >&5 $as_echo_n "checking for broken mbstowcs... " >&6; } -if ${ac_cv_broken_mbstowcs+:} false; then : +if test "${ac_cv_broken_mbstowcs+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13814,7 +13806,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5 $as_echo_n "checking whether $CC supports computed gotos... " >&6; } -if ${ac_cv_computed_gotos+:} false; then : +if test "${ac_cv_computed_gotos+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13894,11 +13886,11 @@ case $ac_sys_system in - OSF*) as_fn_error $? "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;; + OSF*) as_fn_error $? "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;; esac ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" -if test "x$ac_cv_func_pipe2" = xyes; then : +if test "x$ac_cv_func_pipe2" = x""yes; then : $as_echo "#define HAVE_PIPE2 1" >>confdefs.h @@ -13993,21 +13985,10 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -14040,7 +14021,7 @@ -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14141,7 +14122,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14449,7 +14429,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 3.2, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14511,7 +14491,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 3.2 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14642,7 +14622,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -14664,10 +14644,9 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14675,13 +14654,12 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14703,7 +14681,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -14731,7 +14709,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14779,7 +14757,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14811,7 +14789,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14845,7 +14823,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14857,8 +14835,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14959,7 +14937,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14978,7 +14956,7 @@ for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -14987,7 +14965,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -15013,8 +14991,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15144,22 +15122,21 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15170,20 +15147,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -313,14 +313,14 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) ;; - OpenBSD/4.@<:@789@:>@) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jul 22 23:51:50 2011 From: python-checkins at python.org (charles-francois.natali) Date: Fri, 22 Jul 2011 23:51:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Merge_-_Issue_=2312592=3A_M?= =?utf8?q?ake_Python_build_on_OpenBSD_5_=28and_future_major?= Message-ID: http://hg.python.org/cpython/rev/63de97ae832e changeset: 71462:63de97ae832e parent: 71459:d3f0f72c31f8 user: Charles-Fran?ois Natali date: Fri Jul 22 23:52:02 2011 +0200 summary: Merge - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). files: Misc/NEWS | 2 + configure | 597 ++++++++++++++++++-------------------- configure.in | 4 +- 3 files changed, 291 insertions(+), 312 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,8 @@ Library ------- +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). + - Issue #12372: POSIX semaphores are broken on AIX: don't use them. - Issue #12551: Provide a get_channel_binding() method on SSL sockets so as diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for python 3.3. +# Generated by GNU Autoconf 2.67 for python 3.3. # # Report bugs to . # @@ -91,7 +91,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -217,18 +216,11 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1183,7 +1175,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1520,7 +1512,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 3.3 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1566,7 +1558,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1612,7 +1604,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1649,7 +1641,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1662,10 +1654,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1732,7 +1724,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1741,7 +1733,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel @@ -1782,7 +1774,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1796,7 +1788,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1814,7 +1806,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile @@ -1827,7 +1819,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1868,7 +1860,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type @@ -1881,7 +1873,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1921,7 +1913,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t @@ -1934,7 +1926,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1995,7 +1987,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_intX_t @@ -2172,7 +2164,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2185,7 +2177,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2240,7 +2232,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func @@ -2253,7 +2245,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2297,7 +2289,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_member @@ -2312,7 +2304,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2343,7 +2335,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2351,7 +2343,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 3.3, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2609,7 +2601,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2709,7 +2701,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_HG+:} false; then : +if test "${ac_cv_prog_HAS_HG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -3074,7 +3066,7 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123456]) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.[0123456]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -3083,7 +3075,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h ;; - OpenBSD/4.[789]) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD @@ -3257,7 +3249,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3297,7 +3289,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3350,7 +3342,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3390,7 +3382,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3449,7 +3441,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3493,7 +3485,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3548,7 +3540,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3663,7 +3655,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3706,7 +3698,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3765,7 +3757,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3776,7 +3768,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3817,7 +3809,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3827,7 +3819,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3864,7 +3856,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3942,7 +3934,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4077,7 +4069,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4118,7 +4110,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4169,7 +4161,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4270,7 +4262,7 @@ CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4386,7 +4378,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4398,7 +4390,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4461,7 +4453,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4528,7 +4520,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4657,7 +4649,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : +if test "x$ac_cv_header_minix_config_h" = x""yes; then : MINIX=yes else MINIX= @@ -4679,7 +4671,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4872,7 +4864,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : +if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -5068,7 +5060,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5108,7 +5100,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5162,7 +5154,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5213,7 +5205,7 @@ set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_PYTHON+:} false; then : +if test "${ac_cv_prog_HAS_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_PYTHON"; then @@ -5307,7 +5299,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5493,7 +5485,7 @@ ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" save_CFLAGS="$CFLAGS" - if ${ac_cv_no_strict_aliasing+:} false; then : + if test "${ac_cv_no_strict_aliasing+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5743,7 +5735,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if ${ac_cv_pthread_is_default+:} false; then : +if test "${ac_cv_pthread_is_default+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5796,7 +5788,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if ${ac_cv_kpthread+:} false; then : +if test "${ac_cv_kpthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5845,7 +5837,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if ${ac_cv_kthread+:} false; then : +if test "${ac_cv_kthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5894,7 +5886,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if ${ac_cv_thread+:} false; then : +if test "${ac_cv_thread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5979,7 +5971,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6118,7 +6110,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6158,7 +6150,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6192,11 +6184,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6215,7 +6207,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6249,11 +6241,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6273,7 +6265,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : +if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6301,7 +6293,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : +if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6311,7 +6303,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6339,7 +6331,7 @@ #endif " -if test "x$ac_cv_header_net_if_h" = xyes; then : +if test "x$ac_cv_header_net_if_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NET_IF_H 1 _ACEOF @@ -6359,7 +6351,7 @@ #endif " -if test "x$ac_cv_header_term_h" = xyes; then : +if test "x$ac_cv_header_term_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6381,7 +6373,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = xyes; then : +if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6517,7 +6509,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = x""yes; then : else @@ -6528,7 +6520,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = x""yes; then : else @@ -6539,7 +6531,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -6555,7 +6547,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = x""yes; then : else @@ -6567,7 +6559,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : +if test "${ac_cv_type_uid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6646,7 +6638,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = x""yes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6661,7 +6653,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : +if test "${ac_cv_sizeof_int+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6671,7 +6663,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -6694,7 +6686,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : +if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6704,7 +6696,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long=0 fi @@ -6727,7 +6719,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : +if test "${ac_cv_sizeof_void_p+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6737,7 +6729,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_void_p=0 fi @@ -6760,7 +6752,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if ${ac_cv_sizeof_short+:} false; then : +if test "${ac_cv_sizeof_short+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6770,7 +6762,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short=0 fi @@ -6793,7 +6785,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if ${ac_cv_sizeof_float+:} false; then : +if test "${ac_cv_sizeof_float+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6803,7 +6795,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_float=0 fi @@ -6826,7 +6818,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if ${ac_cv_sizeof_double+:} false; then : +if test "${ac_cv_sizeof_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6836,7 +6828,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_double=0 fi @@ -6859,7 +6851,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if ${ac_cv_sizeof_fpos_t+:} false; then : +if test "${ac_cv_sizeof_fpos_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6869,7 +6861,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_fpos_t=0 fi @@ -6892,7 +6884,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if ${ac_cv_sizeof_size_t+:} false; then : +if test "${ac_cv_sizeof_size_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6902,7 +6894,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_size_t=0 fi @@ -6925,7 +6917,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if ${ac_cv_sizeof_pid_t+:} false; then : +if test "${ac_cv_sizeof_pid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6935,7 +6927,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pid_t=0 fi @@ -6985,7 +6977,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : +if test "${ac_cv_sizeof_long_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -6995,7 +6987,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -7046,7 +7038,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if ${ac_cv_sizeof_long_double+:} false; then : +if test "${ac_cv_sizeof_long_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7056,7 +7048,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_double=0 fi @@ -7108,7 +7100,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if ${ac_cv_sizeof__Bool+:} false; then : +if test "${ac_cv_sizeof__Bool+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7118,7 +7110,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof__Bool=0 fi @@ -7144,7 +7136,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = xyes; then : +if test "x$ac_cv_type_uintptr_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7156,7 +7148,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if ${ac_cv_sizeof_uintptr_t+:} false; then : +if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7166,7 +7158,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7192,7 +7184,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if ${ac_cv_sizeof_off_t+:} false; then : +if test "${ac_cv_sizeof_off_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7207,7 +7199,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off_t=0 fi @@ -7251,7 +7243,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : +if test "${ac_cv_sizeof_time_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7269,7 +7261,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_time_t=0 fi @@ -7326,7 +7318,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if ${ac_cv_sizeof_pthread_t+:} false; then : +if test "${ac_cv_sizeof_pthread_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7341,7 +7333,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pthread_t=0 fi @@ -7772,7 +7764,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile in -lsendfile" >&5 $as_echo_n "checking for sendfile in -lsendfile... " >&6; } -if ${ac_cv_lib_sendfile_sendfile+:} false; then : +if test "${ac_cv_lib_sendfile_sendfile+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7806,7 +7798,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sendfile_sendfile" >&5 $as_echo "$ac_cv_lib_sendfile_sendfile" >&6; } -if test "x$ac_cv_lib_sendfile_sendfile" = xyes; then : +if test "x$ac_cv_lib_sendfile_sendfile" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSENDFILE 1 _ACEOF @@ -7817,7 +7809,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7851,7 +7843,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7862,7 +7854,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7896,7 +7888,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7910,7 +7902,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -7944,11 +7936,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_sem_init+:} false; then : + if test "${ac_cv_search_sem_init+set}" = set; then : break fi done -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : else ac_cv_search_sem_init=no @@ -7971,7 +7963,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if ${ac_cv_lib_intl_textdomain+:} false; then : +if test "${ac_cv_lib_intl_textdomain+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8005,7 +7997,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = xyes; then : +if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8052,7 +8044,7 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_t_open+:} false; then : +if test "${ac_cv_lib_nsl_t_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8086,13 +8078,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = xyes; then : +if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : +if test "${ac_cv_lib_socket_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8126,7 +8118,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : +if test "x$ac_cv_lib_socket_socket" = x""yes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8152,7 +8144,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8195,7 +8187,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8491,7 +8483,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = xyes; then : +if test "x$ac_cv_func_pthread_detach" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8500,7 +8492,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if ${ac_cv_lib_pthreads_pthread_create+:} false; then : +if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8534,7 +8526,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8544,7 +8536,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_create+:} false; then : +if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8578,7 +8570,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8588,7 +8580,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : +if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8622,7 +8614,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8632,7 +8624,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if ${ac_cv_lib_cma_pthread_create+:} false; then : +if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8666,7 +8658,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : +if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8692,7 +8684,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if ${ac_cv_lib_mpc_usconfig+:} false; then : +if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8726,7 +8718,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : +if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8738,7 +8730,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : +if test "${ac_cv_lib_thread_thr_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8772,7 +8764,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : +if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -8808,7 +8800,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if ${ac_cv_pthread_system_supported+:} false; then : + if test "${ac_cv_pthread_system_supported+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -8851,7 +8843,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = xyes; then : +if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9243,7 +9235,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9265,7 +9257,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9597,7 +9589,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if ${ac_cv_flock_decl+:} false; then : +if test "${ac_cv_flock_decl+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9627,7 +9619,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = xyes; then : +if test "x$ac_cv_func_flock" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9635,7 +9627,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_flock+:} false; then : +if test "${ac_cv_lib_bsd_flock+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9669,7 +9661,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = xyes; then : +if test "x$ac_cv_lib_bsd_flock" = x""yes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9746,7 +9738,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_TRUE+:} false; then : +if test "${ac_cv_prog_TRUE+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9786,7 +9778,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if ${ac_cv_lib_c_inet_aton+:} false; then : +if test "${ac_cv_lib_c_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9820,12 +9812,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = xyes; then : +if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if ${ac_cv_lib_resolv_inet_aton+:} false; then : +if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9859,7 +9851,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -9876,7 +9868,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if ${ac_cv_have_chflags+:} false; then : +if test "${ac_cv_have_chflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9910,7 +9902,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = xyes; then : +if test "x$ac_cv_func_chflags" = x""yes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -9925,7 +9917,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if ${ac_cv_have_lchflags+:} false; then : +if test "${ac_cv_have_lchflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9959,7 +9951,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = xyes; then : +if test "x$ac_cv_func_lchflags" = x""yes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -9983,7 +9975,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if ${ac_cv_lib_z_inflateCopy+:} false; then : +if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10017,7 +10009,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : +if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10160,7 +10152,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = xyes; then : +if test "x$ac_cv_func_openpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10168,7 +10160,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if ${ac_cv_lib_util_openpty+:} false; then : +if test "${ac_cv_lib_util_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10202,13 +10194,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = xyes; then : +if test "x$ac_cv_lib_util_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_openpty+:} false; then : +if test "${ac_cv_lib_bsd_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10242,7 +10234,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = xyes; then : +if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10257,7 +10249,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = xyes; then : +if test "x$ac_cv_func_forkpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10265,7 +10257,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if ${ac_cv_lib_util_forkpty+:} false; then : +if test "${ac_cv_lib_util_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10299,13 +10291,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = xyes; then : +if test "x$ac_cv_lib_util_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_forkpty+:} false; then : +if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10339,7 +10331,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : +if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10356,7 +10348,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : +if test "x$ac_cv_func_memmove" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10380,7 +10372,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes; then : +if test "x$ac_cv_func_dup2" = x""yes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10393,7 +10385,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : +if test "x$ac_cv_func_getcwd" = x""yes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10406,7 +10398,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = xyes; then : +if test "x$ac_cv_func_strdup" = x""yes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10422,7 +10414,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = xyes; then : +if test "x$ac_cv_func_getpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10450,7 +10442,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = xyes; then : +if test "x$ac_cv_func_setpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10478,7 +10470,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : +if test "x$ac_cv_func_gettimeofday" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10580,7 +10572,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if ${ac_cv_buggy_getaddrinfo+:} false; then : + if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10709,7 +10701,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = xyes; then : +if test "x$ac_cv_func_getnameinfo" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10721,7 +10713,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10756,7 +10748,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : +if test "${ac_cv_struct_tm+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10793,7 +10785,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10809,7 +10801,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -10821,7 +10813,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10857,7 +10849,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -10867,7 +10859,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -10877,7 +10869,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -10887,7 +10879,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -10897,7 +10889,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -10907,7 +10899,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -10929,7 +10921,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if ${ac_cv_header_time_altzone+:} false; then : +if test "${ac_cv_header_time_altzone+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -10993,7 +10985,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if ${ac_cv_struct_addrinfo+:} false; then : +if test "${ac_cv_struct_addrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11025,7 +11017,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if ${ac_cv_struct_sockaddr_storage+:} false; then : +if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11061,7 +11053,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if ${ac_cv_c_char_unsigned+:} false; then : +if test "${ac_cv_c_char_unsigned+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11093,7 +11085,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11381,7 +11373,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes; then : +if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11512,7 +11504,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11534,12 +11526,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = xyes; then : +if test "x$ac_cv_func___fpu_control" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if ${ac_cv_lib_ieee___fpu_control+:} false; then : +if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11573,7 +11565,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11667,7 +11659,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_little_endian_double+:} false; then : +if test "${ac_cv_little_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11709,7 +11701,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_big_endian_double+:} false; then : +if test "${ac_cv_big_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11755,7 +11747,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_mixed_endian_double+:} false; then : +if test "${ac_cv_mixed_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11925,7 +11917,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = xyes; then : +if test "x$ac_cv_have_decl_isinf" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11936,7 +11928,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = xyes; then : +if test "x$ac_cv_have_decl_isnan" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11947,7 +11939,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = xyes; then : +if test "x$ac_cv_have_decl_isfinite" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11962,7 +11954,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if ${ac_cv_tanh_preserves_zero_sign+:} false; then : +if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12010,7 +12002,7 @@ # -0. See issue #9920. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether log1p drops the sign of negative zero" >&5 $as_echo_n "checking whether log1p drops the sign of negative zero... " >&6; } - if ${ac_cv_log1p_drops_zero_sign+:} false; then : + if test "${ac_cv_log1p_drops_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12062,7 +12054,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if ${ac_cv_posix_semaphores_enabled+:} false; then : +if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12113,7 +12105,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if ${ac_cv_broken_sem_getvalue+:} false; then : +if test "${ac_cv_broken_sem_getvalue+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12178,7 +12170,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12196,7 +12188,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes; then : +if test "x$ac_cv_header_wchar_h" = x""yes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12219,7 +12211,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if ${ac_cv_sizeof_wchar_t+:} false; then : +if test "${ac_cv_sizeof_wchar_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12230,7 +12222,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_wchar_t=0 fi @@ -12285,7 +12277,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if ${ac_cv_wchar_t_signed+:} false; then : + if test "${ac_cv_wchar_t_signed+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12381,7 +12373,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : +if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12600,7 +12592,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12672,7 +12664,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if ${ac_cv_rshift_extends_sign+:} false; then : +if test "${ac_cv_rshift_extends_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12711,7 +12703,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if ${ac_cv_have_getc_unlocked+:} false; then : +if test "${ac_cv_have_getc_unlocked+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12809,7 +12801,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : +if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12843,7 +12835,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12895,7 +12887,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12929,7 +12921,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -12939,7 +12931,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12973,7 +12965,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -12983,7 +12975,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13017,7 +13009,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13058,7 +13050,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if ${ac_cv_broken_nice+:} false; then : +if test "${ac_cv_broken_nice+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13099,7 +13091,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if ${ac_cv_broken_poll+:} false; then : +if test "${ac_cv_broken_poll+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13154,7 +13146,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13170,7 +13162,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13182,7 +13174,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13221,7 +13213,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if ${ac_cv_working_tzset+:} false; then : +if test "${ac_cv_working_tzset+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13318,7 +13310,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec+:} false; then : +if test "${ac_cv_stat_tv_nsec+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13355,7 +13347,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec2+:} false; then : +if test "${ac_cv_stat_tv_nsec2+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13392,7 +13384,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if ${ac_cv_mvwdelch_is_expression+:} false; then : +if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13429,7 +13421,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if ${ac_cv_window_has_flags+:} false; then : +if test "${ac_cv_window_has_flags+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13577,7 +13569,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if ${ac_cv_have_long_long_format+:} false; then : + if test "${ac_cv_have_long_long_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13647,7 +13639,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if ${ac_cv_have_size_t_format+:} false; then : +if test "${ac_cv_have_size_t_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13720,7 +13712,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = xyes; then : +if test "x$ac_cv_type_socklen_t" = x""yes; then : else @@ -13731,7 +13723,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken mbstowcs" >&5 $as_echo_n "checking for broken mbstowcs... " >&6; } -if ${ac_cv_broken_mbstowcs+:} false; then : +if test "${ac_cv_broken_mbstowcs+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13771,7 +13763,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5 $as_echo_n "checking whether $CC supports computed gotos... " >&6; } -if ${ac_cv_computed_gotos+:} false; then : +if test "${ac_cv_computed_gotos+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13938,21 +13930,10 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -13985,7 +13966,7 @@ -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14086,7 +14067,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14394,7 +14374,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 3.3, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14418,8 +14398,8 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. -config_files="`echo $ac_config_files`" -config_headers="`echo $ac_config_headers`" +config_files="$ac_config_files" +config_headers="$ac_config_headers" _ACEOF @@ -14456,7 +14436,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 3.3 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14587,7 +14567,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -14609,10 +14589,9 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14620,13 +14599,12 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14648,7 +14626,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -14676,7 +14654,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14724,7 +14702,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14756,7 +14734,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14790,7 +14768,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14802,8 +14780,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14904,7 +14882,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14923,7 +14901,7 @@ for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -14932,7 +14910,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -14958,8 +14936,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15089,22 +15067,21 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15115,20 +15092,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -327,14 +327,14 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) ;; - OpenBSD/4.@<:@789@:>@) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 00:21:53 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Jul 2011 00:21:53 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_allow_None_iden?= =?utf8?q?tifiers?= Message-ID: http://hg.python.org/cpython/rev/7a72068d88fe changeset: 71463:7a72068d88fe branch: 2.7 parent: 71453:c6e63c67efd5 user: Benjamin Peterson date: Fri Jul 22 17:20:58 2011 -0500 summary: allow None identifiers files: Parser/asdl_c.py | 2 +- Python/Python-ast.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -802,7 +802,7 @@ static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyString_CheckExact(obj)) { + if (!PyString_CheckExact(obj) && obj != Py_None) { PyErr_Format(PyExc_TypeError, "AST identifier must be of type str"); return 1; diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2,7 +2,7 @@ /* - __version__ . + __version__ 82160. This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -596,7 +596,7 @@ static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) { - if (!PyString_CheckExact(obj)) { + if (!PyString_CheckExact(obj) && obj != Py_None) { PyErr_Format(PyExc_TypeError, "AST identifier must be of type str"); return 1; @@ -6587,7 +6587,7 @@ if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return; - if (PyModule_AddStringConstant(m, "__version__", "") < 0) + if (PyModule_AddStringConstant(m, "__version__", "82160") < 0) return; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 00:21:54 2011 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 23 Jul 2011 00:21:54 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/8d560f5d40d1 changeset: 71464:8d560f5d40d1 branch: 2.7 parent: 71463:7a72068d88fe parent: 71460:b24a2ccae56a user: Benjamin Peterson date: Fri Jul 22 17:21:56 2011 -0500 summary: merge heads files: Misc/NEWS | 2 + configure | 597 ++++++++++++++++++-------------------- configure.in | 4 +- 3 files changed, 291 insertions(+), 312 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). + - Issue #12372: POSIX semaphores are broken on AIX: don't use them. - Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for python 2.7. +# Generated by GNU Autoconf 2.67 for python 2.7. # # Report bugs to . # @@ -92,7 +92,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -218,18 +217,11 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1182,7 +1174,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1519,7 +1511,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 2.7 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1565,7 +1557,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1602,7 +1594,7 @@ ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1615,10 +1607,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1685,7 +1677,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1694,7 +1686,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel @@ -1735,7 +1727,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1749,7 +1741,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1767,7 +1759,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile @@ -1812,7 +1804,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1826,7 +1818,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1867,7 +1859,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type @@ -1880,7 +1872,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1920,7 +1912,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t @@ -1933,7 +1925,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1994,7 +1986,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_intX_t @@ -2171,7 +2163,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2184,7 +2176,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2239,7 +2231,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func @@ -2252,7 +2244,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2296,7 +2288,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_member @@ -2311,7 +2303,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2342,7 +2334,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2350,7 +2342,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 2.7, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2608,7 +2600,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -3026,7 +3018,7 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123456]) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.[0123456]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -3035,7 +3027,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h ;; - OpenBSD/4.[789]) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD @@ -3248,7 +3240,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3288,7 +3280,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3341,7 +3333,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3381,7 +3373,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3440,7 +3432,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3484,7 +3476,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3539,7 +3531,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3654,7 +3646,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3697,7 +3689,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3756,7 +3748,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3767,7 +3759,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3808,7 +3800,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3818,7 +3810,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3855,7 +3847,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3933,7 +3925,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4072,7 +4064,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4113,7 +4105,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CXX+:} false; then : +if test "${ac_cv_path_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4164,7 +4156,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4235,7 +4227,7 @@ CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4351,7 +4343,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4363,7 +4355,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4426,7 +4418,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4493,7 +4485,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4622,7 +4614,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : +if test "x$ac_cv_header_minix_config_h" = x""yes; then : MINIX=yes else MINIX= @@ -4644,7 +4636,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4988,7 +4980,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5028,7 +5020,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5082,7 +5074,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5132,7 +5124,7 @@ set dummy svnversion; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_SVNVERSION+:} false; then : +if test "${ac_cv_prog_SVNVERSION+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$SVNVERSION"; then @@ -5180,7 +5172,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_HG+:} false; then : +if test "${ac_cv_prog_HAS_HG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -5279,7 +5271,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5460,7 +5452,7 @@ $as_echo_n "checking whether $CC accepts -fno-strict-aliasing... " >&6; } ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" - if ${ac_cv_no_strict_aliasing_ok+:} false; then : + if test "${ac_cv_no_strict_aliasing_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5650,7 +5642,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -OPT:Olimit=0" >&5 $as_echo_n "checking whether $CC accepts -OPT:Olimit=0... " >&6; } -if ${ac_cv_opt_olimit_ok+:} false; then : +if test "${ac_cv_opt_olimit_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5692,7 +5684,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Olimit 1500" >&5 $as_echo_n "checking whether $CC accepts -Olimit 1500... " >&6; } - if ${ac_cv_olimit_ok+:} false; then : + if test "${ac_cv_olimit_ok+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5770,7 +5762,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if ${ac_cv_pthread_is_default+:} false; then : +if test "${ac_cv_pthread_is_default+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5823,7 +5815,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if ${ac_cv_kpthread+:} false; then : +if test "${ac_cv_kpthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5872,7 +5864,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if ${ac_cv_kthread+:} false; then : +if test "${ac_cv_kthread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5921,7 +5913,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if ${ac_cv_thread+:} false; then : +if test "${ac_cv_thread+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -6006,7 +5998,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6145,7 +6137,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6185,7 +6177,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6219,11 +6211,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6242,7 +6234,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6276,11 +6268,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test "${ac_cv_search_opendir+set}" = set; then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no @@ -6300,7 +6292,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : +if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6328,7 +6320,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : +if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6338,7 +6330,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6358,7 +6350,7 @@ #endif " -if test "x$ac_cv_header_term_h" = xyes; then : +if test "x$ac_cv_header_term_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6380,7 +6372,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = xyes; then : +if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6543,7 +6535,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = x""yes; then : else @@ -6554,7 +6546,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = x""yes; then : else @@ -6565,7 +6557,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -6581,7 +6573,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = x""yes; then : else @@ -6593,7 +6585,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : +if test "${ac_cv_type_uid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6672,7 +6664,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = x""yes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6687,7 +6679,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : +if test "${ac_cv_sizeof_int+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6697,7 +6689,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -6720,7 +6712,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : +if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6730,7 +6722,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long=0 fi @@ -6753,7 +6745,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : +if test "${ac_cv_sizeof_void_p+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6763,7 +6755,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_void_p=0 fi @@ -6786,7 +6778,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if ${ac_cv_sizeof_short+:} false; then : +if test "${ac_cv_sizeof_short+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6796,7 +6788,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short=0 fi @@ -6819,7 +6811,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if ${ac_cv_sizeof_float+:} false; then : +if test "${ac_cv_sizeof_float+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6829,7 +6821,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_float=0 fi @@ -6852,7 +6844,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if ${ac_cv_sizeof_double+:} false; then : +if test "${ac_cv_sizeof_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6862,7 +6854,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_double=0 fi @@ -6885,7 +6877,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if ${ac_cv_sizeof_fpos_t+:} false; then : +if test "${ac_cv_sizeof_fpos_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6895,7 +6887,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_fpos_t=0 fi @@ -6918,7 +6910,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if ${ac_cv_sizeof_size_t+:} false; then : +if test "${ac_cv_sizeof_size_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6928,7 +6920,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_size_t=0 fi @@ -6951,7 +6943,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if ${ac_cv_sizeof_pid_t+:} false; then : +if test "${ac_cv_sizeof_pid_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6961,7 +6953,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pid_t=0 fi @@ -7011,7 +7003,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : +if test "${ac_cv_sizeof_long_long+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -7021,7 +7013,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -7072,7 +7064,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if ${ac_cv_sizeof_long_double+:} false; then : +if test "${ac_cv_sizeof_long_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7082,7 +7074,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_double=0 fi @@ -7133,7 +7125,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if ${ac_cv_sizeof__Bool+:} false; then : +if test "${ac_cv_sizeof__Bool+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7143,7 +7135,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof__Bool=0 fi @@ -7169,7 +7161,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = xyes; then : +if test "x$ac_cv_type_uintptr_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7181,7 +7173,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if ${ac_cv_sizeof_uintptr_t+:} false; then : +if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7191,7 +7183,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7217,7 +7209,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if ${ac_cv_sizeof_off_t+:} false; then : +if test "${ac_cv_sizeof_off_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7232,7 +7224,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off_t=0 fi @@ -7276,7 +7268,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : +if test "${ac_cv_sizeof_time_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7294,7 +7286,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_time_t=0 fi @@ -7350,7 +7342,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if ${ac_cv_sizeof_pthread_t+:} false; then : +if test "${ac_cv_sizeof_pthread_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7365,7 +7357,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_pthread_t=0 fi @@ -7877,7 +7869,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7911,7 +7903,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7922,7 +7914,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7956,7 +7948,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7970,7 +7962,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -8004,11 +7996,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_sem_init+:} false; then : + if test "${ac_cv_search_sem_init+set}" = set; then : break fi done -if ${ac_cv_search_sem_init+:} false; then : +if test "${ac_cv_search_sem_init+set}" = set; then : else ac_cv_search_sem_init=no @@ -8031,7 +8023,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if ${ac_cv_lib_intl_textdomain+:} false; then : +if test "${ac_cv_lib_intl_textdomain+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8065,7 +8057,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = xyes; then : +if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8112,7 +8104,7 @@ # BeOS' sockets are stashed in libnet. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_t_open+:} false; then : +if test "${ac_cv_lib_nsl_t_open+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8146,13 +8138,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = xyes; then : +if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : +if test "${ac_cv_lib_socket_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8186,7 +8178,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : +if test "x$ac_cv_lib_socket_socket" = x""yes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8195,7 +8187,7 @@ BeOS*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lnet" >&5 $as_echo_n "checking for socket in -lnet... " >&6; } -if ${ac_cv_lib_net_socket+:} false; then : +if test "${ac_cv_lib_net_socket+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8229,7 +8221,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_socket" >&5 $as_echo "$ac_cv_lib_net_socket" >&6; } -if test "x$ac_cv_lib_net_socket" = xyes; then : +if test "x$ac_cv_lib_net_socket" = x""yes; then : LIBS="-lnet $LIBS" fi # BeOS @@ -8257,7 +8249,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8300,7 +8292,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8568,7 +8560,7 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h ac_fn_c_check_header_mongrel "$LINENO" "cthreads.h" "ac_cv_header_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_cthreads_h" = xyes; then : +if test "x$ac_cv_header_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8581,7 +8573,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = xyes; then : +if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8643,7 +8635,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = xyes; then : +if test "x$ac_cv_func_pthread_detach" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8651,7 +8643,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "atheos/threads.h" "ac_cv_header_atheos_threads_h" "$ac_includes_default" -if test "x$ac_cv_header_atheos_threads_h" = xyes; then : +if test "x$ac_cv_header_atheos_threads_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h @@ -8661,7 +8653,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "kernel/OS.h" "ac_cv_header_kernel_OS_h" "$ac_includes_default" -if test "x$ac_cv_header_kernel_OS_h" = xyes; then : +if test "x$ac_cv_header_kernel_OS_h" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h @@ -8672,7 +8664,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if ${ac_cv_lib_pthreads_pthread_create+:} false; then : +if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8706,7 +8698,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8716,7 +8708,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_create+:} false; then : +if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8750,7 +8742,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8760,7 +8752,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : +if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8794,7 +8786,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8804,7 +8796,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if ${ac_cv_lib_cma_pthread_create+:} false; then : +if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8838,7 +8830,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : +if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8878,7 +8870,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if ${ac_cv_lib_mpc_usconfig+:} false; then : +if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8912,7 +8904,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : +if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8924,7 +8916,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : +if test "${ac_cv_lib_thread_thr_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8958,7 +8950,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : +if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -9003,7 +8995,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if ${ac_cv_pthread_system_supported+:} false; then : + if test "${ac_cv_pthread_system_supported+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9046,7 +9038,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = xyes; then : +if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9436,7 +9428,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9480,7 +9472,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9810,7 +9802,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if ${ac_cv_flock_decl+:} false; then : +if test "${ac_cv_flock_decl+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9840,7 +9832,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = xyes; then : +if test "x$ac_cv_func_flock" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9848,7 +9840,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_flock+:} false; then : +if test "${ac_cv_lib_bsd_flock+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9882,7 +9874,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = xyes; then : +if test "x$ac_cv_lib_bsd_flock" = x""yes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9931,7 +9923,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_TRUE+:} false; then : +if test "${ac_cv_prog_TRUE+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9971,7 +9963,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if ${ac_cv_lib_c_inet_aton+:} false; then : +if test "${ac_cv_lib_c_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10005,12 +9997,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = xyes; then : +if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if ${ac_cv_lib_resolv_inet_aton+:} false; then : +if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10044,7 +10036,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -10061,7 +10053,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if ${ac_cv_have_chflags+:} false; then : +if test "${ac_cv_have_chflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10095,7 +10087,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = xyes; then : +if test "x$ac_cv_func_chflags" = x""yes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -10110,7 +10102,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if ${ac_cv_have_lchflags+:} false; then : +if test "${ac_cv_have_lchflags+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10144,7 +10136,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = xyes; then : +if test "x$ac_cv_func_lchflags" = x""yes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -10168,7 +10160,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if ${ac_cv_lib_z_inflateCopy+:} false; then : +if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10202,7 +10194,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : +if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10345,7 +10337,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = xyes; then : +if test "x$ac_cv_func_openpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10353,7 +10345,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if ${ac_cv_lib_util_openpty+:} false; then : +if test "${ac_cv_lib_util_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10387,13 +10379,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = xyes; then : +if test "x$ac_cv_lib_util_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_openpty+:} false; then : +if test "${ac_cv_lib_bsd_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10427,7 +10419,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = xyes; then : +if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10442,7 +10434,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = xyes; then : +if test "x$ac_cv_func_forkpty" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10450,7 +10442,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if ${ac_cv_lib_util_forkpty+:} false; then : +if test "${ac_cv_lib_util_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10484,13 +10476,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = xyes; then : +if test "x$ac_cv_lib_util_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_forkpty+:} false; then : +if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10524,7 +10516,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : +if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10541,7 +10533,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : +if test "x$ac_cv_func_memmove" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10565,7 +10557,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes; then : +if test "x$ac_cv_func_dup2" = x""yes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10578,7 +10570,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : +if test "x$ac_cv_func_getcwd" = x""yes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10591,7 +10583,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = xyes; then : +if test "x$ac_cv_func_strdup" = x""yes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10607,7 +10599,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = xyes; then : +if test "x$ac_cv_func_getpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10635,7 +10627,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = xyes; then : +if test "x$ac_cv_func_setpgrp" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10663,7 +10655,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : +if test "x$ac_cv_func_gettimeofday" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10765,7 +10757,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if ${ac_cv_buggy_getaddrinfo+:} false; then : + if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10894,7 +10886,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = xyes; then : +if test "x$ac_cv_func_getnameinfo" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10906,7 +10898,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10941,7 +10933,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : +if test "${ac_cv_struct_tm+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10978,7 +10970,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10994,7 +10986,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -11006,7 +10998,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11042,7 +11034,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -11052,7 +11044,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -11062,7 +11054,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -11072,7 +11064,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -11082,7 +11074,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -11092,7 +11084,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -11114,7 +11106,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if ${ac_cv_header_time_altzone+:} false; then : +if test "${ac_cv_header_time_altzone+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11178,7 +11170,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if ${ac_cv_struct_addrinfo+:} false; then : +if test "${ac_cv_struct_addrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11210,7 +11202,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if ${ac_cv_struct_sockaddr_storage+:} false; then : +if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11246,7 +11238,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if ${ac_cv_c_char_unsigned+:} false; then : +if test "${ac_cv_c_char_unsigned+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11278,7 +11270,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11566,7 +11558,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes; then : +if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11697,7 +11689,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11719,12 +11711,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = xyes; then : +if test "x$ac_cv_func___fpu_control" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if ${ac_cv_lib_ieee___fpu_control+:} false; then : +if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11758,7 +11750,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11853,7 +11845,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_little_endian_double+:} false; then : +if test "${ac_cv_little_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11895,7 +11887,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_big_endian_double+:} false; then : +if test "${ac_cv_big_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -11941,7 +11933,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if ${ac_cv_mixed_endian_double+:} false; then : +if test "${ac_cv_mixed_endian_double+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12089,7 +12081,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if ${ac_cv_tanh_preserves_zero_sign+:} false; then : +if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12157,7 +12149,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = xyes; then : +if test "x$ac_cv_have_decl_isinf" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12168,7 +12160,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = xyes; then : +if test "x$ac_cv_have_decl_isnan" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12179,7 +12171,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = xyes; then : +if test "x$ac_cv_have_decl_isfinite" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12199,7 +12191,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if ${ac_cv_posix_semaphores_enabled+:} false; then : +if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12250,7 +12242,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if ${ac_cv_broken_sem_getvalue+:} false; then : +if test "${ac_cv_broken_sem_getvalue+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12315,7 +12307,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12333,7 +12325,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes; then : +if test "x$ac_cv_header_wchar_h" = x""yes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12356,7 +12348,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if ${ac_cv_sizeof_wchar_t+:} false; then : +if test "${ac_cv_sizeof_wchar_t+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12367,7 +12359,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_wchar_t=0 fi @@ -12422,7 +12414,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if ${ac_cv_wchar_t_signed+:} false; then : + if test "${ac_cv_wchar_t_signed+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12486,7 +12478,7 @@ $as_echo "#define Py_UNICODE_SIZE 4" >>confdefs.h ;; -*) as_fn_error $? "invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)." "$LINENO" 5 ;; +*) as_fn_error $? "invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase)." "$LINENO" 5 ;; esac @@ -12533,7 +12525,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : +if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12752,7 +12744,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12760,7 +12752,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if ${ac_cv_rshift_extends_sign+:} false; then : +if test "${ac_cv_rshift_extends_sign+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12799,7 +12791,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if ${ac_cv_have_getc_unlocked+:} false; then : +if test "${ac_cv_have_getc_unlocked+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12897,7 +12889,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : +if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12931,7 +12923,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12983,7 +12975,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13017,7 +13009,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -13027,7 +13019,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13061,7 +13053,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -13071,7 +13063,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : +if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13105,7 +13097,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13146,7 +13138,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if ${ac_cv_broken_nice+:} false; then : +if test "${ac_cv_broken_nice+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13187,7 +13179,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if ${ac_cv_broken_poll+:} false; then : +if test "${ac_cv_broken_poll+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13242,7 +13234,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13258,7 +13250,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = xyes; then : +if test "x$ac_cv_have_decl_tzname" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13270,7 +13262,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : +if test "${ac_cv_var_tzname+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13309,7 +13301,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if ${ac_cv_working_tzset+:} false; then : +if test "${ac_cv_working_tzset+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -13406,7 +13398,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec+:} false; then : +if test "${ac_cv_stat_tv_nsec+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13443,7 +13435,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec2+:} false; then : +if test "${ac_cv_stat_tv_nsec2+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13480,7 +13472,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if ${ac_cv_mvwdelch_is_expression+:} false; then : +if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13517,7 +13509,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if ${ac_cv_window_has_flags+:} false; then : +if test "${ac_cv_window_has_flags+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13665,7 +13657,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if ${ac_cv_have_long_long_format+:} false; then : + if test "${ac_cv_have_long_long_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13736,7 +13728,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if ${ac_cv_have_size_t_format+:} false; then : +if test "${ac_cv_have_size_t_format+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13809,7 +13801,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = xyes; then : +if test "x$ac_cv_type_socklen_t" = x""yes; then : else @@ -13914,21 +13906,10 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -13961,7 +13942,7 @@ -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14062,7 +14043,6 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14370,7 +14350,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 2.7, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14432,7 +14412,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 2.7 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14564,7 +14544,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -14586,10 +14566,9 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14597,13 +14576,12 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14625,7 +14603,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -14653,7 +14631,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14701,7 +14679,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14733,7 +14711,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14767,7 +14745,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14779,8 +14757,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14881,7 +14859,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14900,7 +14878,7 @@ for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -14909,7 +14887,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -14935,8 +14913,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15066,22 +15044,21 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15092,20 +15069,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -317,14 +317,14 @@ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. # In addition, Stefan Krah confirms that issue #1244610 exists through # OpenBSD 4.6, but is fixed in 4.7. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@) + OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) ;; - OpenBSD/4.@<:@789@:>@) + OpenBSD/*) # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE # As this has a different meaning on Linux, only define it on OpenBSD -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 00:34:53 2011 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Jul 2011 00:34:53 +0200 (CEST) Subject: [Python-checkins] r88867 - in tracker/instances/python-dev: extensions/pydevutils.py html/file.item.html html/issue.item.html html/msg.item.html Message-ID: <3RLRcY6MHZzMml@mail.python.org> Author: ezio.melotti Date: Sat Jul 23 00:34:53 2011 New Revision: 88867 Log: #267: remove the remove button from the issue page, move it to the msg/file page, and add a button to add back removed messages/files. Modified: tracker/instances/python-dev/extensions/pydevutils.py tracker/instances/python-dev/html/file.item.html tracker/instances/python-dev/html/issue.item.html tracker/instances/python-dev/html/msg.item.html Modified: tracker/instances/python-dev/extensions/pydevutils.py ============================================================================== --- tracker/instances/python-dev/extensions/pydevutils.py (original) +++ tracker/instances/python-dev/extensions/pydevutils.py Sat Jul 23 00:34:53 2011 @@ -14,6 +14,29 @@ db = request.client.db return 'Coordinator' in db.user.get(user, 'roles') + +def issueid_and_action_from_class(cls): + """ + Return the id of the issue where the msg/file is/was linked + and if the last "linking action" was 'link' or 'unlink'. + """ + last_action = '' + for entry in cls._klass.history(cls._nodeid): + if 'unlink' in entry: + last_unlink = entry + last_action = 'unlink' + elif 'link' in entry: + last_entry = entry + last_action = 'link' + if last_action in ('link', 'unlink'): + # the msg has been unlinked and not linked back + # the link looks like: ('16', , '4', + # 'link', ('issue', '1', 'messages')) + return last_entry[4][1], last_action + return None, None + def init(instance): instance.registerUtil('is_history_ok', is_history_ok) instance.registerUtil('is_coordinator', is_coordinator) + instance.registerUtil('issueid_and_action_from_class', + issueid_and_action_from_class) Modified: tracker/instances/python-dev/html/file.item.html ============================================================================== --- tracker/instances/python-dev/html/file.item.html (original) +++ tracker/instances/python-dev/html/file.item.html Sat Jul 23 00:34:53 2011 @@ -81,6 +81,27 @@ + +
+ + + +

This file is linked to : +

+
+ + +

This file has been unlinked from : +

+ + + + Modified: tracker/instances/python-dev/html/issue.item.html ============================================================================== --- tracker/instances/python-dev/html/issue.item.html (original) +++ tracker/instances/python-dev/html/issue.item.html Sat Jul 23 00:34:53 2011 @@ -240,7 +240,6 @@ Uploaded Description Edit - Remove @@ -258,14 +257,6 @@
review - -
- - - -
- @@ -321,14 +312,6 @@ Date: - -
- - - -
- Modified: tracker/instances/python-dev/html/msg.item.html ============================================================================== --- tracker/instances/python-dev/html/msg.item.html (original) +++ tracker/instances/python-dev/html/msg.item.html Sat Jul 23 00:34:53 2011 @@ -124,6 +124,27 @@ + +
+ + + +

This message is linked to : +

+
+ + +

This message has been unlinked from : +

+ + + + From solipsis at pitrou.net Sat Jul 23 05:25:27 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 23 Jul 2011 05:25:27 +0200 Subject: [Python-checkins] Daily reference leaks (63de97ae832e): sum=0 Message-ID: results for 63de97ae832e on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogPrHw0E', '-x'] From python-checkins at python.org Sat Jul 23 07:51:38 2011 From: python-checkins at python.org (eli.bendersky) Date: Sat, 23 Jul 2011 07:51:38 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2311049=3A_adding_so?= =?utf8?q?me_tests_to_test=2Esupport?= Message-ID: http://hg.python.org/cpython/rev/be558ad15789 changeset: 71465:be558ad15789 parent: 71462:63de97ae832e user: Eli Bendersky date: Sat Jul 23 08:48:53 2011 +0300 summary: Issue #11049: adding some tests to test.support Based on original patch by Giampaolo Rodola with contributions from R. David Murray files: Lib/test/support.py | 21 +- Lib/test/test_support.py | 178 +++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 10 deletions(-) diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -170,7 +170,7 @@ attribute = getattr(obj, name) except AttributeError: raise unittest.SkipTest("module %s has no attribute %s" % ( - obj.__name__, name)) + repr(obj), name)) else: return attribute @@ -577,14 +577,15 @@ rmtree(name) - at contextlib.contextmanager -def temp_umask(umask): - """Context manager that temporarily sets the process umask.""" - oldmask = os.umask(umask) - try: - yield - finally: - os.umask(oldmask) +if hasattr(os, "umask"): + @contextlib.contextmanager + def temp_umask(umask): + """Context manager that temporarily sets the process umask.""" + oldmask = os.umask(umask) + try: + yield + finally: + os.umask(oldmask) def findfile(file, here=__file__, subdir=None): @@ -1029,7 +1030,7 @@ for opt in cflags.split(): if opt.startswith('-O'): final_opt = opt - return final_opt and final_opt != '-O0' + return final_opt != '' and final_opt != '-O0' #======================================================================= diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_support.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python + +import sys +import os +import unittest +import socket +import tempfile +import errno +from test import support + +TESTFN = support.TESTFN +TESTDIRN = os.path.basename(tempfile.mkdtemp(dir='.')) + + +class TestSupport(unittest.TestCase): + def setUp(self): + support.unlink(TESTFN) + support.rmtree(TESTDIRN) + tearDown = setUp + + def test_import_module(self): + support.import_module("ftplib") + self.assertRaises(unittest.SkipTest, support.import_module, "foo") + + def test_import_fresh_module(self): + support.import_fresh_module("ftplib") + + def test_get_attribute(self): + self.assertEqual(support.get_attribute(self, "test_get_attribute"), + self.test_get_attribute) + self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo") + + def test_get_original_stdout(self): + self.assertEqual(support.get_original_stdout(), sys.stdout) + + def test_unload(self): + import sched + self.assertIn("sched", sys.modules) + support.unload("sched") + self.assertNotIn("sched", sys.modules) + + def test_unlink(self): + with open(TESTFN, "w") as f: + pass + support.unlink(TESTFN) + self.assertFalse(os.path.exists(TESTFN)) + support.unlink(TESTFN) + + def test_rmtree(self): + os.mkdir(TESTDIRN) + os.mkdir(os.path.join(TESTDIRN, TESTDIRN)) + support.rmtree(TESTDIRN) + self.assertFalse(os.path.exists(TESTDIRN)) + support.rmtree(TESTDIRN) + + def test_forget(self): + import smtplib + support.forget("smtplib") + self.assertNotIn("smtplib", sys.modules) + + def test_HOST(self): + s = socket.socket() + s.bind((support.HOST, 0)) + s.close() + + def test_find_unused_port(self): + port = support.find_unused_port() + s = socket.socket() + s.bind((support.HOST, port)) + s.close() + + def test_bind_port(self): + s = socket.socket() + support.bind_port(s) + s.listen(1) + s.close() + + def test_temp_cwd(self): + here = os.getcwd() + with support.temp_cwd(name=TESTFN): + self.assertEqual(os.path.basename(os.getcwd()), TESTFN) + self.assertFalse(os.path.exists(TESTFN)) + self.assertTrue(os.path.basename(os.getcwd()), here) + + def test_sortdict(self): + self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}") + + def test_make_bad_fd(self): + fd = support.make_bad_fd() + with self.assertRaises(OSError) as cm: + os.write(fd, b"foo") + self.assertEqual(cm.exception.errno, errno.EBADF) + + def test_check_syntax_error(self): + support.check_syntax_error(self, "def class") + self.assertRaises(AssertionError, support.check_syntax_error, self, "1") + + def test_CleanImport(self): + import importlib + with support.CleanImport("asyncore"): + importlib.import_module("asyncore") + + def test_DirsOnSysPath(self): + with support.DirsOnSysPath('foo', 'bar'): + self.assertIn("foo", sys.path) + self.assertIn("bar", sys.path) + self.assertNotIn("foo", sys.path) + self.assertNotIn("bar", sys.path) + + def test_captured_stdout(self): + with support.captured_stdout() as s: + print("hello") + self.assertEqual(s.getvalue(), "hello\n") + + def test_captured_stderr(self): + with support.captured_stderr() as s: + print("hello", file=sys.stderr) + self.assertEqual(s.getvalue(), "hello\n") + + def test_captured_stdin(self): + with support.captured_stdin() as s: + print("hello", file=sys.stdin) + self.assertEqual(s.getvalue(), "hello\n") + + def test_gc_collect(self): + support.gc_collect() + + def test_python_is_optimized(self): + self.assertIsInstance(support.python_is_optimized(), bool) + + def test_swap_attr(self): + class Obj: + x = 1 + obj = Obj() + with support.swap_attr(obj, "x", 5): + self.assertEqual(obj.x, 5) + self.assertEqual(obj.x, 1) + + def test_swap_item(self): + D = {"item":1} + with support.swap_item(D, "item", 5): + self.assertEqual(D["item"], 5) + self.assertEqual(D["item"], 1) + + # XXX -follows a list of untested API + # make_legacy_pyc + # is_resource_enabled + # requires + # fcmp + # umaks + # findfile + # check_warnings + # EnvironmentVarGuard + # TransientResource + # transient_internet + # run_with_locale + # set_memlimit + # bigmemtest + # precisionbigmemtest + # bigaddrspacetest + # requires_resource + # run_doctest + # threading_cleanup + # reap_threads + # reap_children + # strip_python_stderr + # args_from_interpreter_flags + # can_symlink + # skip_unless_symlink + + +def test_main(): + tests = [TestSupport] + support.run_unittest(*tests) + +if __name__ == '__main__': + test_main() + -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 07:51:39 2011 From: python-checkins at python.org (eli.bendersky) Date: Sat, 23 Jul 2011 07:51:39 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_fixing_whitespace_in_the_pr?= =?utf8?q?evious_commit?= Message-ID: http://hg.python.org/cpython/rev/e9d0503a2113 changeset: 71466:e9d0503a2113 user: Eli Bendersky date: Sat Jul 23 08:51:14 2011 +0300 summary: fixing whitespace in the previous commit files: Lib/test/test_support.py | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -108,19 +108,19 @@ self.assertNotIn("bar", sys.path) def test_captured_stdout(self): - with support.captured_stdout() as s: - print("hello") - self.assertEqual(s.getvalue(), "hello\n") + with support.captured_stdout() as s: + print("hello") + self.assertEqual(s.getvalue(), "hello\n") def test_captured_stderr(self): - with support.captured_stderr() as s: - print("hello", file=sys.stderr) - self.assertEqual(s.getvalue(), "hello\n") + with support.captured_stderr() as s: + print("hello", file=sys.stderr) + self.assertEqual(s.getvalue(), "hello\n") def test_captured_stdin(self): - with support.captured_stdin() as s: - print("hello", file=sys.stdin) - self.assertEqual(s.getvalue(), "hello\n") + with support.captured_stdin() as s: + print("hello", file=sys.stdin) + self.assertEqual(s.getvalue(), "hello\n") def test_gc_collect(self): support.gc_collect() @@ -175,4 +175,3 @@ if __name__ == '__main__': test_main() - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 07:55:16 2011 From: python-checkins at python.org (ezio.melotti) Date: Sat, 23 Jul 2011 07:55:16 +0200 (CEST) Subject: [Python-checkins] r88868 - in tracker/instances/python-dev/html: issue.index.html style.css Message-ID: <3RLdNh1ZQNzMWX@mail.python.org> Author: ezio.melotti Date: Sat Jul 23 07:55:16 2011 New Revision: 88868 Log: #406: fix a bug in the colspan value getting rid of a useless table. Modified: tracker/instances/python-dev/html/issue.index.html tracker/instances/python-dev/html/style.css Modified: tracker/instances/python-dev/html/issue.index.html ============================================================================== --- tracker/instances/python-dev/html/issue.index.html (original) +++ tracker/instances/python-dev/html/issue.index.html Sat Jul 23 07:55:16 2011 @@ -93,37 +93,33 @@ - - - - - - - - - - -
- - -
+ +
+ + + Download as CSV Modified: tracker/instances/python-dev/html/style.css ============================================================================== --- tracker/instances/python-dev/html/style.css (original) +++ tracker/instances/python-dev/html/style.css Sat Jul 23 07:55:16 2011 @@ -233,18 +233,23 @@ empty-cells: show; } -table.list tr.navigation th { - width: 33%; - border-style: hidden; - text-align: center; +div.navigation { + background-color: #e0e0e0; } -table.list tr.navigation td { - border: none + +div.navigation span { + display: block; + width: 33.33%; + float: left; + text-align: center; + font-weight: bold; + color: #234764; + background-color: #e0e0e0; } -table.list tr.navigation th:first-child { +div.navigation span:first-child { text-align: left; } -table.list tr.navigation th:last-child { +div.navigation span:last-child { text-align: right; } From python-checkins at python.org Sat Jul 23 08:05:50 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 23 Jul 2011 08:05:50 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_function_na?= =?utf8?q?me=3A_open_-=3E_urlopen=2E?= Message-ID: http://hg.python.org/cpython/rev/b28cb14edf89 changeset: 71467:b28cb14edf89 branch: 3.2 parent: 71461:9c7f9d5841ff user: Georg Brandl date: Sat Jul 23 08:04:40 2011 +0200 summary: Fix function name: open -> urlopen. files: Doc/howto/urllib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -140,7 +140,7 @@ name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values - >>> data = urllib.request.open(full_url) + >>> data = urllib.request.urlopen(full_url) Notice that the full URL is created by adding a ``?`` to the URL, followed by the encoded values. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 08:05:51 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 23 Jul 2011 08:05:51 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_3=2E2_branch=2E?= Message-ID: http://hg.python.org/cpython/rev/1053d094e346 changeset: 71468:1053d094e346 parent: 71466:e9d0503a2113 parent: 71467:b28cb14edf89 user: Georg Brandl date: Sat Jul 23 08:06:00 2011 +0200 summary: Merge 3.2 branch. files: Doc/howto/urllib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -140,7 +140,7 @@ name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values - >>> data = urllib.request.open(full_url) + >>> data = urllib.request.urlopen(full_url) Notice that the full URL is created by adding a ``?`` to the URL, followed by the encoded values. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 08:05:52 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 23 Jul 2011 08:05:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_function_na?= =?utf8?q?me=3A_open_-=3E_urlopen=2E?= Message-ID: http://hg.python.org/cpython/rev/a24bd2bf4adb changeset: 71469:a24bd2bf4adb branch: 2.7 parent: 71464:8d560f5d40d1 user: Georg Brandl date: Sat Jul 23 08:06:33 2011 +0200 summary: Fix function name: open -> urlopen. files: Doc/howto/urllib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -138,7 +138,7 @@ name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values - >>> data = urllib2.open(full_url) + >>> data = urllib2.urlopen(full_url) Notice that the full URL is created by adding a ``?`` to the URL, followed by the encoded values. -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Sat Jul 23 08:55:36 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sat, 23 Jul 2011 16:55:36 +1000 Subject: [Python-checkins] r88867 - in tracker/instances/python-dev: extensions/pydevutils.py html/file.item.html html/issue.item.html html/msg.item.html In-Reply-To: <3RLRcY6MHZzMml@mail.python.org> References: <3RLRcY6MHZzMml@mail.python.org> Message-ID: On Sat, Jul 23, 2011 at 8:34 AM, ezio.melotti wrote: > Author: ezio.melotti > Date: Sat Jul 23 00:34:53 2011 > New Revision: 88867 > > Log: > #267: remove the remove button from the issue page, move it to the msg/file page, and add a button to add back removed messages/files. Thank you! (I accidentally deleted one of RDM's comments just the other day) Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Sat Jul 23 09:52:31 2011 From: python-checkins at python.org (georg.brandl) Date: Sat, 23 Jul 2011 09:52:31 +0200 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_a_step_for_the_doc_source_?= =?utf8?q?links_in_Doc/tools/sphinxext/pyspecific=2Epy=2E?= Message-ID: http://hg.python.org/peps/rev/e32f140a020b changeset: 3910:e32f140a020b user: Georg Brandl date: Sat Jul 23 09:53:12 2011 +0200 summary: Add a step for the doc source links in Doc/tools/sphinxext/pyspecific.py. files: pep-0101.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pep-0101.txt b/pep-0101.txt --- a/pep-0101.txt +++ b/pep-0101.txt @@ -150,6 +150,10 @@ ___ Commit any changes to pydoc_topics.py and the doc sources. + ___ Make sure the SOURCE_URI in ``Doc/tools/sphinxext/pyspecific.py`` + points to the right branch in the hg repository (or ``default`` for + unstable releases of the default branch). + ___ Bump version numbers via the release script. $ .../release/release.py --bump X.YaZ -- Repository URL: http://hg.python.org/peps From ezio.melotti at gmail.com Sat Jul 23 10:45:25 2011 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Sat, 23 Jul 2011 11:45:25 +0300 Subject: [Python-checkins] r88867 - in tracker/instances/python-dev: extensions/pydevutils.py html/file.item.html html/issue.item.html html/msg.item.html In-Reply-To: References: <3RLRcY6MHZzMml@mail.python.org> Message-ID: <4E2A8A25.2010006@gmail.com> On 23/07/2011 9.55, Nick Coghlan wrote: > On Sat, Jul 23, 2011 at 8:34 AM, ezio.melotti > wrote: >> Author: ezio.melotti >> Date: Sat Jul 23 00:34:53 2011 >> New Revision: 88867 >> >> Log: >> #267: remove the remove button from the issue page, move it to the msg/file page, and add a button to add back removed messages/files. > Thank you! (I accidentally deleted one of RDM's comments just the other day) You are welcome! (That was actually one of the reasons that made me look at that issue again) Now restoring messages and files that got deleted should be trivial, and deleting them accidentally (almost) impossible. Messages and files can be deleted/restored from their pages. Links to these pages can be found in the history of the issue. For messages and files that are still linked to the issue, the "(view)" and "edit" links can also be used. Best Regards, Ezio Melotti > > Cheers, > Nick. > From python-checkins at python.org Sat Jul 23 12:43:09 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 23 Jul 2011 12:43:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_closes_issu?= =?utf8?q?e12581_-_Increase_the_urllib=2Eparse_test_coverage=2E_Patch_by?= Message-ID: http://hg.python.org/cpython/rev/e171db785c37 changeset: 71470:e171db785c37 branch: 3.2 parent: 71467:b28cb14edf89 user: Senthil Kumaran date: Sat Jul 23 18:27:45 2011 +0800 summary: Fix closes issue12581 - Increase the urllib.parse test coverage. Patch by Petter Haggholm. files: Lib/test/test_urlparse.py | 78 ++++++++++++++++++++++++++- 1 files changed, 76 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -93,8 +93,11 @@ def test_qsl(self): for orig, expect in parse_qsl_test_cases: result = urllib.parse.parse_qsl(orig, keep_blank_values=True) - self.assertEqual(result, expect, "Error parsing %s" % repr(orig)) - + self.assertEqual(result, expect, "Error parsing %r" % orig) + expect_without_blanks = [v for v in expect if len(v[1])] + result = urllib.parse.parse_qsl(orig, keep_blank_values=False) + self.assertEqual(result, expect_without_blanks, + "Error parsing %r" % orig) def test_roundtrips(self): str_cases = [ @@ -365,6 +368,9 @@ self.checkJoin(SIMPLE_BASE, 'http:?y','http://a/b/c/d?y') self.checkJoin(SIMPLE_BASE, 'http:g?y','http://a/b/c/g?y') self.checkJoin(SIMPLE_BASE, 'http:g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('http:///', '..','http:///') + self.checkJoin('', 'http://a/b/c/g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('', 'http://a/./g', 'http://a/./g') def test_RFC2732(self): str_cases = [ @@ -719,6 +725,74 @@ errors="ignore") self.assertEqual(result, [('key', '\u0141-')]) + def test_splitnport(self): + # Normal cases are exercised by other tests; ensure that we also + # catch cases with no port specified. (testcase ensuring coverage) + result = urllib.parse.splitnport('parrot:88') + self.assertEqual(result, ('parrot', 88)) + result = urllib.parse.splitnport('parrot') + self.assertEqual(result, ('parrot', -1)) + result = urllib.parse.splitnport('parrot', 55) + self.assertEqual(result, ('parrot', 55)) + result = urllib.parse.splitnport('parrot:') + self.assertEqual(result, ('parrot', None)) + + def test_splitquery(self): + # Normal cases are exercised by other tests; ensure that we also + # catch cases with no port specified (testcase ensuring coverage) + result = urllib.parse.splitquery('http://python.org/fake?foo=bar') + self.assertEqual(result, ('http://python.org/fake', 'foo=bar')) + result = urllib.parse.splitquery('http://python.org/fake?foo=bar?') + self.assertEqual(result, ('http://python.org/fake?foo=bar', '')) + result = urllib.parse.splitquery('http://python.org/fake') + self.assertEqual(result, ('http://python.org/fake', None)) + + def test_splitvalue(self): + # Normal cases are exercised by other tests; test pathological cases + # with no key/value pairs. (testcase ensuring coverage) + result = urllib.parse.splitvalue('foo=bar') + self.assertEqual(result, ('foo', 'bar')) + result = urllib.parse.splitvalue('foo=') + self.assertEqual(result, ('foo', '')) + result = urllib.parse.splitvalue('foobar') + self.assertEqual(result, ('foobar', None)) + + def test_to_bytes(self): + result = urllib.parse.to_bytes('http://www.python.org') + self.assertEqual(result, 'http://www.python.org') + self.assertRaises(UnicodeError, urllib.parse.to_bytes, + 'http://www.python.org/medi\u00e6val') + + def test_urlencode_sequences(self): + # Other tests incidentally urlencode things; test non-covered cases: + # Sequence and object values. + result = urllib.parse.urlencode({'a': [1, 2], 'b': (3, 4, 5)}, True) + self.assertEqual(result, 'a=1&a=2&b=3&b=4&b=5') + + class Trivial: + def __str__(self): + return 'trivial' + + result = urllib.parse.urlencode({'a': Trivial()}, True) + self.assertEqual(result, 'a=trivial') + + def test_quote_from_bytes(self): + self.assertRaises(TypeError, urllib.parse.quote_from_bytes, 'foo') + result = urllib.parse.quote_from_bytes(b'archaeological arcana') + self.assertEqual(result, 'archaeological%20arcana') + result = urllib.parse.quote_from_bytes(b'') + self.assertEqual(result, '') + + def test_unquote_to_bytes(self): + result = urllib.parse.unquote_to_bytes('abc%20def') + self.assertEqual(result, b'abc def') + result = urllib.parse.unquote_to_bytes('') + self.assertEqual(result, b'') + + def test_quote_errors(self): + self.assertRaises(TypeError, urllib.parse.quote, b'foo', + encoding='utf-8') + self.assertRaises(TypeError, urllib.parse.quote, b'foo', errors='strict') def test_main(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 12:43:09 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 23 Jul 2011 12:43:09 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_closes_issue12581_-_Increase_the_urll?= =?utf8?q?ib=2Eparse_test?= Message-ID: http://hg.python.org/cpython/rev/fcccda3c546f changeset: 71471:fcccda3c546f parent: 71468:1053d094e346 parent: 71470:e171db785c37 user: Senthil Kumaran date: Sat Jul 23 18:28:43 2011 +0800 summary: merge from 3.2 - Fix closes issue12581 - Increase the urllib.parse test coverage. Patch by Petter Haggholm. files: Lib/test/test_urlparse.py | 78 ++++++++++++++++++++++++++- 1 files changed, 76 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -93,8 +93,11 @@ def test_qsl(self): for orig, expect in parse_qsl_test_cases: result = urllib.parse.parse_qsl(orig, keep_blank_values=True) - self.assertEqual(result, expect, "Error parsing %s" % repr(orig)) - + self.assertEqual(result, expect, "Error parsing %r" % orig) + expect_without_blanks = [v for v in expect if len(v[1])] + result = urllib.parse.parse_qsl(orig, keep_blank_values=False) + self.assertEqual(result, expect_without_blanks, + "Error parsing %r" % orig) def test_roundtrips(self): str_cases = [ @@ -365,6 +368,9 @@ self.checkJoin(SIMPLE_BASE, 'http:?y','http://a/b/c/d?y') self.checkJoin(SIMPLE_BASE, 'http:g?y','http://a/b/c/g?y') self.checkJoin(SIMPLE_BASE, 'http:g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('http:///', '..','http:///') + self.checkJoin('', 'http://a/b/c/g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('', 'http://a/./g', 'http://a/./g') def test_RFC2732(self): str_cases = [ @@ -719,6 +725,74 @@ errors="ignore") self.assertEqual(result, [('key', '\u0141-')]) + def test_splitnport(self): + # Normal cases are exercised by other tests; ensure that we also + # catch cases with no port specified. (testcase ensuring coverage) + result = urllib.parse.splitnport('parrot:88') + self.assertEqual(result, ('parrot', 88)) + result = urllib.parse.splitnport('parrot') + self.assertEqual(result, ('parrot', -1)) + result = urllib.parse.splitnport('parrot', 55) + self.assertEqual(result, ('parrot', 55)) + result = urllib.parse.splitnport('parrot:') + self.assertEqual(result, ('parrot', None)) + + def test_splitquery(self): + # Normal cases are exercised by other tests; ensure that we also + # catch cases with no port specified (testcase ensuring coverage) + result = urllib.parse.splitquery('http://python.org/fake?foo=bar') + self.assertEqual(result, ('http://python.org/fake', 'foo=bar')) + result = urllib.parse.splitquery('http://python.org/fake?foo=bar?') + self.assertEqual(result, ('http://python.org/fake?foo=bar', '')) + result = urllib.parse.splitquery('http://python.org/fake') + self.assertEqual(result, ('http://python.org/fake', None)) + + def test_splitvalue(self): + # Normal cases are exercised by other tests; test pathological cases + # with no key/value pairs. (testcase ensuring coverage) + result = urllib.parse.splitvalue('foo=bar') + self.assertEqual(result, ('foo', 'bar')) + result = urllib.parse.splitvalue('foo=') + self.assertEqual(result, ('foo', '')) + result = urllib.parse.splitvalue('foobar') + self.assertEqual(result, ('foobar', None)) + + def test_to_bytes(self): + result = urllib.parse.to_bytes('http://www.python.org') + self.assertEqual(result, 'http://www.python.org') + self.assertRaises(UnicodeError, urllib.parse.to_bytes, + 'http://www.python.org/medi\u00e6val') + + def test_urlencode_sequences(self): + # Other tests incidentally urlencode things; test non-covered cases: + # Sequence and object values. + result = urllib.parse.urlencode({'a': [1, 2], 'b': (3, 4, 5)}, True) + self.assertEqual(result, 'a=1&a=2&b=3&b=4&b=5') + + class Trivial: + def __str__(self): + return 'trivial' + + result = urllib.parse.urlencode({'a': Trivial()}, True) + self.assertEqual(result, 'a=trivial') + + def test_quote_from_bytes(self): + self.assertRaises(TypeError, urllib.parse.quote_from_bytes, 'foo') + result = urllib.parse.quote_from_bytes(b'archaeological arcana') + self.assertEqual(result, 'archaeological%20arcana') + result = urllib.parse.quote_from_bytes(b'') + self.assertEqual(result, '') + + def test_unquote_to_bytes(self): + result = urllib.parse.unquote_to_bytes('abc%20def') + self.assertEqual(result, b'abc def') + result = urllib.parse.unquote_to_bytes('') + self.assertEqual(result, b'') + + def test_quote_errors(self): + self.assertRaises(TypeError, urllib.parse.quote, b'foo', + encoding='utf-8') + self.assertRaises(TypeError, urllib.parse.quote, b'foo', errors='strict') def test_main(): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 12:43:10 2011 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 23 Jul 2011 12:43:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_merge_from_3=2E?= =?utf8?q?2_-_Fix_closes_issue12581_-_Increase_the_urllib=2Eparse_test?= Message-ID: http://hg.python.org/cpython/rev/ed79da800b4a changeset: 71472:ed79da800b4a branch: 2.7 parent: 71469:a24bd2bf4adb user: Senthil Kumaran date: Sat Jul 23 18:41:43 2011 +0800 summary: merge from 3.2 - Fix closes issue12581 - Increase the urllib.parse test coverage (cases applicable to 2.7). Patch by Petter Haggholm. files: Lib/test/test_urlparse.py | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -82,7 +82,12 @@ def test_qsl(self): for orig, expect in parse_qsl_test_cases: result = urlparse.parse_qsl(orig, keep_blank_values=True) - self.assertEqual(result, expect, "Error parsing %s" % repr(orig)) + self.assertEqual(result, expect, "Error parsing %r" % orig) + expect_without_blanks = [v for v in expect if len(v[1])] + result = urlparse.parse_qsl(orig, keep_blank_values=False) + self.assertEqual(result, expect_without_blanks, + "Error parsing %r" % orig) + def test_roundtrips(self): testcases = [ @@ -331,6 +336,9 @@ self.checkJoin(SIMPLE_BASE, 'http:?y','http://a/b/c/d?y') self.checkJoin(SIMPLE_BASE, 'http:g?y','http://a/b/c/g?y') self.checkJoin(SIMPLE_BASE, 'http:g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('http:///', '..','http:///') + self.checkJoin('', 'http://a/b/c/g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin('', 'http://a/./g', 'http://a/./g') def test_RFC2732(self): for url, hostname, port in [ @@ -505,7 +513,6 @@ self.assertEqual(urlparse.urlparse("http://www.python.org:80"), ('http','www.python.org:80','','','','')) - def test_main(): test_support.run_unittest(UrlParseTestCase) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 14:01:00 2011 From: python-checkins at python.org (eli.bendersky) Date: Sat, 23 Jul 2011 14:01:00 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2311049=3A_skip_a_te?= =?utf8?q?st_that_fails_on_some_buildbots?= Message-ID: http://hg.python.org/cpython/rev/0018a28583f4 changeset: 71473:0018a28583f4 parent: 71471:fcccda3c546f user: Eli Bendersky date: Sat Jul 23 15:00:31 2011 +0300 summary: Issue #11049: skip a test that fails on some buildbots files: Lib/test/test_support.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -30,6 +30,7 @@ self.test_get_attribute) self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo") + @unittest.skip("failing buildbots") def test_get_original_stdout(self): self.assertEqual(support.get_original_stdout(), sys.stdout) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 14:26:10 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 14:26:10 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEwODgz?= =?utf8?q?=3A_Fix_socket_leaks_in_urllib=2Erequest=2E?= Message-ID: http://hg.python.org/cpython/rev/c741ba9e37ef changeset: 71474:c741ba9e37ef branch: 3.2 parent: 71470:e171db785c37 user: Nadeem Vawda date: Sat Jul 23 14:03:00 2011 +0200 summary: Issue #10883: Fix socket leaks in urllib.request. * ftpwrapper now uses reference counting to ensure that the underlying socket is closed when the ftpwrapper object is no longer in use * ftplib.FTP.ntransfercmd() now closes the socket if an error occurs Initial patch by Victor Stinner. files: Lib/ftplib.py | 56 +++++++++++++----------- Lib/test/test_urllib2.py | 1 + Lib/test/test_urllib2net.py | 1 + Lib/urllib/request.py | 30 +++++++++++- 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -336,33 +336,39 @@ if self.passiveserver: host, port = self.makepasv() conn = socket.create_connection((host, port), self.timeout) - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # Some servers apparently send a 200 reply to - # a LIST or STOR command, before the 150 reply - # (and way before the 226 reply). This seems to - # be in violation of the protocol (which only allows - # 1xx or error messages for LIST), so we just discard - # this response. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply(resp) + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # Some servers apparently send a 200 reply to + # a LIST or STOR command, before the 150 reply + # (and way before the 226 reply). This seems to + # be in violation of the protocol (which only allows + # 1xx or error messages for LIST), so we just discard + # this response. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply(resp) + except: + conn.close() + raise else: sock = self.makeport() - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # See above. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply(resp) - conn, sockaddr = sock.accept() - if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: - conn.settimeout(self.timeout) - sock.close() + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # See above. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply(resp) + conn, sockaddr = sock.accept() + if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: + conn.settimeout(self.timeout) + finally: + sock.close() if resp[:3] == '150': # this is conditional in case we received a 125 size = parse150(resp) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -622,6 +622,7 @@ def retrfile(self, filename, filetype): self.filename, self.filetype = filename, filetype return io.StringIO(self.data), len(self.data) + def close(self): pass class NullFTPHandler(urllib.request.FTPHandler): def __init__(self, data): self.data = data diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -222,6 +222,7 @@ handlers = [] cfh = urllib.request.CacheFTPHandler() + self.addCleanup(cfh.clear_cache) cfh.setTimeout(1) handlers.append(cfh) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1362,8 +1362,8 @@ raise exc.with_traceback(sys.exc_info()[2]) def connect_ftp(self, user, passwd, host, port, dirs, timeout): - fw = ftpwrapper(user, passwd, host, port, dirs, timeout) - return fw + return ftpwrapper(user, passwd, host, port, dirs, timeout, + persistent=False) class CacheFTPHandler(FTPHandler): # XXX would be nice to have pluggable cache strategies @@ -1412,6 +1412,13 @@ break self.soonest = min(list(self.timeout.values())) + def clear_cache(self): + for conn in self.cache.values(): + conn.close() + self.cache.clear() + self.timeout.clear() + + # Code move from the old urllib module MAXFTPCACHE = 10 # Trim the ftp cache beyond this size @@ -2135,13 +2142,16 @@ class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" - def __init__(self, user, passwd, host, port, dirs, timeout=None): + def __init__(self, user, passwd, host, port, dirs, timeout=None, + persistent=True): self.user = user self.passwd = passwd self.host = host self.port = port self.dirs = dirs self.timeout = timeout + self.refcount = 0 + self.keepalive = persistent self.init() def init(self): @@ -2192,7 +2202,8 @@ conn, retrlen = self.ftp.ntransfercmd(cmd) self.busy = 1 - ftpobj = addclosehook(conn.makefile('rb'), self.endtransfer) + ftpobj = addclosehook(conn.makefile('rb'), self.file_close) + self.refcount += 1 conn.close() # Pass back both a suitably decorated object and a retrieval length return (ftpobj, retrlen) @@ -2207,6 +2218,17 @@ pass def close(self): + self.keepalive = False + if self.refcount <= 0: + self.real_close() + + def file_close(self): + self.endtransfer() + self.refcount -= 1 + if self.refcount <= 0 and not self.keepalive: + self.real_close() + + def real_close(self): self.endtransfer() try: self.ftp.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 14:26:10 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 14:26:10 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge=3A_=2310883=3A_Fix_socket_leaks_in_urllib=2Erequest=2E?= Message-ID: http://hg.python.org/cpython/rev/d68765bd6490 changeset: 71475:d68765bd6490 parent: 71473:0018a28583f4 parent: 71474:c741ba9e37ef user: Nadeem Vawda date: Sat Jul 23 14:25:45 2011 +0200 summary: Merge: #10883: Fix socket leaks in urllib.request. * ftpwrapper now uses reference counting to ensure that the underlying socket is closed when the ftpwrapper object is no longer in use * ftplib.FTP.ntransfercmd() now closes the socket if an error occurs Initial patch by Victor Stinner. files: Lib/ftplib.py | 56 +++++++++++++----------- Lib/test/test_urllib2.py | 1 + Lib/test/test_urllib2net.py | 1 + Lib/urllib/request.py | 30 +++++++++++- 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -343,33 +343,39 @@ host, port = self.makepasv() conn = socket.create_connection((host, port), self.timeout, source_address=self.source_address) - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # Some servers apparently send a 200 reply to - # a LIST or STOR command, before the 150 reply - # (and way before the 226 reply). This seems to - # be in violation of the protocol (which only allows - # 1xx or error messages for LIST), so we just discard - # this response. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply(resp) + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # Some servers apparently send a 200 reply to + # a LIST or STOR command, before the 150 reply + # (and way before the 226 reply). This seems to + # be in violation of the protocol (which only allows + # 1xx or error messages for LIST), so we just discard + # this response. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply(resp) + except: + conn.close() + raise else: sock = self.makeport() - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # See above. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply(resp) - conn, sockaddr = sock.accept() - if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: - conn.settimeout(self.timeout) - sock.close() + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # See above. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply(resp) + conn, sockaddr = sock.accept() + if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: + conn.settimeout(self.timeout) + finally: + sock.close() if resp[:3] == '150': # this is conditional in case we received a 125 size = parse150(resp) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -623,6 +623,7 @@ def retrfile(self, filename, filetype): self.filename, self.filetype = filename, filetype return io.StringIO(self.data), len(self.data) + def close(self): pass class NullFTPHandler(urllib.request.FTPHandler): def __init__(self, data): self.data = data diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -222,6 +222,7 @@ handlers = [] cfh = urllib.request.CacheFTPHandler() + self.addCleanup(cfh.clear_cache) cfh.setTimeout(1) handlers.append(cfh) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1371,8 +1371,8 @@ raise exc.with_traceback(sys.exc_info()[2]) def connect_ftp(self, user, passwd, host, port, dirs, timeout): - fw = ftpwrapper(user, passwd, host, port, dirs, timeout) - return fw + return ftpwrapper(user, passwd, host, port, dirs, timeout, + persistent=False) class CacheFTPHandler(FTPHandler): # XXX would be nice to have pluggable cache strategies @@ -1421,6 +1421,13 @@ break self.soonest = min(list(self.timeout.values())) + def clear_cache(self): + for conn in self.cache.values(): + conn.close() + self.cache.clear() + self.timeout.clear() + + # Code move from the old urllib module MAXFTPCACHE = 10 # Trim the ftp cache beyond this size @@ -2144,13 +2151,16 @@ class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" - def __init__(self, user, passwd, host, port, dirs, timeout=None): + def __init__(self, user, passwd, host, port, dirs, timeout=None, + persistent=True): self.user = user self.passwd = passwd self.host = host self.port = port self.dirs = dirs self.timeout = timeout + self.refcount = 0 + self.keepalive = persistent self.init() def init(self): @@ -2201,7 +2211,8 @@ conn, retrlen = self.ftp.ntransfercmd(cmd) self.busy = 1 - ftpobj = addclosehook(conn.makefile('rb'), self.endtransfer) + ftpobj = addclosehook(conn.makefile('rb'), self.file_close) + self.refcount += 1 conn.close() # Pass back both a suitably decorated object and a retrieval length return (ftpobj, retrlen) @@ -2216,6 +2227,17 @@ pass def close(self): + self.keepalive = False + if self.refcount <= 0: + self.real_close() + + def file_close(self): + self.endtransfer() + self.refcount -= 1 + if self.refcount <= 0 and not self.keepalive: + self.real_close() + + def real_close(self): self.endtransfer() try: self.ftp.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 15:17:48 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 15:17:48 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Add_Misc/NEWS_e?= =?utf8?q?ntry_for_c741ba9e37ef=2E?= Message-ID: http://hg.python.org/cpython/rev/ba1eb9860649 changeset: 71476:ba1eb9860649 branch: 3.2 parent: 71474:c741ba9e37ef user: Nadeem Vawda date: Sat Jul 23 15:16:23 2011 +0200 summary: Add Misc/NEWS entry for c741ba9e37ef. files: Misc/NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #10883: Fix socket leaks in urllib.request when using FTP. + - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). - Issue #12372: POSIX semaphores are broken on AIX: don't use them. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 15:17:48 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 15:17:48 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Add_Misc/NEWS_entry_for_d68765bd6490=2E?= Message-ID: http://hg.python.org/cpython/rev/e3a773fefddf changeset: 71477:e3a773fefddf parent: 71475:d68765bd6490 parent: 71476:ba1eb9860649 user: Nadeem Vawda date: Sat Jul 23 15:17:19 2011 +0200 summary: Add Misc/NEWS entry for d68765bd6490. files: Misc/NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,8 @@ Library ------- +- Issue #10883: Fix socket leaks in urllib.request when using FTP. + - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). - Issue #12372: POSIX semaphores are broken on AIX: don't use them. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 16:02:01 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 16:02:01 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwODgz?= =?utf8?q?=3A_Fix_socket_leaks_in_urllib=2Erequest=2E?= Message-ID: http://hg.python.org/cpython/rev/dbf1e1a27427 changeset: 71478:dbf1e1a27427 branch: 2.7 parent: 71472:ed79da800b4a user: Nadeem Vawda date: Sat Jul 23 15:51:16 2011 +0200 summary: Issue #10883: Fix socket leaks in urllib.request. * ftpwrapper now uses reference counting to ensure that the underlying socket is closed when the ftpwrapper object is no longer in use * ftplib.FTP.ntransfercmd() now closes the socket if an error occurs Initial patch by Victor Stinner. files: Lib/ftplib.py | 56 +++++++++++++----------- Lib/test/test_urllib2.py | 1 + Lib/test/test_urllib2net.py | 1 + Lib/urllib.py | 27 +++++++++-- Lib/urllib2.py | 9 +++- Misc/NEWS | 2 + 6 files changed, 65 insertions(+), 31 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -325,33 +325,39 @@ if self.passiveserver: host, port = self.makepasv() conn = socket.create_connection((host, port), self.timeout) - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # Some servers apparently send a 200 reply to - # a LIST or STOR command, before the 150 reply - # (and way before the 226 reply). This seems to - # be in violation of the protocol (which only allows - # 1xx or error messages for LIST), so we just discard - # this response. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply, resp + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # Some servers apparently send a 200 reply to + # a LIST or STOR command, before the 150 reply + # (and way before the 226 reply). This seems to + # be in violation of the protocol (which only allows + # 1xx or error messages for LIST), so we just discard + # this response. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply, resp + except: + conn.close() + raise else: sock = self.makeport() - if rest is not None: - self.sendcmd("REST %s" % rest) - resp = self.sendcmd(cmd) - # See above. - if resp[0] == '2': - resp = self.getresp() - if resp[0] != '1': - raise error_reply, resp - conn, sockaddr = sock.accept() - if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: - conn.settimeout(self.timeout) - sock.close() + try: + if rest is not None: + self.sendcmd("REST %s" % rest) + resp = self.sendcmd(cmd) + # See above. + if resp[0] == '2': + resp = self.getresp() + if resp[0] != '1': + raise error_reply, resp + conn, sockaddr = sock.accept() + if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: + conn.settimeout(self.timeout) + finally: + sock.close() if resp[:3] == '150': # this is conditional in case we received a 125 size = parse150(resp) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -611,6 +611,7 @@ def retrfile(self, filename, filetype): self.filename, self.filetype = filename, filetype return StringIO.StringIO(self.data), len(self.data) + def close(self): pass class NullFTPHandler(urllib2.FTPHandler): def __init__(self, data): self.data = data diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -231,6 +231,7 @@ handlers = [] cfh = urllib2.CacheFTPHandler() + self.addCleanup(cfh.clear_cache) cfh.setTimeout(1) handlers.append(cfh) diff --git a/Lib/urllib.py b/Lib/urllib.py --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -850,13 +850,16 @@ """Class used by open_ftp() for cache of open FTP connections.""" def __init__(self, user, passwd, host, port, dirs, - timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + persistent=False): self.user = user self.passwd = passwd self.host = host self.port = port self.dirs = dirs self.timeout = timeout + self.refcount = 0 + self.keepalive = persistent self.init() def init(self): @@ -883,7 +886,7 @@ # Try to retrieve as a file try: cmd = 'RETR ' + file - conn = self.ftp.ntransfercmd(cmd) + conn, retrlen = self.ftp.ntransfercmd(cmd) except ftplib.error_perm, reason: if str(reason)[:3] != '550': raise IOError, ('ftp error', reason), sys.exc_info()[2] @@ -903,11 +906,14 @@ cmd = 'LIST ' + file else: cmd = 'LIST' - conn = self.ftp.ntransfercmd(cmd) + conn, retrlen = self.ftp.ntransfercmd(cmd) self.busy = 1 + ftpobj = addclosehook(conn.makefile('rb'), self.file_close) + self.refcount += 1 + conn.close() # Pass back both a suitably decorated object and a retrieval length - return (addclosehook(conn[0].makefile('rb'), - self.endtransfer), conn[1]) + return (ftpobj, retrlen) + def endtransfer(self): if not self.busy: return @@ -918,6 +924,17 @@ pass def close(self): + self.keepalive = False + if self.refcount <= 0: + self.real_close() + + def file_close(self): + self.endtransfer() + self.refcount -= 1 + if self.refcount <= 0 and not self.keepalive: + self.real_close() + + def real_close(self): self.endtransfer() try: self.ftp.close() diff --git a/Lib/urllib2.py b/Lib/urllib2.py --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -1399,7 +1399,8 @@ raise URLError, ('ftp error: %s' % msg), sys.exc_info()[2] def connect_ftp(self, user, passwd, host, port, dirs, timeout): - fw = ftpwrapper(user, passwd, host, port, dirs, timeout) + fw = ftpwrapper(user, passwd, host, port, dirs, timeout, + persistent=False) ## fw.ftp.set_debuglevel(1) return fw @@ -1448,3 +1449,9 @@ del self.timeout[k] break self.soonest = min(self.timeout.values()) + + def clear_cache(self): + for conn in self.cache.values(): + conn.close() + self.cache.clear() + self.timeout.clear() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #10883: Fix socket leaks in urllib.request when using FTP. + - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). - Issue #12372: POSIX semaphores are broken on AIX: don't use them. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 16:13:30 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 16:13:30 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_typo_in_NEW?= =?utf8?q?S_entry_for_dbf1e1a27427=2E?= Message-ID: http://hg.python.org/cpython/rev/2560f2c33222 changeset: 71479:2560f2c33222 branch: 2.7 user: Nadeem Vawda date: Sat Jul 23 16:13:01 2011 +0200 summary: Fix typo in NEWS entry for dbf1e1a27427. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,7 +37,7 @@ Library ------- -- Issue #10883: Fix socket leaks in urllib.request when using FTP. +- Issue #10883: Fix socket leaks in urllib when using FTP. - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 16:33:48 2011 From: python-checkins at python.org (local-hg) Date: Sat, 23 Jul 2011 16:33:48 +0200 Subject: [Python-checkins] =?utf8?q?hooks=3A_Fix_buildbot_hook_for_hg_1=2E?= =?utf8?q?9?= Message-ID: http://hg.python.org/hooks/rev/9f892b325417 changeset: 76:9f892b325417 user: Antoine Pitrou date: Sat Jul 23 16:33:48 2011 +0200 summary: Fix buildbot hook for hg 1.9 files: hgbuildbot.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hgbuildbot.py b/hgbuildbot.py --- a/hgbuildbot.py +++ b/hgbuildbot.py @@ -41,7 +41,7 @@ sys.path.append('/data/buildbot/lib/python') -def sendchanges(master, changes): +def sendchanges(ui, master, changes): # send change information to one master from buildbot.clients import sendchange @@ -56,6 +56,8 @@ # Yikes! if isinstance(v, localstr): change[k] = fromlocal(v).decode('utf8', 'replace') + elif isinstance(v, str): + change[k] = v.decode('utf8', 'replace') d.addCallback(send, change) d.addCallbacks(s.printSuccess, s.printFailure) d.addBoth(s.stop) @@ -116,7 +118,7 @@ new_stdout = sys.stdout = StringIO() try: for master in masters: - sendchanges(master, changes) + sendchanges(ui, master, changes) reactor.run() finally: sys.stdout = old_stdout -- Repository URL: http://hg.python.org/hooks From python-checkins at python.org Sat Jul 23 17:04:52 2011 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 23 Jul 2011 17:04:52 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_typo_in_dbf?= =?utf8?q?1e1a27427_that_was_causing_some_buildbots_to_fail=2E?= Message-ID: http://hg.python.org/cpython/rev/dbacafae72d8 changeset: 71480:dbacafae72d8 branch: 2.7 user: Nadeem Vawda date: Sat Jul 23 17:04:42 2011 +0200 summary: Fix typo in dbf1e1a27427 that was causing some buildbots to fail. files: Lib/urllib.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/urllib.py b/Lib/urllib.py --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -851,7 +851,7 @@ def __init__(self, user, passwd, host, port, dirs, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - persistent=False): + persistent=True): self.user = user self.passwd = passwd self.host = host -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 18:15:57 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 23 Jul 2011 18:15:57 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_12620=3A_Make_pending?= =?utf8?q?busy_flag_static_to_Py=5FMakePendingCalls=28=29=2E?= Message-ID: http://hg.python.org/cpython/rev/cda93720c06d changeset: 71481:cda93720c06d parent: 71477:e3a773fefddf user: Charles-Fran?ois Natali date: Sat Jul 23 18:15:43 2011 +0200 summary: Issue 12620: Make pendingbusy flag static to Py_MakePendingCalls(). files: Python/ceval.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -491,7 +491,6 @@ } pendingcalls[NPENDINGCALLS]; static int pendingfirst = 0; static int pendinglast = 0; -static char pendingbusy = 0; int Py_AddPendingCall(int (*func)(void *), void *arg) @@ -538,6 +537,7 @@ int Py_MakePendingCalls(void) { + static int busy = 0; int i; int r = 0; @@ -552,9 +552,9 @@ if (main_thread && PyThread_get_thread_ident() != main_thread) return 0; /* don't perform recursive pending calls */ - if (pendingbusy) + if (busy) return 0; - pendingbusy = 1; + busy = 1; /* perform a bounded number of calls, in case of recursion */ for (i=0; i http://hg.python.org/cpython/rev/9144014028f3 changeset: 71482:9144014028f3 branch: 3.2 parent: 71476:ba1eb9860649 user: Antoine Pitrou date: Sat Jul 23 21:46:35 2011 +0200 summary: Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without a read1() method), and add an undocumented *write_through* parameter to mandate unbuffered writes. files: Lib/_pyio.py | 8 ++++++-- Lib/test/test_io.py | 21 +++++++++++++++++++++ Misc/NEWS | 4 ++++ Modules/_io/textio.c | 20 ++++++++++++++------ 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1472,7 +1472,7 @@ _CHUNK_SIZE = 2048 def __init__(self, buffer, encoding=None, errors=None, newline=None, - line_buffering=False): + line_buffering=False, write_through=False): if newline is not None and not isinstance(newline, str): raise TypeError("illegal newline type: %r" % (type(newline),)) if newline not in (None, "", "\n", "\r", "\r\n"): @@ -1515,6 +1515,7 @@ self._decoded_chars_used = 0 # offset into _decoded_chars for read() self._snapshot = None # info for reconstructing decoder state self._seekable = self._telling = self.buffer.seekable() + self._has_read1 = hasattr(self.buffer, 'read1') if self._seekable and self.writable(): position = self.buffer.tell() @@ -1680,7 +1681,10 @@ # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). # Read a chunk, decode it, and put the result in self._decoded_chars. - input_chunk = self.buffer.read1(self._CHUNK_SIZE) + if self._has_read1: + input_chunk = self.buffer.read1(self._CHUNK_SIZE) + else: + input_chunk = self.buffer.read(self._CHUNK_SIZE) eof = not input_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2307,6 +2307,27 @@ with self.assertRaises(AttributeError): txt.buffer = buf + def test_rawio(self): + # Issue #12591: TextIOWrapper must work with raw I/O objects, so + # that subprocess.Popen() can have the required unbuffered + # semantics with universal_newlines=True. + raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n']) + txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n') + # Reads + self.assertEqual(txt.read(4), 'abcd') + self.assertEqual(txt.readline(), 'efghi\n') + self.assertEqual(list(txt), ['jkl\n', 'opq\n']) + + def test_rawio_write_through(self): + # Issue #12591: with write_through=True, writes don't need a flush + raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n']) + txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n', + write_through=True) + txt.write('1') + txt.write('23\n4') + txt.write('5') + self.assertEqual(b''.join(raw._write_stack), b'123\n45') + class CTextIOWrapperTest(TextIOWrapperTest): def test_initialization(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,10 @@ Library ------- +- Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without + a read1() method), and add an undocumented *write_through* parameter to + mandate unbuffered writes. + - Issue #10883: Fix socket leaks in urllib.request when using FTP. - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -653,10 +653,12 @@ PyObject *errors; const char *writenl; /* utf-8 encoded, NULL stands for \n */ char line_buffering; + char write_through; char readuniversal; char readtranslate; char writetranslate; char seekable; + char has_read1; char telling; char deallocating; /* Specialized encoding func (see below) */ @@ -809,13 +811,13 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"buffer", "encoding", "errors", - "newline", "line_buffering", + "newline", "line_buffering", "write_through", NULL}; PyObject *buffer, *raw; char *encoding = NULL; char *errors = NULL; char *newline = NULL; - int line_buffering = 0; + int line_buffering = 0, write_through = 0; _PyIO_State *state = IO_STATE; PyObject *res; @@ -823,9 +825,9 @@ self->ok = 0; self->detached = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzi:fileio", + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzii:fileio", kwlist, &buffer, &encoding, &errors, - &newline, &line_buffering)) + &newline, &line_buffering, &write_through)) return -1; if (newline && newline[0] != '\0' @@ -930,6 +932,7 @@ self->chunk_size = 8192; self->readuniversal = (newline == NULL || newline[0] == '\0'); self->line_buffering = line_buffering; + self->write_through = write_through; self->readtranslate = (newline == NULL); if (newline) { self->readnl = PyUnicode_FromString(newline); @@ -1039,6 +1042,8 @@ self->seekable = self->telling = PyObject_IsTrue(res); Py_DECREF(res); + self->has_read1 = PyObject_HasAttrString(buffer, "read1"); + self->encoding_start_of_stream = 0; if (self->seekable && self->encoder) { PyObject *cookieObj; @@ -1282,7 +1287,9 @@ text = newtext; } - if (self->line_buffering && + if (self->write_through) + needflush = 1; + else if (self->line_buffering && (haslf || findchar(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), '\r'))) @@ -1429,7 +1436,8 @@ if (chunk_size == NULL) goto fail; input_chunk = PyObject_CallMethodObjArgs(self->buffer, - _PyIO_str_read1, chunk_size, NULL); + (self->has_read1 ? _PyIO_str_read1: _PyIO_str_read), + chunk_size, NULL); Py_DECREF(chunk_size); if (input_chunk == NULL) goto fail; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 21:52:29 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 21:52:29 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312591=3A_Allow_io=2ETextIOWrapper_to_work_with_raw_?= =?utf8?q?IO_objects_=28without?= Message-ID: http://hg.python.org/cpython/rev/c3b47cdea0d1 changeset: 71483:c3b47cdea0d1 parent: 71481:cda93720c06d parent: 71482:9144014028f3 user: Antoine Pitrou date: Sat Jul 23 21:50:21 2011 +0200 summary: Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without a read1() method), and add a *write_through* parameter to mandate unbuffered writes. files: Lib/_pyio.py | 8 ++++++-- Lib/test/test_io.py | 21 +++++++++++++++++++++ Misc/NEWS | 4 ++++ Modules/_io/textio.c | 20 ++++++++++++++------ 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1478,7 +1478,7 @@ _CHUNK_SIZE = 2048 def __init__(self, buffer, encoding=None, errors=None, newline=None, - line_buffering=False): + line_buffering=False, write_through=False): if newline is not None and not isinstance(newline, str): raise TypeError("illegal newline type: %r" % (type(newline),)) if newline not in (None, "", "\n", "\r", "\r\n"): @@ -1521,6 +1521,7 @@ self._decoded_chars_used = 0 # offset into _decoded_chars for read() self._snapshot = None # info for reconstructing decoder state self._seekable = self._telling = self.buffer.seekable() + self._has_read1 = hasattr(self.buffer, 'read1') self._b2cratio = 0.0 if self._seekable and self.writable(): @@ -1687,7 +1688,10 @@ # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). # Read a chunk, decode it, and put the result in self._decoded_chars. - input_chunk = self.buffer.read1(self._CHUNK_SIZE) + if self._has_read1: + input_chunk = self.buffer.read1(self._CHUNK_SIZE) + else: + input_chunk = self.buffer.read(self._CHUNK_SIZE) eof = not input_chunk decoded_chars = self._decoder.decode(input_chunk, eof) self._set_decoded_chars(decoded_chars) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2314,6 +2314,27 @@ with self.assertRaises(AttributeError): txt.buffer = buf + def test_rawio(self): + # Issue #12591: TextIOWrapper must work with raw I/O objects, so + # that subprocess.Popen() can have the required unbuffered + # semantics with universal_newlines=True. + raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n']) + txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n') + # Reads + self.assertEqual(txt.read(4), 'abcd') + self.assertEqual(txt.readline(), 'efghi\n') + self.assertEqual(list(txt), ['jkl\n', 'opq\n']) + + def test_rawio_write_through(self): + # Issue #12591: with write_through=True, writes don't need a flush + raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n']) + txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n', + write_through=True) + txt.write('1') + txt.write('23\n4') + txt.write('5') + self.assertEqual(b''.join(raw._write_stack), b'123\n45') + class CTextIOWrapperTest(TextIOWrapperTest): def test_initialization(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,10 @@ Library ------- +- Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without + a read1() method), and add a *write_through* parameter to mandate + unbuffered writes. + - Issue #10883: Fix socket leaks in urllib.request when using FTP. - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -653,10 +653,12 @@ PyObject *errors; const char *writenl; /* utf-8 encoded, NULL stands for \n */ char line_buffering; + char write_through; char readuniversal; char readtranslate; char writetranslate; char seekable; + char has_read1; char telling; char deallocating; /* Specialized encoding func (see below) */ @@ -813,13 +815,13 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"buffer", "encoding", "errors", - "newline", "line_buffering", + "newline", "line_buffering", "write_through", NULL}; PyObject *buffer, *raw; char *encoding = NULL; char *errors = NULL; char *newline = NULL; - int line_buffering = 0; + int line_buffering = 0, write_through = 0; _PyIO_State *state = IO_STATE; PyObject *res; @@ -827,9 +829,9 @@ self->ok = 0; self->detached = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzi:fileio", + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzii:fileio", kwlist, &buffer, &encoding, &errors, - &newline, &line_buffering)) + &newline, &line_buffering, &write_through)) return -1; if (newline && newline[0] != '\0' @@ -935,6 +937,7 @@ self->chunk_size = 8192; self->readuniversal = (newline == NULL || newline[0] == '\0'); self->line_buffering = line_buffering; + self->write_through = write_through; self->readtranslate = (newline == NULL); if (newline) { self->readnl = PyUnicode_FromString(newline); @@ -1044,6 +1047,8 @@ self->seekable = self->telling = PyObject_IsTrue(res); Py_DECREF(res); + self->has_read1 = PyObject_HasAttrString(buffer, "read1"); + self->encoding_start_of_stream = 0; if (self->seekable && self->encoder) { PyObject *cookieObj; @@ -1287,7 +1292,9 @@ text = newtext; } - if (self->line_buffering && + if (self->write_through) + needflush = 1; + else if (self->line_buffering && (haslf || findchar(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), '\r'))) @@ -1435,7 +1442,8 @@ if (chunk_size == NULL) goto fail; input_chunk = PyObject_CallMethodObjArgs(self->buffer, - _PyIO_str_read1, chunk_size, NULL); + (self->has_read1 ? _PyIO_str_read1: _PyIO_str_read), + chunk_size, NULL); Py_DECREF(chunk_size); if (input_chunk == NULL) goto fail; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 22:01:26 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 22:01:26 +0200 Subject: [Python-checkins] =?utf8?q?cpython=3A_Followup_to_c3b47cdea0d1=3A?= =?utf8?q?_document_the_*write=5Fthrough*_argument_to?= Message-ID: http://hg.python.org/cpython/rev/26566bc02d1c changeset: 71484:26566bc02d1c user: Antoine Pitrou date: Sat Jul 23 22:00:03 2011 +0200 summary: Followup to c3b47cdea0d1: document the *write_through* argument to TextIOWrapper. files: Doc/library/io.rst | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -706,7 +706,8 @@ written. -.. class:: TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False) +.. class:: TextIOWrapper(buffer, encoding=None, errors=None, newline=None, \ + line_buffering=False, write_through=False) A buffered text stream over a :class:`BufferedIOBase` binary stream. It inherits :class:`TextIOBase`. @@ -737,6 +738,13 @@ If *line_buffering* is ``True``, :meth:`flush` is implied when a call to write contains a newline character. + If *write_through* is ``True``, calls to :meth:`write` are guaranteed + not to be buffered: any data written on the :class:`TextIOWrapper` + object is immediately handled to its underlying binary *buffer*. + + .. versionchanged:: 3.3 + The *write_through* argument has been added. + :class:`TextIOWrapper` provides one attribute in addition to those of :class:`TextIOBase` and its parents: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 22:06:06 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 22:06:06 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTkx?= =?utf8?q?=3A_Improve_support_of_=22universal_newlines=22_in_the_subproces?= =?utf8?q?s?= Message-ID: http://hg.python.org/cpython/rev/5cc536fbd7c1 changeset: 71485:5cc536fbd7c1 branch: 3.2 parent: 71482:9144014028f3 user: Antoine Pitrou date: Sat Jul 23 22:03:45 2011 +0200 summary: Issue #12591: Improve support of "universal newlines" in the subprocess module: the piped streams can now be properly read from or written to. (this was broken due to the 2.x to 3.x transition; communicate() support is still sketchy) files: Lib/subprocess.py | 2 +- Lib/test/test_subprocess.py | 64 ++++++++++++++++++------ Misc/NEWS | 3 + 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -721,7 +721,7 @@ if p2cwrite != -1: self.stdin = io.open(p2cwrite, 'wb', bufsize) if self.universal_newlines: - self.stdin = io.TextIOWrapper(self.stdin) + self.stdin = io.TextIOWrapper(self.stdin, write_through=True) if c2pread != -1: self.stdout = io.open(c2pread, 'rb', bufsize) if universal_newlines: diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -474,44 +474,75 @@ def test_universal_newlines(self): p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' + 'sys.stdout.write(sys.stdin.readline());' 'sys.stdout.flush();' 'sys.stdout.write("line2\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.write(sys.stdin.read());' 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' + 'sys.stdout.write("line4\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' + 'sys.stdout.write("line5\\r\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], + 'sys.stdout.write("line6\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline7");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline8");'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=1) + p.stdin.write("line1\n") + self.assertEqual(p.stdout.readline(), "line1\n") + p.stdin.write("line3\n") + p.stdin.close() self.addCleanup(p.stdout.close) - stdout = p.stdout.read() - self.assertEqual(stdout, "line1\nline2\nline3\nline4\nline5\nline6") + self.assertEqual(p.stdout.readline(), + "line2\n") + self.assertEqual(p.stdout.read(6), + "line3\n") + self.assertEqual(p.stdout.read(), + "line4\nline5\nline6\nline7\nline8") def test_universal_newlines_communicate(self): # universal newlines through communicate() p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' - 'sys.stdout.flush();' 'sys.stdout.write("line2\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.write("line4\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' + 'sys.stdout.write("line5\\r\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' + 'sys.stdout.write("line6\\r");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, + 'sys.stdout.write("\\nline7");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline8");'], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=1) self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) + # BUG: can't give a non-empty stdin because it breaks both the + # select- and poll-based communicate() implementations. (stdout, stderr) = p.communicate() - self.assertEqual(stdout, "line1\nline2\nline3\nline4\nline5\nline6") + self.assertEqual(stdout, + "line2\nline4\nline5\nline6\nline7\nline8") + + def test_universal_newlines_communicate_stdin(self): + # universal newlines through communicate(), with only stdin + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + '''\nif True: + s = sys.stdin.readline() + assert s == "line1\\n", repr(s) + s = sys.stdin.read() + assert s == "line3\\n", repr(s) + '''], + stdin=subprocess.PIPE, + universal_newlines=1) + (stdout, stderr) = p.communicate("line1\nline3\n") + self.assertEqual(p.returncode, 0) def test_no_leaking(self): # Make sure we leak no resources @@ -1584,7 +1615,8 @@ ProcessTestCaseNoPoll, HelperFunctionTests, CommandsWithSpaces, - ContextManagerTests) + ContextManagerTests, + ) support.run_unittest(*unit_tests) support.reap_children() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,9 @@ Library ------- +- Issue #12591: Improve support of "universal newlines" in the subprocess + module: the piped streams can now be properly read from or written to. + - Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without a read1() method), and add an undocumented *write_through* parameter to mandate unbuffered writes. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 22:06:07 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 22:06:07 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312591=3A_Improve_support_of_=22universal_newlines?= =?utf8?q?=22_in_the_subprocess?= Message-ID: http://hg.python.org/cpython/rev/b616396fa170 changeset: 71486:b616396fa170 parent: 71484:26566bc02d1c parent: 71485:5cc536fbd7c1 user: Antoine Pitrou date: Sat Jul 23 22:04:41 2011 +0200 summary: Issue #12591: Improve support of "universal newlines" in the subprocess module: the piped streams can now be properly read from or written to. files: Lib/subprocess.py | 2 +- Lib/test/test_subprocess.py | 64 ++++++++++++++++++------ Misc/NEWS | 3 + 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -728,7 +728,7 @@ if p2cwrite != -1: self.stdin = io.open(p2cwrite, 'wb', bufsize) if self.universal_newlines: - self.stdin = io.TextIOWrapper(self.stdin) + self.stdin = io.TextIOWrapper(self.stdin, write_through=True) if c2pread != -1: self.stdout = io.open(c2pread, 'rb', bufsize) if universal_newlines: diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -557,44 +557,75 @@ def test_universal_newlines(self): p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' + 'sys.stdout.write(sys.stdin.readline());' 'sys.stdout.flush();' 'sys.stdout.write("line2\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.write(sys.stdin.read());' 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' + 'sys.stdout.write("line4\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' + 'sys.stdout.write("line5\\r\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], + 'sys.stdout.write("line6\\r");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline7");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline8");'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=1) + p.stdin.write("line1\n") + self.assertEqual(p.stdout.readline(), "line1\n") + p.stdin.write("line3\n") + p.stdin.close() self.addCleanup(p.stdout.close) - stdout = p.stdout.read() - self.assertEqual(stdout, "line1\nline2\nline3\nline4\nline5\nline6") + self.assertEqual(p.stdout.readline(), + "line2\n") + self.assertEqual(p.stdout.read(6), + "line3\n") + self.assertEqual(p.stdout.read(), + "line4\nline5\nline6\nline7\nline8") def test_universal_newlines_communicate(self): # universal newlines through communicate() p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' + SETBINARY + - 'sys.stdout.write("line1\\n");' - 'sys.stdout.flush();' 'sys.stdout.write("line2\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line3\\r\\n");' + 'sys.stdout.write("line4\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("line4\\r");' + 'sys.stdout.write("line5\\r\\n");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline5");' + 'sys.stdout.write("line6\\r");' 'sys.stdout.flush();' - 'sys.stdout.write("\\nline6");'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, + 'sys.stdout.write("\\nline7");' + 'sys.stdout.flush();' + 'sys.stdout.write("\\nline8");'], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=1) self.addCleanup(p.stdout.close) self.addCleanup(p.stderr.close) + # BUG: can't give a non-empty stdin because it breaks both the + # select- and poll-based communicate() implementations. (stdout, stderr) = p.communicate() - self.assertEqual(stdout, "line1\nline2\nline3\nline4\nline5\nline6") + self.assertEqual(stdout, + "line2\nline4\nline5\nline6\nline7\nline8") + + def test_universal_newlines_communicate_stdin(self): + # universal newlines through communicate(), with only stdin + p = subprocess.Popen([sys.executable, "-c", + 'import sys,os;' + SETBINARY + '''\nif True: + s = sys.stdin.readline() + assert s == "line1\\n", repr(s) + s = sys.stdin.read() + assert s == "line3\\n", repr(s) + '''], + stdin=subprocess.PIPE, + universal_newlines=1) + (stdout, stderr) = p.communicate("line1\nline3\n") + self.assertEqual(p.returncode, 0) def test_no_leaking(self): # Make sure we leak no resources @@ -1658,7 +1689,8 @@ ProcessTestCaseNoPoll, HelperFunctionTests, CommandsWithSpaces, - ContextManagerTests) + ContextManagerTests, + ) support.run_unittest(*unit_tests) support.reap_children() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,9 @@ Library ------- +- Issue #12591: Improve support of "universal newlines" in the subprocess + module: the piped streams can now be properly read from or written to. + - Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without a read1() method), and add a *write_through* parameter to mandate unbuffered writes. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 22:39:24 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 22:39:24 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNjI0?= =?utf8?q?=3A_It_is_now_possible_to_fail_after_the_first_failure_when?= Message-ID: http://hg.python.org/cpython/rev/9f847dfba217 changeset: 71487:9f847dfba217 branch: 3.2 parent: 71485:5cc536fbd7c1 user: Antoine Pitrou date: Sat Jul 23 22:33:39 2011 +0200 summary: Issue #12624: It is now possible to fail after the first failure when running in verbose mode (`-v` or `-W`), by using the `--failfast` (or `-G`) option to regrtest. This is useful with long test suites such as test_io or test_subprocess. files: Lib/test/regrtest.py | 21 +++++++++++++++------ Lib/test/support.py | 6 ++++-- Misc/NEWS | 5 +++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -38,6 +38,7 @@ -f/--fromfile -- read names of tests to run from a file (see below) -x/--exclude -- arguments are tests to *exclude* -s/--single -- single step through a set of tests (see below) +-G/--failfast -- fail as soon as a test fails (only with -v or -W) -u/--use RES1,RES2,... -- specify which special resource intensive tests to run -M/--memlimit LIMIT @@ -241,7 +242,7 @@ findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, random_seed=None, use_mp=None, verbose3=False, forever=False, - header=False): + header=False, failfast=False): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -269,13 +270,13 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:G', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', - 'start=', 'nowindows', 'header']) + 'start=', 'nowindows', 'header', 'failfast']) except getopt.error as msg: usage(msg) @@ -298,6 +299,8 @@ debug = True elif o in ('-W', '--verbose3'): verbose3 = True + elif o in ('-G', '--failfast'): + failfast = True elif o in ('-q', '--quiet'): quiet = True; verbose = 0 @@ -406,6 +409,8 @@ usage("-T and -j don't go together!") if use_mp and findleaks: usage("-l and -j don't go together!") + if failfast and not (verbose or verbose3): + usage("-G/--failfast needs either -v or -W") good = [] bad = [] @@ -545,7 +550,8 @@ args_tuple = ( (test, verbose, quiet), dict(huntrleaks=huntrleaks, use_resources=use_resources, - debug=debug, output_on_failure=verbose3) + debug=debug, output_on_failure=verbose3, + failfast=failfast) ) yield (test, args_tuple) pending = tests_and_args() @@ -623,7 +629,8 @@ else: try: result = runtest(test, verbose, quiet, huntrleaks, debug, - output_on_failure=verbose3) + output_on_failure=verbose3, + failfast=failfast) accumulate_result(test, result) except KeyboardInterrupt: interrupted = True @@ -770,7 +777,7 @@ def runtest(test, verbose, quiet, huntrleaks=False, debug=False, use_resources=None, - output_on_failure=False): + output_on_failure=False, failfast=False): """Run a single test. test -- the name of the test @@ -793,6 +800,8 @@ if use_resources is not None: support.use_resources = use_resources try: + if failfast: + support.failfast = True if output_on_failure: support.verbose = True diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -52,7 +52,7 @@ "reap_children", "cpython_only", "check_impl_detail", "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754", "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", - "import_fresh_module" + "import_fresh_module", "failfast", ] class Error(Exception): @@ -176,6 +176,7 @@ max_memuse = 0 # Disable bigmem tests (they will still be run with # small sizes, to make sure they work.) real_max_memuse = 0 +failfast = False # _original_stdout is meant to hold stdout at the time regrtest began. # This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. @@ -1186,7 +1187,8 @@ def _run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: - runner = unittest.TextTestRunner(sys.stdout, verbosity=2) + runner = unittest.TextTestRunner(sys.stdout, verbosity=2, + failfast=failfast) else: runner = BasicTestRunner() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -104,6 +104,11 @@ Tests ----- +- Issue #12624: It is now possible to fail after the first failure when + running in verbose mode (``-v`` or ``-W``), by using the ``--failfast`` + (or ``-G``) option to regrtest. This is useful with long test suites + such as test_io or test_subprocess. + - Issue #12587: Correct faulty test file and reference in test_tokenize. (Patch by Robert Xiao) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jul 23 22:39:25 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 23 Jul 2011 22:39:25 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312624=3A_It_is_now_possible_to_fail_after_the_first?= =?utf8?q?_failure_when?= Message-ID: http://hg.python.org/cpython/rev/01d18277c40b changeset: 71488:01d18277c40b parent: 71486:b616396fa170 parent: 71487:9f847dfba217 user: Antoine Pitrou date: Sat Jul 23 22:37:52 2011 +0200 summary: Issue #12624: It is now possible to fail after the first failure when running in verbose mode (`-v` or `-W`), by using the `--failfast` (or `-G`) option to regrtest. This is useful with long test suites such as test_io or test_subprocess. files: Lib/test/regrtest.py | 21 +++++++++++++++------ Lib/test/support.py | 6 ++++-- Misc/NEWS | 5 +++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -43,6 +43,7 @@ -f/--fromfile -- read names of tests to run from a file (see below) -x/--exclude -- arguments are tests to *exclude* -s/--single -- single step through a set of tests (see below) +-G/--failfast -- fail as soon as a test fails (only with -v or -W) -u/--use RES1,RES2,... -- specify which special resource intensive tests to run -M/--memlimit LIMIT @@ -252,7 +253,7 @@ findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, random_seed=None, use_mp=None, verbose3=False, forever=False, - header=False): + header=False, failfast=False): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -292,13 +293,14 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:G', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', - 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'wait']) + 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'wait', + 'failfast']) except getopt.error as msg: usage(msg) @@ -322,6 +324,8 @@ debug = True elif o in ('-W', '--verbose3'): verbose3 = True + elif o in ('-G', '--failfast'): + failfast = True elif o in ('-q', '--quiet'): quiet = True; verbose = 0 @@ -454,6 +458,8 @@ usage("-T and -j don't go together!") if use_mp and findleaks: usage("-l and -j don't go together!") + if failfast and not (verbose or verbose3): + usage("-G/--failfast needs either -v or -W") good = [] bad = [] @@ -600,7 +606,7 @@ (test, verbose, quiet), dict(huntrleaks=huntrleaks, use_resources=use_resources, debug=debug, output_on_failure=verbose3, - timeout=timeout) + timeout=timeout, failfast=failfast) ) yield (test, args_tuple) pending = tests_and_args() @@ -685,7 +691,8 @@ else: try: result = runtest(test, verbose, quiet, huntrleaks, debug, - output_on_failure=verbose3, timeout=timeout) + output_on_failure=verbose3, + timeout=timeout, failfast=failfast) accumulate_result(test, result) except KeyboardInterrupt: interrupted = True @@ -829,7 +836,7 @@ def runtest(test, verbose, quiet, huntrleaks=False, debug=False, use_resources=None, - output_on_failure=False, timeout=None): + output_on_failure=False, failfast=False, timeout=None): """Run a single test. test -- the name of the test @@ -857,6 +864,8 @@ if use_timeout: faulthandler.dump_tracebacks_later(timeout, exit=True) try: + if failfast: + support.failfast = True if output_on_failure: support.verbose = True diff --git a/Lib/test/support.py b/Lib/test/support.py --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -55,7 +55,7 @@ "threading_cleanup", "reap_children", "cpython_only", "check_impl_detail", "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754", "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", - "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE" + "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast", ] class Error(Exception): @@ -179,6 +179,7 @@ max_memuse = 0 # Disable bigmem tests (they will still be run with # small sizes, to make sure they work.) real_max_memuse = 0 +failfast = False # _original_stdout is meant to hold stdout at the time regrtest began. # This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. @@ -1270,7 +1271,8 @@ def _run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: - runner = unittest.TextTestRunner(sys.stdout, verbosity=2) + runner = unittest.TextTestRunner(sys.stdout, verbosity=2, + failfast=failfast) else: runner = BasicTestRunner() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1087,6 +1087,11 @@ Tests ----- +- Issue #12624: It is now possible to fail after the first failure when + running in verbose mode (``-v`` or ``-W``), by using the ``--failfast`` + (or ``-G``) option to regrtest. This is useful with long test suites + such as test_io or test_subprocess. + - Issue #12587: Correct faulty test file and reference in test_tokenize. (Patch by Robert Xiao) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 02:43:22 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 24 Jul 2011 02:43:22 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzE4MTM6?= =?utf8?q?_Fix_codec_lookup_under_Turkish_locales=2E?= Message-ID: http://hg.python.org/cpython/rev/92d02de91cc9 changeset: 71489:92d02de91cc9 branch: 3.2 parent: 71487:9f847dfba217 user: Antoine Pitrou date: Sun Jul 24 02:27:04 2011 +0200 summary: Issue #1813: Fix codec lookup under Turkish locales. files: Lib/test/test_codecs.py | 14 ++++++++++++++ Misc/NEWS | 2 ++ Python/codecs.c | 2 +- 3 files changed, 17 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1,6 +1,7 @@ from test import support import unittest import codecs +import locale import sys, _testcapi, io class Queue(object): @@ -1230,6 +1231,19 @@ self.assertRaises(TypeError, codecs.getwriter) self.assertRaises(LookupError, codecs.getwriter, "__spam__") + def test_lookup_issue1813(self): + # Issue #1813: under Turkish locales, lookup of some codecs failed + # because 'I' is lowercased as "?" (dotless i) + oldlocale = locale.getlocale(locale.LC_CTYPE) + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + c = codecs.lookup('ASCII') + self.assertEqual(c.name, 'ascii') + class StreamReaderTest(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #1813: Fix codec lookup under Turkish locales. + - Issue #12591: Improve support of "universal newlines" in the subprocess module: the piped streams can now be properly read from or written to. diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -69,7 +69,7 @@ if (ch == ' ') ch = '-'; else - ch = tolower(Py_CHARMASK(ch)); + ch = Py_TOLOWER(Py_CHARMASK(ch)); p[i] = ch; } p[i] = '\0'; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 02:43:22 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 24 Jul 2011 02:43:22 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Add_a_test_for_?= =?utf8?q?issue_=231813=3A_getlocale=28=29_failing_under_a_Turkish_locale?= Message-ID: http://hg.python.org/cpython/rev/a77a4df54b95 changeset: 71490:a77a4df54b95 branch: 3.2 user: Antoine Pitrou date: Sun Jul 24 02:40:25 2011 +0200 summary: Add a test for issue #1813: getlocale() failing under a Turkish locale (not a problem under 3.x) files: Lib/test/test_locale.py | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -391,6 +391,19 @@ # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345) + def test_getsetlocale_issue1813(self): + # Issue #1813: setting and getting the locale under a Turkish locale + oldlocale = locale.getlocale() + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + loc = locale.getlocale() + locale.setlocale(locale.LC_CTYPE, loc) + self.assertEqual(loc, locale.getlocale()) + def test_main(): tests = [ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 02:43:23 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 24 Jul 2011 02:43:23 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Add_a_test_for_issue_=231813=3A_getlocale=28=29_failing_unde?= =?utf8?q?r_a_Turkish_locale?= Message-ID: http://hg.python.org/cpython/rev/fe0caf8c48d2 changeset: 71491:fe0caf8c48d2 parent: 71488:01d18277c40b parent: 71490:a77a4df54b95 user: Antoine Pitrou date: Sun Jul 24 02:41:54 2011 +0200 summary: Add a test for issue #1813: getlocale() failing under a Turkish locale (not a problem under 3.x) files: Lib/test/test_codecs.py | 14 ++++++++++++++ Lib/test/test_locale.py | 13 +++++++++++++ Misc/NEWS | 2 ++ Python/codecs.c | 2 +- 4 files changed, 30 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1,6 +1,7 @@ from test import support import unittest import codecs +import locale import sys, _testcapi, io class Queue(object): @@ -1230,6 +1231,19 @@ self.assertRaises(TypeError, codecs.getwriter) self.assertRaises(LookupError, codecs.getwriter, "__spam__") + def test_lookup_issue1813(self): + # Issue #1813: under Turkish locales, lookup of some codecs failed + # because 'I' is lowercased as "?" (dotless i) + oldlocale = locale.getlocale(locale.LC_CTYPE) + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + c = codecs.lookup('ASCII') + self.assertEqual(c.name, 'ascii') + class StreamReaderTest(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -391,6 +391,19 @@ # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345) + def test_getsetlocale_issue1813(self): + # Issue #1813: setting and getting the locale under a Turkish locale + oldlocale = locale.getlocale() + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + loc = locale.getlocale() + locale.setlocale(locale.LC_CTYPE, loc) + self.assertEqual(loc, locale.getlocale()) + def test_main(): tests = [ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,8 @@ Library ------- +- Issue #1813: Fix codec lookup under Turkish locales. + - Issue #12591: Improve support of "universal newlines" in the subprocess module: the piped streams can now be properly read from or written to. diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -69,7 +69,7 @@ if (ch == ' ') ch = '-'; else - ch = tolower(Py_CHARMASK(ch)); + ch = Py_TOLOWER(Py_CHARMASK(ch)); p[i] = ch; } p[i] = '\0'; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 02:52:26 2011 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 24 Jul 2011 02:52:26 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE4MTM6?= =?utf8?q?_Fix_codec_lookup_and_setting/getting_locales_under_Turkish_loca?= =?utf8?q?les=2E?= Message-ID: http://hg.python.org/cpython/rev/739958134fe5 changeset: 71492:739958134fe5 branch: 2.7 parent: 71480:dbacafae72d8 user: Antoine Pitrou date: Sun Jul 24 02:51:01 2011 +0200 summary: Issue #1813: Fix codec lookup and setting/getting locales under Turkish locales. files: Lib/locale.py | 9 ++++++++- Lib/test/test_codecs.py | 14 ++++++++++++++ Lib/test/test_locale.py | 13 +++++++++++++ Misc/NEWS | 3 +++ Python/codecs.c | 2 +- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Lib/locale.py b/Lib/locale.py --- a/Lib/locale.py +++ b/Lib/locale.py @@ -331,6 +331,13 @@ # overridden below) _setlocale = setlocale +# Avoid relying on the locale-dependent .lower() method +# (see issue #1813). +_ascii_lower_map = ''.join( + chr(x + 32 if x >= ord('A') and x <= ord('Z') else x) + for x in range(256) +) + def normalize(localename): """ Returns a normalized locale code for the given locale @@ -348,7 +355,7 @@ """ # Normalize the locale name and extract the encoding - fullname = localename.lower() + fullname = localename.translate(_ascii_lower_map) if ':' in fullname: # ':' is sometimes used as encoding delimiter. fullname = fullname.replace(':', '.') diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1,6 +1,7 @@ from test import test_support import unittest import codecs +import locale import sys, StringIO, _testcapi class Queue(object): @@ -1153,6 +1154,19 @@ self.assertRaises(TypeError, codecs.getwriter) self.assertRaises(LookupError, codecs.getwriter, "__spam__") + def test_lookup_issue1813(self): + # Issue #1813: under Turkish locales, lookup of some codecs failed + # because 'I' is lowercased as a dotless "i" + oldlocale = locale.getlocale(locale.LC_CTYPE) + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + c = codecs.lookup('ASCII') + self.assertEqual(c.name, 'ascii') + class StreamReaderTest(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -396,6 +396,19 @@ # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345) + def test_getsetlocale_issue1813(self): + # Issue #1813: setting and getting the locale under a Turkish locale + oldlocale = locale.getlocale() + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) + try: + locale.setlocale(locale.LC_CTYPE, 'tr_TR') + except locale.Error: + # Unsupported locale on this system + self.skipTest('test needs Turkish locale') + loc = locale.getlocale() + locale.setlocale(locale.LC_CTYPE, loc) + self.assertEqual(loc, locale.getlocale()) + def test_main(): tests = [ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,9 @@ Library ------- +- Issue #1813: Fix codec lookup and setting/getting locales under Turkish + locales. + - Issue #10883: Fix socket leaks in urllib when using FTP. - Issue #12592: Make Python build on OpenBSD 5 (and future major releases). diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -70,7 +70,7 @@ if (ch == ' ') ch = '-'; else - ch = tolower(Py_CHARMASK(ch)); + ch = Py_TOLOWER(Py_CHARMASK(ch)); p[i] = ch; } return v; -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jul 24 06:35:41 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 24 Jul 2011 06:35:41 +0200 Subject: [Python-checkins] Daily reference leaks (fe0caf8c48d2): sum=0 Message-ID: results for fe0caf8c48d2 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog1fWIim', '-x'] From python-checkins at python.org Sun Jul 24 22:33:30 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 24 Jul 2011 22:33:30 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTYw?= =?utf8?q?=3A_Build_libpython=2Eso_on_OpenBSD=2E_Patch_by_Stefan_Sperling?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/33be4896003a changeset: 71493:33be4896003a branch: 2.7 user: Charles-Fran?ois Natali date: Sun Jul 24 22:33:35 2011 +0200 summary: Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. files: Misc/ACKS | 1 + Misc/NEWS | 2 ++ configure | 2 +- configure.in | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -771,6 +771,7 @@ Paul Sokolovsky Cody Somerville Clay Spence +Stefan Sperling Per Spilling Joshua Spoerri Noah Spurrier diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. + - Issue #1813: Fix codec lookup and setting/getting locales under Turkish locales. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -4919,7 +4919,7 @@ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} INSTSONAME="$LDLIBRARY".$SOVERSION ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -778,7 +778,7 @@ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} INSTSONAME="$LDLIBRARY".$SOVERSION ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 22:41:22 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 24 Jul 2011 22:41:22 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyNTYw?= =?utf8?q?=3A_Build_libpython=2Eso_on_OpenBSD=2E_Patch_by_Stefan_Sperling?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/1fdad36ac838 changeset: 71494:1fdad36ac838 branch: 3.2 parent: 71490:a77a4df54b95 user: Charles-Fran?ois Natali date: Sun Jul 24 22:41:18 2011 +0200 summary: Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. files: Misc/ACKS | 1 + Misc/NEWS | 2 ++ configure | 2 +- configure.in | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -829,6 +829,7 @@ Paul Sokolovsky Cody Somerville Clay Spence +Stefan Sperling Per Spilling Joshua Spoerri Noah Spurrier diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,8 @@ Library ------- +- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. + - Issue #1813: Fix codec lookup under Turkish locales. - Issue #12591: Improve support of "universal newlines" in the subprocess diff --git a/configure b/configure --- a/configure +++ b/configure @@ -4950,7 +4950,7 @@ PY3LIBRARY=libpython3.so fi ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -755,7 +755,7 @@ PY3LIBRARY=libpython3.so fi ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jul 24 22:43:58 2011 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 24 Jul 2011 22:43:58 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312560=3A_Build_libpython=2Eso_on_OpenBSD=2E_Patch_b?= =?utf8?q?y_Stefan_Sperling=2E?= Message-ID: http://hg.python.org/cpython/rev/a095cbed24c3 changeset: 71495:a095cbed24c3 parent: 71491:fe0caf8c48d2 parent: 71494:1fdad36ac838 user: Charles-Fran?ois Natali date: Sun Jul 24 22:44:15 2011 +0200 summary: Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. files: Misc/ACKS | 1 + Misc/NEWS | 2 ++ configure | 2 +- configure.in | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -885,6 +885,7 @@ Cody Somerville Edoardo Spadolini Clay Spence +Stefan Sperling Per Spilling Joshua Spoerri Noah Spurrier diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,8 @@ Library ------- +- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. + - Issue #1813: Fix codec lookup under Turkish locales. - Issue #12591: Improve support of "universal newlines" in the subprocess diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5005,7 +5005,7 @@ PY3LIBRARY=libpython3.so fi ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -769,7 +769,7 @@ PY3LIBRARY=libpython3.so fi ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jul 25 05:25:07 2011 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 25 Jul 2011 05:25:07 +0200 Subject: [Python-checkins] Daily reference leaks (a095cbed24c3): sum=0 Message-ID: results for a095cbed24c3 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog7tImXO', '-x'] From python-checkins at python.org Mon Jul 25 07:15:52 2011 From: python-checkins at python.org (ross.lagerwall) Date: Mon, 25 Jul 2011 07:15:52 +0200 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMTAy?= =?utf8?q?=3A_Document_that_buffered_files_must_be_flushed_before_being_us?= =?utf8?q?ed?= Message-ID: http://hg.python.org/cpython/rev/198627bbe242 changeset: 71496:198627bbe242 branch: 3.2 parent: 71494:1fdad36ac838 user: Ross Lagerwall date: Mon Jul 25 07:12:43 2011 +0200 summary: Issue #12102: Document that buffered files must be flushed before being used with mmap. Patch by Steffen Daode Nurpmeso. files: Doc/ACKS.txt | 1 + Doc/library/mmap.rst | 6 ++++++ Misc/NEWS | 3 +++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -144,6 +144,7 @@ * Sjoerd Mullender * Dale Nagata * Michal Nowikowski + * Steffen Daode Nurpmeso * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -21,6 +21,12 @@ :func:`os.open` function, which returns a file descriptor directly (the file still needs to be closed when done). +.. note:: + If you want to create a memory-mapping for a writable, buffered file, you + should :func:`~io.IOBase.flush` the file first. This is necessary to ensure + that local modifications to the buffers are actually available to the + mapping. + For both the Unix and Windows versions of the constructor, *access* may be specified as an optional keyword parameter. *access* accepts one of three values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,9 @@ Library ------- +- Issue #12102: Document that buffered files must be flushed before being used + with mmap. Patch by Steffen Daode Nurpmeso. + - Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. - Issue #1813: Fix codec lookup under Turkish locales. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 25 07:15:53 2011 From: python-checkins at python.org (ross.lagerwall) Date: Mon, 25 Jul 2011 07:15:53 +0200 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312102=3A_Merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/4898b14dcd69 changeset: 71497:4898b14dcd69 parent: 71495:a095cbed24c3 parent: 71496:198627bbe242 user: Ross Lagerwall date: Mon Jul 25 07:14:15 2011 +0200 summary: Issue #12102: Merge with 3.2. files: Doc/ACKS.txt | 1 + Doc/library/mmap.rst | 6 ++++++ Misc/NEWS | 3 +++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -144,6 +144,7 @@ * Sjoerd Mullender * Dale Nagata * Michal Nowikowski + * Steffen Daode Nurpmeso * Ng Pheng Siong * Koray Oner * Tomas Oppelstrup diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -21,6 +21,12 @@ :func:`os.open` function, which returns a file descriptor directly (the file still needs to be closed when done). +.. note:: + If you want to create a memory-mapping for a writable, buffered file, you + should :func:`~io.IOBase.flush` the file first. This is necessary to ensure + that local modifications to the buffers are actually available to the + mapping. + For both the Unix and Windows versions of the constructor, *access* may be specified as an optional keyword parameter. *access* accepts one of three values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -237,6 +237,9 @@ Library ------- +- Issue #12102: Document that buffered files must be flushed before being used + with mmap. Patch by Steffen Daode Nurpmeso. + - Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. - Issue #1813: Fix codec lookup under Turkish locales. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jul 25 07:15:53 2011 From: python-checkins at python.org (ezio.melotti) Date: Mon, 25 Jul 2011 07:15:53 +0200 (CEST) Subject: [Python-checkins] r88869 - in tracker/instances/python-dev/html: issue.index.html style.css Message-ID: <3RMrQK46zgzMpZ@mail.python.org> Author: ezio.melotti Date: Mon Jul 25 07:15:53 2011 New Revision: 88869 Log: Align the message headers and the navigation links. Modified: tracker/instances/python-dev/html/issue.index.html tracker/instances/python-dev/html/style.css Modified: tracker/instances/python-dev/html/issue.index.html ============================================================================== --- tracker/instances/python-dev/html/issue.index.html (original) +++ tracker/instances/python-dev/html/issue.index.html Mon Jul 25 07:15:53 2011 @@ -98,11 +98,11 @@