From python-checkins at python.org Sun Apr 1 20:24:24 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 1 Apr 2007 20:24:24 +0200 (CEST) Subject: [Python-checkins] r54644 - in python/trunk: Lib/distutils/msvccompiler.py Misc/NEWS Message-ID: <20070401182424.4FB111E4006@bag.python.org> Author: neal.norwitz Date: Sun Apr 1 20:24:22 2007 New Revision: 54644 Modified: python/trunk/Lib/distutils/msvccompiler.py python/trunk/Misc/NEWS Log: SF #1685563, MSVCCompiler creates redundant and long PATH strings If MSVCCompiler.initialize() was called multiple times, the path would get duplicated. On Windows, this is a problem because the path is limited to 4k. There's no benefit in adding a path multiple times, so prevent that from occuring. We also normalize the path before checking for duplicates so things like /a and /a/ won't both be stored. Will backport. Modified: python/trunk/Lib/distutils/msvccompiler.py ============================================================================== --- python/trunk/Lib/distutils/msvccompiler.py (original) +++ python/trunk/Lib/distutils/msvccompiler.py Sun Apr 1 20:24:22 2007 @@ -187,6 +187,19 @@ j = string.find(sys.version, ")", i) return sys.version[i+len(prefix):j] +def normalize_and_reduce_paths(paths): + """Return a list of normalized paths with duplicates removed. + + The current order of paths is maintained. + """ + # Paths are normalized so things like: /a and /a/ aren't both preserved. + reduced_paths = [] + for p in paths: + np = os.path.normpath(p) + # XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set. + if np not in reduced_paths: + reduced_paths.append(np) + return reduced_paths class MSVCCompiler (CCompiler) : @@ -270,6 +283,7 @@ self.__paths.append(p) except KeyError: pass + self.__paths = normalize_and_reduce_paths(self.__paths) os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Apr 1 20:24:22 2007 @@ -1,4 +1,4 @@ -__init+++++++++++ ++++++++++++ Python News +++++++++++ @@ -200,6 +200,8 @@ Library ------- +- Patch #1685563: remove (don't add) duplicate paths in distutils.MSVCCompiler. + - Added a timeout parameter to the constructor of other protocols (telnetlib, ftplib, smtplib and poplib). This is second part of the work started with create_connection() and timeout in httplib, and From python-checkins at python.org Sun Apr 1 20:29:53 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 1 Apr 2007 20:29:53 +0200 (CEST) Subject: [Python-checkins] r54645 - in python/branches/release25-maint: Lib/distutils/msvccompiler.py Misc/NEWS Message-ID: <20070401182953.D922F1E4006@bag.python.org> Author: neal.norwitz Date: Sun Apr 1 20:29:47 2007 New Revision: 54645 Modified: python/branches/release25-maint/Lib/distutils/msvccompiler.py python/branches/release25-maint/Misc/NEWS Log: Backport 54644: SF #1685563, MSVCCompiler creates redundant and long PATH strings If MSVCCompiler.initialize() was called multiple times, the path would get duplicated. On Windows, this is a problem because the path is limited to 4k. There's no benefit in adding a path multiple times, so prevent that from occuring. We also normalize the path before checking for duplicates so things like /a and /a/ won't both be stored. Modified: python/branches/release25-maint/Lib/distutils/msvccompiler.py ============================================================================== --- python/branches/release25-maint/Lib/distutils/msvccompiler.py (original) +++ python/branches/release25-maint/Lib/distutils/msvccompiler.py Sun Apr 1 20:29:47 2007 @@ -187,6 +187,19 @@ j = string.find(sys.version, ")", i) return sys.version[i+len(prefix):j] +def normalize_and_reduce_paths(paths): + """Return a list of normalized paths with duplicates removed. + + The current order of paths is maintained. + """ + # Paths are normalized so things like: /a and /a/ aren't both preserved. + reduced_paths = [] + for p in paths: + np = os.path.normpath(p) + # XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set. + if np not in reduced_paths: + reduced_paths.append(np) + return reduced_paths class MSVCCompiler (CCompiler) : @@ -270,6 +283,7 @@ self.__paths.append(p) except KeyError: pass + self.__paths = normalize_and_reduce_paths(self.__paths) os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Apr 1 20:29:47 2007 @@ -219,6 +219,8 @@ Library ------- +- Patch #1685563: remove (don't add) duplicate paths in distutils.MSVCCompiler. + - Bug #978833: Revert r50844, as it broke _socketobject.dup. - Bug #1675967: re patterns pickled with Python 2.4 and earlier can From python-checkins at python.org Sun Apr 1 20:47:33 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Apr 2007 20:47:33 +0200 (CEST) Subject: [Python-checkins] r54646 - in python/trunk: Lib/_strptime.py Lib/test/test_strptime.py Misc/NEWS Message-ID: <20070401184733.D18E21E400B@bag.python.org> Author: brett.cannon Date: Sun Apr 1 20:47:27 2007 New Revision: 54646 Modified: python/trunk/Lib/_strptime.py python/trunk/Lib/test/test_strptime.py python/trunk/Misc/NEWS Log: time.strptime's caching of its locale object was being recreated when the locale changed but not used during the function call it was recreated during. The test in this checkin is untested (OS X does not have the proper locale support for me to test), although the fix for the bug this deals with was tested by the OP (#1290505). Once the buildbots verify the test at least doesn't fail it becomes a backport candidate. Modified: python/trunk/Lib/_strptime.py ============================================================================== --- python/trunk/Lib/_strptime.py (original) +++ python/trunk/Lib/_strptime.py Sun Apr 1 20:47:27 2007 @@ -295,17 +295,16 @@ """Return a time struct based on the input string and the format string.""" global _TimeRE_cache, _regex_cache with _cache_lock: - time_re = _TimeRE_cache - locale_time = time_re.locale_time - if _getlang() != locale_time.lang: + if _getlang() != _TimeRE_cache.locale_time.lang: _TimeRE_cache = TimeRE() - _regex_cache = {} + _regex_cache.clear() if len(_regex_cache) > _CACHE_MAX_SIZE: _regex_cache.clear() + locale_time = _TimeRE_cache.locale_time format_regex = _regex_cache.get(format) if not format_regex: try: - format_regex = time_re.compile(format) + format_regex = _TimeRE_cache.compile(format) # KeyError raised when a bad format is found; can be specified as # \\, in which case it was a stray % but with a space after it except KeyError, err: Modified: python/trunk/Lib/test/test_strptime.py ============================================================================== --- python/trunk/Lib/test/test_strptime.py (original) +++ python/trunk/Lib/test/test_strptime.py Sun Apr 1 20:47:27 2007 @@ -505,6 +505,23 @@ self.failIfEqual(locale_time_id, id(_strptime._TimeRE_cache.locale_time)) + def test_TimeRE_recreation(self): + # The TimeRE instance should be recreated upon changing the locale. + locale_info = locale.getlocale(locale.LC_TIME) + try: + locale.setlocale(locale.LC_TIME, ('en_US', 'UTF8')) + except locale.Error: + return + try: + _strptime.strptime('10', '%d') + first_time_re_id = id(_strptime._TimeRE_cache) + locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) + _strptime.strptime('10', '%d') + second_time_re_id = id(_strptime._TimeRE_cache) + self.failIfEqual(first_time_re_id, second_time_re_id) + finally: + locale.setlocale(locale.LC_TIME, locale_info) + def test_main(): test_support.run_unittest( Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Apr 1 20:47:27 2007 @@ -200,6 +200,9 @@ Library ------- +- Bug #1290505: time.strptime's internal cache of locale information is now + properly recreated when the locale is changed. + - Patch #1685563: remove (don't add) duplicate paths in distutils.MSVCCompiler. - Added a timeout parameter to the constructor of other protocols From buildbot at python.org Sun Apr 1 21:25:31 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Apr 2007 19:25:31 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070401192531.766EA1E4007@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2102 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_strptime ====================================================================== ERROR: test_TimeRE_recreation (test.test_strptime.CacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_strptime.py", line 518, in test_TimeRE_recreation locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/locale.py", line 476, in setlocale return _setlocale(category, locale) Error: unsupported locale setting make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Apr 1 21:26:22 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Apr 2007 19:26:22 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070401192622.6BF731E400B@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1919 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_strptime ====================================================================== ERROR: test_TimeRE_recreation (test.test_strptime.CacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_strptime.py", line 518, in test_TimeRE_recreation locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/locale.py", line 476, in setlocale return _setlocale(category, locale) Error: unsupported locale setting make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Apr 1 21:29:23 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Apr 2007 19:29:23 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070401192924.168C81E4016@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/232 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socketserver Traceback (most recent call last): File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 81, in run svr = svrcls(self.__addr, self.__hdlrcls) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/SocketServer.py", line 330, in __init__ self.server_bind() File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/SocketServer.py", line 341, in server_bind self.socket.bind(self.server_address) File "", line 1, in bind error: (48, 'Address already in use') Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 212, in test_main testall() File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 197, in testall testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 144, in testloop testfunc(proto, addr) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 53, in testdgram buf = data = receive(s, 100) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socketserver.py", line 48, in receive raise RuntimeError, "timed out on %r" % (sock,) RuntimeError: timed out on sincerely, -The Buildbot From python-checkins at python.org Sun Apr 1 21:46:23 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Apr 2007 21:46:23 +0200 (CEST) Subject: [Python-checkins] r54647 - python/trunk/Lib/test/test_strptime.py Message-ID: <20070401194623.0839A1E4007@bag.python.org> Author: brett.cannon Date: Sun Apr 1 21:46:19 2007 New Revision: 54647 Modified: python/trunk/Lib/test/test_strptime.py Log: Fix the test for recreating the locale cache object by not worrying about if one of the test locales cannot be set. Modified: python/trunk/Lib/test/test_strptime.py ============================================================================== --- python/trunk/Lib/test/test_strptime.py (original) +++ python/trunk/Lib/test/test_strptime.py Sun Apr 1 21:46:19 2007 @@ -514,11 +514,23 @@ return try: _strptime.strptime('10', '%d') + # Get id of current cache object. first_time_re_id = id(_strptime._TimeRE_cache) - locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) - _strptime.strptime('10', '%d') - second_time_re_id = id(_strptime._TimeRE_cache) - self.failIfEqual(first_time_re_id, second_time_re_id) + try: + # Change the locale and force a recreation of the cache. + locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) + _strptime.strptime('10', '%d') + # Get the new cache object's id. + second_time_re_id = id(_strptime._TimeRE_cache) + # They should not be equal. + self.failIfEqual(first_time_re_id, second_time_re_id) + # Possible test locale is not supported while initial locale is. + # If this is the case just suppress the exception and fall-through + # to the reseting to the original locale. + except locale.Error: + pass + # Make sure we don't trample on the locale setting once we leave the + # test. finally: locale.setlocale(locale.LC_TIME, locale_info) From buildbot at python.org Sun Apr 1 21:58:45 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Apr 2007 19:58:45 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070401195845.292271E4006@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/173 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 2 tests failed: test_os test_urllib ====================================================================== ERROR: test_makedir (test.test_os.MakedirTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 384, in setUp os.mkdir(test_support.TESTFN) WindowsError: [Error 183] Cannot create a file when that file already exists: '@test' ====================================================================== ERROR: test_access (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 451, in test_access self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) TypeError: utime() arg 2 must be a tuple (atime, mtime) ====================================================================== FAIL: test_traversal (test.test_os.WalkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 313, in test_traversal self.assertEqual(len(all), 4) AssertionError: 5 != 4 ====================================================================== FAIL: test_chdir (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 442, in test_chdir self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) AssertionError: WindowsError not raised Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\test\test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\test\test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2000-2000-2000-2000-2000' Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\test\test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0002-0002-0002-0002-0002' Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\test\test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1000-1000-1000-1000-1000' sincerely, -The Buildbot From python-checkins at python.org Sun Apr 1 22:46:18 2007 From: python-checkins at python.org (collin.winter) Date: Sun, 1 Apr 2007 22:46:18 +0200 (CEST) Subject: [Python-checkins] r54648 - in sandbox/trunk/2to3: fixes/util.py tests/test_util.py Message-ID: <20070401204618.8252D1E4007@bag.python.org> Author: collin.winter Date: Sun Apr 1 22:46:14 2007 New Revision: 54648 Modified: sandbox/trunk/2to3/fixes/util.py sandbox/trunk/2to3/tests/test_util.py Log: Add more tests and nested control structure support to fixes.util.find_binding(). Modified: sandbox/trunk/2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/fixes/util.py Sun Apr 1 22:46:14 2007 @@ -117,17 +117,38 @@ ### The following functions are to find bindings in a suite ########################################################### +def make_suite(node): + if node.type == syms.suite: + return node + node = node.clone() + parent, node.parent = node.parent, None + suite = Node(syms.suite, [node]) + suite.parent = parent + return suite + _def_syms = set([syms.classdef, syms.funcdef]) def find_binding(name, node): for child in node.children: if child.type == syms.for_stmt: if _find(name, child.children[1]): return child - elif _find(name, child.children[-1]): - return child + n = find_binding(name, make_suite(child.children[-1])) + if n: + return n elif child.type in (syms.if_stmt, syms.while_stmt): - if _find(name, child.children[-1]): - return child + n = find_binding(name, make_suite(child.children[-1])) + if n: + return n + elif child.type == syms.try_stmt: + n = find_binding(name, make_suite(child.children[2])) + if n: + return n + for i, kid in enumerate(child.children[3:]): + if kid.type == token.COLON and kid.value == ":": + # i+3 is the colon, i+4 is the suite + n = find_binding(name, make_suite(child.children[i+4])) + if n: + return n elif child.type in _def_syms and child.children[1].value == name: return child elif _is_import_binding(child, name): Modified: sandbox/trunk/2to3/tests/test_util.py ============================================================================== --- sandbox/trunk/2to3/tests/test_util.py (original) +++ sandbox/trunk/2to3/tests/test_util.py Sun Apr 1 22:46:14 2007 @@ -101,7 +101,7 @@ self.failUnless(self.find_binding("a", "(c, (d, a), b) = foo()")) self.failUnless(self.find_binding("a", "(a, b) = foo().foo.foo[6][foo]")) self.failIf(self.find_binding("a", "(foo, b) = (b, a)")) - self.failIf(self.find_binding("a", "(foo, b, c) = (a, b, c)")) + self.failIf(self.find_binding("a", "(foo, (b, c)) = (a, b, c)")) def test_list_assignment(self): self.failUnless(self.find_binding("a", "[a] = b")) @@ -109,7 +109,7 @@ self.failUnless(self.find_binding("a", "[c, [d, a], b] = foo()")) self.failUnless(self.find_binding("a", "[a, b] = foo().foo.foo[a][foo]")) self.failIf(self.find_binding("a", "[foo, b] = (b, a)")) - self.failIf(self.find_binding("a", "[foo, b, c] = (a, b, c)")) + self.failIf(self.find_binding("a", "[foo, [b, c]] = (a, b, c)")) def test_invalid_assignments(self): self.failIf(self.find_binding("a", "foo.a = 5")) @@ -157,6 +157,12 @@ self.failIf(self.find_binding("a", "def d(a): pass")) self.failIf(self.find_binding("a", "def d(): a = 7")) + s = """ + def d(): + def a(): + pass""" + self.failIf(self.find_binding("a", s)) + def test_class_def(self): self.failUnless(self.find_binding("a", "class a: pass")) self.failUnless(self.find_binding("a", "class a(): pass")) @@ -169,6 +175,12 @@ self.failIf(self.find_binding("a", "class d(b, **a): pass")) self.failIf(self.find_binding("a", "class d: a = 7")) + s = """ + class d(): + class a(): + pass""" + self.failIf(self.find_binding("a", s)) + def test_for(self): self.failUnless(self.find_binding("a", "for a in r: pass")) self.failUnless(self.find_binding("a", "for a, b in r: pass")) @@ -176,14 +188,266 @@ self.failUnless(self.find_binding("a", "for c, (a,) in r: pass")) self.failUnless(self.find_binding("a", "for c, (a, b) in r: pass")) self.failUnless(self.find_binding("a", "for c in r: a = c")) + self.failIf(self.find_binding("a", "for c in a: pass")) + + def test_for_nested(self): + s = """ + for b in r: + for a in b: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for a, c in b: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for (a, c) in b: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for (a,) in b: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for c, (a, d) in b: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for c in b: + a = 7""" + self.failUnless(self.find_binding("a", s)) + + s = """ + for b in r: + for c in b: + d = a""" + self.failIf(self.find_binding("a", s)) + + s = """ + for b in r: + for c in a: + d = 7""" + self.failIf(self.find_binding("a", s)) def test_if(self): self.failUnless(self.find_binding("a", "if b in r: a = c")) self.failIf(self.find_binding("a", "if a in r: d = e")) + + def test_if_nested(self): + s = """ + if b in r: + if c in d: + a = c""" + self.failUnless(self.find_binding("a", s)) + + s = """ + if b in r: + if c in d: + c = a""" + self.failIf(self.find_binding("a", s)) def test_while(self): self.failUnless(self.find_binding("a", "while b in r: a = c")) self.failIf(self.find_binding("a", "while a in r: d = e")) + + def test_while_nested(self): + s = """ + while b in r: + while c in d: + a = c""" + self.failUnless(self.find_binding("a", s)) + + s = """ + while b in r: + while c in d: + c = a""" + self.failIf(self.find_binding("a", s)) + + def test_try_except(self): + s = """ + try: + a = 6 + except: + b = 8""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except KeyError: + pass + except: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + b = 6""" + self.failIf(self.find_binding("a", s)) + + def test_try_except_nested(self): + s = """ + try: + try: + a = 6 + except: + pass + except: + b = 8""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + try: + a = 6 + except: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + try: + pass + except: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + try: + b = 8 + except KeyError: + pass + except: + a = 6 + except: + pass""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + pass + except: + try: + b = 8 + except KeyError: + pass + except: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + b = 6""" + self.failIf(self.find_binding("a", s)) + + s = """ + try: + try: + b = 8 + except: + c = d + except: + try: + b = 6 + except: + t = 8 + except: + o = y""" + self.failIf(self.find_binding("a", s)) + + def test_try_except_finally(self): + s = """ + try: + c = 6 + except: + b = 8 + finally: + a = 9""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + finally: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + finally: + b = 6""" + self.failIf(self.find_binding("a", s)) + + s = """ + try: + b = 8 + except: + b = 9 + finally: + b = 6""" + self.failIf(self.find_binding("a", s)) + + def test_try_except_finally_nested(self): + s = """ + try: + c = 6 + except: + b = 8 + finally: + try: + a = 9 + except: + b = 9 + finally: + c = 9""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + finally: + try: + pass + finally: + a = 6""" + self.failUnless(self.find_binding("a", s)) + + s = """ + try: + b = 8 + finally: + try: + b = 6 + finally: + b = 7""" + self.failIf(self.find_binding("a", s)) if __name__ == "__main__": From python-checkins at python.org Sun Apr 1 23:29:18 2007 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Apr 2007 23:29:18 +0200 (CEST) Subject: [Python-checkins] r54649 - in python/trunk/Doc: lib/libbsddb.tex lib/libcgitb.tex lib/libcodecs.tex lib/libcollections.tex lib/libconsts.tex lib/libcursespanel.tex lib/libdl.tex lib/libdoctest.tex lib/libdumbdbm.tex lib/libetree.tex lib/libhmac.tex lib/liblogging.tex lib/libmmap.tex lib/libpoplib.tex lib/libselect.tex lib/libsocket.tex lib/libsqlite3.tex lib/libwebbrowser.tex lib/libwinreg.tex lib/libzlib.tex mac/libframework.tex Message-ID: <20070401212918.8091F1E4007@bag.python.org> Author: georg.brandl Date: Sun Apr 1 23:29:15 2007 New Revision: 54649 Modified: python/trunk/Doc/lib/libbsddb.tex python/trunk/Doc/lib/libcgitb.tex python/trunk/Doc/lib/libcodecs.tex python/trunk/Doc/lib/libcollections.tex python/trunk/Doc/lib/libconsts.tex python/trunk/Doc/lib/libcursespanel.tex python/trunk/Doc/lib/libdl.tex python/trunk/Doc/lib/libdoctest.tex python/trunk/Doc/lib/libdumbdbm.tex python/trunk/Doc/lib/libetree.tex python/trunk/Doc/lib/libhmac.tex python/trunk/Doc/lib/liblogging.tex python/trunk/Doc/lib/libmmap.tex python/trunk/Doc/lib/libpoplib.tex python/trunk/Doc/lib/libselect.tex python/trunk/Doc/lib/libsocket.tex python/trunk/Doc/lib/libsqlite3.tex python/trunk/Doc/lib/libwebbrowser.tex python/trunk/Doc/lib/libwinreg.tex python/trunk/Doc/lib/libzlib.tex python/trunk/Doc/mac/libframework.tex Log: Fix a lot of markup and meta-information glitches. Modified: python/trunk/Doc/lib/libbsddb.tex ============================================================================== --- python/trunk/Doc/lib/libbsddb.tex (original) +++ python/trunk/Doc/lib/libbsddb.tex Sun Apr 1 23:29:15 2007 @@ -113,23 +113,23 @@ the methods listed below. \versionchanged[Added dictionary methods]{2.3.1} -\begin{methoddesc}{close}{} +\begin{methoddesc}[bsddbobject]{close}{} Close the underlying file. The object can no longer be accessed. Since there is no open \method{open} method for these objects, to open the file again a new \module{bsddb} module open function must be called. \end{methoddesc} -\begin{methoddesc}{keys}{} +\begin{methoddesc}[bsddbobject]{keys}{} Return the list of keys contained in the DB file. The order of the list is unspecified and should not be relied on. In particular, the order of the list returned is different for different file formats. \end{methoddesc} -\begin{methoddesc}{has_key}{key} +\begin{methoddesc}[bsddbobject]{has_key}{key} Return \code{1} if the DB file contains the argument as a key. \end{methoddesc} -\begin{methoddesc}{set_location}{key} +\begin{methoddesc}[bsddbobject]{set_location}{key} Set the cursor to the item indicated by \var{key} and return a tuple containing the key and its value. For binary tree databases (opened using \function{btopen()}), if \var{key} does not actually exist in @@ -139,32 +139,32 @@ database. \end{methoddesc} -\begin{methoddesc}{first}{} +\begin{methoddesc}[bsddbobject]{first}{} Set the cursor to the first item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This method raises \exception{bsddb.error} if the database is empty. \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[bsddbobject]{next}{} Set the cursor to the next item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. \end{methoddesc} -\begin{methoddesc}{previous}{} +\begin{methoddesc}[bsddbobject]{previous}{} Set the cursor to the previous item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened with \function{hashopen()}). \end{methoddesc} -\begin{methoddesc}{last}{} +\begin{methoddesc}[bsddbobject]{last}{} Set the cursor to the last item in the DB file and return it. The order of keys in the file is unspecified. This is not supported on hashtable databases (those opened with \function{hashopen()}). This method raises \exception{bsddb.error} if the database is empty. \end{methoddesc} -\begin{methoddesc}{sync}{} +\begin{methoddesc}[bsddbobject]{sync}{} Synchronize the database on disk. \end{methoddesc} Modified: python/trunk/Doc/lib/libcgitb.tex ============================================================================== --- python/trunk/Doc/lib/libcgitb.tex (original) +++ python/trunk/Doc/lib/libcgitb.tex Sun Apr 1 23:29:15 2007 @@ -38,7 +38,7 @@ context\optional{, format}}}}} This function causes the \module{cgitb} module to take over the interpreter's default handling for exceptions by setting the - value of \code{\refmodule{sys}.excepthook}. + value of \member{\refmodule{sys}.excepthook}. \withsubitem{(in module sys)}{\ttindex{excepthook()}} The optional argument \var{display} defaults to \code{1} and can be set @@ -61,7 +61,7 @@ report it using \module{cgitb}. The optional \var{info} argument should be a 3-tuple containing an exception type, exception value, and traceback object, exactly like the tuple returned by - \code{\refmodule{sys}.exc_info()}. If the \var{info} argument + \function{\refmodule{sys}.exc_info()}. If the \var{info} argument is not supplied, the current exception is obtained from - \code{\refmodule{sys}.exc_info()}. + \function{\refmodule{sys}.exc_info()}. \end{funcdesc} Modified: python/trunk/Doc/lib/libcodecs.tex ============================================================================== --- python/trunk/Doc/lib/libcodecs.tex (original) +++ python/trunk/Doc/lib/libcodecs.tex Sun Apr 1 23:29:15 2007 @@ -307,7 +307,7 @@ The \class{Codec} class defines these methods which also define the function interfaces of the stateless encoder and decoder: -\begin{methoddesc}{encode}{input\optional{, errors}} +\begin{methoddesc}[Codec]{encode}{input\optional{, errors}} Encodes the object \var{input} and returns a tuple (output object, length consumed). While codecs are not restricted to use with Unicode, in a Unicode context, encoding converts a Unicode object to a plain string @@ -325,7 +325,7 @@ empty object of the output object type in this situation. \end{methoddesc} -\begin{methoddesc}{decode}{input\optional{, errors}} +\begin{methoddesc}[Codec]{decode}{input\optional{, errors}} Decodes the object \var{input} and returns a tuple (output object, length consumed). In a Unicode context, decoding converts a plain string encoded using a particular character set encoding to a Unicode object. @@ -1197,9 +1197,8 @@ \lineiv{idna} {} {Unicode string} - {Implements \rfc{3490}. - \versionadded{2.3} - See also \refmodule{encodings.idna}} + {Implements \rfc{3490}, + see also \refmodule{encodings.idna}} \lineiv{mbcs} {dbcs} @@ -1214,8 +1213,7 @@ \lineiv{punycode} {} {Unicode string} - {Implements \rfc{3492}. - \versionadded{2.3}} + {Implements \rfc{3492}} \lineiv{quopri_codec} {quopri, quoted-printable, quotedprintable} @@ -1269,6 +1267,8 @@ \end{tableiv} +\versionadded[The \code{idna} and \code{punycode} encodings]{2.3} + \subsection{\module{encodings.idna} --- Internationalized Domain Names in Applications} Modified: python/trunk/Doc/lib/libcollections.tex ============================================================================== --- python/trunk/Doc/lib/libcollections.tex (original) +++ python/trunk/Doc/lib/libcollections.tex Sun Apr 1 23:29:15 2007 @@ -17,7 +17,7 @@ \subsection{\class{deque} objects \label{deque-objects}} -\begin{funcdesc}{deque}{\optional{iterable}} +\begin{classdesc}{deque}{\optional{iterable}} Returns a new deque object initialized left-to-right (using \method{append()}) with data from \var{iterable}. If \var{iterable} is not specified, the new deque is empty. @@ -32,7 +32,7 @@ for \samp{pop(0)} and \samp{insert(0, v)} operations which change both the size and position of the underlying data representation. \versionadded{2.4} -\end{funcdesc} +\end{classdesc} Deque objects support the following methods: Modified: python/trunk/Doc/lib/libconsts.tex ============================================================================== --- python/trunk/Doc/lib/libconsts.tex (original) +++ python/trunk/Doc/lib/libconsts.tex Sun Apr 1 23:29:15 2007 @@ -13,7 +13,7 @@ \end{datadesc} \begin{datadesc}{None} - The sole value of \code{\refmodule{types}.NoneType}. \code{None} is + The sole value of \member{\refmodule{types}.NoneType}. \code{None} is frequently used to represent the absence of a value, as when default arguments are not passed to a function. \end{datadesc} Modified: python/trunk/Doc/lib/libcursespanel.tex ============================================================================== --- python/trunk/Doc/lib/libcursespanel.tex (original) +++ python/trunk/Doc/lib/libcursespanel.tex Sun Apr 1 23:29:15 2007 @@ -45,52 +45,52 @@ Panel objects have the following methods: -\begin{methoddesc}{above}{} +\begin{methoddesc}[Panel]{above}{} Returns the panel above the current panel. \end{methoddesc} -\begin{methoddesc}{below}{} +\begin{methoddesc}[Panel]{below}{} Returns the panel below the current panel. \end{methoddesc} -\begin{methoddesc}{bottom}{} +\begin{methoddesc}[Panel]{bottom}{} Push the panel to the bottom of the stack. \end{methoddesc} -\begin{methoddesc}{hidden}{} +\begin{methoddesc}[Panel]{hidden}{} Returns true if the panel is hidden (not visible), false otherwise. \end{methoddesc} -\begin{methoddesc}{hide}{} +\begin{methoddesc}[Panel]{hide}{} Hide the panel. This does not delete the object, it just makes the window on screen invisible. \end{methoddesc} -\begin{methoddesc}{move}{y, x} +\begin{methoddesc}[Panel]{move}{y, x} Move the panel to the screen coordinates \code{(\var{y}, \var{x})}. \end{methoddesc} -\begin{methoddesc}{replace}{win} +\begin{methoddesc}[Panel]{replace}{win} Change the window associated with the panel to the window \var{win}. \end{methoddesc} -\begin{methoddesc}{set_userptr}{obj} +\begin{methoddesc}[Panel]{set_userptr}{obj} Set the panel's user pointer to \var{obj}. This is used to associate an arbitrary piece of data with the panel, and can be any Python object. \end{methoddesc} -\begin{methoddesc}{show}{} +\begin{methoddesc}[Panel]{show}{} Display the panel (which might have been hidden). \end{methoddesc} -\begin{methoddesc}{top}{} +\begin{methoddesc}[Panel]{top}{} Push panel to the top of the stack. \end{methoddesc} -\begin{methoddesc}{userptr}{} +\begin{methoddesc}[Panel]{userptr}{} Returns the user pointer for the panel. This might be any Python object. \end{methoddesc} -\begin{methoddesc}{window}{} +\begin{methoddesc}[Panel]{window}{} Returns the window object associated with the panel. \end{methoddesc} Modified: python/trunk/Doc/lib/libdl.tex ============================================================================== --- python/trunk/Doc/lib/libdl.tex (original) +++ python/trunk/Doc/lib/libdl.tex Sun Apr 1 23:29:15 2007 @@ -67,11 +67,11 @@ Dl objects, as returned by \function{open()} above, have the following methods: -\begin{methoddesc}{close}{} +\begin{methoddesc}[dl]{close}{} Free all resources, except the memory. \end{methoddesc} -\begin{methoddesc}{sym}{name} +\begin{methoddesc}[dl]{sym}{name} Return the pointer for the function named \var{name}, as a number, if it exists in the referenced shared object, otherwise \code{None}. This is useful in code like: @@ -87,7 +87,7 @@ \NULL{} pointer) \end{methoddesc} -\begin{methoddesc}{call}{name\optional{, arg1\optional{, arg2\ldots}}} +\begin{methoddesc}[dl]{call}{name\optional{, arg1\optional{, arg2\ldots}}} Call the function named \var{name} in the referenced shared object. The arguments must be either Python integers, which will be passed as is, Python strings, to which a pointer will be passed, Modified: python/trunk/Doc/lib/libdoctest.tex ============================================================================== --- python/trunk/Doc/lib/libdoctest.tex (original) +++ python/trunk/Doc/lib/libdoctest.tex Sun Apr 1 23:29:15 2007 @@ -1741,7 +1741,7 @@ >>> \end{verbatim} - \versionchanged[The ability to use \code{\refmodule{pdb}.set_trace()} + \versionchanged[The ability to use \function{\refmodule{pdb}.set_trace()} usefully inside doctests was added]{2.4} \end{itemize} @@ -1825,10 +1825,10 @@ used. If \var{pm} has a true value, the script file is run directly, and the debugger gets involved only if the script terminates via raising an unhandled exception. If it does, then post-mortem debugging is invoked, - via \code{\refmodule{pdb}.post_mortem()}, passing the traceback object + via \function{\refmodule{pdb}.post_mortem()}, passing the traceback object from the unhandled exception. If \var{pm} is not specified, or is false, the script is run under the debugger from the start, via passing an - appropriate \function{execfile()} call to \code{\refmodule{pdb}.run()}. + appropriate \function{execfile()} call to \function{\refmodule{pdb}.run()}. \versionadded{2.3} Modified: python/trunk/Doc/lib/libdumbdbm.tex ============================================================================== --- python/trunk/Doc/lib/libdumbdbm.tex (original) +++ python/trunk/Doc/lib/libdumbdbm.tex Sun Apr 1 23:29:15 2007 @@ -57,7 +57,7 @@ In addition to the methods provided by the \class{UserDict.DictMixin} class, \class{dumbdbm} objects provide the following methods. -\begin{methoddesc}{sync}{} +\begin{methoddesc}[dumbdbm]{sync}{} Synchronize the on-disk directory and data files. This method is called by the \method{sync} method of \class{Shelve} objects. \end{methoddesc} Modified: python/trunk/Doc/lib/libetree.tex ============================================================================== --- python/trunk/Doc/lib/libetree.tex (original) +++ python/trunk/Doc/lib/libetree.tex Sun Apr 1 23:29:15 2007 @@ -144,12 +144,12 @@ Element objects returned by Element or SubElement have the following methods and attributes. -\begin{memberdesc}{tag} +\begin{memberdesc}[Element]{tag} A string identifying what kind of data this element represents (the element type, in other words). \end{memberdesc} -\begin{memberdesc}{text} +\begin{memberdesc}[Element]{text} The \var{text} attribute can be used to hold additional data associated with the element. As the name implies this attribute is usually a string but may be any @@ -158,7 +158,7 @@ any text found between the element tags. \end{memberdesc} -\begin{memberdesc}{tail} +\begin{memberdesc}[Element]{tail} The \var{tail} attribute can be used to hold additional data associated with the element. This attribute is usually a string but may be any application-specific object. @@ -166,7 +166,7 @@ any text found after the element's end tag and before the next tag. \end{memberdesc} -\begin{memberdesc}{attrib} +\begin{memberdesc}[Element]{attrib} A dictionary containing the element's attributes. Note that while the \var{attrib} value is always a real mutable Python dictionary, an ElementTree implementation may choose to use another @@ -177,52 +177,52 @@ The following dictionary-like methods work on the element attributes. -\begin{methoddesc}{clear}{} +\begin{methoddesc}[Element]{clear}{} Resets an element. This function removes all subelements, clears all attributes, and sets the text and tail attributes to None. \end{methoddesc} -\begin{methoddesc}{get}{key\optional{, default=None}} +\begin{methoddesc}[Element]{get}{key\optional{, default=None}} Gets the element attribute named \var{key}. Returns the attribute value, or \var{default} if the attribute was not found. \end{methoddesc} -\begin{methoddesc}{items}{} +\begin{methoddesc}[Element]{items}{} Returns the element attributes as a sequence of (name, value) pairs. The attributes are returned in an arbitrary order. \end{methoddesc} -\begin{methoddesc}{keys}{} +\begin{methoddesc}[Element]{keys}{} Returns the elements attribute names as a list. The names are returned in an arbitrary order. \end{methoddesc} -\begin{methoddesc}{set}{key, value} +\begin{methoddesc}[Element]{set}{key, value} Set the attribute \var{key} on the element to \var{value}. \end{methoddesc} The following methods work on the element's children (subelements). -\begin{methoddesc}{append}{subelement} +\begin{methoddesc}[Element]{append}{subelement} Adds the element \var{subelement} to the end of this elements internal list of subelements. \end{methoddesc} -\begin{methoddesc}{find}{match} +\begin{methoddesc}[Element]{find}{match} Finds the first subelement matching \var{match}. \var{match} may be a tag name or path. Returns an element instance or \code{None}. \end{methoddesc} -\begin{methoddesc}{findall}{match} +\begin{methoddesc}[Element]{findall}{match} Finds all subelements matching \var{match}. \var{match} may be a tag name or path. Returns an iterable yielding all matching elements in document order. \end{methoddesc} -\begin{methoddesc}{findtext}{condition\optional{, default=None}} +\begin{methoddesc}[Element]{findtext}{condition\optional{, default=None}} Finds text for the first subelement matching \var{condition}. \var{condition} may be a tag name or path. Returns the text content of the first matching element, or @@ -230,11 +230,11 @@ matching element has no text content an empty string is returned. \end{methoddesc} -\begin{methoddesc}{getchildren}{} +\begin{methoddesc}[Element]{getchildren}{} Returns all subelements. The elements are returned in document order. \end{methoddesc} -\begin{methoddesc}{getiterator}{\optional{tag=None}} +\begin{methoddesc}[Element]{getiterator}{\optional{tag=None}} Creates a tree iterator with the current element as the root. The iterator iterates over this element and all elements below it that match the given tag. If tag @@ -243,16 +243,16 @@ order. \end{methoddesc} -\begin{methoddesc}{insert}{index, element} +\begin{methoddesc}[Element]{insert}{index, element} Inserts a subelement at the given position in this element. \end{methoddesc} -\begin{methoddesc}{makeelement}{tag, attrib} +\begin{methoddesc}[Element]{makeelement}{tag, attrib} Creates a new element object of the same type as this element. Do not call this method, use the SubElement factory function instead. \end{methoddesc} -\begin{methoddesc}{remove}{subelement} +\begin{methoddesc}[Element]{remove}{subelement} Removes \var{subelement} from the element. Unlike the findXXX methods this method compares elements based on the instance identity, not on tag value or contents. Modified: python/trunk/Doc/lib/libhmac.tex ============================================================================== --- python/trunk/Doc/lib/libhmac.tex (original) +++ python/trunk/Doc/lib/libhmac.tex Sun Apr 1 23:29:15 2007 @@ -15,7 +15,7 @@ Return a new hmac object. If \var{msg} is present, the method call \code{update(\var{msg})} is made. \var{digestmod} is the digest constructor or module for the HMAC object to use. It defaults to - the \code{\refmodule{hashlib}.md5} constructor. \note{The md5 hash + the \function{\refmodule{hashlib}.md5} constructor. \note{The md5 hash has known weaknesses but remains the default for backwards compatibility. Choose a better one for your application.} \end{funcdesc} Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Sun Apr 1 23:29:15 2007 @@ -364,13 +364,13 @@ never instantiated directly, but always through the module-level function \function{logging.getLogger(name)}. -\begin{datadesc}{propagate} +\begin{memberdesc}[Logger]{propagate} If this evaluates to false, logging messages are not passed by this logger or by child loggers to higher level (ancestor) loggers. The constructor sets this attribute to 1. -\end{datadesc} +\end{memberdesc} -\begin{methoddesc}{setLevel}{lvl} +\begin{methoddesc}[Logger]{setLevel}{lvl} Sets the threshold for this logger to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a logger is created, the level is set to \constant{NOTSET} (which causes all messages @@ -393,21 +393,21 @@ as the effective level. \end{methoddesc} -\begin{methoddesc}{isEnabledFor}{lvl} +\begin{methoddesc}[Logger]{isEnabledFor}{lvl} Indicates if a message of severity \var{lvl} would be processed by this logger. This method checks first the module-level level set by \function{logging.disable(lvl)} and then the logger's effective level as determined by \method{getEffectiveLevel()}. \end{methoddesc} -\begin{methoddesc}{getEffectiveLevel}{} +\begin{methoddesc}[Logger]{getEffectiveLevel}{} Indicates the effective level for this logger. If a value other than \constant{NOTSET} has been set using \method{setLevel()}, it is returned. Otherwise, the hierarchy is traversed towards the root until a value other than \constant{NOTSET} is found, and that value is returned. \end{methoddesc} -\begin{methoddesc}{debug}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{debug}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{DEBUG} on this logger. The \var{msg} is the message format string, and the \var{args} are the arguments which are merged into \var{msg} using the string formatting @@ -462,67 +462,67 @@ \end{methoddesc} -\begin{methoddesc}{info}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{info}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{INFO} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{warning}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{warning}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{WARNING} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{error}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{error}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{ERROR} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{critical}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{critical}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{CRITICAL} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{log}{lvl, msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{log}{lvl, msg\optional{, *args\optional{, **kwargs}}} Logs a message with integer level \var{lvl} on this logger. The other arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{exception}{msg\optional{, *args}} +\begin{methoddesc}[Logger]{exception}{msg\optional{, *args}} Logs a message with level \constant{ERROR} on this logger. The arguments are interpreted as for \method{debug()}. Exception info is added to the logging message. This method should only be called from an exception handler. \end{methoddesc} -\begin{methoddesc}{addFilter}{filt} +\begin{methoddesc}[Logger]{addFilter}{filt} Adds the specified filter \var{filt} to this logger. \end{methoddesc} -\begin{methoddesc}{removeFilter}{filt} +\begin{methoddesc}[Logger]{removeFilter}{filt} Removes the specified filter \var{filt} from this logger. \end{methoddesc} -\begin{methoddesc}{filter}{record} +\begin{methoddesc}[Logger]{filter}{record} Applies this logger's filters to the record and returns a true value if the record is to be processed. \end{methoddesc} -\begin{methoddesc}{addHandler}{hdlr} +\begin{methoddesc}[Logger]{addHandler}{hdlr} Adds the specified handler \var{hdlr} to this logger. \end{methoddesc} -\begin{methoddesc}{removeHandler}{hdlr} +\begin{methoddesc}[Logger]{removeHandler}{hdlr} Removes the specified handler \var{hdlr} from this logger. \end{methoddesc} -\begin{methoddesc}{findCaller}{} +\begin{methoddesc}[Logger]{findCaller}{} Finds the caller's source filename and line number. Returns the filename, line number and function name as a 3-element tuple. \versionchanged[The function name was added. In earlier versions, the filename and line number were returned as a 2-element tuple.]{2.5} \end{methoddesc} -\begin{methoddesc}{handle}{record} +\begin{methoddesc}[Logger]{handle}{record} Handles a record by passing it to all handlers associated with this logger and its ancestors (until a false value of \var{propagate} is found). This method is used for unpickled records received from a socket, as well @@ -530,8 +530,8 @@ \method{filter()}. \end{methoddesc} -\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info - \optional{, func, extra}} +\begin{methoddesc}[Logger]{makeRecord}{name, lvl, fn, lno, msg, args, exc_info + \optional{, func, extra}} This is a factory method which can be overridden in subclasses to create specialized \class{LogRecord} instances. \versionchanged[\var{func} and \var{extra} were added]{2.5} @@ -875,66 +875,66 @@ base for more useful subclasses. However, the \method{__init__()} method in subclasses needs to call \method{Handler.__init__()}. -\begin{methoddesc}{__init__}{level=\constant{NOTSET}} +\begin{methoddesc}[Handler]{__init__}{level=\constant{NOTSET}} Initializes the \class{Handler} instance by setting its level, setting the list of filters to the empty list and creating a lock (using \method{createLock()}) for serializing access to an I/O mechanism. \end{methoddesc} -\begin{methoddesc}{createLock}{} +\begin{methoddesc}[Handler]{createLock}{} Initializes a thread lock which can be used to serialize access to underlying I/O functionality which may not be threadsafe. \end{methoddesc} -\begin{methoddesc}{acquire}{} +\begin{methoddesc}[Handler]{acquire}{} Acquires the thread lock created with \method{createLock()}. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[Handler]{release}{} Releases the thread lock acquired with \method{acquire()}. \end{methoddesc} -\begin{methoddesc}{setLevel}{lvl} +\begin{methoddesc}[Handler]{setLevel}{lvl} Sets the threshold for this handler to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a handler is created, the level is set to \constant{NOTSET} (which causes all messages to be processed). \end{methoddesc} -\begin{methoddesc}{setFormatter}{form} +\begin{methoddesc}[Handler]{setFormatter}{form} Sets the \class{Formatter} for this handler to \var{form}. \end{methoddesc} -\begin{methoddesc}{addFilter}{filt} +\begin{methoddesc}[Handler]{addFilter}{filt} Adds the specified filter \var{filt} to this handler. \end{methoddesc} -\begin{methoddesc}{removeFilter}{filt} +\begin{methoddesc}[Handler]{removeFilter}{filt} Removes the specified filter \var{filt} from this handler. \end{methoddesc} -\begin{methoddesc}{filter}{record} +\begin{methoddesc}[Handler]{filter}{record} Applies this handler's filters to the record and returns a true value if the record is to be processed. \end{methoddesc} -\begin{methoddesc}{flush}{} +\begin{methoddesc}[Handler]{flush}{} Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Handler]{close}{} Tidy up any resources used by the handler. This version does nothing and is intended to be implemented by subclasses. \end{methoddesc} -\begin{methoddesc}{handle}{record} +\begin{methoddesc}[Handler]{handle}{record} Conditionally emits the specified logging record, depending on filters which may have been added to the handler. Wraps the actual emission of the record with acquisition/release of the I/O thread lock. \end{methoddesc} -\begin{methoddesc}{handleError}{record} +\begin{methoddesc}[Handler]{handleError}{record} This method should be called from handlers when an exception is encountered during an \method{emit()} call. By default it does nothing, which means that exceptions get silently ignored. This is what is @@ -945,12 +945,12 @@ processed when the exception occurred. \end{methoddesc} -\begin{methoddesc}{format}{record} +\begin{methoddesc}[Handler]{format}{record} Do formatting for a record - if a formatter is set, use it. Otherwise, use the default formatter for the module. \end{methoddesc} -\begin{methoddesc}{emit}{record} +\begin{methoddesc}[Handler]{emit}{record} Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a \exception{NotImplementedError}. Modified: python/trunk/Doc/lib/libmmap.tex ============================================================================== --- python/trunk/Doc/lib/libmmap.tex (original) +++ python/trunk/Doc/lib/libmmap.tex Sun Apr 1 23:29:15 2007 @@ -89,18 +89,18 @@ Memory-mapped file objects support the following methods: -\begin{methoddesc}{close}{} +\begin{methoddesc}[mmap]{close}{} Close the file. Subsequent calls to other methods of the object will result in an exception being raised. \end{methoddesc} -\begin{methoddesc}{find}{string\optional{, start}} +\begin{methoddesc}[mmap]{find}{string\optional{, start}} Returns the lowest index in the object where the substring \var{string} is found. Returns \code{-1} on failure. \var{start} is the index at which the search begins, and defaults to zero. \end{methoddesc} -\begin{methoddesc}{flush}{\optional{offset, size}} +\begin{methoddesc}[mmap]{flush}{\optional{offset, size}} Flushes changes made to the in-memory copy of a file back to disk. Without use of this call there is no guarantee that changes are written back before the object is destroyed. If \var{offset} and @@ -109,36 +109,36 @@ is flushed. \end{methoddesc} -\begin{methoddesc}{move}{\var{dest}, \var{src}, \var{count}} +\begin{methoddesc}[mmap]{move}{\var{dest}, \var{src}, \var{count}} Copy the \var{count} bytes starting at offset \var{src} to the destination index \var{dest}. If the mmap was created with \constant{ACCESS_READ}, then calls to move will throw a \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{read}{\var{num}} +\begin{methoddesc}[mmap]{read}{\var{num}} Return a string containing up to \var{num} bytes starting from the current file position; the file position is updated to point after the bytes that were returned. \end{methoddesc} -\begin{methoddesc}{read_byte}{} +\begin{methoddesc}[mmap]{read_byte}{} Returns a string of length 1 containing the character at the current file position, and advances the file position by 1. \end{methoddesc} -\begin{methoddesc}{readline}{} +\begin{methoddesc}[mmap]{readline}{} Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} -\begin{methoddesc}{resize}{\var{newsize}} +\begin{methoddesc}[mmap]{resize}{\var{newsize}} Resizes the map and the underlying file, if any. If the mmap was created with \constant{ACCESS_READ} or \constant{ACCESS_COPY}, resizing the map will throw a \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{seek}{pos\optional{, whence}} +\begin{methoddesc}[mmap]{seek}{pos\optional{, whence}} Set the file's current position. \var{whence} argument is optional and defaults to \code{os.SEEK_SET} or \code{0} (absolute file positioning); other values are \code{os.SEEK_CUR} or \code{1} (seek @@ -146,16 +146,16 @@ (seek relative to the file's end). \end{methoddesc} -\begin{methoddesc}{size}{} +\begin{methoddesc}[mmap]{size}{} Return the length of the file, which can be larger than the size of the memory-mapped area. \end{methoddesc} -\begin{methoddesc}{tell}{} +\begin{methoddesc}[mmap]{tell}{} Returns the current position of the file pointer. \end{methoddesc} -\begin{methoddesc}{write}{\var{string}} +\begin{methoddesc}[mmap]{write}{\var{string}} Write the bytes in \var{string} into memory at the current position of the file pointer; the file position is updated to point after the bytes that were written. If the mmap was created with @@ -163,7 +163,7 @@ \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{write_byte}{\var{byte}} +\begin{methoddesc}[mmap]{write_byte}{\var{byte}} Write the single-character string \var{byte} into memory at the current position of the file pointer; the file position is advanced by \code{1}. If the mmap was created with \constant{ACCESS_READ}, Modified: python/trunk/Doc/lib/libpoplib.tex ============================================================================== --- python/trunk/Doc/lib/libpoplib.tex (original) +++ python/trunk/Doc/lib/libpoplib.tex Sun Apr 1 23:29:15 2007 @@ -23,7 +23,7 @@ Note that POP3, though widely supported, is obsolescent. The implementation quality of POP3 servers varies widely, and too many are quite poor. If your mailserver supports IMAP, you would be better off -using the \code{\refmodule{imaplib}.\class{IMAP4}} class, as IMAP +using the \class{\refmodule{imaplib}.IMAP4} class, as IMAP servers tend to be better implemented. A single class is provided by the \module{poplib} module: Modified: python/trunk/Doc/lib/libselect.tex ============================================================================== --- python/trunk/Doc/lib/libselect.tex (original) +++ python/trunk/Doc/lib/libselect.tex Sun Apr 1 23:29:15 2007 @@ -77,7 +77,7 @@ \cfunction{select()} is O(highest file descriptor), while \cfunction{poll()} is O(number of file descriptors). -\begin{methoddesc}{register}{fd\optional{, eventmask}} +\begin{methoddesc}[poll]{register}{fd\optional{, eventmask}} Register a file descriptor with the polling object. Future calls to the \method{poll()} method will then check whether the file descriptor has any pending I/O events. \var{fd} can be either an integer, or an @@ -105,7 +105,7 @@ once. \end{methoddesc} -\begin{methoddesc}{unregister}{fd} +\begin{methoddesc}[poll]{unregister}{fd} Remove a file descriptor being tracked by a polling object. Just like the \method{register()} method, \var{fd} can be an integer or an object with a \method{fileno()} method that returns an integer. @@ -114,7 +114,7 @@ causes a \exception{KeyError} exception to be raised. \end{methoddesc} -\begin{methoddesc}{poll}{\optional{timeout}} +\begin{methoddesc}[poll]{poll}{\optional{timeout}} Polls the set of registered file descriptors, and returns a possibly-empty list containing \code{(\var{fd}, \var{event})} 2-tuples for the descriptors that have events or errors to report. Modified: python/trunk/Doc/lib/libsocket.tex ============================================================================== --- python/trunk/Doc/lib/libsocket.tex (original) +++ python/trunk/Doc/lib/libsocket.tex Sun Apr 1 23:29:15 2007 @@ -14,7 +14,7 @@ papers: \citetitle{An Introductory 4.3BSD Interprocess Communication Tutorial}, by Stuart Sechrest and \citetitle{An Advanced 4.3BSD Interprocess Communication Tutorial}, by Samuel J. Leffler et al, -both in the \citetitle{\UNIX{} Programmer's Manual, Supplementary Documents 1} +both in the \citetitle{UNIX Programmer's Manual, Supplementary Documents 1} (sections PS1:7 and PS1:8). The platform-specific reference material for the various socket-related system calls are also a valuable source of information on the details of socket semantics. For \UNIX, refer @@ -733,23 +733,23 @@ SSL objects have the following methods. -\begin{methoddesc}{write}{s} +\begin{methoddesc}[SSL]{write}{s} Writes the string \var{s} to the on the object's SSL connection. The return value is the number of bytes written. \end{methoddesc} -\begin{methoddesc}{read}{\optional{n}} +\begin{methoddesc}[SSL]{read}{\optional{n}} If \var{n} is provided, read \var{n} bytes from the SSL connection, otherwise read until EOF. The return value is a string of the bytes read. \end{methoddesc} -\begin{methoddesc}{server}{} +\begin{methoddesc}[SSL]{server}{} Returns a string describing the server's certificate. Useful for debugging purposes; do not parse the content of this string because its format can't be parsed unambiguously. \end{methoddesc} -\begin{methoddesc}{issuer}{} +\begin{methoddesc}[SSL]{issuer}{} Returns a string describing the issuer of the server's certificate. Useful for debugging purposes; do not parse the content of this string because its format can't be parsed unambiguously. Modified: python/trunk/Doc/lib/libsqlite3.tex ============================================================================== --- python/trunk/Doc/lib/libsqlite3.tex (original) +++ python/trunk/Doc/lib/libsqlite3.tex Sun Apr 1 23:29:15 2007 @@ -210,37 +210,37 @@ A \class{Connection} instance has the following attributes and methods: \label{sqlite3-Connection-IsolationLevel} -\begin{memberdesc}{isolation_level} +\begin{memberdesc}[Connection]{isolation_level} Get or set the current isolation level. None for autocommit mode or one of "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See ``Controlling Transactions'', section~\ref{sqlite3-Controlling-Transactions}, for a more detailed explanation. \end{memberdesc} -\begin{methoddesc}{cursor}{\optional{cursorClass}} +\begin{methoddesc}[Connection]{cursor}{\optional{cursorClass}} The cursor method accepts a single optional parameter \var{cursorClass}. If supplied, this must be a custom cursor class that extends \class{sqlite3.Cursor}. \end{methoddesc} -\begin{methoddesc}{execute}{sql, \optional{parameters}} +\begin{methoddesc}[Connection]{execute}{sql, \optional{parameters}} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{execute} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{executemany}{sql, \optional{parameters}} +\begin{methoddesc}[Connection]{executemany}{sql, \optional{parameters}} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{executemany} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{executescript}{sql_script} +\begin{methoddesc}[Connection]{executescript}{sql_script} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{executescript} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{create_function}{name, num_params, func} +\begin{methoddesc}[Connection]{create_function}{name, num_params, func} Creates a user-defined function that you can later use from within SQL statements under the function name \var{name}. \var{num_params} is the number @@ -255,7 +255,7 @@ \verbatiminput{sqlite3/md5func.py} \end{methoddesc} -\begin{methoddesc}{create_aggregate}{name, num_params, aggregate_class} +\begin{methoddesc}[Connection]{create_aggregate}{name, num_params, aggregate_class} Creates a user-defined aggregate function. @@ -271,7 +271,7 @@ \verbatiminput{sqlite3/mysumaggr.py} \end{methoddesc} -\begin{methoddesc}{create_collation}{name, callable} +\begin{methoddesc}[Connection]{create_collation}{name, callable} Creates a collation with the specified \var{name} and \var{callable}. The callable will be passed two string arguments. It should return -1 if the first @@ -293,14 +293,14 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{interrupt}{} +\begin{methoddesc}[Connection]{interrupt}{} You can call this method from a different thread to abort any queries that might be executing on the connection. The query will then abort and the caller will get an exception. \end{methoddesc} -\begin{methoddesc}{set_authorizer}{authorizer_callback} +\begin{methoddesc}[Connection]{set_authorizer}{authorizer_callback} This routine registers a callback. The callback is invoked for each attempt to access a column of a table in the database. The callback should return @@ -322,7 +322,7 @@ module. \end{methoddesc} -\begin{memberdesc}{row_factory} +\begin{memberdesc}[Connection]{row_factory} You can change this attribute to a callable that accepts the cursor and the original row as a tuple and will return the real result row. This way, you can implement more advanced ways of returning results, such @@ -341,7 +341,7 @@ % XXX what's a db_row-based solution? \end{memberdesc} -\begin{memberdesc}{text_factory} +\begin{memberdesc}[Connection]{text_factory} Using this attribute you can control what objects are returned for the TEXT data type. By default, this attribute is set to \class{unicode} and the \module{sqlite3} module will return Unicode objects for TEXT. If you want to return @@ -359,7 +359,7 @@ \verbatiminput{sqlite3/text_factory.py} \end{memberdesc} -\begin{memberdesc}{total_changes} +\begin{memberdesc}[Connection]{total_changes} Returns the total number of database rows that have been modified, inserted, or deleted since the database connection was opened. \end{memberdesc} @@ -372,7 +372,7 @@ A \class{Cursor} instance has the following attributes and methods: -\begin{methoddesc}{execute}{sql, \optional{parameters}} +\begin{methoddesc}[Cursor]{execute}{sql, \optional{parameters}} Executes a SQL statement. The SQL statement may be parametrized (i. e. placeholders instead of SQL literals). The \module{sqlite3} module supports two kinds of @@ -394,7 +394,7 @@ \end{methoddesc} -\begin{methoddesc}{executemany}{sql, seq_of_parameters} +\begin{methoddesc}[Cursor]{executemany}{sql, seq_of_parameters} Executes a SQL command against all parameter sequences or mappings found in the sequence \var{sql}. The \module{sqlite3} module also allows using an iterator yielding parameters instead of a sequence. @@ -406,7 +406,7 @@ \verbatiminput{sqlite3/executemany_2.py} \end{methoddesc} -\begin{methoddesc}{executescript}{sql_script} +\begin{methoddesc}[Cursor]{executescript}{sql_script} This is a nonstandard convenience method for executing multiple SQL statements at once. It issues a COMMIT statement first, then executes the SQL script it @@ -419,7 +419,7 @@ \verbatiminput{sqlite3/executescript.py} \end{methoddesc} -\begin{memberdesc}{rowcount} +\begin{memberdesc}[Cursor]{rowcount} Although the \class{Cursor} class of the \module{sqlite3} module implements this attribute, the database engine's own support for the determination of "rows affected"/"rows selected" is quirky. Modified: python/trunk/Doc/lib/libwebbrowser.tex ============================================================================== --- python/trunk/Doc/lib/libwebbrowser.tex (original) +++ python/trunk/Doc/lib/libwebbrowser.tex Sun Apr 1 23:29:15 2007 @@ -154,19 +154,19 @@ Browser controllers provide two methods which parallel two of the module-level convenience functions: -\begin{methoddesc}{open}{url\optional{, new\optional{, autoraise=1}}} +\begin{methoddesc}[controller]{open}{url\optional{, new\optional{, autoraise=1}}} Display \var{url} using the browser handled by this controller. If \var{new} is 1, a new browser window is opened if possible. If \var{new} is 2, a new browser page ("tab") is opened if possible. \end{methoddesc} -\begin{methoddesc}{open_new}{url} +\begin{methoddesc}[controller]{open_new}{url} Open \var{url} in a new window of the browser handled by this controller, if possible, otherwise, open \var{url} in the only browser window. Alias \function{open_new}. \end{methoddesc} -\begin{methoddesc}{open_new_tab}{url} +\begin{methoddesc}[controller]{open_new_tab}{url} Open \var{url} in a new page ("tab") of the browser handled by this controller, if possible, otherwise equivalent to \function{open_new}. \versionadded{2.5} Modified: python/trunk/Doc/lib/libwinreg.tex ============================================================================== --- python/trunk/Doc/lib/libwinreg.tex (original) +++ python/trunk/Doc/lib/libwinreg.tex Sun Apr 1 23:29:15 2007 @@ -393,14 +393,14 @@ \method{Detach()} method to return the integer handle, and also disconnect the Windows handle from the handle object. -\begin{methoddesc}{Close}{} +\begin{methoddesc}[PyHKEY]{Close}{} Closes the underlying Windows handle. If the handle is already closed, no error is raised. \end{methoddesc} -\begin{methoddesc}{Detach}{} +\begin{methoddesc}[PyHKEY]{Detach}{} Detaches the Windows handle from the handle object. The result is an integer (or long on 64 bit Windows) that holds Modified: python/trunk/Doc/lib/libzlib.tex ============================================================================== --- python/trunk/Doc/lib/libzlib.tex (original) +++ python/trunk/Doc/lib/libzlib.tex Sun Apr 1 23:29:15 2007 @@ -131,7 +131,7 @@ Decompression objects support the following methods, and two attributes: -\begin{memberdesc}{unused_data} +\begin{memberdesc}[Decompress]{unused_data} A string which contains any bytes past the end of the compressed data. That is, this remains \code{""} until the last byte that contains compression data is available. If the whole string turned out to @@ -145,7 +145,7 @@ \member{unused_data} attribute is no longer the empty string. \end{memberdesc} -\begin{memberdesc}{unconsumed_tail} +\begin{memberdesc}[Decompress]{unconsumed_tail} A string that contains any data that was not consumed by the last \method{decompress} call because it exceeded the limit for the uncompressed data buffer. This data has not yet been seen by the zlib Modified: python/trunk/Doc/mac/libframework.tex ============================================================================== --- python/trunk/Doc/mac/libframework.tex (original) +++ python/trunk/Doc/mac/libframework.tex Sun Apr 1 23:29:15 2007 @@ -218,7 +218,7 @@ An update event for the window was received. Redraw the window. \end{methoddesc} -\begin{methoddesc}{do_activate}{activate, event} +\begin{methoddesc}[Window]{do_activate}{activate, event} The window was activated (\code{\var{activate} == 1}) or deactivated (\code{\var{activate} == 0}). Handle things like focus highlighting, etc. From python-checkins at python.org Sun Apr 1 23:39:53 2007 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Apr 2007 23:39:53 +0200 (CEST) Subject: [Python-checkins] r54650 - python/trunk/Doc/lib/libre.tex Message-ID: <20070401213953.0CED41E4007@bag.python.org> Author: georg.brandl Date: Sun Apr 1 23:39:52 2007 New Revision: 54650 Modified: python/trunk/Doc/lib/libre.tex Log: Another fix. Modified: python/trunk/Doc/lib/libre.tex ============================================================================== --- python/trunk/Doc/lib/libre.tex (original) +++ python/trunk/Doc/lib/libre.tex Sun Apr 1 23:39:52 2007 @@ -812,7 +812,7 @@ \end{methoddesc} \begin{methoddesc}[MatchObject]{start}{\optional{group}} -\methodline{end}{\optional{group}} +\methodline[MatchObject]{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole matched substring). From buildbot at python.org Sun Apr 1 23:43:46 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Apr 2007 21:43:46 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) trunk Message-ID: <20070401214346.806F41E4007@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1216 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_strptime ====================================================================== ERROR: test_TimeRE_recreation (test.test_strptime.CacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/test/test_strptime.py", line 518, in test_TimeRE_recreation locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) File "/home/buildbot/Buildbot/trunk.baxter-ubuntu/build/Lib/locale.py", line 476, in setlocale return _setlocale(category, locale) Error: unsupported locale setting sincerely, -The Buildbot From python-checkins at python.org Mon Apr 2 00:39:26 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Apr 2007 00:39:26 +0200 (CEST) Subject: [Python-checkins] r54651 - in python/trunk/Doc: lib/libcfgparser.tex lib/libcmd.tex lib/libcode.tex lib/libcollections.tex lib/libcookielib.tex lib/libdatetime.tex lib/libdocxmlrpc.tex lib/libftplib.tex lib/libfuncs.tex lib/libhotshot.tex lib/libhtmllib.tex lib/libhttplib.tex lib/libimaplib.tex lib/libmailbox.tex lib/libmimetools.tex lib/libmimetypes.tex lib/libmimewriter.tex lib/libmsilib.tex lib/libmultifile.tex lib/libmutex.tex lib/libnetrc.tex lib/libnntplib.tex lib/libpipes.tex lib/libpopen2.tex lib/libpoplib.tex lib/libpprint.tex lib/libqueue.tex lib/librepr.tex lib/librexec.tex lib/librfc822.tex lib/libsched.tex lib/libshlex.tex lib/libsimplexmlrpc.tex lib/libsmtplib.tex lib/libsubprocess.tex lib/libtelnetlib.tex lib/libthreading.tex lib/libturtle.tex lib/libunittest.tex lib/liburllib2.tex lib/libxmlrpclib.tex mac/libmacic.tex Message-ID: <20070401223926.6378A1E4007@bag.python.org> Author: georg.brandl Date: Mon Apr 2 00:39:10 2007 New Revision: 54651 Modified: python/trunk/Doc/lib/libcfgparser.tex python/trunk/Doc/lib/libcmd.tex python/trunk/Doc/lib/libcode.tex python/trunk/Doc/lib/libcollections.tex python/trunk/Doc/lib/libcookielib.tex python/trunk/Doc/lib/libdatetime.tex python/trunk/Doc/lib/libdocxmlrpc.tex python/trunk/Doc/lib/libftplib.tex python/trunk/Doc/lib/libfuncs.tex python/trunk/Doc/lib/libhotshot.tex python/trunk/Doc/lib/libhtmllib.tex python/trunk/Doc/lib/libhttplib.tex python/trunk/Doc/lib/libimaplib.tex python/trunk/Doc/lib/libmailbox.tex python/trunk/Doc/lib/libmimetools.tex python/trunk/Doc/lib/libmimetypes.tex python/trunk/Doc/lib/libmimewriter.tex python/trunk/Doc/lib/libmsilib.tex python/trunk/Doc/lib/libmultifile.tex python/trunk/Doc/lib/libmutex.tex python/trunk/Doc/lib/libnetrc.tex python/trunk/Doc/lib/libnntplib.tex python/trunk/Doc/lib/libpipes.tex python/trunk/Doc/lib/libpopen2.tex python/trunk/Doc/lib/libpoplib.tex python/trunk/Doc/lib/libpprint.tex python/trunk/Doc/lib/libqueue.tex python/trunk/Doc/lib/librepr.tex python/trunk/Doc/lib/librexec.tex python/trunk/Doc/lib/librfc822.tex python/trunk/Doc/lib/libsched.tex python/trunk/Doc/lib/libshlex.tex python/trunk/Doc/lib/libsimplexmlrpc.tex python/trunk/Doc/lib/libsmtplib.tex python/trunk/Doc/lib/libsubprocess.tex python/trunk/Doc/lib/libtelnetlib.tex python/trunk/Doc/lib/libthreading.tex python/trunk/Doc/lib/libturtle.tex python/trunk/Doc/lib/libunittest.tex python/trunk/Doc/lib/liburllib2.tex python/trunk/Doc/lib/libxmlrpclib.tex python/trunk/Doc/mac/libmacic.tex Log: Lots of explicit class names for method and member descs. Modified: python/trunk/Doc/lib/libcfgparser.tex ============================================================================== --- python/trunk/Doc/lib/libcfgparser.tex (original) +++ python/trunk/Doc/lib/libcfgparser.tex Mon Apr 2 00:39:10 2007 @@ -155,37 +155,37 @@ \class{RawConfigParser} instances have the following methods: -\begin{methoddesc}{defaults}{} +\begin{methoddesc}[RawConfigParser]{defaults}{} Return a dictionary containing the instance-wide defaults. \end{methoddesc} -\begin{methoddesc}{sections}{} +\begin{methoddesc}[RawConfigParser]{sections}{} Return a list of the sections available; \code{DEFAULT} is not included in the list. \end{methoddesc} -\begin{methoddesc}{add_section}{section} +\begin{methoddesc}[RawConfigParser]{add_section}{section} Add a section named \var{section} to the instance. If a section by the given name already exists, \exception{DuplicateSectionError} is raised. \end{methoddesc} -\begin{methoddesc}{has_section}{section} +\begin{methoddesc}[RawConfigParser]{has_section}{section} Indicates whether the named section is present in the configuration. The \code{DEFAULT} section is not acknowledged. \end{methoddesc} -\begin{methoddesc}{options}{section} +\begin{methoddesc}[RawConfigParser]{options}{section} Returns a list of options available in the specified \var{section}. \end{methoddesc} -\begin{methoddesc}{has_option}{section, option} +\begin{methoddesc}[RawConfigParser]{has_option}{section, option} If the given section exists, and contains the given option, return \constant{True}; otherwise return \constant{False}. \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{read}{filenames} +\begin{methoddesc}[RawConfigParser]{read}{filenames} Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If \var{filenames} is a string or Unicode string, it is treated as a single filename. @@ -210,28 +210,28 @@ \versionchanged[Returns list of successfully parsed filenames]{2.4} \end{methoddesc} -\begin{methoddesc}{readfp}{fp\optional{, filename}} +\begin{methoddesc}[RawConfigParser]{readfp}{fp\optional{, filename}} Read and parse configuration data from the file or file-like object in \var{fp} (only the \method{readline()} method is used). If \var{filename} is omitted and \var{fp} has a \member{name} attribute, that is used for \var{filename}; the default is \samp{}. \end{methoddesc} -\begin{methoddesc}{get}{section, option} +\begin{methoddesc}[RawConfigParser]{get}{section, option} Get an \var{option} value for the named \var{section}. \end{methoddesc} -\begin{methoddesc}{getint}{section, option} +\begin{methoddesc}[RawConfigParser]{getint}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to an integer. \end{methoddesc} -\begin{methoddesc}{getfloat}{section, option} +\begin{methoddesc}[RawConfigParser]{getfloat}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to a floating point number. \end{methoddesc} -\begin{methoddesc}{getboolean}{section, option} +\begin{methoddesc}[RawConfigParser]{getboolean}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to a Boolean value. Note that the accepted values for the option are \code{"1"}, \code{"yes"}, \code{"true"}, and \code{"on"}, @@ -241,12 +241,12 @@ cause it to raise \exception{ValueError}. \end{methoddesc} -\begin{methoddesc}{items}{section} +\begin{methoddesc}[RawConfigParser]{items}{section} Return a list of \code{(\var{name}, \var{value})} pairs for each option in the given \var{section}. \end{methoddesc} -\begin{methoddesc}{set}{section, option, value} +\begin{methoddesc}[RawConfigParser]{set}{section, option, value} If the given section exists, set the given option to the specified value; otherwise raise \exception{NoSectionError}. While it is possible to use \class{RawConfigParser} (or \class{ConfigParser} with @@ -256,14 +256,14 @@ \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{write}{fileobject} +\begin{methoddesc}[RawConfigParser]{write}{fileobject} Write a representation of the configuration to the specified file object. This representation can be parsed by a future \method{read()} call. \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{remove_option}{section, option} +\begin{methoddesc}[RawConfigParser]{remove_option}{section, option} Remove the specified \var{option} from the specified \var{section}. If the section does not exist, raise \exception{NoSectionError}. If the option existed to be removed, return \constant{True}; @@ -271,13 +271,13 @@ \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{remove_section}{section} +\begin{methoddesc}[RawConfigParser]{remove_section}{section} Remove the specified \var{section} from the configuration. If the section in fact existed, return \code{True}. Otherwise return \code{False}. \end{methoddesc} -\begin{methoddesc}{optionxform}{option} +\begin{methoddesc}[RawConfigParser]{optionxform}{option} Transforms the option name \var{option} as found in an input file or as passed in by client code to the form that should be used in the internal structures. The default implementation returns a lower-case @@ -293,14 +293,14 @@ The \class{ConfigParser} class extends some methods of the \class{RawConfigParser} interface, adding some optional arguments. -\begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} +\begin{methoddesc}[ConfigParser]{get}{section, option\optional{, raw\optional{, vars}}} Get an \var{option} value for the named \var{section}. All the \character{\%} interpolations are expanded in the return values, based on the defaults passed into the constructor, as well as the options \var{vars} provided, unless the \var{raw} argument is true. \end{methoddesc} -\begin{methoddesc}{items}{section\optional{, raw\optional{, vars}}} +\begin{methoddesc}[ConfigParser]{items}{section\optional{, raw\optional{, vars}}} Return a list of \code{(\var{name}, \var{value})} pairs for each option in the given \var{section}. Optional arguments have the same meaning as for the \method{get()} method. @@ -313,7 +313,7 @@ The \class{SafeConfigParser} class implements the same extended interface as \class{ConfigParser}, with the following addition: -\begin{methoddesc}{set}{section, option, value} +\begin{methoddesc}[SafeConfigParser]{set}{section, option, value} If the given section exists, set the given option to the specified value; otherwise raise \exception{NoSectionError}. \var{value} must be a string (\class{str} or \class{unicode}); if not, Modified: python/trunk/Doc/lib/libcmd.tex ============================================================================== --- python/trunk/Doc/lib/libcmd.tex (original) +++ python/trunk/Doc/lib/libcmd.tex Mon Apr 2 00:39:10 2007 @@ -37,7 +37,7 @@ A \class{Cmd} instance has the following methods: -\begin{methoddesc}{cmdloop}{\optional{intro}} +\begin{methoddesc}[Cmd]{cmdloop}{\optional{intro}} Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. @@ -82,7 +82,7 @@ any undocumented commands. \end{methoddesc} -\begin{methoddesc}{onecmd}{str} +\begin{methoddesc}[Cmd]{onecmd}{str} Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the \method{precmd()} and \method{postcmd()} methods for useful @@ -93,25 +93,25 @@ \method{default()} method is returned. \end{methoddesc} -\begin{methoddesc}{emptyline}{} +\begin{methoddesc}[Cmd]{emptyline}{} Method called when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered. \end{methoddesc} -\begin{methoddesc}{default}{line} +\begin{methoddesc}[Cmd]{default}{line} Method called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns. \end{methoddesc} -\begin{methoddesc}{completedefault}{text, line, begidx, endidx} +\begin{methoddesc}[Cmd]{completedefault}{text, line, begidx, endidx} Method called to complete an input line when no command-specific \method{complete_*()} method is available. By default, it returns an empty list. \end{methoddesc} -\begin{methoddesc}{precmd}{line} +\begin{methoddesc}[Cmd]{precmd}{line} Hook method executed just before the command line \var{line} is interpreted, but after the input prompt is generated and issued. This method is a stub in \class{Cmd}; it exists to be overridden by @@ -121,7 +121,7 @@ unchanged. \end{methoddesc} -\begin{methoddesc}{postcmd}{stop, line} +\begin{methoddesc}[Cmd]{postcmd}{stop, line} Hook method executed just after a command dispatch is finished. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. \var{line} is the command line which was executed, and @@ -133,13 +133,13 @@ to continue. \end{methoddesc} -\begin{methoddesc}{preloop}{} +\begin{methoddesc}[Cmd]{preloop}{} Hook method executed once when \method{cmdloop()} is called. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. \end{methoddesc} -\begin{methoddesc}{postloop}{} +\begin{methoddesc}[Cmd]{postloop}{} Hook method executed once when \method{cmdloop()} is about to return. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. @@ -147,47 +147,47 @@ Instances of \class{Cmd} subclasses have some public instance variables: -\begin{memberdesc}{prompt} +\begin{memberdesc}[Cmd]{prompt} The prompt issued to solicit input. \end{memberdesc} -\begin{memberdesc}{identchars} +\begin{memberdesc}[Cmd]{identchars} The string of characters accepted for the command prefix. \end{memberdesc} -\begin{memberdesc}{lastcmd} +\begin{memberdesc}[Cmd]{lastcmd} The last nonempty command prefix seen. \end{memberdesc} -\begin{memberdesc}{intro} +\begin{memberdesc}[Cmd]{intro} A string to issue as an intro or banner. May be overridden by giving the \method{cmdloop()} method an argument. \end{memberdesc} -\begin{memberdesc}{doc_header} +\begin{memberdesc}[Cmd]{doc_header} The header to issue if the help output has a section for documented commands. \end{memberdesc} -\begin{memberdesc}{misc_header} +\begin{memberdesc}[Cmd]{misc_header} The header to issue if the help output has a section for miscellaneous help topics (that is, there are \method{help_*()} methods without corresponding \method{do_*()} methods). \end{memberdesc} -\begin{memberdesc}{undoc_header} +\begin{memberdesc}[Cmd]{undoc_header} The header to issue if the help output has a section for undocumented commands (that is, there are \method{do_*()} methods without corresponding \method{help_*()} methods). \end{memberdesc} -\begin{memberdesc}{ruler} +\begin{memberdesc}[Cmd]{ruler} The character used to draw separator lines under the help-message headers. If empty, no ruler line is drawn. It defaults to \character{=}. \end{memberdesc} -\begin{memberdesc}{use_rawinput} +\begin{memberdesc}[Cmd]{use_rawinput} A flag, defaulting to true. If true, \method{cmdloop()} uses \function{raw_input()} to display a prompt and read the next command; if false, \method{sys.stdout.write()} and Modified: python/trunk/Doc/lib/libcode.tex ============================================================================== --- python/trunk/Doc/lib/libcode.tex (original) +++ python/trunk/Doc/lib/libcode.tex Mon Apr 2 00:39:10 2007 @@ -68,7 +68,7 @@ \subsection{Interactive Interpreter Objects \label{interpreter-objects}} -\begin{methoddesc}{runsource}{source\optional{, filename\optional{, symbol}}} +\begin{methoddesc}[InteractiveInterpreter]{runsource}{source\optional{, filename\optional{, symbol}}} Compile and run some source in the interpreter. Arguments are the same as for \function{compile_command()}; the default for \var{filename} is \code{''}, and for @@ -98,7 +98,7 @@ \code{sys.ps1} or \code{sys.ps2} to prompt the next line. \end{methoddesc} -\begin{methoddesc}{runcode}{code} +\begin{methoddesc}[InteractiveInterpreter]{runcode}{code} Execute a code object. When an exception occurs, \method{showtraceback()} is called to display a traceback. All exceptions are caught except @@ -109,7 +109,7 @@ should be prepared to deal with it. \end{methoddesc} -\begin{methoddesc}{showsyntaxerror}{\optional{filename}} +\begin{methoddesc}[InteractiveInterpreter]{showsyntaxerror}{\optional{filename}} Display the syntax error that just occurred. This does not display a stack trace because there isn't one for syntax errors. If \var{filename} is given, it is stuffed into the exception instead @@ -118,13 +118,13 @@ The output is written by the \method{write()} method. \end{methoddesc} -\begin{methoddesc}{showtraceback}{} +\begin{methoddesc}[InteractiveInterpreter]{showtraceback}{} Display the exception that just occurred. We remove the first stack item because it is within the interpreter object implementation. The output is written by the \method{write()} method. \end{methoddesc} -\begin{methoddesc}{write}{data} +\begin{methoddesc}[InteractiveInterpreter]{write}{data} Write a string to the standard error stream (\code{sys.stderr}). Derived classes should override this to provide the appropriate output handling as needed. @@ -138,7 +138,7 @@ \class{InteractiveInterpreter}, and so offers all the methods of the interpreter objects as well as the following additions. -\begin{methoddesc}{interact}{\optional{banner}} +\begin{methoddesc}[InteractiveConsole]{interact}{\optional{banner}} Closely emulate the interactive Python console. The optional banner argument specify the banner to print before the first interaction; by default it prints a banner similar to the one @@ -147,7 +147,7 @@ with the real interpreter -- since it's so close!). \end{methoddesc} -\begin{methoddesc}{push}{line} +\begin{methoddesc}[InteractiveConsole]{push}{line} Push a line of source text to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's @@ -160,11 +160,11 @@ \method{runsource()}). \end{methoddesc} -\begin{methoddesc}{resetbuffer}{} +\begin{methoddesc}[InteractiveConsole]{resetbuffer}{} Remove any unhandled source text from the input buffer. \end{methoddesc} -\begin{methoddesc}{raw_input}{\optional{prompt}} +\begin{methoddesc}[InteractiveConsole]{raw_input}{\optional{prompt}} Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the \EOF{} key sequence, \exception{EOFError} is raised. The base implementation uses the Modified: python/trunk/Doc/lib/libcollections.tex ============================================================================== --- python/trunk/Doc/lib/libcollections.tex (original) +++ python/trunk/Doc/lib/libcollections.tex Mon Apr 2 00:39:10 2007 @@ -221,7 +221,7 @@ \subsection{\class{defaultdict} objects \label{defaultdict-objects}} -\begin{funcdesc}{defaultdict}{\optional{default_factory\optional{, ...}}} +\begin{classdesc}{defaultdict}{\optional{default_factory\optional{, ...}}} Returns a new dictionary-like object. \class{defaultdict} is a subclass of the builtin \class{dict} class. It overrides one method and adds one writable instance variable. The remaining functionality is the same as @@ -233,7 +233,7 @@ passed to the \class{dict} constructor, including keyword arguments. \versionadded{2.5} -\end{funcdesc} +\end{classdesc} \class{defaultdict} objects support the following method in addition to the standard \class{dict} operations: @@ -256,11 +256,11 @@ \class{defaultdict} objects support the following instance variable: -\begin{datadesc}{default_factory} +\begin{memberdesc}{default_factory} This attribute is used by the \method{__missing__} method; it is initialized from the first argument to the constructor, if present, or to \code{None}, if absent. -\end{datadesc} +\end{memberdesc} \subsubsection{\class{defaultdict} Examples \label{defaultdict-examples}} Modified: python/trunk/Doc/lib/libcookielib.tex ============================================================================== --- python/trunk/Doc/lib/libcookielib.tex (original) +++ python/trunk/Doc/lib/libcookielib.tex Mon Apr 2 00:39:10 2007 @@ -292,12 +292,12 @@ \class{FileCookieJar} instances have the following public attributes: -\begin{memberdesc}{filename} +\begin{memberdesc}[FileCookieJar]{filename} Filename of default file in which to keep cookies. This attribute may be assigned to. \end{memberdesc} -\begin{memberdesc}{delayload} +\begin{memberdesc}[FileCookieJar]{delayload} If true, load cookies lazily from disk. This attribute should not be assigned to. This is only a hint, since this only affects performance, not behaviour (unless the cookies on disk are changing). @@ -400,13 +400,13 @@ attributes, indicating which protocols should be used, and how. All of these attributes may be assigned to. -\begin{memberdesc}{netscape} +\begin{memberdesc}[CookiePolicy]{netscape} Implement Netscape protocol. \end{memberdesc} -\begin{memberdesc}{rfc2965} +\begin{memberdesc}[CookiePolicy]{rfc2965} Implement RFC 2965 protocol. \end{memberdesc} -\begin{memberdesc}{hide_cookie2} +\begin{memberdesc}[CookiePolicy]{hide_cookie2} Don't add \mailheader{Cookie2} header to requests (the presence of this header indicates to the server that we understand RFC 2965 cookies). @@ -504,7 +504,7 @@ which are all initialised from the constructor arguments of the same name, and which may all be assigned to. -\begin{memberdesc}{rfc2109_as_netscape} +\begin{memberdesc}[DefaultCookiePolicy]{rfc2109_as_netscape} If true, request that the \class{CookieJar} instance downgrade RFC 2109 cookies (ie. cookies received in a \mailheader{Set-Cookie} header with a version cookie-attribute of 1) to Netscape cookies by setting @@ -517,7 +517,7 @@ General strictness switches: -\begin{memberdesc}{strict_domain} +\begin{memberdesc}[DefaultCookiePolicy]{strict_domain} Don't allow sites to set two-component domains with country-code top-level domains like \code{.co.uk}, \code{.gov.uk}, \code{.co.nz}.etc. This is far from perfect and isn't guaranteed to @@ -526,7 +526,7 @@ RFC 2965 protocol strictness switches: -\begin{memberdesc}{strict_rfc2965_unverifiable} +\begin{memberdesc}[DefaultCookiePolicy]{strict_rfc2965_unverifiable} Follow RFC 2965 rules on unverifiable transactions (usually, an unverifiable transaction is one resulting from a redirect or a request for an image hosted on another site). If this is false, cookies are @@ -535,19 +535,19 @@ Netscape protocol strictness switches: -\begin{memberdesc}{strict_ns_unverifiable} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_unverifiable} apply RFC 2965 rules on unverifiable transactions even to Netscape cookies \end{memberdesc} -\begin{memberdesc}{strict_ns_domain} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_domain} Flags indicating how strict to be with domain-matching rules for Netscape cookies. See below for acceptable values. \end{memberdesc} -\begin{memberdesc}{strict_ns_set_initial_dollar} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_initial_dollar} Ignore cookies in Set-Cookie: headers that have names starting with \code{'\$'}. \end{memberdesc} -\begin{memberdesc}{strict_ns_set_path} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_path} Don't allow setting cookies whose path doesn't path-match request URI. \end{memberdesc} @@ -556,30 +556,30 @@ \code{DomainStrictNoDots|DomainStrictNonDomain} means both flags are set). -\begin{memberdesc}{DomainStrictNoDots} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNoDots} When setting cookies, the 'host prefix' must not contain a dot (eg. \code{www.foo.bar.com} can't set a cookie for \code{.bar.com}, because \code{www.foo} contains a dot). \end{memberdesc} -\begin{memberdesc}{DomainStrictNonDomain} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNonDomain} Cookies that did not explicitly specify a \code{domain} cookie-attribute can only be returned to a domain equal to the domain that set the cookie (eg. \code{spam.example.com} won't be returned cookies from \code{example.com} that had no \code{domain} cookie-attribute). \end{memberdesc} -\begin{memberdesc}{DomainRFC2965Match} +\begin{memberdesc}[DefaultCookiePolicy]{DomainRFC2965Match} When setting cookies, require a full RFC 2965 domain-match. \end{memberdesc} The following attributes are provided for convenience, and are the most useful combinations of the above flags: -\begin{memberdesc}{DomainLiberal} +\begin{memberdesc}[DefaultCookiePolicy]{DomainLiberal} Equivalent to 0 (ie. all of the above Netscape domain strictness flags switched off). \end{memberdesc} -\begin{memberdesc}{DomainStrict} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrict} Equivalent to \code{DomainStrictNoDots|DomainStrictNonDomain}. \end{memberdesc} Modified: python/trunk/Doc/lib/libdatetime.tex ============================================================================== --- python/trunk/Doc/lib/libdatetime.tex (original) +++ python/trunk/Doc/lib/libdatetime.tex Mon Apr 2 00:39:10 2007 @@ -1154,7 +1154,7 @@ uses made of aware \module{datetime} objects. If in doubt, simply implement all of them. -\begin{methoddesc}{utcoffset}{self, dt} +\begin{methoddesc}[tzinfo]{utcoffset}{self, dt} Return offset of local time from UTC, in minutes east of UTC. If local time is west of UTC, this should be negative. Note that this is intended to be the total offset from UTC; for example, if a @@ -1178,7 +1178,7 @@ \exception{NotImplementedError}. \end{methoddesc} -\begin{methoddesc}{dst}{self, dt} +\begin{methoddesc}[tzinfo]{dst}{self, dt} Return the daylight saving time (DST) adjustment, in minutes east of UTC, or \code{None} if DST information isn't known. Return \code{timedelta(0)} if DST is not in effect. @@ -1237,7 +1237,7 @@ \exception{NotImplementedError}. \end{methoddesc} -\begin{methoddesc}{tzname}{self, dt} +\begin{methoddesc}[tzinfo]{tzname}{self, dt} Return the time zone name corresponding to the \class{datetime} object \var{dt}, as a string. Nothing about string names is defined by the @@ -1278,7 +1278,7 @@ There is one more \class{tzinfo} method that a subclass may wish to override: -\begin{methoddesc}{fromutc}{self, dt} +\begin{methoddesc}[tzinfo]{fromutc}{self, dt} This is called from the default \class{datetime.astimezone()} implementation. When called from that, \code{\var{dt}.tzinfo} is \var{self}, and \var{dt}'s date and time members are to be viewed as Modified: python/trunk/Doc/lib/libdocxmlrpc.tex ============================================================================== --- python/trunk/Doc/lib/libdocxmlrpc.tex (original) +++ python/trunk/Doc/lib/libdocxmlrpc.tex Mon Apr 2 00:39:10 2007 @@ -51,14 +51,14 @@ handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. -\begin{methoddesc}{set_server_title}{server_title} +\begin{methoddesc}[DocXMLRPCServer]{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} -\begin{methoddesc}{set_server_name}{server_name} +\begin{methoddesc}[DocXMLRPCServer]{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" @@ -67,7 +67,7 @@ \end{methoddesc} -\begin{methoddesc}{set_server_documentation}{server_documentation} +\begin{methoddesc}[DocXMLRPCServer]{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the @@ -84,14 +84,14 @@ generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. -\begin{methoddesc}{set_server_title}{server_title} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} -\begin{methoddesc}{set_server_name}{server_name} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" @@ -100,7 +100,7 @@ \end{methoddesc} -\begin{methoddesc}{set_server_documentation}{server_documentation} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the Modified: python/trunk/Doc/lib/libftplib.tex ============================================================================== --- python/trunk/Doc/lib/libftplib.tex (original) +++ python/trunk/Doc/lib/libftplib.tex Mon Apr 2 00:39:10 2007 @@ -95,7 +95,7 @@ \class{FTP} instances have the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[FTP]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of @@ -104,7 +104,7 @@ logging each line sent and received on the control connection. \end{methoddesc} -\begin{methoddesc}{connect}{host\optional{, port\optional{, timeout}}} +\begin{methoddesc}[FTP]{connect}{host\optional{, port\optional{, timeout}}} Connect to the given host and port. The default port number is \code{21}, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only @@ -119,13 +119,13 @@ setting will be used. \end{methoddesc} -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[FTP]{getwelcome}{} Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help information that may be relevant to the user.) \end{methoddesc} -\begin{methoddesc}{login}{\optional{user\optional{, passwd\optional{, acct}}}} +\begin{methoddesc}[FTP]{login}{\optional{user\optional{, passwd\optional{, acct}}}} Log in as the given \var{user}. The \var{passwd} and \var{acct} parameters are optional and default to the empty string. If no \var{user} is specified, it defaults to \code{'anonymous'}. If @@ -137,23 +137,23 @@ client has logged in. \end{methoddesc} -\begin{methoddesc}{abort}{} +\begin{methoddesc}[FTP]{abort}{} Abort a file transfer that is in progress. Using this does not always work, but it's worth a try. \end{methoddesc} -\begin{methoddesc}{sendcmd}{command} +\begin{methoddesc}[FTP]{sendcmd}{command} Send a simple command string to the server and return the response string. \end{methoddesc} -\begin{methoddesc}{voidcmd}{command} +\begin{methoddesc}[FTP]{voidcmd}{command} Send a simple command string to the server and handle the response. Return nothing if a response code in the range 200--299 is received. Raise an exception otherwise. \end{methoddesc} -\begin{methoddesc}{retrbinary}{command, +\begin{methoddesc}[FTP]{retrbinary}{command, callback\optional{, maxblocksize\optional{, rest}}} Retrieve a file in binary transfer mode. \var{command} should be an appropriate \samp{RETR} command: \code{'RETR \var{filename}'}. @@ -166,7 +166,7 @@ same thing as in the \method{transfercmd()} method. \end{methoddesc} -\begin{methoddesc}{retrlines}{command\optional{, callback}} +\begin{methoddesc}[FTP]{retrlines}{command\optional{, callback}} Retrieve a file or directory listing in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{RETR} command (see \method{retrbinary()}) or a \samp{LIST} command (usually just the string @@ -175,13 +175,13 @@ the line to \code{sys.stdout}. \end{methoddesc} -\begin{methoddesc}{set_pasv}{boolean} +\begin{methoddesc}[FTP]{set_pasv}{boolean} Enable ``passive'' mode if \var{boolean} is true, other disable passive mode. (In Python 2.0 and before, passive mode was off by default; in Python 2.1 and later, it is on by default.) \end{methoddesc} -\begin{methoddesc}{storbinary}{command, file\optional{, blocksize}} +\begin{methoddesc}[FTP]{storbinary}{command, file\optional{, blocksize}} Store a file in binary transfer mode. \var{command} should be an appropriate \samp{STOR} command: \code{"STOR \var{filename}"}. \var{file} is an open file object which is read until \EOF{} using its @@ -190,14 +190,14 @@ \versionchanged[default for \var{blocksize} added]{2.1} \end{methoddesc} -\begin{methoddesc}{storlines}{command, file} +\begin{methoddesc}[FTP]{storlines}{command, file} Store a file in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{STOR} command (see \method{storbinary()}). Lines are read until \EOF{} from the open file object \var{file} using its \method{readline()} method to provide the data to be stored. \end{methoddesc} -\begin{methoddesc}{transfercmd}{cmd\optional{, rest}} +\begin{methoddesc}[FTP]{transfercmd}{cmd\optional{, rest}} Initiate a transfer over the data connection. If the transfer is active, send a \samp{EPRT} or \samp{PORT} command and the transfer command specified by \var{cmd}, and accept the connection. If the server is passive, @@ -219,7 +219,7 @@ simply call \method{transfercmd()} without a \var{rest} argument. \end{methoddesc} -\begin{methoddesc}{ntransfercmd}{cmd\optional{, rest}} +\begin{methoddesc}[FTP]{ntransfercmd}{cmd\optional{, rest}} Like \method{transfercmd()}, but returns a tuple of the data connection and the expected size of the data. If the expected size could not be computed, \code{None} will be returned as the expected @@ -227,14 +227,14 @@ \method{transfercmd()}. \end{methoddesc} -\begin{methoddesc}{nlst}{argument\optional{, \ldots}} +\begin{methoddesc}[FTP]{nlst}{argument\optional{, \ldots}} Return a list of files as returned by the \samp{NLST} command. The optional \var{argument} is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard options to the \samp{NLST} command. \end{methoddesc} -\begin{methoddesc}{dir}{argument\optional{, \ldots}} +\begin{methoddesc}[FTP]{dir}{argument\optional{, \ldots}} Produce a directory listing as returned by the \samp{LIST} command, printing it to standard output. The optional \var{argument} is a directory to list (default is the current server directory). Multiple @@ -244,41 +244,41 @@ prints to \code{sys.stdout}. This method returns \code{None}. \end{methoddesc} -\begin{methoddesc}{rename}{fromname, toname} +\begin{methoddesc}[FTP]{rename}{fromname, toname} Rename file \var{fromname} on the server to \var{toname}. \end{methoddesc} -\begin{methoddesc}{delete}{filename} +\begin{methoddesc}[FTP]{delete}{filename} Remove the file named \var{filename} from the server. If successful, returns the text of the response, otherwise raises \exception{error_perm} on permission errors or \exception{error_reply} on other errors. \end{methoddesc} -\begin{methoddesc}{cwd}{pathname} +\begin{methoddesc}[FTP]{cwd}{pathname} Set the current directory on the server. \end{methoddesc} -\begin{methoddesc}{mkd}{pathname} +\begin{methoddesc}[FTP]{mkd}{pathname} Create a new directory on the server. \end{methoddesc} -\begin{methoddesc}{pwd}{} +\begin{methoddesc}[FTP]{pwd}{} Return the pathname of the current directory on the server. \end{methoddesc} -\begin{methoddesc}{rmd}{dirname} +\begin{methoddesc}[FTP]{rmd}{dirname} Remove the directory named \var{dirname} on the server. \end{methoddesc} -\begin{methoddesc}{size}{filename} +\begin{methoddesc}[FTP]{size}{filename} Request the size of the file named \var{filename} on the server. On success, the size of the file is returned as an integer, otherwise \code{None} is returned. Note that the \samp{SIZE} command is not standardized, but is supported by many common server implementations. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[FTP]{quit}{} Send a \samp{QUIT} command to the server and close the connection. This is the ``polite'' way to close a connection, but it may raise an exception of the server reponds with an error to the @@ -287,7 +287,7 @@ calls (see below). \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[FTP]{close}{} Close the connection unilaterally. This should not be applied to an already closed connection such as after a successful call to \method{quit()}. After this call the \class{FTP} instance should not Modified: python/trunk/Doc/lib/libfuncs.tex ============================================================================== --- python/trunk/Doc/lib/libfuncs.tex (original) +++ python/trunk/Doc/lib/libfuncs.tex Mon Apr 2 00:39:10 2007 @@ -1166,7 +1166,7 @@ as detailed below. \end{funcdesc} -\begin{funcdesc}{type}{name, bases, dict} +\begin{funcdescni}{type}{name, bases, dict} Return a new type object. This is essentially a dynamic form of the \keyword{class} statement. The \var{name} string is the class name and becomes the \member{__name__} attribute; the \var{bases} tuple @@ -1183,7 +1183,7 @@ >>> X = type('X', (object,), dict(a=1)) \end{verbatim} \versionadded{2.2} -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{unichr}{i} Return the Unicode string of one character whose Unicode code is the Modified: python/trunk/Doc/lib/libhotshot.tex ============================================================================== --- python/trunk/Doc/lib/libhotshot.tex (original) +++ python/trunk/Doc/lib/libhotshot.tex Mon Apr 2 00:39:10 2007 @@ -48,25 +48,25 @@ Profile objects have the following methods: -\begin{methoddesc}{addinfo}{key, value} +\begin{methoddesc}[Profile]{addinfo}{key, value} Add an arbitrary labelled value to the profile output. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Profile]{close}{} Close the logfile and terminate the profiler. \end{methoddesc} -\begin{methoddesc}{fileno}{} +\begin{methoddesc}[Profile]{fileno}{} Return the file descriptor of the profiler's log file. \end{methoddesc} -\begin{methoddesc}{run}{cmd} +\begin{methoddesc}[Profile]{run}{cmd} Profile an \keyword{exec}-compatible string in the script environment. The globals from the \refmodule[main]{__main__} module are used as both the globals and locals for the script. \end{methoddesc} -\begin{methoddesc}{runcall}{func, *args, **keywords} +\begin{methoddesc}[Profile]{runcall}{func, *args, **keywords} Profile a single call of a callable. Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are @@ -75,16 +75,16 @@ \end{methoddesc} -\begin{methoddesc}{runctx}{cmd, globals, locals} +\begin{methoddesc}[Profile]{runctx}{cmd, globals, locals} Evaluate an \keyword{exec}-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} -\begin{methoddesc}{start}{} +\begin{methoddesc}[Profile]{start}{} Start the profiler. \end{methoddesc} -\begin{methoddesc}{stop}{} +\begin{methoddesc}[Profile]{stop}{} Stop the profiler. \end{methoddesc} Modified: python/trunk/Doc/lib/libhtmllib.tex ============================================================================== --- python/trunk/Doc/lib/libhtmllib.tex (original) +++ python/trunk/Doc/lib/libhtmllib.tex Mon Apr 2 00:39:10 2007 @@ -96,11 +96,11 @@ In addition to tag methods, the \class{HTMLParser} class provides some additional methods and instance variables for use within tag methods. -\begin{memberdesc}{formatter} +\begin{memberdesc}[HTMLParser]{formatter} This is the formatter instance associated with the parser. \end{memberdesc} -\begin{memberdesc}{nofill} +\begin{memberdesc}[HTMLParser]{nofill} Boolean flag which should be true when whitespace should not be collapsed, or false when it should be. In general, this should only be true when character data is to be treated as ``preformatted'' text, @@ -109,7 +109,7 @@ \end{memberdesc} -\begin{methoddesc}{anchor_bgn}{href, name, type} +\begin{methoddesc}[HTMLParser]{anchor_bgn}{href, name, type} This method is called at the start of an anchor region. The arguments correspond to the attributes of the \code{} tag with the same names. The default implementation maintains a list of hyperlinks @@ -118,27 +118,27 @@ \member{anchorlist}. \end{methoddesc} -\begin{methoddesc}{anchor_end}{} +\begin{methoddesc}[HTMLParser]{anchor_end}{} This method is called at the end of an anchor region. The default implementation adds a textual footnote marker using an index into the list of hyperlinks created by \method{anchor_bgn()}. \end{methoddesc} -\begin{methoddesc}{handle_image}{source, alt\optional{, ismap\optional{, +\begin{methoddesc}[HTMLParser]{handle_image}{source, alt\optional{, ismap\optional{, align\optional{, width\optional{, height}}}}} This method is called to handle images. The default implementation simply passes the \var{alt} value to the \method{handle_data()} method. \end{methoddesc} -\begin{methoddesc}{save_bgn}{} +\begin{methoddesc}[HTMLParser]{save_bgn}{} Begins saving character data in a buffer instead of sending it to the formatter object. Retrieve the stored data via \method{save_end()}. Use of the \method{save_bgn()} / \method{save_end()} pair may not be nested. \end{methoddesc} -\begin{methoddesc}{save_end}{} +\begin{methoddesc}[HTMLParser]{save_end}{} Ends buffering character data and returns all data saved since the preceding call to \method{save_bgn()}. If the \member{nofill} flag is false, whitespace is collapsed to single spaces. A call to this Modified: python/trunk/Doc/lib/libhttplib.tex ============================================================================== --- python/trunk/Doc/lib/libhttplib.tex (original) +++ python/trunk/Doc/lib/libhttplib.tex Mon Apr 2 00:39:10 2007 @@ -309,7 +309,7 @@ \class{HTTPConnection} instances have the following methods: -\begin{methoddesc}{request}{method, url\optional{, body\optional{, headers}}} +\begin{methoddesc}[HTTPConnection]{request}{method, url\optional{, body\optional{, headers}}} This will send a request to the server using the HTTP request method \var{method} and the selector \var{url}. If the \var{body} argument is present, it should be a string of data to send after the headers are finished. @@ -323,24 +323,24 @@ \versionchanged[\var{body} can be a file object]{2.6} \end{methoddesc} -\begin{methoddesc}{getresponse}{} +\begin{methoddesc}[HTTPConnection]{getresponse}{} Should be called after a request is sent to get the response from the server. Returns an \class{HTTPResponse} instance. \note{Note that you must have read the whole response before you can send a new request to the server.} \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[HTTPConnection]{set_debuglevel}{level} Set the debugging level (the amount of debugging output printed). The default debug level is \code{0}, meaning no debugging output is printed. \end{methoddesc} -\begin{methoddesc}{connect}{} +\begin{methoddesc}[HTTPConnection]{connect}{} Connect to the server specified when the object was created. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[HTTPConnection]{close}{} Close the connection to the server. \end{methoddesc} @@ -348,7 +348,7 @@ you can also send your request step by step, by using the four functions below. -\begin{methoddesc}{putrequest}{request, selector\optional{, +\begin{methoddesc}[HTTPConnection]{putrequest}{request, selector\optional{, skip\_host\optional{, skip_accept_encoding}}} This should be the first call after the connection to the server has been made. It sends a line to the server consisting of the @@ -360,18 +360,18 @@ \versionchanged[\var{skip_accept_encoding} argument added]{2.4} \end{methoddesc} -\begin{methoddesc}{putheader}{header, argument\optional{, ...}} +\begin{methoddesc}[HTTPConnection]{putheader}{header, argument\optional{, ...}} Send an \rfc{822}-style header to the server. It sends a line to the server consisting of the header, a colon and a space, and the first argument. If more arguments are given, continuation lines are sent, each consisting of a tab and an argument. \end{methoddesc} -\begin{methoddesc}{endheaders}{} +\begin{methoddesc}[HTTPConnection]{endheaders}{} Send a blank line to the server, signalling the end of the headers. \end{methoddesc} -\begin{methoddesc}{send}{data} +\begin{methoddesc}[HTTPConnection]{send}{data} Send data to the server. This should be used directly only after the \method{endheaders()} method has been called and before \method{getresponse()} is called. @@ -381,34 +381,34 @@ \class{HTTPResponse} instances have the following methods and attributes: -\begin{methoddesc}{read}{\optional{amt}} +\begin{methoddesc}[HTTPResponse]{read}{\optional{amt}} Reads and returns the response body, or up to the next \var{amt} bytes. \end{methoddesc} -\begin{methoddesc}{getheader}{name\optional{, default}} +\begin{methoddesc}[HTTPResponse]{getheader}{name\optional{, default}} Get the contents of the header \var{name}, or \var{default} if there is no matching header. \end{methoddesc} -\begin{methoddesc}{getheaders}{} +\begin{methoddesc}[HTTPResponse]{getheaders}{} Return a list of (header, value) tuples. \versionadded{2.4} \end{methoddesc} -\begin{datadesc}{msg} +\begin{memberdesc}[HTTPResponse]{msg} A \class{mimetools.Message} instance containing the response headers. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{version} +\begin{memberdesc}[HTTPResponse]{version} HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{status} +\begin{memberdesc}[HTTPResponse]{status} Status code returned by server. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{reason} +\begin{memberdesc}[HTTPResponse]{reason} Reason phrase returned by server. -\end{datadesc} +\end{memberdesc} \subsection{Examples \label{httplib-examples}} Modified: python/trunk/Doc/lib/libimaplib.tex ============================================================================== --- python/trunk/Doc/lib/libimaplib.tex (original) +++ python/trunk/Doc/lib/libimaplib.tex Mon Apr 2 00:39:10 2007 @@ -153,11 +153,11 @@ An \class{IMAP4} instance has the following methods: -\begin{methoddesc}{append}{mailbox, flags, date_time, message} +\begin{methoddesc}[IMAP4]{append}{mailbox, flags, date_time, message} Append \var{message} to named mailbox. \end{methoddesc} -\begin{methoddesc}{authenticate}{mechanism, authobject} +\begin{methoddesc}[IMAP4]{authenticate}{mechanism, authobject} Authenticate command --- requires response processing. \var{mechanism} specifies which authentication mechanism is to be @@ -176,115 +176,115 @@ be sent instead. \end{methoddesc} -\begin{methoddesc}{check}{} +\begin{methoddesc}[IMAP4]{check}{} Checkpoint mailbox on server. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[IMAP4]{close}{} Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before \samp{LOGOUT}. \end{methoddesc} -\begin{methoddesc}{copy}{message_set, new_mailbox} +\begin{methoddesc}[IMAP4]{copy}{message_set, new_mailbox} Copy \var{message_set} messages onto end of \var{new_mailbox}. \end{methoddesc} -\begin{methoddesc}{create}{mailbox} +\begin{methoddesc}[IMAP4]{create}{mailbox} Create new mailbox named \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{delete}{mailbox} +\begin{methoddesc}[IMAP4]{delete}{mailbox} Delete old mailbox named \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{deleteacl}{mailbox, who} +\begin{methoddesc}[IMAP4]{deleteacl}{mailbox, who} Delete the ACLs (remove any rights) set for who on mailbox. \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{expunge}{} +\begin{methoddesc}[IMAP4]{expunge}{} Permanently remove deleted items from selected mailbox. Generates an \samp{EXPUNGE} response for each deleted message. Returned data contains a list of \samp{EXPUNGE} message numbers in order received. \end{methoddesc} -\begin{methoddesc}{fetch}{message_set, message_parts} +\begin{methoddesc}[IMAP4]{fetch}{message_set, message_parts} Fetch (parts of) messages. \var{message_parts} should be a string of message part names enclosed within parentheses, eg: \samp{"(UID BODY[TEXT])"}. Returned data are tuples of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{getacl}{mailbox} +\begin{methoddesc}[IMAP4]{getacl}{mailbox} Get the \samp{ACL}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \end{methoddesc} -\begin{methoddesc}{getannotation}{mailbox, entry, attribute} +\begin{methoddesc}[IMAP4]{getannotation}{mailbox, entry, attribute} Retrieve the specified \samp{ANNOTATION}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{getquota}{root} +\begin{methoddesc}[IMAP4]{getquota}{root} Get the \samp{quota} \var{root}'s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{getquotaroot}{mailbox} +\begin{methoddesc}[IMAP4]{getquotaroot}{mailbox} Get the list of \samp{quota} \samp{roots} for the named \var{mailbox}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{list}{\optional{directory\optional{, pattern}}} +\begin{methoddesc}[IMAP4]{list}{\optional{directory\optional{, pattern}}} List mailbox names in \var{directory} matching \var{pattern}. \var{directory} defaults to the top-level mail folder, and \var{pattern} defaults to match anything. Returned data contains a list of \samp{LIST} responses. \end{methoddesc} -\begin{methoddesc}{login}{user, password} +\begin{methoddesc}[IMAP4]{login}{user, password} Identify the client using a plaintext password. The \var{password} will be quoted. \end{methoddesc} -\begin{methoddesc}{login_cram_md5}{user, password} +\begin{methoddesc}[IMAP4]{login_cram_md5}{user, password} Force use of \samp{CRAM-MD5} authentication when identifying the client to protect the password. Will only work if the server \samp{CAPABILITY} response includes the phrase \samp{AUTH=CRAM-MD5}. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{logout}{} +\begin{methoddesc}[IMAP4]{logout}{} Shutdown connection to server. Returns server \samp{BYE} response. \end{methoddesc} -\begin{methoddesc}{lsub}{\optional{directory\optional{, pattern}}} +\begin{methoddesc}[IMAP4]{lsub}{\optional{directory\optional{, pattern}}} List subscribed mailbox names in directory matching pattern. \var{directory} defaults to the top level directory and \var{pattern} defaults to match any mailbox. Returned data are tuples of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{myrights}{mailbox} +\begin{methoddesc}[IMAP4]{myrights}{mailbox} Show my ACLs for a mailbox (i.e. the rights that I have on mailbox). \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{namespace}{} +\begin{methoddesc}[IMAP4]{namespace}{} Returns IMAP namespaces as defined in RFC2342. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{noop}{} +\begin{methoddesc}[IMAP4]{noop}{} Send \samp{NOOP} to server. \end{methoddesc} -\begin{methoddesc}{open}{host, port} +\begin{methoddesc}[IMAP4]{open}{host, port} Opens socket to \var{port} at \var{host}. The connection objects established by this method will be used in the \code{read}, \code{readline}, \code{send}, and @@ -292,42 +292,42 @@ You may override this method. \end{methoddesc} -\begin{methoddesc}{partial}{message_num, message_part, start, length} +\begin{methoddesc}[IMAP4]{partial}{message_num, message_part, start, length} Fetch truncated part of a message. Returned data is a tuple of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{proxyauth}{user} +\begin{methoddesc}[IMAP4]{proxyauth}{user} Assume authentication as \var{user}. Allows an authorised administrator to proxy into any user's mailbox. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{read}{size} +\begin{methoddesc}[IMAP4]{read}{size} Reads \var{size} bytes from the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{readline}{} +\begin{methoddesc}[IMAP4]{readline}{} Reads one line from the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{recent}{} +\begin{methoddesc}[IMAP4]{recent}{} Prompt server for an update. Returned data is \code{None} if no new messages, else value of \samp{RECENT} response. \end{methoddesc} -\begin{methoddesc}{rename}{oldmailbox, newmailbox} +\begin{methoddesc}[IMAP4]{rename}{oldmailbox, newmailbox} Rename mailbox named \var{oldmailbox} to \var{newmailbox}. \end{methoddesc} -\begin{methoddesc}{response}{code} +\begin{methoddesc}[IMAP4]{response}{code} Return data for response \var{code} if received, or \code{None}. Returns the given code, instead of the usual type. \end{methoddesc} -\begin{methoddesc}{search}{charset, criterion\optional{, ...}} +\begin{methoddesc}[IMAP4]{search}{charset, criterion\optional{, ...}} Search mailbox for matching messages. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one @@ -345,45 +345,45 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{select}{\optional{mailbox\optional{, readonly}}} +\begin{methoddesc}[IMAP4]{select}{\optional{mailbox\optional{, readonly}}} Select a mailbox. Returned data is the count of messages in \var{mailbox} (\samp{EXISTS} response). The default \var{mailbox} is \code{'INBOX'}. If the \var{readonly} flag is set, modifications to the mailbox are not allowed. \end{methoddesc} -\begin{methoddesc}{send}{data} +\begin{methoddesc}[IMAP4]{send}{data} Sends \code{data} to the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{setacl}{mailbox, who, what} +\begin{methoddesc}[IMAP4]{setacl}{mailbox, who, what} Set an \samp{ACL} for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \end{methoddesc} -\begin{methoddesc}{setannotation}{mailbox, entry, attribute\optional{, ...}} +\begin{methoddesc}[IMAP4]{setannotation}{mailbox, entry, attribute\optional{, ...}} Set \samp{ANNOTATION}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{setquota}{root, limits} +\begin{methoddesc}[IMAP4]{setquota}{root, limits} Set the \samp{quota} \var{root}'s resource \var{limits}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{shutdown}{} +\begin{methoddesc}[IMAP4]{shutdown}{} Close connection established in \code{open}. You may override this method. \end{methoddesc} -\begin{methoddesc}{socket}{} +\begin{methoddesc}[IMAP4]{socket}{} Returns socket instance used to connect to server. \end{methoddesc} -\begin{methoddesc}{sort}{sort_criteria, charset, search_criterion\optional{, ...}} +\begin{methoddesc}[IMAP4]{sort}{sort_criteria, charset, search_criterion\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. @@ -402,11 +402,11 @@ This is an \samp{IMAP4rev1} extension command. \end{methoddesc} -\begin{methoddesc}{status}{mailbox, names} +\begin{methoddesc}[IMAP4]{status}{mailbox, names} Request named status conditions for \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{store}{message_set, command, flag_list} +\begin{methoddesc}[IMAP4]{store}{message_set, command, flag_list} Alters flag dispositions for messages in mailbox. \var{command} is specified by section 6.4.6 of \rfc{2060} as being one of "FLAGS", "+FLAGS", or "-FLAGS", optionally with a suffix of ".SILENT". @@ -421,11 +421,11 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{subscribe}{mailbox} +\begin{methoddesc}[IMAP4]{subscribe}{mailbox} Subscribe to new mailbox. \end{methoddesc} -\begin{methoddesc}{thread}{threading_algorithm, charset, +\begin{methoddesc}[IMAP4]{thread}{threading_algorithm, charset, search_criterion\optional{, ...}} The \code{thread} command is a variant of \code{search} with threading semantics for the results. Returned data contains a space @@ -448,18 +448,18 @@ This is an \samp{IMAP4rev1} extension command. \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{uid}{command, arg\optional{, ...}} +\begin{methoddesc}[IMAP4]{uid}{command, arg\optional{, ...}} Execute command args with messages identified by UID, rather than message number. Returns response appropriate to command. At least one argument must be supplied; if none are provided, the server will return an error and an exception will be raised. \end{methoddesc} -\begin{methoddesc}{unsubscribe}{mailbox} +\begin{methoddesc}[IMAP4]{unsubscribe}{mailbox} Unsubscribe from old mailbox. \end{methoddesc} -\begin{methoddesc}{xatom}{name\optional{, arg\optional{, ...}}} +\begin{methoddesc}[IMAP4]{xatom}{name\optional{, arg\optional{, ...}}} Allow simple extension commands notified by server in \samp{CAPABILITY} response. \end{methoddesc} @@ -467,7 +467,7 @@ Instances of \class{IMAP4_SSL} have just one additional method: -\begin{methoddesc}{ssl}{} +\begin{methoddesc}[IMAP4_SSL]{ssl}{} Returns SSLObject instance used for the secure connection with the server. \end{methoddesc} @@ -475,12 +475,12 @@ The following attributes are defined on instances of \class{IMAP4}: -\begin{memberdesc}{PROTOCOL_VERSION} +\begin{memberdesc}[IMAP4]{PROTOCOL_VERSION} The most recent supported protocol in the \samp{CAPABILITY} response from the server. \end{memberdesc} -\begin{memberdesc}{debug} +\begin{memberdesc}[IMAP4]{debug} Integer value to control debugging output. The initialize value is taken from the module variable \code{Debug}. Values greater than three trace each command. Modified: python/trunk/Doc/lib/libmailbox.tex ============================================================================== --- python/trunk/Doc/lib/libmailbox.tex (original) +++ python/trunk/Doc/lib/libmailbox.tex Mon Apr 2 00:39:10 2007 @@ -1246,7 +1246,7 @@ Older mailbox objects support only iteration and provide a single public method: -\begin{methoddesc}{next}{} +\begin{methoddesc}[oldmailbox]{next}{} Return the next message in the mailbox, created with the optional \var{factory} argument passed into the mailbox object's constructor. By default this is an \class{rfc822.Message} object (see the \refmodule{rfc822} module). Depending Modified: python/trunk/Doc/lib/libmimetools.tex ============================================================================== --- python/trunk/Doc/lib/libmimetools.tex (original) +++ python/trunk/Doc/lib/libmimetools.tex Mon Apr 2 00:39:10 2007 @@ -76,7 +76,7 @@ The \class{Message} class defines the following methods in addition to the \class{rfc822.Message} methods: -\begin{methoddesc}{getplist}{} +\begin{methoddesc}[Message]{getplist}{} Return the parameter list of the \mailheader{Content-Type} header. This is a list of strings. For parameters of the form \samp{\var{key}=\var{value}}, \var{key} is converted to lower case but @@ -86,34 +86,34 @@ 'spam=2', 'Spam']}. \end{methoddesc} -\begin{methoddesc}{getparam}{name} +\begin{methoddesc}[Message]{getparam}{name} Return the \var{value} of the first parameter (as returned by \method{getplist()}) of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. \end{methoddesc} -\begin{methoddesc}{getencoding}{} +\begin{methoddesc}[Message]{getencoding}{} Return the encoding specified in the \mailheader{Content-Transfer-Encoding} message header. If no such header exists, return \code{'7bit'}. The encoding is converted to lower case. \end{methoddesc} -\begin{methoddesc}{gettype}{} +\begin{methoddesc}[Message]{gettype}{} Return the message type (of the form \samp{\var{type}/\var{subtype}}) as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'text/plain'}. The type is converted to lower case. \end{methoddesc} -\begin{methoddesc}{getmaintype}{} +\begin{methoddesc}[Message]{getmaintype}{} Return the main type as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'text'}. The main type is converted to lower case. \end{methoddesc} -\begin{methoddesc}{getsubtype}{} +\begin{methoddesc}[Message]{getsubtype}{} Return the subtype as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'plain'}. The subtype is converted to lower case. Modified: python/trunk/Doc/lib/libmimetypes.tex ============================================================================== --- python/trunk/Doc/lib/libmimetypes.tex (original) +++ python/trunk/Doc/lib/libmimetypes.tex Mon Apr 2 00:39:10 2007 @@ -178,49 +178,49 @@ \class{MimeTypes} instances provide an interface which is very like that of the \refmodule{mimetypes} module. -\begin{datadesc}{suffix_map} +\begin{memberdesc}[MimeTypes]{suffix_map} Dictionary mapping suffixes to suffixes. This is used to allow recognition of encoded files for which the encoding and the type are indicated by the same extension. For example, the \file{.tgz} extension is mapped to \file{.tar.gz} to allow the encoding and type to be recognized separately. This is initially a copy of the global \code{suffix_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{encodings_map} +\begin{memberdesc}[MimeTypes]{encodings_map} Dictionary mapping filename extensions to encoding types. This is initially a copy of the global \code{encodings_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{types_map} +\begin{memberdesc}[MimeTypes]{types_map} Dictionary mapping filename extensions to MIME types. This is initially a copy of the global \code{types_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{common_types} +\begin{memberdesc}[MimeTypes]{common_types} Dictionary mapping filename extensions to non-standard, but commonly found MIME types. This is initially a copy of the global \code{common_types} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{methoddesc}{guess_extension}{type\optional{, strict}} +\begin{methoddesc}[MimeTypes]{guess_extension}{type\optional{, strict}} Similar to the \function{guess_extension()} function, using the tables stored as part of the object. \end{methoddesc} -\begin{methoddesc}{guess_type}{url\optional{, strict}} +\begin{methoddesc}[MimeTypes]{guess_type}{url\optional{, strict}} Similar to the \function{guess_type()} function, using the tables stored as part of the object. \end{methoddesc} -\begin{methoddesc}{read}{path} +\begin{methoddesc}[MimeTypes]{read}{path} Load MIME information from a file named \var{path}. This uses \method{readfp()} to parse the file. \end{methoddesc} -\begin{methoddesc}{readfp}{file} +\begin{methoddesc}[MimeTypes]{readfp}{file} Load MIME type information from an open file. The file must have the format of the standard \file{mime.types} files. \end{methoddesc} Modified: python/trunk/Doc/lib/libmimewriter.tex ============================================================================== --- python/trunk/Doc/lib/libmimewriter.tex (original) +++ python/trunk/Doc/lib/libmimewriter.tex Mon Apr 2 00:39:10 2007 @@ -31,7 +31,7 @@ \class{MimeWriter} instances have the following methods: -\begin{methoddesc}{addheader}{key, value\optional{, prefix}} +\begin{methoddesc}[MimeWriter]{addheader}{key, value\optional{, prefix}} Add a header line to the MIME message. The \var{key} is the name of the header, where the \var{value} obviously provides the value of the header. The optional argument \var{prefix} determines where the header @@ -39,14 +39,14 @@ the start. The default is to append. \end{methoddesc} -\begin{methoddesc}{flushheaders}{} +\begin{methoddesc}[MimeWriter]{flushheaders}{} Causes all headers accumulated so far to be written out (and forgotten). This is useful if you don't need a body part at all, e.g.\ for a subpart of type \mimetype{message/rfc822} that's (mis)used to store some header-like information. \end{methoddesc} -\begin{methoddesc}{startbody}{ctype\optional{, plist\optional{, prefix}}} +\begin{methoddesc}[MimeWriter]{startbody}{ctype\optional{, plist\optional{, prefix}}} Returns a file-like object which can be used to write to the body of the message. The content-type is set to the provided \var{ctype}, and the optional parameter \var{plist} provides @@ -55,8 +55,8 @@ insert at the start. \end{methoddesc} -\begin{methoddesc}{startmultipartbody}{subtype\optional{, - boundary\optional{, plist\optional{, prefix}}}} +\begin{methoddesc}[MimeWriter]{startmultipartbody}{subtype\optional{, + boundary\optional{, plist\optional{, prefix}}}} Returns a file-like object which can be used to write to the body of the message. Additionally, this method initializes the multi-part code, where \var{subtype} provides the multipart subtype, @@ -66,7 +66,7 @@ created using \method{nextpart()}. \end{methoddesc} -\begin{methoddesc}{nextpart}{} +\begin{methoddesc}[MimeWriter]{nextpart}{} Returns a new instance of \class{MimeWriter} which represents an individual part in a multipart message. This may be used to write the part as well as used for creating recursively complex multipart @@ -74,7 +74,7 @@ \method{startmultipartbody()} before using \method{nextpart()}. \end{methoddesc} -\begin{methoddesc}{lastpart}{} +\begin{methoddesc}[MimeWriter]{lastpart}{} This is used to designate the last part of a multipart message, and should \emph{always} be used when writing multipart messages. \end{methoddesc} Modified: python/trunk/Doc/lib/libmsilib.tex ============================================================================== --- python/trunk/Doc/lib/libmsilib.tex (original) +++ python/trunk/Doc/lib/libmsilib.tex Mon Apr 2 00:39:10 2007 @@ -121,17 +121,17 @@ \subsection{Database Objects\label{database-objects}} -\begin{methoddesc}{OpenView}{sql} +\begin{methoddesc}[Database]{OpenView}{sql} Return a view object, by calling \cfunction{MSIDatabaseOpenView}. \var{sql} is the SQL statement to execute. \end{methoddesc} -\begin{methoddesc}{Commit}{} +\begin{methoddesc}[Database]{Commit}{} Commit the changes pending in the current transaction, by calling \cfunction{MSIDatabaseCommit}. \end{methoddesc} -\begin{methoddesc}{GetSummaryInformation}{count} +\begin{methoddesc}[Database]{GetSummaryInformation}{count} Return a new summary information object, by calling \cfunction{MsiGetSummaryInformation}. \var{count} is the maximum number of updated values. @@ -145,24 +145,24 @@ \subsection{View Objects\label{view-objects}} -\begin{methoddesc}{Execute}{\optional{params=None}} +\begin{methoddesc}[View]{Execute}{\optional{params=None}} Execute the SQL query of the view, through \cfunction{MSIViewExecute}. \var{params} is an optional record describing actual values of the parameter tokens in the query. \end{methoddesc} -\begin{methoddesc}{GetColumnInfo}{kind} +\begin{methoddesc}[View]{GetColumnInfo}{kind} Return a record describing the columns of the view, through calling \cfunction{MsiViewGetColumnInfo}. \var{kind} can be either \code{MSICOLINFO_NAMES} or \code{MSICOLINFO_TYPES}. \end{methoddesc} -\begin{methoddesc}{Fetch}{} +\begin{methoddesc}[View]{Fetch}{} Return a result record of the query, through calling \cfunction{MsiViewFetch}. \end{methoddesc} -\begin{methoddesc}{Modify}{kind, data} +\begin{methoddesc}[View]{Modify}{kind, data} Modify the view, by calling \cfunction{MsiViewModify}. \var{kind} can be one of \code{MSIMODIFY_SEEK}, \code{MSIMODIFY_REFRESH}, \code{MSIMODIFY_INSERT}, \code{MSIMODIFY_UPDATE}, \code{MSIMODIFY_ASSIGN}, @@ -174,7 +174,7 @@ \var{data} must be a record describing the new data. \end{methoddesc} -\begin{methoddesc}{Close}{} +\begin{methoddesc}[View]{Close}{} Close the view, through \cfunction{MsiViewClose}. \end{methoddesc} @@ -188,7 +188,7 @@ \subsection{Summary Information Objects\label{summary-objects}} -\begin{methoddesc}{GetProperty}{field} +\begin{methoddesc}[SummaryInformation]{GetProperty}{field} Return a property of the summary, through \cfunction{MsiSummaryInfoGetProperty}. \var{field} is the name of the property, and can be one of the constants @@ -200,19 +200,19 @@ \code{PID_APPNAME}, or \code{PID_SECURITY}. \end{methoddesc} -\begin{methoddesc}{GetPropertyCount}{} +\begin{methoddesc}[SummaryInformation]{GetPropertyCount}{} Return the number of summary properties, through \cfunction{MsiSummaryInfoGetPropertyCount}. \end{methoddesc} -\begin{methoddesc}{SetProperty}{field, value} +\begin{methoddesc}[SummaryInformation]{SetProperty}{field, value} Set a property through \cfunction{MsiSummaryInfoSetProperty}. \var{field} can have the same values as in \method{GetProperty}, \var{value} is the new value of the property. Possible value types are integer and string. \end{methoddesc} -\begin{methoddesc}{Persist}{} +\begin{methoddesc}[SummaryInformation]{Persist}{} Write the modified properties to the summary information stream, using \cfunction{MsiSummaryInfoPersist}. \end{methoddesc} @@ -226,27 +226,27 @@ \subsection{Record Objects\label{record-objects}} -\begin{methoddesc}{GetFieldCount}{} +\begin{methoddesc}[Record]{GetFieldCount}{} Return the number of fields of the record, through \cfunction{MsiRecordGetFieldCount}. \end{methoddesc} -\begin{methoddesc}{SetString}{field, value} +\begin{methoddesc}[Record]{SetString}{field, value} Set \var{field} to \var{value} through \cfunction{MsiRecordSetString}. \var{field} must be an integer; \var{value} a string. \end{methoddesc} -\begin{methoddesc}{SetStream}{field, value} +\begin{methoddesc}[Record]{SetStream}{field, value} Set \var{field} to the contents of the file named \var{value}, through \cfunction{MsiRecordSetStream}. \var{field} must be an integer; \var{value} a string. \end{methoddesc} -\begin{methoddesc}{SetInteger}{field, value} +\begin{methoddesc}[Record]{SetInteger}{field, value} Set \var{field} to \var{value} through \cfunction{MsiRecordSetInteger}. Both \var{field} and \var{value} must be an integer. \end{methoddesc} -\begin{methoddesc}{ClearData}{} +\begin{methoddesc}[Record]{ClearData}{} Set all fields of the record to 0, through \cfunction{MsiRecordClearData}. \end{methoddesc} @@ -274,7 +274,7 @@ \var{name} is the name of the CAB file in the MSI file. \end{classdesc} -\begin{methoddesc}[CAB]{append}{full, logical} +\begin{methoddesc}[CAB]{append}{full, file, logical} Add the file with the pathname \var{full} to the CAB file, under the name \var{logical}. If there is already a file named \var{logical}, a new file name is created. @@ -283,7 +283,7 @@ new name of the file inside the CAB file. \end{methoddesc} -\begin{methoddesc}[CAB]{append}{database} +\begin{methoddesc}[CAB]{commit}{database} Generate a CAB file, add it as a stream to the MSI file, put it into the \code{Media} table, and remove the generated file from the disk. Modified: python/trunk/Doc/lib/libmultifile.tex ============================================================================== --- python/trunk/Doc/lib/libmultifile.tex (original) +++ python/trunk/Doc/lib/libmultifile.tex Mon Apr 2 00:39:10 2007 @@ -48,7 +48,7 @@ A \class{MultiFile} instance has the following methods: -\begin{methoddesc}{readline}{str} +\begin{methoddesc}[MultiFile]{readline}{str} Read a line. If the line is data (not a section-divider or end-marker or real EOF) return it. If the line matches the most-recently-stacked boundary, return \code{''} and set \code{self.last} to 1 or 0 according as @@ -58,33 +58,33 @@ all boundaries have been popped. \end{methoddesc} -\begin{methoddesc}{readlines}{str} +\begin{methoddesc}[MultiFile]{readlines}{str} Return all lines remaining in this part as a list of strings. \end{methoddesc} -\begin{methoddesc}{read}{} +\begin{methoddesc}[MultiFile]{read}{} Read all lines, up to the next section. Return them as a single (multiline) string. Note that this doesn't take a size argument! \end{methoddesc} -\begin{methoddesc}{seek}{pos\optional{, whence}} +\begin{methoddesc}[MultiFile]{seek}{pos\optional{, whence}} Seek. Seek indices are relative to the start of the current section. The \var{pos} and \var{whence} arguments are interpreted as for a file seek. \end{methoddesc} -\begin{methoddesc}{tell}{} +\begin{methoddesc}[MultiFile]{tell}{} Return the file position relative to the start of the current section. \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[MultiFile]{next}{} Skip lines to the next section (that is, read lines until a section-divider or end-marker has been consumed). Return true if there is such a section, false if an end-marker is seen. Re-enable the most-recently-pushed boundary. \end{methoddesc} -\begin{methoddesc}{is_data}{str} +\begin{methoddesc}[MultiFile]{is_data}{str} Return true if \var{str} is data and false if it might be a section boundary. As written, it tests for a prefix other than \code{'-}\code{-'} at start of line (which all MIME boundaries have) but it is declared so @@ -95,7 +95,7 @@ processing, not cause it to fail. \end{methoddesc} -\begin{methoddesc}{push}{str} +\begin{methoddesc}[MultiFile]{push}{str} Push a boundary string. When a decorated version of this boundary is found as an input line, it will be interpreted as a section-divider or end-marker (depending on the decoration, see \rfc{2045}). All subsequent @@ -108,12 +108,12 @@ boundary will raise an error. \end{methoddesc} -\begin{methoddesc}{pop}{} +\begin{methoddesc}[MultiFile]{pop}{} Pop a section boundary. This boundary will no longer be interpreted as EOF. \end{methoddesc} -\begin{methoddesc}{section_divider}{str} +\begin{methoddesc}[MultiFile]{section_divider}{str} Turn a boundary into a section-divider line. By default, this method prepends \code{'-}\code{-'} (which MIME section boundaries have) but it is declared so it can be overridden in derived classes. This @@ -121,7 +121,7 @@ ignores trailing whitespace. \end{methoddesc} -\begin{methoddesc}{end_marker}{str} +\begin{methoddesc}[MultiFile]{end_marker}{str} Turn a boundary string into an end-marker line. By default, this method prepends \code{'-}\code{-'} and appends \code{'-}\code{-'} (like a MIME-multipart end-of-message marker) but it is declared so it can be @@ -131,11 +131,11 @@ Finally, \class{MultiFile} instances have two public instance variables: -\begin{memberdesc}{level} +\begin{memberdesc}[MultiFile]{level} Nesting depth of the current part. \end{memberdesc} -\begin{memberdesc}{last} +\begin{memberdesc}[MultiFile]{last} True if the last end-of-file was for an end-of-message marker. \end{memberdesc} Modified: python/trunk/Doc/lib/libmutex.tex ============================================================================== --- python/trunk/Doc/lib/libmutex.tex (original) +++ python/trunk/Doc/lib/libmutex.tex Mon Apr 2 00:39:10 2007 @@ -35,23 +35,23 @@ \class{mutex} objects have following methods: -\begin{methoddesc}{test}{} +\begin{methoddesc}[mutex]{test}{} Check whether the mutex is locked. \end{methoddesc} -\begin{methoddesc}{testandset}{} +\begin{methoddesc}[mutex]{testandset}{} ``Atomic'' test-and-set, grab the lock if it is not set, and return \code{True}, otherwise, return \code{False}. \end{methoddesc} -\begin{methoddesc}{lock}{function, argument} +\begin{methoddesc}[mutex]{lock}{function, argument} Execute \code{\var{function}(\var{argument})}, unless the mutex is locked. In the case it is locked, place the function and argument on the queue. See \method{unlock} for explanation of when \code{\var{function}(\var{argument})} is executed in that case. \end{methoddesc} -\begin{methoddesc}{unlock}{} +\begin{methoddesc}[mutex]{unlock}{} Unlock the mutex if queue is empty, otherwise execute the first element in the queue. \end{methoddesc} Modified: python/trunk/Doc/lib/libnetrc.tex ============================================================================== --- python/trunk/Doc/lib/libnetrc.tex (original) +++ python/trunk/Doc/lib/libnetrc.tex Mon Apr 2 00:39:10 2007 @@ -35,7 +35,7 @@ A \class{netrc} instance has the following methods: -\begin{methoddesc}{authenticators}{host} +\begin{methoddesc}[netrc]{authenticators}{host} Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})} of authenticators for \var{host}. If the netrc file did not contain an entry for the given host, return the tuple associated with @@ -43,20 +43,20 @@ available, return \code{None}. \end{methoddesc} -\begin{methoddesc}{__repr__}{} +\begin{methoddesc}[netrc]{__repr__}{} Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) \end{methoddesc} Instances of \class{netrc} have public instance variables: -\begin{memberdesc}{hosts} +\begin{memberdesc}[netrc]{hosts} Dictionary mapping host names to \code{(\var{login}, \var{account}, \var{password})} tuples. The `default' entry, if any, is represented as a pseudo-host by that name. \end{memberdesc} -\begin{memberdesc}{macros} +\begin{memberdesc}[netrc]{macros} Dictionary mapping macro names to string lists. \end{memberdesc} Modified: python/trunk/Doc/lib/libnntplib.tex ============================================================================== --- python/trunk/Doc/lib/libnntplib.tex (original) +++ python/trunk/Doc/lib/libnntplib.tex Mon Apr 2 00:39:10 2007 @@ -121,13 +121,13 @@ the above exceptions. -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[NNTP]{getwelcome}{} Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help information that may be relevant to the user.) \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[NNTP]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of debugging @@ -137,7 +137,7 @@ message text). \end{methoddesc} -\begin{methoddesc}{newgroups}{date, time, \optional{file}} +\begin{methoddesc}[NNTP]{newgroups}{date, time, \optional{file}} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the date, and \var{time} should be a string of the form @@ -152,7 +152,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{newnews}{group, date, time, \optional{file}} +\begin{methoddesc}[NNTP]{newnews}{group, date, time, \optional{file}} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, @@ -165,7 +165,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{list}{\optional{file}} +\begin{methoddesc}[NNTP]{list}{\optional{file}} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the form \code{(\var{group}, \var{last}, \var{first}, \var{flag})}, where @@ -182,7 +182,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{descriptions}{grouppattern} +\begin{methoddesc}[NNTP]{descriptions}{grouppattern} Send a \samp{LIST NEWSGROUPS} command, where \var{grouppattern} is a wildmat string as specified in RFC2980 (it's essentially the same as DOS or UNIX shell wildcard strings). Return a pair \code{(\var{response}, @@ -192,7 +192,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{description}{group} +\begin{methoddesc}[NNTP]{description}{group} Get a description for a single group \var{group}. If more than one group matches (if 'group' is a real wildmat string), return the first match. If no group matches, return an empty string. @@ -203,7 +203,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{group}{name} +\begin{methoddesc}[NNTP]{group}{name} Send a \samp{GROUP} command, where \var{name} is the group name. Return a tuple \code{(\var{response}, \var{count}, \var{first}, \var{last}, \var{name})} where \var{count} is the (estimated) number @@ -212,7 +212,7 @@ \var{name} is the group name. The numbers are returned as strings. \end{methoddesc} -\begin{methoddesc}{help}{\optional{file}} +\begin{methoddesc}[NNTP]{help}{\optional{file}} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. If the \var{file} parameter is supplied, then the output of the @@ -223,7 +223,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{stat}{id} +\begin{methoddesc}[NNTP]{stat}{id} Send a \samp{STAT} command, where \var{id} is the message id (enclosed in \character{<} and \character{>}) or an article number (as a string). Return a triple \code{(\var{response}, \var{number}, \var{id})} where @@ -231,15 +231,15 @@ message id (enclosed in \character{<} and \character{>}). \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[NNTP]{next}{} Send a \samp{NEXT} command. Return as for \method{stat()}. \end{methoddesc} -\begin{methoddesc}{last}{} +\begin{methoddesc}[NNTP]{last}{} Send a \samp{LAST} command. Return as for \method{stat()}. \end{methoddesc} -\begin{methoddesc}{head}{id} +\begin{methoddesc}[NNTP]{head}{id} Send a \samp{HEAD} command, where \var{id} has the same meaning as for \method{stat()}. Return a tuple \code{(\var{response}, \var{number}, \var{id}, \var{list})} @@ -248,7 +248,7 @@ list of lines, without trailing newlines). \end{methoddesc} -\begin{methoddesc}{body}{id,\optional{file}} +\begin{methoddesc}[NNTP]{body}{id,\optional{file}} Send a \samp{BODY} command, where \var{id} has the same meaning as for \method{stat()}. If the \var{file} parameter is supplied, then the body is stored in a file. If \var{file} is a string, then @@ -259,16 +259,16 @@ the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{article}{id} +\begin{methoddesc}[NNTP]{article}{id} Send an \samp{ARTICLE} command, where \var{id} has the same meaning as for \method{stat()}. Return as for \method{head()}. \end{methoddesc} -\begin{methoddesc}{slave}{} +\begin{methoddesc}[NNTP]{slave}{} Send a \samp{SLAVE} command. Return the server's \var{response}. \end{methoddesc} -\begin{methoddesc}{xhdr}{header, string, \optional{file}} +\begin{methoddesc}[NNTP]{xhdr}{header, string, \optional{file}} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header keyword, e.g. \code{'subject'}. The \var{string} argument should have @@ -286,7 +286,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{post}{file} +\begin{methoddesc}[NNTP]{post}{file} Post an article using the \samp{POST} command. The \var{file} argument is an open file object which is read until EOF using its \method{readline()} method. It should be a well-formed news article, @@ -294,14 +294,14 @@ automatically escapes lines beginning with \samp{.}. \end{methoddesc} -\begin{methoddesc}{ihave}{id, file} +\begin{methoddesc}[NNTP]{ihave}{id, file} Send an \samp{IHAVE} command. \var{id} is a message id (enclosed in \character{<} and \character{>}). If the response is not an error, treat \var{file} exactly as for the \method{post()} method. \end{methoddesc} -\begin{methoddesc}{date}{} +\begin{methoddesc}[NNTP]{date}{} Return a triple \code{(\var{response}, \var{date}, \var{time})}, containing the current date and time in a form suitable for the \method{newnews()} and \method{newgroups()} methods. @@ -309,7 +309,7 @@ servers. \end{methoddesc} -\begin{methoddesc}{xgtitle}{name, \optional{file}} +\begin{methoddesc}[NNTP]{xgtitle}{name, \optional{file}} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. @@ -327,7 +327,7 @@ \method{descriptions()} or \method{description()} instead. \end{methoddesc} -\begin{methoddesc}{xover}{start, end, \optional{file}} +\begin{methoddesc}[NNTP]{xover}{start, end, \optional{file}} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} and \var{end} article numbers. Each tuple is of the form @@ -343,13 +343,13 @@ servers. \end{methoddesc} -\begin{methoddesc}{xpath}{id} +\begin{methoddesc}[NNTP]{xpath}{id} Return a pair \code{(\var{resp}, \var{path})}, where \var{path} is the directory path to the article with message ID \var{id}. This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[NNTP]{quit}{} Send a \samp{QUIT} command and close the connection. Once this method has been called, no other methods of the NNTP object should be called. \end{methoddesc} Modified: python/trunk/Doc/lib/libpipes.tex ============================================================================== --- python/trunk/Doc/lib/libpipes.tex (original) +++ python/trunk/Doc/lib/libpipes.tex Mon Apr 2 00:39:10 2007 @@ -39,21 +39,21 @@ Template objects following methods: -\begin{methoddesc}{reset}{} +\begin{methoddesc}[Template]{reset}{} Restore a pipeline template to its initial state. \end{methoddesc} -\begin{methoddesc}{clone}{} +\begin{methoddesc}[Template]{clone}{} Return a new, equivalent, pipeline template. \end{methoddesc} -\begin{methoddesc}{debug}{flag} +\begin{methoddesc}[Template]{debug}{flag} If \var{flag} is true, turn debugging on. Otherwise, turn debugging off. When debugging is on, commands to be executed are printed, and the shell is given \code{set -x} command to be more verbose. \end{methoddesc} -\begin{methoddesc}{append}{cmd, kind} +\begin{methoddesc}[Template]{append}{cmd, kind} Append a new action at the end. The \var{cmd} variable must be a valid bourne shell command. The \var{kind} variable consists of two letters. @@ -68,17 +68,17 @@ the command does not write anything, and hence must be last.) \end{methoddesc} -\begin{methoddesc}{prepend}{cmd, kind} +\begin{methoddesc}[Template]{prepend}{cmd, kind} Add a new action at the beginning. See \method{append()} for explanations of the arguments. \end{methoddesc} -\begin{methoddesc}{open}{file, mode} +\begin{methoddesc}[Template]{open}{file, mode} Return a file-like object, open to \var{file}, but read from or written to by the pipeline. Note that only one of \code{'r'}, \code{'w'} may be given. \end{methoddesc} -\begin{methoddesc}{copy}{infile, outfile} +\begin{methoddesc}[Template]{copy}{infile, outfile} Copy \var{infile} to \var{outfile} through the pipe. \end{methoddesc} Modified: python/trunk/Doc/lib/libpopen2.tex ============================================================================== --- python/trunk/Doc/lib/libpopen2.tex (original) +++ python/trunk/Doc/lib/libpopen2.tex Mon Apr 2 00:39:10 2007 @@ -84,12 +84,12 @@ Instances of the \class{Popen3} and \class{Popen4} classes have the following methods: -\begin{methoddesc}{poll}{} +\begin{methoddesc}[Popen3]{poll}{} Returns \code{-1} if child process hasn't completed yet, or its return code otherwise. \end{methoddesc} -\begin{methoddesc}{wait}{} +\begin{methoddesc}[Popen3]{wait}{} Waits for and returns the status code of the child process. The status code encodes both the return code of the process and information about whether it exited using the \cfunction{exit()} @@ -101,24 +101,24 @@ The following attributes are also available: -\begin{memberdesc}{fromchild} +\begin{memberdesc}[Popen3]{fromchild} A file object that provides output from the child process. For \class{Popen4} instances, this will provide both the standard output and standard error streams. \end{memberdesc} -\begin{memberdesc}{tochild} +\begin{memberdesc}[Popen3]{tochild} A file object that provides input to the child process. \end{memberdesc} -\begin{memberdesc}{childerr} +\begin{memberdesc}[Popen3]{childerr} A file object that provides error output from the child process, if \var{capturestderr} was true for the constructor, otherwise \code{None}. This will always be \code{None} for \class{Popen4} instances. \end{memberdesc} -\begin{memberdesc}{pid} +\begin{memberdesc}[Popen3]{pid} The process ID of the child process. \end{memberdesc} Modified: python/trunk/Doc/lib/libpoplib.tex ============================================================================== --- python/trunk/Doc/lib/libpoplib.tex (original) +++ python/trunk/Doc/lib/libpoplib.tex Mon Apr 2 00:39:10 2007 @@ -73,7 +73,7 @@ An \class{POP3} instance has the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[POP3]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of @@ -82,64 +82,64 @@ logging each line sent and received on the control connection. \end{methoddesc} -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[POP3]{getwelcome}{} Returns the greeting string sent by the POP3 server. \end{methoddesc} -\begin{methoddesc}{user}{username} +\begin{methoddesc}[POP3]{user}{username} Send user command, response should indicate that a password is required. \end{methoddesc} -\begin{methoddesc}{pass_}{password} +\begin{methoddesc}[POP3]{pass_}{password} Send password, response includes message count and mailbox size. Note: the mailbox on the server is locked until \method{quit()} is called. \end{methoddesc} -\begin{methoddesc}{apop}{user, secret} +\begin{methoddesc}[POP3]{apop}{user, secret} Use the more secure APOP authentication to log into the POP3 server. \end{methoddesc} -\begin{methoddesc}{rpop}{user} +\begin{methoddesc}[POP3]{rpop}{user} Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server. \end{methoddesc} -\begin{methoddesc}{stat}{} +\begin{methoddesc}[POP3]{stat}{} Get mailbox status. The result is a tuple of 2 integers: \code{(\var{message count}, \var{mailbox size})}. \end{methoddesc} -\begin{methoddesc}{list}{\optional{which}} +\begin{methoddesc}[POP3]{list}{\optional{which}} Request message list, result is in the form \code{(\var{response}, ['mesg_num octets', ...], \var{octets})}. If \var{which} is set, it is the message to list. \end{methoddesc} -\begin{methoddesc}{retr}{which} +\begin{methoddesc}[POP3]{retr}{which} Retrieve whole message number \var{which}, and set its seen flag. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. \end{methoddesc} -\begin{methoddesc}{dele}{which} +\begin{methoddesc}[POP3]{dele}{which} Flag message number \var{which} for deletion. On most servers deletions are not actually performed until QUIT (the major exception is Eudora QPOP, which deliberately violates the RFCs by doing pending deletes on any disconnect). \end{methoddesc} -\begin{methoddesc}{rset}{} +\begin{methoddesc}[POP3]{rset}{} Remove any deletion marks for the mailbox. \end{methoddesc} -\begin{methoddesc}{noop}{} +\begin{methoddesc}[POP3]{noop}{} Do nothing. Might be used as a keep-alive. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[POP3]{quit}{} Signoff: commit changes, unlock mailbox, drop connection. \end{methoddesc} -\begin{methoddesc}{top}{which, howmuch} +\begin{methoddesc}[POP3]{top}{which, howmuch} Retrieves the message header plus \var{howmuch} lines of the message after the header of message number \var{which}. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. @@ -151,7 +151,7 @@ trusting it. \end{methoddesc} -\begin{methoddesc}{uidl}{\optional{which}} +\begin{methoddesc}[POP3]{uidl}{\optional{which}} Return message digest (unique id) list. If \var{which} is specified, result contains the unique id for that message in the form \code{'\var{response}\ \var{mesgnum}\ \var{uid}}, Modified: python/trunk/Doc/lib/libpprint.tex ============================================================================== --- python/trunk/Doc/lib/libpprint.tex (original) +++ python/trunk/Doc/lib/libpprint.tex Mon Apr 2 00:39:10 2007 @@ -158,12 +158,12 @@ \class{PrettyPrinter} instances have the following methods: -\begin{methoddesc}{pformat}{object} +\begin{methoddesc}[PrettyPrinter]{pformat}{object} Return the formatted representation of \var{object}. This takes into account the options passed to the \class{PrettyPrinter} constructor. \end{methoddesc} -\begin{methoddesc}{pprint}{object} +\begin{methoddesc}[PrettyPrinter]{pprint}{object} Print the formatted representation of \var{object} on the configured stream, followed by a newline. \end{methoddesc} @@ -173,7 +173,7 @@ instance is slightly more efficient since new \class{PrettyPrinter} objects don't need to be created. -\begin{methoddesc}{isreadable}{object} +\begin{methoddesc}[PrettyPrinter]{isreadable}{object} Determine if the formatted representation of the object is ``readable,'' or can be used to reconstruct the value using \function{eval()}\bifuncindex{eval}. Note that this returns false for @@ -182,7 +182,7 @@ this returns false. \end{methoddesc} -\begin{methoddesc}{isrecursive}{object} +\begin{methoddesc}[PrettyPrinter]{isrecursive}{object} Determine if the object requires a recursive representation. \end{methoddesc} @@ -190,7 +190,7 @@ way objects are converted to strings. The default implementation uses the internals of the \function{saferepr()} implementation. -\begin{methoddesc}{format}{object, context, maxlevels, level} +\begin{methoddesc}[PrettyPrinter]{format}{object, context, maxlevels, level} Returns three values: the formatted version of \var{object} as a string, a flag indicating whether the result is readable, and a flag indicating whether recursion was detected. The first argument is the Modified: python/trunk/Doc/lib/libqueue.tex ============================================================================== --- python/trunk/Doc/lib/libqueue.tex (original) +++ python/trunk/Doc/lib/libqueue.tex Mon Apr 2 00:39:10 2007 @@ -45,22 +45,22 @@ is not described here. See the source code for details. The public methods are: -\begin{methoddesc}{qsize}{} +\begin{methoddesc}[Queue]{qsize}{} Return the approximate size of the queue. Because of multithreading semantics, this number is not reliable. \end{methoddesc} -\begin{methoddesc}{empty}{} +\begin{methoddesc}[Queue]{empty}{} Return \code{True} if the queue is empty, \code{False} otherwise. Because of multithreading semantics, this is not reliable. \end{methoddesc} -\begin{methoddesc}{full}{} +\begin{methoddesc}[Queue]{full}{} Return \code{True} if the queue is full, \code{False} otherwise. Because of multithreading semantics, this is not reliable. \end{methoddesc} -\begin{methoddesc}{put}{item\optional{, block\optional{, timeout}}} +\begin{methoddesc}[Queue]{put}{item\optional{, block\optional{, timeout}}} Put \var{item} into the queue. If optional args \var{block} is true and \var{timeout} is None (the default), block if necessary until a free slot is available. If \var{timeout} is a positive number, it @@ -74,11 +74,11 @@ \end{methoddesc} -\begin{methoddesc}{put_nowait}{item} +\begin{methoddesc}[Queue]{put_nowait}{item} Equivalent to \code{put(\var{item}, False)}. \end{methoddesc} -\begin{methoddesc}{get}{\optional{block\optional{, timeout}}} +\begin{methoddesc}[Queue]{get}{\optional{block\optional{, timeout}}} Remove and return an item from the queue. If optional args \var{block} is true and \var{timeout} is None (the default), block if necessary until an item is available. If \var{timeout} is @@ -92,14 +92,14 @@ \end{methoddesc} -\begin{methoddesc}{get_nowait}{} +\begin{methoddesc}[Queue]{get_nowait}{} Equivalent to \code{get(False)}. \end{methoddesc} Two methods are offered to support tracking whether enqueued tasks have been fully processed by daemon consumer threads. -\begin{methoddesc}{task_done}{} +\begin{methoddesc}[Queue]{task_done}{} Indicate that a formerly enqueued task is complete. Used by queue consumer threads. For each \method{get()} used to fetch a task, a subsequent call to \method{task_done()} tells the queue that the processing on the task is complete. @@ -113,7 +113,7 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{join}{} +\begin{methoddesc}[Queue]{join}{} Blocks until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the Modified: python/trunk/Doc/lib/librepr.tex ============================================================================== --- python/trunk/Doc/lib/librepr.tex (original) +++ python/trunk/Doc/lib/librepr.tex Mon Apr 2 00:39:10 2007 @@ -44,18 +44,18 @@ and methods which format specific object types. -\begin{memberdesc}{maxlevel} +\begin{memberdesc}[Repr]{maxlevel} Depth limit on the creation of recursive representations. The default is \code{6}. \end{memberdesc} -\begin{memberdesc}{maxdict} -\memberline{maxlist} -\memberline{maxtuple} -\memberline{maxset} -\memberline{maxfrozenset} -\memberline{maxdeque} -\memberline{maxarray} +\begin{memberdesc}[Repr]{maxdict} +\memberline[Repr]{maxlist} +\memberline[Repr]{maxtuple} +\memberline[Repr]{maxset} +\memberline[Repr]{maxfrozenset} +\memberline[Repr]{maxdeque} +\memberline[Repr]{maxarray} Limits on the number of entries represented for the named object type. The default is \code{4} for \member{maxdict}, \code{5} for \member{maxarray}, and \code{6} for the others. @@ -63,13 +63,13 @@ and \member{set}]{2.4}. \end{memberdesc} -\begin{memberdesc}{maxlong} +\begin{memberdesc}[Repr]{maxlong} Maximum number of characters in the representation for a long integer. Digits are dropped from the middle. The default is \code{40}. \end{memberdesc} -\begin{memberdesc}{maxstring} +\begin{memberdesc}[Repr]{maxstring} Limit on the number of characters in the representation of the string. Note that the ``normal'' representation of the string is used as the character source: if escape sequences are needed in the @@ -77,19 +77,19 @@ shortened. The default is \code{30}. \end{memberdesc} -\begin{memberdesc}{maxother} +\begin{memberdesc}[Repr]{maxother} This limit is used to control the size of object types for which no specific formatting method is available on the \class{Repr} object. It is applied in a similar manner as \member{maxstring}. The default is \code{20}. \end{memberdesc} -\begin{methoddesc}{repr}{obj} +\begin{methoddesc}[Repr]{repr}{obj} The equivalent to the built-in \function{repr()} that uses the formatting imposed by the instance. \end{methoddesc} -\begin{methoddesc}{repr1}{obj, level} +\begin{methoddesc}[Repr]{repr1}{obj, level} Recursive implementation used by \method{repr()}. This uses the type of \var{obj} to determine which formatting method to call, passing it \var{obj} and \var{level}. The type-specific methods @@ -98,7 +98,7 @@ call. \end{methoddesc} -\begin{methoddescni}{repr_\var{type}}{obj, level} +\begin{methoddescni}[Repr]{repr_\var{type}}{obj, level} Formatting methods for specific types are implemented as methods with a name based on the type name. In the method name, \var{type} is replaced by Modified: python/trunk/Doc/lib/librexec.tex ============================================================================== --- python/trunk/Doc/lib/librexec.tex (original) +++ python/trunk/Doc/lib/librexec.tex Mon Apr 2 00:39:10 2007 @@ -89,20 +89,20 @@ \class{RExec} instances support the following methods: -\begin{methoddesc}{r_eval}{code} +\begin{methoddesc}[RExec]{r_eval}{code} \var{code} must either be a string containing a Python expression, or a compiled code object, which will be evaluated in the restricted environment's \module{__main__} module. The value of the expression or code object will be returned. \end{methoddesc} -\begin{methoddesc}{r_exec}{code} +\begin{methoddesc}[RExec]{r_exec}{code} \var{code} must either be a string containing one or more lines of Python code, or a compiled code object, which will be executed in the restricted environment's \module{__main__} module. \end{methoddesc} -\begin{methoddesc}{r_execfile}{filename} +\begin{methoddesc}[RExec]{r_execfile}{filename} Execute the Python code contained in the file \var{filename} in the restricted environment's \module{__main__} module. \end{methoddesc} @@ -112,17 +112,17 @@ restricted versions of the standard I/O streams \code{sys.stdin}, \code{sys.stderr}, and \code{sys.stdout}. -\begin{methoddesc}{s_eval}{code} +\begin{methoddesc}[RExec]{s_eval}{code} \var{code} must be a string containing a Python expression, which will be evaluated in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_exec}{code} +\begin{methoddesc}[RExec]{s_exec}{code} \var{code} must be a string containing one or more lines of Python code, which will be executed in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_execfile}{code} +\begin{methoddesc}[RExec]{s_execfile}{code} Execute the Python code contained in the file \var{filename} in the restricted environment. \end{methoddesc} @@ -132,13 +132,13 @@ Overriding these methods in a subclass is used to change the policies enforced by a restricted environment. -\begin{methoddesc}{r_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{r_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{r_open}{filename\optional{, mode\optional{, bufsize}}} +\begin{methoddesc}[RExec]{r_open}{filename\optional{, mode\optional{, bufsize}}} Method called when \function{open()} is called in the restricted environment. The arguments are identical to those of \function{open()}, and a file object (or a class instance compatible with file objects) @@ -148,28 +148,28 @@ \method{r_open()}. \end{methoddesc} -\begin{methoddesc}{r_reload}{module} +\begin{methoddesc}[RExec]{r_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{r_unload}{module} +\begin{methoddesc}[RExec]{r_unload}{module} Unload the module object \var{module} (remove it from the restricted environment's \code{sys.modules} dictionary). \end{methoddesc} And their equivalents with access to restricted standard I/O streams: -\begin{methoddesc}{s_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{s_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{s_reload}{module} +\begin{methoddesc}[RExec]{s_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{s_unload}{module} +\begin{methoddesc}[RExec]{s_unload}{module} Unload the module object \var{module}. % XXX what are the semantics of this? \end{methoddesc} @@ -184,7 +184,7 @@ Instances of the new class will then use those new values. All these attributes are tuples of strings. -\begin{memberdesc}{nok_builtin_names} +\begin{memberdesc}[RExec]{nok_builtin_names} Contains the names of built-in functions which will \emph{not} be available to programs running in the restricted environment. The value for \class{RExec} is \code{('open', 'reload', '__import__')}. @@ -196,7 +196,7 @@ this module.) \end{memberdesc} -\begin{memberdesc}{ok_builtin_modules} +\begin{memberdesc}[RExec]{ok_builtin_modules} Contains the names of built-in modules which can be safely imported. The value for \class{RExec} is \code{('audioop', 'array', 'binascii', 'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator', @@ -205,14 +205,14 @@ applies --- use the value from the base class as a starting point. \end{memberdesc} -\begin{memberdesc}{ok_path} +\begin{memberdesc}[RExec]{ok_path} Contains the directories which will be searched when an \keyword{import} is performed in the restricted environment. The value for \class{RExec} is the same as \code{sys.path} (at the time the module is loaded) for unrestricted code. \end{memberdesc} -\begin{memberdesc}{ok_posix_names} +\begin{memberdesc}[RExec]{ok_posix_names} % Should this be called ok_os_names? Contains the names of the functions in the \refmodule{os} module which will be available to programs running in the restricted environment. The @@ -221,14 +221,14 @@ 'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid')}. \end{memberdesc} -\begin{memberdesc}{ok_sys_names} +\begin{memberdesc}[RExec]{ok_sys_names} Contains the names of the functions and variables in the \refmodule{sys} module which will be available to programs running in the restricted environment. The value for \class{RExec} is \code{('ps1', 'ps2', 'copyright', 'version', 'platform', 'exit', 'maxint')}. \end{memberdesc} -\begin{memberdesc}{ok_file_types} +\begin{memberdesc}[RExec]{ok_file_types} Contains the file types from which modules are allowed to be loaded. Each file type is an integer constant defined in the \refmodule{imp} module. The meaningful values are \constant{PY_SOURCE}, \constant{PY_COMPILED}, and Modified: python/trunk/Doc/lib/librfc822.tex ============================================================================== --- python/trunk/Doc/lib/librfc822.tex (original) +++ python/trunk/Doc/lib/librfc822.tex Mon Apr 2 00:39:10 2007 @@ -142,12 +142,12 @@ A \class{Message} instance has the following methods: -\begin{methoddesc}{rewindbody}{} +\begin{methoddesc}[Message]{rewindbody}{} Seek to the start of the message body. This only works if the file object is seekable. \end{methoddesc} -\begin{methoddesc}{isheader}{line} +\begin{methoddesc}[Message]{isheader}{line} Returns a line's canonicalized fieldname (the dictionary key that will be used to index it) if the line is a legal \rfc{2822} header; otherwise returns \code{None} (implying that parsing should stop here and the @@ -155,33 +155,33 @@ override this method in a subclass. \end{methoddesc} -\begin{methoddesc}{islast}{line} +\begin{methoddesc}[Message]{islast}{line} Return true if the given line is a delimiter on which Message should stop. The delimiter line is consumed, and the file object's read location positioned immediately after it. By default this method just checks that the line is blank, but you can override it in a subclass. \end{methoddesc} -\begin{methoddesc}{iscomment}{line} +\begin{methoddesc}[Message]{iscomment}{line} Return \code{True} if the given line should be ignored entirely, just skipped. By default this is a stub that always returns \code{False}, but you can override it in a subclass. \end{methoddesc} -\begin{methoddesc}{getallmatchingheaders}{name} +\begin{methoddesc}[Message]{getallmatchingheaders}{name} Return a list of lines consisting of all headers matching \var{name}, if any. Each physical line, whether it is a continuation line or not, is a separate list item. Return the empty list if no header matches \var{name}. \end{methoddesc} -\begin{methoddesc}{getfirstmatchingheader}{name} +\begin{methoddesc}[Message]{getfirstmatchingheader}{name} Return a list of lines comprising the first header matching \var{name}, and its continuation line(s), if any. Return \code{None} if there is no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{getrawheader}{name} +\begin{methoddesc}[Message]{getrawheader}{name} Return a single string consisting of the text after the colon in the first header matching \var{name}. This includes leading whitespace, the trailing linefeed, and internal linefeeds and whitespace if there @@ -189,19 +189,19 @@ no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{getheader}{name\optional{, default}} +\begin{methoddesc}[Message]{getheader}{name\optional{, default}} Like \code{getrawheader(\var{name})}, but strip leading and trailing whitespace. Internal whitespace is not stripped. The optional \var{default} argument can be used to specify a different default to be returned when there is no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{get}{name\optional{, default}} +\begin{methoddesc}[Message]{get}{name\optional{, default}} An alias for \method{getheader()}, to make the interface more compatible with regular dictionaries. \end{methoddesc} -\begin{methoddesc}{getaddr}{name} +\begin{methoddesc}[Message]{getaddr}{name} Return a pair \code{(\var{full name}, \var{email address})} parsed from the string returned by \code{getheader(\var{name})}. If no header matching \var{name} exists, return \code{(None, None)}; @@ -217,7 +217,7 @@ exact same result. \end{methoddesc} -\begin{methoddesc}{getaddrlist}{name} +\begin{methoddesc}[Message]{getaddrlist}{name} This is similar to \code{getaddr(\var{list})}, but parses a header containing a list of email addresses (e.g.\ a \mailheader{To} header) and returns a list of \code{(\var{full name}, \var{email address})} pairs @@ -229,7 +229,7 @@ Any continuation lines the named headers contain are also parsed. \end{methoddesc} -\begin{methoddesc}{getdate}{name} +\begin{methoddesc}[Message]{getdate}{name} Retrieve a header using \method{getheader()} and parse it into a 9-tuple compatible with \function{time.mktime()}; note that fields 6, 7, and 8 are not usable. If there is no header matching @@ -241,7 +241,7 @@ function may occasionally yield an incorrect result. \end{methoddesc} -\begin{methoddesc}{getdate_tz}{name} +\begin{methoddesc}[Message]{getdate_tz}{name} Retrieve a header using \method{getheader()} and parse it into a 10-tuple; the first 9 elements will make a tuple compatible with \function{time.mktime()}, and the 10th is a number giving the offset @@ -270,19 +270,19 @@ Finally, \class{Message} instances have some public instance variables: -\begin{memberdesc}{headers} +\begin{memberdesc}[Message]{headers} A list containing the entire set of header lines, in the order in which they were read (except that setitem calls may disturb this order). Each line contains a trailing newline. The blank line terminating the headers is not contained in the list. \end{memberdesc} -\begin{memberdesc}{fp} +\begin{memberdesc}[Message]{fp} The file or file-like object passed at instantiation time. This can be used to read the message content. \end{memberdesc} -\begin{memberdesc}{unixfrom} +\begin{memberdesc}[Message]{unixfrom} The \UNIX{} \samp{From~} line, if the message had one, or an empty string. This is needed to regenerate the message in some contexts, such as an \code{mbox}-style mailbox file. @@ -293,34 +293,34 @@ An \class{AddressList} instance has the following methods: -\begin{methoddesc}{__len__}{} +\begin{methoddesc}[AddressList]{__len__}{} Return the number of addresses in the address list. \end{methoddesc} -\begin{methoddesc}{__str__}{} +\begin{methoddesc}[AddressList]{__str__}{} Return a canonicalized string representation of the address list. Addresses are rendered in "name" form, comma-separated. \end{methoddesc} -\begin{methoddesc}{__add__}{alist} +\begin{methoddesc}[AddressList]{__add__}{alist} Return a new \class{AddressList} instance that contains all addresses in both \class{AddressList} operands, with duplicates removed (set union). \end{methoddesc} -\begin{methoddesc}{__iadd__}{alist} +\begin{methoddesc}[AddressList]{__iadd__}{alist} In-place version of \method{__add__()}; turns this \class{AddressList} instance into the union of itself and the right-hand instance, \var{alist}. \end{methoddesc} -\begin{methoddesc}{__sub__}{alist} +\begin{methoddesc}[AddressList]{__sub__}{alist} Return a new \class{AddressList} instance that contains every address in the left-hand \class{AddressList} operand that is not present in the right-hand address operand (set difference). \end{methoddesc} -\begin{methoddesc}{__isub__}{alist} +\begin{methoddesc}[AddressList]{__isub__}{alist} In-place version of \method{__sub__()}, removing addresses in this list which are also in \var{alist}. \end{methoddesc} @@ -328,7 +328,7 @@ Finally, \class{AddressList} instances have one public instance variable: -\begin{memberdesc}{addresslist} +\begin{memberdesc}[AddressList]{addresslist} A list of tuple string pairs, one per address. In each member, the first is the canonicalized name part, the second is the actual route-address (\character{@}-separated username-host.domain Modified: python/trunk/Doc/lib/libsched.tex ============================================================================== --- python/trunk/Doc/lib/libsched.tex (original) +++ python/trunk/Doc/lib/libsched.tex Mon Apr 2 00:39:10 2007 @@ -48,7 +48,7 @@ \class{scheduler} instances have the following methods: -\begin{methoddesc}{enterabs}{time, priority, action, argument} +\begin{methoddesc}[scheduler]{enterabs}{time, priority, action, argument} Schedule a new event. The \var{time} argument should be a numeric type compatible with the return value of the \var{timefunc} function passed to the constructor. Events scheduled for @@ -63,23 +63,23 @@ the event (see \method{cancel()}). \end{methoddesc} -\begin{methoddesc}{enter}{delay, priority, action, argument} +\begin{methoddesc}[scheduler]{enter}{delay, priority, action, argument} Schedule an event for \var{delay} more time units. Other then the relative time, the other arguments, the effect and the return value are the same as those for \method{enterabs()}. \end{methoddesc} -\begin{methoddesc}{cancel}{event} +\begin{methoddesc}[scheduler]{cancel}{event} Remove the event from the queue. If \var{event} is not an event currently in the queue, this method will raise a \exception{RuntimeError}. \end{methoddesc} -\begin{methoddesc}{empty}{} +\begin{methoddesc}[scheduler]{empty}{} Return true if the event queue is empty. \end{methoddesc} -\begin{methoddesc}{run}{} +\begin{methoddesc}[scheduler]{run}{} Run all scheduled events. This function will wait (using the \function{delayfunc} function passed to the constructor) for the next event, then execute it and so on until there are no more Modified: python/trunk/Doc/lib/libshlex.tex ============================================================================== --- python/trunk/Doc/lib/libshlex.tex (original) +++ python/trunk/Doc/lib/libshlex.tex Mon Apr 2 00:39:10 2007 @@ -58,7 +58,7 @@ A \class{shlex} instance has the following methods: -\begin{methoddesc}{get_token}{} +\begin{methoddesc}[shlex]{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate @@ -66,17 +66,17 @@ in non-\POSIX{} mode, and \code{None} in \POSIX{} mode). \end{methoddesc} -\begin{methoddesc}{push_token}{str} +\begin{methoddesc}[shlex]{push_token}{str} Push the argument onto the token stack. \end{methoddesc} -\begin{methoddesc}{read_token}{} +\begin{methoddesc}[shlex]{read_token}{} Read a raw token. Ignore the pushback stack, and do not interpret source requests. (This is not ordinarily a useful entry point, and is documented here only for the sake of completeness.) \end{methoddesc} -\begin{methoddesc}{sourcehook}{filename} +\begin{methoddesc}[shlex]{sourcehook}{filename} When \class{shlex} detects a source request (see \member{source} below) this method is given the following token as argument, and expected to return a tuple consisting of a filename and @@ -106,7 +106,7 @@ \method{push_source()} and \method{pop_source()} methods. \end{methoddesc} -\begin{methoddesc}{push_source}{stream\optional{, filename}} +\begin{methoddesc}[shlex]{push_source}{stream\optional{, filename}} Push an input source stream onto the input stack. If the filename argument is specified it will later be available for use in error messages. This is the same method used internally by the @@ -114,14 +114,14 @@ \versionadded{2.1} \end{methoddesc} -\begin{methoddesc}{pop_source}{} +\begin{methoddesc}[shlex]{pop_source}{} Pop the last-pushed input source from the input stack. This is the same method used internally when the lexer reaches \EOF{} on a stacked input stream. \versionadded{2.1} \end{methoddesc} -\begin{methoddesc}{error_leader}{\optional{file\optional{, line}}} +\begin{methoddesc}[shlex]{error_leader}{\optional{file\optional{, line}}} This method generates an error message leader in the format of a \UNIX{} C compiler error label; the format is \code{'"\%s", line \%d: '}, where the \samp{\%s} is replaced with the name of the current source @@ -137,63 +137,63 @@ variables which either control lexical analysis or can be used for debugging: -\begin{memberdesc}{commenters} +\begin{memberdesc}[shlex]{commenters} The string of characters that are recognized as comment beginners. All characters from the comment beginner to end of line are ignored. Includes just \character{\#} by default. \end{memberdesc} -\begin{memberdesc}{wordchars} +\begin{memberdesc}[shlex]{wordchars} The string of characters that will accumulate into multi-character tokens. By default, includes all \ASCII{} alphanumerics and underscore. \end{memberdesc} -\begin{memberdesc}{whitespace} +\begin{memberdesc}[shlex]{whitespace} Characters that will be considered whitespace and skipped. Whitespace bounds tokens. By default, includes space, tab, linefeed and carriage-return. \end{memberdesc} -\begin{memberdesc}{escape} +\begin{memberdesc}[shlex]{escape} Characters that will be considered as escape. This will be only used in \POSIX{} mode, and includes just \character{\textbackslash} by default. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{quotes} +\begin{memberdesc}[shlex]{quotes} Characters that will be considered string quotes. The token accumulates until the same quote is encountered again (thus, different quote types protect each other as in the shell.) By default, includes \ASCII{} single and double quotes. \end{memberdesc} -\begin{memberdesc}{escapedquotes} +\begin{memberdesc}[shlex]{escapedquotes} Characters in \member{quotes} that will interpret escape characters defined in \member{escape}. This is only used in \POSIX{} mode, and includes just \character{"} by default. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{whitespace_split} +\begin{memberdesc}[shlex]{whitespace_split} If \code{True}, tokens will only be split in whitespaces. This is useful, for example, for parsing command lines with \class{shlex}, getting tokens in a similar way to shell arguments. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{infile} +\begin{memberdesc}[shlex]{infile} The name of the current input file, as initially set at class instantiation time or stacked by later source requests. It may be useful to examine this when constructing error messages. \end{memberdesc} -\begin{memberdesc}{instream} +\begin{memberdesc}[shlex]{instream} The input stream from which this \class{shlex} instance is reading characters. \end{memberdesc} -\begin{memberdesc}{source} +\begin{memberdesc}[shlex]{source} This member is \code{None} by default. If you assign a string to it, that string will be recognized as a lexical-level inclusion request similar to the \samp{source} keyword in various shells. That is, the @@ -204,23 +204,23 @@ number of levels deep. \end{memberdesc} -\begin{memberdesc}{debug} +\begin{memberdesc}[shlex]{debug} If this member is numeric and \code{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. \end{memberdesc} -\begin{memberdesc}{lineno} +\begin{memberdesc}[shlex]{lineno} Source line number (count of newlines seen so far plus one). \end{memberdesc} -\begin{memberdesc}{token} +\begin{memberdesc}[shlex]{token} The token buffer. It may be useful to examine this when catching exceptions. \end{memberdesc} -\begin{memberdesc}{eof} +\begin{memberdesc}[shlex]{eof} Token used to determine end of file. This will be set to the empty string (\code{''}), in non-\POSIX{} mode, and to \code{None} in \POSIX{} mode. Modified: python/trunk/Doc/lib/libsimplexmlrpc.tex ============================================================================== --- python/trunk/Doc/lib/libsimplexmlrpc.tex (original) +++ python/trunk/Doc/lib/libsimplexmlrpc.tex Mon Apr 2 00:39:10 2007 @@ -108,13 +108,13 @@ \end{methoddesc} -\begin{methoddesc}{register_introspection_functions}{} +\begin{methoddesc}[SimpleXMLRPCServer]{register_introspection_functions}{} Registers the XML-RPC introspection functions \code{system.listMethods}, \code{system.methodHelp} and \code{system.methodSignature}. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{register_multicall_functions}{} +\begin{methoddesc}[SimpleXMLRPCServer]{register_multicall_functions}{} Registers the XML-RPC multicall function system.multicall. \end{methoddesc} @@ -178,7 +178,7 @@ The \class{CGIXMLRPCRequestHandler} class can be used to handle XML-RPC requests sent to Python CGI scripts. -\begin{methoddesc}{register_function}{function\optional{, name}} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_function}{function\optional{, name}} Register a function that can respond to XML-RPC requests. If \var{name} is given, it will be the method name associated with function, otherwise \var{function.__name__} will be used. \var{name} @@ -187,7 +187,7 @@ character. \end{methoddesc} -\begin{methoddesc}{register_instance}{instance} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_instance}{instance} Register an object which is used to expose method names which have not been registered using \method{register_function()}. If instance contains a \method{_dispatch()} method, it is called with the @@ -203,17 +203,17 @@ back to the client. \end{methoddesc} -\begin{methoddesc}{register_introspection_functions}{} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_introspection_functions}{} Register the XML-RPC introspection functions \code{system.listMethods}, \code{system.methodHelp} and \code{system.methodSignature}. \end{methoddesc} -\begin{methoddesc}{register_multicall_functions}{} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_multicall_functions}{} Register the XML-RPC multicall function \code{system.multicall}. \end{methoddesc} -\begin{methoddesc}{handle_request}{\optional{request_text = None}} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{handle_request}{\optional{request_text = None}} Handle a XML-RPC request. If \var{request_text} is given, it should be the POST data provided by the HTTP server, otherwise the contents of stdin will be used. Modified: python/trunk/Doc/lib/libsmtplib.tex ============================================================================== --- python/trunk/Doc/lib/libsmtplib.tex (original) +++ python/trunk/Doc/lib/libsmtplib.tex Mon Apr 2 00:39:10 2007 @@ -126,13 +126,13 @@ An \class{SMTP} instance has the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[SMTP]{set_debuglevel}{level} Set the debug output level. A true value for \var{level} results in debug messages for connection and for all messages sent to and received from the server. \end{methoddesc} -\begin{methoddesc}{connect}{\optional{host\optional{, port}}} +\begin{methoddesc}[SMTP]{connect}{\optional{host\optional{, port}}} Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (\character{:}) followed by a @@ -142,7 +142,7 @@ host is specified during instantiation. \end{methoddesc} -\begin{methoddesc}{docmd}{cmd, \optional{, argstring}} +\begin{methoddesc}[SMTP]{docmd}{cmd, \optional{, argstring}} Send a command \var{cmd} to the server. The optional argument \var{argstring} is simply concatenated to the command, separated by a space. @@ -159,7 +159,7 @@ \exception{SMTPServerDisconnected} will be raised. \end{methoddesc} -\begin{methoddesc}{helo}{\optional{hostname}} +\begin{methoddesc}[SMTP]{helo}{\optional{hostname}} Identify yourself to the SMTP server using \samp{HELO}. The hostname argument defaults to the fully qualified domain name of the local host. @@ -169,7 +169,7 @@ when necessary. \end{methoddesc} -\begin{methoddesc}{ehlo}{\optional{hostname}} +\begin{methoddesc}[SMTP]{ehlo}{\optional{hostname}} Identify yourself to an ESMTP server using \samp{EHLO}. The hostname argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by @@ -180,13 +180,13 @@ will be implicitly called by \method{sendmail()} when necessary. \end{methoddesc} -\begin{methoddesc}{has_extn}{name} +\begin{methoddesc}[SMTP]{has_extn}{name} Return \constant{True} if \var{name} is in the set of SMTP service extensions returned by the server, \constant{False} otherwise. Case is ignored. \end{methoddesc} -\begin{methoddesc}{verify}{address} +\begin{methoddesc}[SMTP]{verify}{address} Check the validity of an address on this server using SMTP \samp{VRFY}. Returns a tuple consisting of code 250 and a full \rfc{822} address (including human name) if the user address is valid. Otherwise returns @@ -195,7 +195,7 @@ \note{Many sites disable SMTP \samp{VRFY} in order to foil spammers.} \end{methoddesc} -\begin{methoddesc}{login}{user, password} +\begin{methoddesc}[SMTP]{login}{user, password} Log in on an SMTP server that requires authentication. The arguments are the username and the password to authenticate with. If there has been no previous \samp{EHLO} or \samp{HELO} command this @@ -213,7 +213,7 @@ \end{description} \end{methoddesc} -\begin{methoddesc}{starttls}{\optional{keyfile\optional{, certfile}}} +\begin{methoddesc}[SMTP]{starttls}{\optional{keyfile\optional{, certfile}}} Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that follow will be encrypted. You should then call \method{ehlo()} again. @@ -222,8 +222,8 @@ the \refmodule{socket} module's \function{ssl()} function. \end{methoddesc} -\begin{methoddesc}{sendmail}{from_addr, to_addrs, msg\optional{, - mail_options, rcpt_options}} +\begin{methoddesc}[SMTP]{sendmail}{from_addr, to_addrs, msg\optional{, + mail_options, rcpt_options}} Send mail. The required arguments are an \rfc{822} from-address string, a list of \rfc{822} to-address strings (a bare string will be treated as a list with 1 address), and a message string. The caller @@ -279,7 +279,7 @@ \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[SMTP]{quit}{} Terminate the SMTP session and close the connection. \end{methoddesc} Modified: python/trunk/Doc/lib/libsubprocess.tex ============================================================================== --- python/trunk/Doc/lib/libsubprocess.tex (original) +++ python/trunk/Doc/lib/libsubprocess.tex Mon Apr 2 00:39:10 2007 @@ -176,16 +176,16 @@ Instances of the \class{Popen} class have the following methods: -\begin{methoddesc}{poll}{} +\begin{methoddesc}[Popen]{poll}{} Check if child process has terminated. Returns returncode attribute. \end{methoddesc} -\begin{methoddesc}{wait}{} +\begin{methoddesc}[Popen]{wait}{} Wait for child process to terminate. Returns returncode attribute. \end{methoddesc} -\begin{methoddesc}{communicate}{input=None} +\begin{methoddesc}[Popen]{communicate}{input=None} Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional \var{input} argument should be a string to be sent to the @@ -199,29 +199,29 @@ The following attributes are also available: -\begin{memberdesc}{stdin} +\begin{memberdesc}[Popen]{stdin} If the \var{stdin} argument is \code{PIPE}, this attribute is a file object that provides input to the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{stdout} +\begin{memberdesc}[Popen]{stdout} If the \var{stdout} argument is \code{PIPE}, this attribute is a file object that provides output from the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{stderr} +\begin{memberdesc}[Popen]{stderr} If the \var{stderr} argument is \code{PIPE}, this attribute is file object that provides error output from the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{pid} +\begin{memberdesc}[Popen]{pid} The process ID of the child process. \end{memberdesc} -\begin{memberdesc}{returncode} +\begin{memberdesc}[Popen]{returncode} The child return code. A \code{None} value indicates that the process hasn't terminated yet. A negative value -N indicates that the child was terminated by signal N (\UNIX{} only). Modified: python/trunk/Doc/lib/libtelnetlib.tex ============================================================================== --- python/trunk/Doc/lib/libtelnetlib.tex (original) +++ python/trunk/Doc/lib/libtelnetlib.tex Mon Apr 2 00:39:10 2007 @@ -55,7 +55,7 @@ \class{Telnet} instances have the following methods: -\begin{methoddesc}{read_until}{expected\optional{, timeout}} +\begin{methoddesc}[Telnet]{read_until}{expected\optional{, timeout}} Read until a given string, \var{expected}, is encountered or until \var{timeout} seconds have passed. @@ -64,17 +64,17 @@ is closed and no cooked data is available. \end{methoddesc} -\begin{methoddesc}{read_all}{} +\begin{methoddesc}[Telnet]{read_all}{} Read all data until \EOF; block until connection closed. \end{methoddesc} -\begin{methoddesc}{read_some}{} +\begin{methoddesc}[Telnet]{read_some}{} Read at least one byte of cooked data unless \EOF{} is hit. Return \code{''} if \EOF{} is hit. Block if no data is immediately available. \end{methoddesc} -\begin{methoddesc}{read_very_eager}{} +\begin{methoddesc}[Telnet]{read_very_eager}{} Read everything that can be without blocking in I/O (eager). Raise \exception{EOFError} if connection closed and no cooked data @@ -82,7 +82,7 @@ Do not block unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_eager}{} +\begin{methoddesc}[Telnet]{read_eager}{} Read readily available data. Raise \exception{EOFError} if connection closed and no cooked data @@ -90,7 +90,7 @@ Do not block unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_lazy}{} +\begin{methoddesc}[Telnet]{read_lazy}{} Process and return data already in the queues (lazy). Raise \exception{EOFError} if connection closed and no data available. @@ -98,7 +98,7 @@ unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_very_lazy}{} +\begin{methoddesc}[Telnet]{read_very_lazy}{} Return any data available in the cooked queue (very lazy). Raise \exception{EOFError} if connection closed and no data available. @@ -106,7 +106,7 @@ never blocks. \end{methoddesc} -\begin{methoddesc}{read_sb_data}{} +\begin{methoddesc}[Telnet]{read_sb_data}{} Return the data collected between a SB/SE pair (suboption begin/end). The callback should access these data when it was invoked with a \code{SE} command. This method never blocks. @@ -114,7 +114,7 @@ \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{open}{host\optional{, port\optional{, timeout}}} +\begin{methoddesc}[Telnet]{open}{host\optional{, port\optional{, timeout}}} Connect to a host. The optional second argument is the port number, which defaults to the standard Telnet port (23). @@ -125,44 +125,44 @@ Do not try to reopen an already connected instance. \end{methoddesc} -\begin{methoddesc}{msg}{msg\optional{, *args}} +\begin{methoddesc}[Telnet]{msg}{msg\optional{, *args}} Print a debug message when the debug level is \code{>} 0. If extra arguments are present, they are substituted in the message using the standard string formatting operator. \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{debuglevel} +\begin{methoddesc}[Telnet]{set_debuglevel}{debuglevel} Set the debug level. The higher the value of \var{debuglevel}, the more debug output you get (on \code{sys.stdout}). \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Telnet]{close}{} Close the connection. \end{methoddesc} -\begin{methoddesc}{get_socket}{} +\begin{methoddesc}[Telnet]{get_socket}{} Return the socket object used internally. \end{methoddesc} -\begin{methoddesc}{fileno}{} +\begin{methoddesc}[Telnet]{fileno}{} Return the file descriptor of the socket object used internally. \end{methoddesc} -\begin{methoddesc}{write}{buffer} +\begin{methoddesc}[Telnet]{write}{buffer} Write a string to the socket, doubling any IAC characters. This can block if the connection is blocked. May raise \exception{socket.error} if the connection is closed. \end{methoddesc} -\begin{methoddesc}{interact}{} +\begin{methoddesc}[Telnet]{interact}{} Interaction function, emulates a very dumb Telnet client. \end{methoddesc} -\begin{methoddesc}{mt_interact}{} +\begin{methoddesc}[Telnet]{mt_interact}{} Multithreaded version of \method{interact()}. \end{methoddesc} -\begin{methoddesc}{expect}{list\optional{, timeout}} +\begin{methoddesc}[Telnet]{expect}{list\optional{, timeout}} Read until one from a list of a regular expressions matches. The first argument is a list of regular expressions, either @@ -184,7 +184,7 @@ results are indeterministic, and may depend on the I/O timing. \end{methoddesc} -\begin{methoddesc}{set_option_negotiation_callback}{callback} +\begin{methoddesc}[Telnet]{set_option_negotiation_callback}{callback} Each time a telnet option is read on the input flow, this \var{callback} (if set) is called with the following parameters : callback(telnet socket, command (DO/DONT/WILL/WONT), option). No other Modified: python/trunk/Doc/lib/libthreading.tex ============================================================================== --- python/trunk/Doc/lib/libthreading.tex (original) +++ python/trunk/Doc/lib/libthreading.tex Mon Apr 2 00:39:10 2007 @@ -20,11 +20,11 @@ \function{enumerate()}. \end{funcdesc} -\begin{funcdesc}{Condition}{} +\begin{funcdescni}{Condition}{} A factory function that returns a new condition variable object. A condition variable allows one or more threads to wait until they are notified by another thread. -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{currentThread}{} Return the current \class{Thread} object, corresponding to the @@ -41,12 +41,12 @@ terminated threads and threads that have not yet been started. \end{funcdesc} -\begin{funcdesc}{Event}{} +\begin{funcdescni}{Event}{} A factory function that returns a new event object. An event manages a flag that can be set to true with the \method{set()} method and reset to false with the \method{clear()} method. The \method{wait()} method blocks until the flag is true. -\end{funcdesc} +\end{funcdescni} \begin{classdesc*}{local}{} A class that represents thread-local data. Thread-local data are data @@ -81,14 +81,14 @@ for each time it has acquired it. \end{funcdesc} -\begin{funcdesc}{Semaphore}{\optional{value}} +\begin{funcdescni}{Semaphore}{\optional{value}} A factory function that returns a new semaphore object. A semaphore manages a counter representing the number of \method{release()} calls minus the number of \method{acquire()} calls, plus an initial value. The \method{acquire()} method blocks if necessary until it can return without making the counter negative. If not given, \var{value} defaults to 1. -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{BoundedSemaphore}{\optional{value}} A factory function that returns a new bounded semaphore object. A bounded @@ -99,12 +99,12 @@ \var{value} defaults to 1. \end{funcdesc} -\begin{classdesc*}{Thread}{} +\begin{classdesc*}{Thread} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. \end{classdesc*} -\begin{classdesc*}{Timer}{} +\begin{classdesc*}{Timer} A thread that executes a function after a specified interval has passed. \end{classdesc*} @@ -182,7 +182,7 @@ All methods are executed atomically. -\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}} +\begin{methoddesc}[Lock]{acquire}{\optional{blocking\code{ = 1}}} Acquire a lock, blocking or non-blocking. When invoked without arguments, block until the lock is @@ -197,7 +197,7 @@ without arguments, and return true. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[Lock]{release}{} Release a lock. When the lock is locked, reset it to unlocked, and return. If @@ -227,7 +227,7 @@ pair) resets the lock to unlocked and allows another thread blocked in \method{acquire()} to proceed. -\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}} +\begin{methoddesc}[RLock]{acquire}{\optional{blocking\code{ = 1}}} Acquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns @@ -249,7 +249,7 @@ without arguments, and return true. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[RLock]{release}{} Release a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to Modified: python/trunk/Doc/lib/libturtle.tex ============================================================================== --- python/trunk/Doc/lib/libturtle.tex (original) +++ python/trunk/Doc/lib/libturtle.tex Mon Apr 2 00:39:10 2007 @@ -261,7 +261,7 @@ \function{degrees()}, which takes an optional argument letting you specify the number of units corresponding to a full circle: -\begin{methoddesc}{degrees}{\optional{fullcircle}} +\begin{methoddesc}[Turtle]{degrees}{\optional{fullcircle}} \var{fullcircle} is by default 360. This can cause the pen to have any angular units whatever: give \var{fullcircle} 2*$\pi$ for radians, or 400 for gradians. Modified: python/trunk/Doc/lib/libunittest.tex ============================================================================== --- python/trunk/Doc/lib/libunittest.tex (original) +++ python/trunk/Doc/lib/libunittest.tex Mon Apr 2 00:39:10 2007 @@ -619,14 +619,14 @@ report failures. \begin{methoddesc}[TestCase]{assert_}{expr\optional{, msg}} -\methodline{failUnless}{expr\optional{, msg}} +\methodline[TestCase]{failUnless}{expr\optional{, msg}} Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be \constant{None}. \end{methoddesc} \begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}} -\methodline{failUnlessEqual}{first, second\optional{, msg}} +\methodline[TestCase]{failUnlessEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by \var{msg}, or \constant{None}. Note that using \method{failUnlessEqual()} @@ -637,7 +637,7 @@ \end{methoddesc} \begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}} -\methodline{failIfEqual}{first, second\optional{, msg}} +\methodline[TestCase]{failIfEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by \var{msg}, or \constant{None}. Note that using \method{failIfEqual()} @@ -649,7 +649,7 @@ \begin{methoddesc}[TestCase]{assertAlmostEqual}{first, second\optional{, places\optional{, msg}}} -\methodline{failUnlessAlmostEqual}{first, second\optional{, +\methodline[TestCase]{failUnlessAlmostEqual}{first, second\optional{, places\optional{, msg}}} Test that \var{first} and \var{second} are approximately equal by computing the difference, rounding to the given number of \var{places}, @@ -661,7 +661,7 @@ \begin{methoddesc}[TestCase]{assertNotAlmostEqual}{first, second\optional{, places\optional{, msg}}} -\methodline{failIfAlmostEqual}{first, second\optional{, +\methodline[TestCase]{failIfAlmostEqual}{first, second\optional{, places\optional{, msg}}} Test that \var{first} and \var{second} are not approximately equal by computing the difference, rounding to the given number of \var{places}, @@ -672,7 +672,7 @@ \end{methoddesc} \begin{methoddesc}[TestCase]{assertRaises}{exception, callable, \moreargs} -\methodline{failUnlessRaises}{exception, callable, \moreargs} +\methodline[TestCase]{failUnlessRaises}{exception, callable, \moreargs} Test that an exception is raised when \var{callable} is called with any positional or keyword arguments that are also passed to \method{assertRaises()}. The test passes if \var{exception} is Modified: python/trunk/Doc/lib/liburllib2.tex ============================================================================== --- python/trunk/Doc/lib/liburllib2.tex (original) +++ python/trunk/Doc/lib/liburllib2.tex Mon Apr 2 00:39:10 2007 @@ -588,7 +588,7 @@ \class{HTTPCookieProcessor} instances have one attribute: -\begin{memberdesc}{cookiejar} +\begin{memberdesc}[HTTPCookieProcessor]{cookiejar} The \class{cookielib.CookieJar} in which cookies are stored. \end{memberdesc} Modified: python/trunk/Doc/lib/libxmlrpclib.tex ============================================================================== --- python/trunk/Doc/lib/libxmlrpclib.tex (original) +++ python/trunk/Doc/lib/libxmlrpclib.tex Mon Apr 2 00:39:10 2007 @@ -134,12 +134,12 @@ Servers that support the XML introspection API support some common methods grouped under the reserved \member{system} member: -\begin{methoddesc}{system.listMethods}{} +\begin{methoddesc}[ServerProxy]{system.listMethods}{} This method returns a list of strings, one for each (non-system) method supported by the XML-RPC server. \end{methoddesc} -\begin{methoddesc}{system.methodSignature}{name} +\begin{methoddesc}[ServerProxy]{system.methodSignature}{name} This method takes one parameter, the name of a method implemented by the XML-RPC server.It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is @@ -159,7 +159,7 @@ value will be something other that list. \end{methoddesc} -\begin{methoddesc}{system.methodHelp}{name} +\begin{methoddesc}[ServerProxy]{system.methodHelp}{name} This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns a documentation string describing the use of that method. If no such string is available, an empty string is @@ -184,7 +184,7 @@ It also has the following method, supported mainly for internal use by the unmarshalling code: -\begin{methoddesc}{encode}{out} +\begin{methoddesc}[Boolean]{encode}{out} Write the XML-RPC encoding of this Boolean item to the out stream object. \end{methoddesc} @@ -197,11 +197,11 @@ instance. It has the following methods, supported mainly for internal use by the marshalling/unmarshalling code: -\begin{methoddesc}{decode}{string} +\begin{methoddesc}[DateTime]{decode}{string} Accept a string as the instance's new time value. \end{methoddesc} -\begin{methoddesc}{encode}{out} +\begin{methoddesc}[DateTime]{encode}{out} Write the XML-RPC encoding of this \class{DateTime} item to the \var{out} stream object. \end{methoddesc} @@ -242,11 +242,11 @@ A \class{Fault} object encapsulates the content of an XML-RPC fault tag. Fault objects have the following members: -\begin{memberdesc}{faultCode} +\begin{memberdesc}[Fault]{faultCode} A string indicating the fault type. \end{memberdesc} -\begin{memberdesc}{faultString} +\begin{memberdesc}[Fault]{faultString} A string containing a diagnostic message associated with the fault. \end{memberdesc} @@ -258,19 +258,19 @@ server named by the URI does not exist). It has the following members: -\begin{memberdesc}{url} +\begin{memberdesc}[ProtocolError]{url} The URI or URL that triggered the error. \end{memberdesc} -\begin{memberdesc}{errcode} +\begin{memberdesc}[ProtocolError]{errcode} The error code. \end{memberdesc} -\begin{memberdesc}{errmsg} +\begin{memberdesc}[ProtocolError]{errmsg} The error message or diagnostic string. \end{memberdesc} -\begin{memberdesc}{headers} +\begin{memberdesc}[ProtocolError]{headers} A string containing the headers of the HTTP/HTTPS request that triggered the error. \end{memberdesc} Modified: python/trunk/Doc/mac/libmacic.tex ============================================================================== --- python/trunk/Doc/mac/libmacic.tex (original) +++ python/trunk/Doc/mac/libmacic.tex Mon Apr 2 00:39:10 2007 @@ -68,14 +68,14 @@ following methods: -\begin{methoddesc}{launchurl}{url\optional{, hint}} +\begin{methoddesc}[IC]{launchurl}{url\optional{, hint}} Parse the given URL, launch the correct application and pass it the URL. The optional \var{hint} can be a scheme name such as \code{'mailto:'}, in which case incomplete URLs are completed with this scheme. If \var{hint} is not provided, incomplete URLs are invalid. \end{methoddesc} -\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}} +\begin{methoddesc}[IC]{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}} Find an URL somewhere in \var{data} and return start position, end position and the URL. The optional \var{start} and \var{end} can be used to limit the search, so for instance if a user clicks in a long @@ -85,7 +85,7 @@ complete incomplete URLs. \end{methoddesc} -\begin{methoddesc}{mapfile}{file} +\begin{methoddesc}[IC]{mapfile}{file} Return the mapping entry for the given \var{file}, which can be passed as either a filename or an \function{FSSpec()} result, and which need not exist. @@ -106,7 +106,7 @@ file and \var{entryname} is the name of this entry. \end{methoddesc} -\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}} +\begin{methoddesc}[IC]{maptypecreator}{type, creator\optional{, filename}} Return the mapping entry for files with given 4-character \var{type} and \var{creator} codes. The optional \var{filename} may be specified to further help finding the correct entry (if the creator code is @@ -115,7 +115,7 @@ The mapping entry is returned in the same format as for \var{mapfile}. \end{methoddesc} -\begin{methoddesc}{settypecreator}{file} +\begin{methoddesc}[IC]{settypecreator}{file} Given an existing \var{file}, specified either as a filename or as an \function{FSSpec()} result, set its creator and type correctly based on its extension. The finder is told about the change, so the finder From python-checkins at python.org Mon Apr 2 00:40:13 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Apr 2007 00:40:13 +0200 (CEST) Subject: [Python-checkins] r54652 - python/trunk/Doc/dist/dist.tex Message-ID: <20070401224013.222401E400A@bag.python.org> Author: georg.brandl Date: Mon Apr 2 00:40:12 2007 New Revision: 54652 Modified: python/trunk/Doc/dist/dist.tex Log: Explicit class names. Modified: python/trunk/Doc/dist/dist.tex ============================================================================== --- python/trunk/Doc/dist/dist.tex (original) +++ python/trunk/Doc/dist/dist.tex Mon Apr 2 00:40:12 2007 @@ -3733,7 +3733,7 @@ Subclasses of \class{Command} must define the following methods. -\begin{methoddesc}{initialize_options()} +\begin{methoddesc}[Command]{initialize_options()} Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the @@ -3742,7 +3742,7 @@ are just a bunch of \samp{self.foo = None} assignments. \end{methoddesc} -\begin{methoddesc}{finalize_options}{} +\begin{methoddesc}[Command]{finalize_options}{} Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been @@ -3751,7 +3751,7 @@ \var{bar} as long as \var{foo} still has the same value it was assigned in \method{initialize_options()}. \end{methoddesc} -\begin{methoddesc}{run}{} +\begin{methoddesc}[Command]{run}{} A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in \method{initialize_options()}, customized by other commands, the setup From python-checkins at python.org Mon Apr 2 00:47:34 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Apr 2007 00:47:34 +0200 (CEST) Subject: [Python-checkins] r54653 - python/trunk/Doc/lib/compiler.tex python/trunk/Doc/lib/email.tex python/trunk/Doc/lib/libwinreg.tex Message-ID: <20070401224734.D4CDD1E4007@bag.python.org> Author: georg.brandl Date: Mon Apr 2 00:47:31 2007 New Revision: 54653 Modified: python/trunk/Doc/lib/compiler.tex python/trunk/Doc/lib/email.tex python/trunk/Doc/lib/libwinreg.tex Log: Some semantic fixes. Modified: python/trunk/Doc/lib/compiler.tex ============================================================================== --- python/trunk/Doc/lib/compiler.tex (original) +++ python/trunk/Doc/lib/compiler.tex Mon Apr 2 00:47:31 2007 @@ -103,8 +103,7 @@ construct. The root of the tree is \class{Module} object. The abstract syntax offers a higher level interface to parsed Python -source code. The \ulink{\module{parser}} -{http://www.python.org/doc/current/lib/module-parser.html} +source code. The \refmodule{parser} module and the compiler written in C for the Python interpreter use a concrete syntax tree. The concrete syntax is tied closely to the grammar description used for the Python parser. Instead of a single Modified: python/trunk/Doc/lib/email.tex ============================================================================== --- python/trunk/Doc/lib/email.tex (original) +++ python/trunk/Doc/lib/email.tex Mon Apr 2 00:47:31 2007 @@ -239,7 +239,7 @@ The \module{email} package was originally prototyped as a separate library called -\ulink{\module{mimelib}}{http://mimelib.sf.net/}. +\ulink{\texttt{mimelib}}{http://mimelib.sf.net/}. Changes have been made so that method names are more consistent, and some methods or modules have either been added or removed. The semantics of some of the methods Modified: python/trunk/Doc/lib/libwinreg.tex ============================================================================== --- python/trunk/Doc/lib/libwinreg.tex (original) +++ python/trunk/Doc/lib/libwinreg.tex Mon Apr 2 00:47:31 2007 @@ -151,7 +151,7 @@ An application should only call \function{FlushKey()} if it requires absolute certainty that registry changes are on disk. - \emph{If you don't know whether a \function{FlushKey()} call is required, it + \note{If you don't know whether a \function{FlushKey()} call is required, it probably isn't.} \end{funcdesc} From python-checkins at python.org Mon Apr 2 01:29:12 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Apr 2007 01:29:12 +0200 (CEST) Subject: [Python-checkins] r54654 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20070401232912.E13551E4007@bag.python.org> Author: georg.brandl Date: Mon Apr 2 01:29:10 2007 New Revision: 54654 Modified: python/trunk/Doc/lib/liblogging.tex Log: Remove bogus entry. Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Mon Apr 2 01:29:10 2007 @@ -1138,9 +1138,6 @@ Closes the socket. \end{methoddesc} -\begin{methoddesc}{handleError}{} -\end{methoddesc} - \begin{methoddesc}{emit}{} Pickles the record's attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the From python-checkins at python.org Mon Apr 2 01:31:33 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Apr 2007 01:31:33 +0200 (CEST) Subject: [Python-checkins] r54655 - python/trunk/Doc/lib/libstdtypes.tex Message-ID: <20070401233133.B61AF1E4007@bag.python.org> Author: georg.brandl Date: Mon Apr 2 01:31:30 2007 New Revision: 54655 Modified: python/trunk/Doc/lib/libstdtypes.tex Log: Fix the class name of strings. Modified: python/trunk/Doc/lib/libstdtypes.tex ============================================================================== --- python/trunk/Doc/lib/libstdtypes.tex (original) +++ python/trunk/Doc/lib/libstdtypes.tex Mon Apr 2 01:31:30 2007 @@ -572,25 +572,25 @@ These are the string methods which both 8-bit strings and Unicode objects support: -\begin{methoddesc}[string]{capitalize}{} +\begin{methoddesc}[str]{capitalize}{} Return a copy of the string with only its first character capitalized. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{center}{width\optional{, fillchar}} +\begin{methoddesc}[str]{center}{width\optional{, fillchar}} Return centered in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{count}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{count}{sub\optional{, start\optional{, end}}} Return the number of occurrences of substring \var{sub} in string S\code{[\var{start}:\var{end}]}. Optional arguments \var{start} and \var{end} are interpreted as in slice notation. \end{methoddesc} -\begin{methoddesc}[string]{decode}{\optional{encoding\optional{, errors}}} +\begin{methoddesc}[str]{decode}{\optional{encoding\optional{, errors}}} Decodes the string using the codec registered for \var{encoding}. \var{encoding} defaults to the default string encoding. \var{errors} may be given to set a different error handling scheme. The default is @@ -602,7 +602,7 @@ \versionchanged[Support for other error handling schemes added]{2.3} \end{methoddesc} -\begin{methoddesc}[string]{encode}{\optional{encoding\optional{,errors}}} +\begin{methoddesc}[str]{encode}{\optional{encoding\optional{,errors}}} Return an encoded version of the string. Default encoding is the current default string encoding. \var{errors} may be given to set a different error handling scheme. The default for \var{errors} is @@ -617,7 +617,7 @@ \code{'backslashreplace'} and other error handling schemes added]{2.3} \end{methoddesc} -\begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{endswith}{suffix\optional{, start\optional{, end}}} Return \code{True} if the string ends with the specified \var{suffix}, otherwise return \code{False}. \var{suffix} can also be a tuple of suffixes to look for. With optional \var{start}, test beginning at @@ -626,13 +626,13 @@ \versionchanged[Accept tuples as \var{suffix}]{2.5} \end{methoddesc} -\begin{methoddesc}[string]{expandtabs}{\optional{tabsize}} +\begin{methoddesc}[str]{expandtabs}{\optional{tabsize}} Return a copy of the string where all tab characters are expanded using spaces. If \var{tabsize} is not given, a tab size of \code{8} characters is assumed. \end{methoddesc} -\begin{methoddesc}[string]{find}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{find}{sub\optional{, start\optional{, end}}} Return the lowest index in the string where substring \var{sub} is found, such that \var{sub} is contained in the range [\var{start}, \var{end}]. Optional arguments \var{start} and \var{end} are @@ -640,47 +640,47 @@ not found. \end{methoddesc} -\begin{methoddesc}[string]{index}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{index}{sub\optional{, start\optional{, end}}} Like \method{find()}, but raise \exception{ValueError} when the substring is not found. \end{methoddesc} -\begin{methoddesc}[string]{isalnum}{} +\begin{methoddesc}[str]{isalnum}{} Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isalpha}{} +\begin{methoddesc}[str]{isalpha}{} Return true if all characters in the string are alphabetic and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isdigit}{} +\begin{methoddesc}[str]{isdigit}{} Return true if all characters in the string are digits and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{islower}{} +\begin{methoddesc}[str]{islower}{} Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isspace}{} +\begin{methoddesc}[str]{isspace}{} Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{istitle}{} +\begin{methoddesc}[str]{istitle}{} Return true if the string is a titlecased string and there is at least one character, for example uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return false @@ -689,20 +689,20 @@ For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isupper}{} +\begin{methoddesc}[str]{isupper}{} Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{join}{seq} +\begin{methoddesc}[str]{join}{seq} Return a string which is the concatenation of the strings in the sequence \var{seq}. The separator between elements is the string providing this method. \end{methoddesc} -\begin{methoddesc}[string]{ljust}{width\optional{, fillchar}} +\begin{methoddesc}[str]{ljust}{width\optional{, fillchar}} Return the string left justified in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). The original string is returned if @@ -710,13 +710,13 @@ \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{lower}{} +\begin{methoddesc}[str]{lower}{} Return a copy of the string converted to lowercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{lstrip}{\optional{chars}} +\begin{methoddesc}[str]{lstrip}{\optional{chars}} Return a copy of the string with leading characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} argument @@ -731,7 +731,7 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{partition}{sep} +\begin{methoddesc}[str]{partition}{sep} Split the string at the first occurrence of \var{sep}, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not @@ -740,26 +740,26 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}[string]{replace}{old, new\optional{, count}} +\begin{methoddesc}[str]{replace}{old, new\optional{, count}} Return a copy of the string with all occurrences of substring \var{old} replaced by \var{new}. If the optional argument \var{count} is given, only the first \var{count} occurrences are replaced. \end{methoddesc} -\begin{methoddesc}[string]{rfind}{sub \optional{,start \optional{,end}}} +\begin{methoddesc}[str]{rfind}{sub \optional{,start \optional{,end}}} Return the highest index in the string where substring \var{sub} is found, such that \var{sub} is contained within s[start,end]. Optional arguments \var{start} and \var{end} are interpreted as in slice notation. Return \code{-1} on failure. \end{methoddesc} -\begin{methoddesc}[string]{rindex}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{rindex}{sub\optional{, start\optional{, end}}} Like \method{rfind()} but raises \exception{ValueError} when the substring \var{sub} is not found. \end{methoddesc} -\begin{methoddesc}[string]{rjust}{width\optional{, fillchar}} +\begin{methoddesc}[str]{rjust}{width\optional{, fillchar}} Return the string right justified in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). The original string is returned if @@ -767,7 +767,7 @@ \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{rpartition}{sep} +\begin{methoddesc}[str]{rpartition}{sep} Split the string at the last occurrence of \var{sep}, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not @@ -776,7 +776,7 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}[string]{rsplit}{\optional{sep \optional{,maxsplit}}} +\begin{methoddesc}[str]{rsplit}{\optional{sep \optional{,maxsplit}}} Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} splits are done, the \emph{rightmost} ones. If \var{sep} is not specified @@ -786,7 +786,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}[string]{rstrip}{\optional{chars}} +\begin{methoddesc}[str]{rstrip}{\optional{chars}} Return a copy of the string with trailing characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} argument @@ -801,7 +801,7 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{split}{\optional{sep \optional{,maxsplit}}} +\begin{methoddesc}[str]{split}{\optional{sep \optional{,maxsplit}}} Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} splits are done. (thus, the list will have at most \code{\var{maxsplit}+1} @@ -824,13 +824,13 @@ returns an empty list. \end{methoddesc} -\begin{methoddesc}[string]{splitlines}{\optional{keepends}} +\begin{methoddesc}[str]{splitlines}{\optional{keepends}} Return a list of the lines in the string, breaking at line boundaries. Line breaks are not included in the resulting list unless \var{keepends} is given and true. \end{methoddesc} -\begin{methoddesc}[string]{startswith}{prefix\optional{, +\begin{methoddesc}[str]{startswith}{prefix\optional{, start\optional{, end}}} Return \code{True} if string starts with the \var{prefix}, otherwise return \code{False}. \var{prefix} can also be a tuple of @@ -841,7 +841,7 @@ \versionchanged[Accept tuples as \var{prefix}]{2.5} \end{methoddesc} -\begin{methoddesc}[string]{strip}{\optional{chars}} +\begin{methoddesc}[str]{strip}{\optional{chars}} Return a copy of the string with the leading and trailing characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} @@ -856,21 +856,21 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{swapcase}{} +\begin{methoddesc}[str]{swapcase}{} Return a copy of the string with uppercase characters converted to lowercase and vice versa. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{title}{} +\begin{methoddesc}[str]{title}{} Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{translate}{table\optional{, deletechars}} +\begin{methoddesc}[str]{translate}{table\optional{, deletechars}} Return a copy of the string where all characters occurring in the optional argument \var{deletechars} are removed, and the remaining characters have been mapped through the given translation table, which @@ -890,13 +890,13 @@ \module{encodings.cp1251} for an example). \end{methoddesc} -\begin{methoddesc}[string]{upper}{} +\begin{methoddesc}[str]{upper}{} Return a copy of the string converted to uppercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{zfill}{width} +\begin{methoddesc}[str]{zfill}{width} Return the numeric string left filled with zeros in a string of length \var{width}. The original string is returned if \var{width} is less than \code{len(\var{s})}. From buildbot at python.org Mon Apr 2 05:06:42 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Apr 2007 03:06:42 +0000 Subject: [Python-checkins] buildbot warnings in x86 cygwin 2.5 Message-ID: <20070402030642.042DD1E400F@bag.python.org> The Buildbot has detected a new failure of x86 cygwin 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%25202.5/builds/13 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From nnorwitz at gmail.com Mon Apr 2 11:31:09 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 2 Apr 2007 05:31:09 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20070402093109.GA29567@python.psfb.org> TEXINPUTS=/home/neal/python/trunk/Doc/commontex: python /home/neal/python/trunk/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/lib lib/lib.tex *** Session transcript and error messages are in /home/neal/python/trunk/Doc/html/lib/lib.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex lib This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/trunk/Doc/lib/lib.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/trunk/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/trunk/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/trunk/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/trunk/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/trunk/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/home/neal/python/trunk/Doc/texinputs/underscore.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/trunk/Doc/commontex/boilerplate.tex (/home/neal/python/trunk/Doc/commontex/patchlevel.tex)) Writing index file lib.idx No file lib.aux. (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) (/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) [1] (/home/neal/python/trunk/Doc/commontex/copyright.tex (/usr/share/texmf/tex/latex/psnfss/omsptm.fd)) [2] Adding blank page after the abstract. [1] [2] No file lib.toc. Adding blank page after the table of contents. [1] [2] (/home/neal/python/trunk/Doc/lib/libintro.tex Chapter 1. (/usr/share/texmf/tex/latex/psnfss/ot1pcr.fd) LaTeX Warning: Reference `builtin' on page 1 undefined on input line 49. ) (/home/neal/python/trunk/Doc/lib/libobjs.tex [1] [2] Chapter 2. ) (/home/neal/python/trunk/Doc/lib/libfuncs.tex [3] [4] [5] [6] [7] LaTeX Warning: Reference `bltin-file-objects' on page 8 undefined on input line 424. Underfull \hbox (badness 10000) in paragraph at lines 445--449 []\OT1/ptm/m/n/10 Note that \OT1/pcr/m/n/10 filter(function, \OT1/ptm/m/it/10 i t-er-able\OT1/pcr/m/n/10 ) \OT1/ptm/m/n/10 is equiv-a-lent to \OT1/pcr/m/n/10 [ item for item in \OT1/ptm/m/it/10 it-er-able \OT1/pcr/m/n/10 if [8] [9] [10] LaTeX Warning: Reference `bltin-file-objects' on page 11 undefined on input lin e 705. [11] [12] [13] [14] LaTeX Warning: Reference `typesseq-mutable' on page 15 undefined on input line 1050. [15] [16] [17]) (/home/neal/python/trunk/Doc/lib/libexcs.tex Underfull \hbox (badness 10000) in paragraph at lines 78--82 \OT1/ptm/m/n/10 The base class for all built-in ex-cep-tions ex-cept \OT1/pcr/m /n/10 StopIteration\OT1/ptm/m/n/10 , \OT1/pcr/m/n/10 GeneratorExit\OT1/ptm/m/n/ 10 , [18] [19] [20] [21] No file ../../Lib/test/exception_hierarchy.txt. ) (/home/neal/python/trunk/Doc/lib/libconsts.tex) (/home/neal/python/trunk/Doc/lib/libstdtypes.tex [22] Chapter 3. [23] [24] LaTeX Warning: Reference `built-in-funcs' on page 25 undefined on input line 29 5. [25] [26] [27] [28] LaTeX Warning: Reference `codec-base-classes' on page 29 undefined on input lin e 600. LaTeX Warning: Reference `codec-base-classes' on page 29 undefined on input lin e 613. LaTeX Warning: Reference `standard-encodings' on page 29 undefined on input lin e 614. [29] [30] [31] [32] Overfull \hbox (8.48134pt too wide) in paragraph at lines 977--987 [] Overfull \hbox (141.78873pt too wide) in paragraph at lines 994--1019 [] [33] Overfull \hbox (44.61931pt too wide) in paragraph at lines 1103--1135 [] [34] [35] [36] Overfull \hbox (98.60141pt too wide) in paragraph at lines 1315--1343 [] Overfull \hbox (44.38484pt too wide) in paragraph at lines 1405--1461 [] [37] [38] LaTeX Warning: Reference `built-in-funcs' on page 39 undefined on input line 15 31. LaTeX Warning: Reference `context-closing' on page 39 undefined on input line 1 583. [39] [40] [41] Underfull \hbox (badness 10000) in paragraph at lines 1836--1843 []\OT1/ptm/m/n/10 An ex-am-ple of a con-text man-ager that re-turns a re-lated ob-ject is the one re-turned by [42] [43] [44]) (/home/neal/python/trunk/Doc/lib/libstrings.tex [45] [46] Chapter 4. LaTeX Warning: Reference `string-methods' on page 47 undefined on input line 10 . ) (/home/neal/python/trunk/Doc/lib/libstring.tex [47] [48] [49] LaTeX Warning: Reference `string-methods' on page 50 undefined on input line 23 7. [50] [51]) (/home/neal/python/trunk/Doc/lib/libre.tex [52] [53] [54] [55] [56] [57] [58] [59] [60] [61]) (/home/neal/python/trunk/Doc/lib/libstruct.tex [62] [63] [64] LaTeX Warning: Reference `module-array' on page 65 undefined on input line 227. LaTeX Warning: Reference `module-xdrlib' on page 65 undefined on input line 228 . ) (/home/neal/python/trunk/Doc/lib/libdifflib.tex [65] [66] [67] [68] [69] [70] [71] [72]) (/home/neal/python/trunk/Doc/lib/libstringio.tex [73] LaTeX Warning: Reference `bltin-file-objects' on page 74 undefined on input lin e 11. [74]) (/home/neal/python/trunk/Doc/lib/libtextwrap.tex [75] [76]) (/home/neal/python/trunk/Doc/lib/libcodecs.tex [77] Underfull \hbox (badness 5161) in paragraph at lines 52--56 []\OT1/ptm/m/n/10 The fac-tory func-tions must re-turn ob-jects pro-vid-ing the in-ter-faces de-fined by the base classes [78] [79] Overfull \hbox (405.07822pt too wide) in paragraph at lines 288--300 [] [80] [81] [82] [83] [84] [85] [86] Overfull \hbox (11.18082pt too wide) in alignment at lines 820--901 [] [] [] Overfull \hbox (11.18082pt too wide) in alignment at lines 901--981 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 981--1062 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 1062--1142 [] [] [] [87] Overfull \hbox (254.7505pt too wide) in alignment at lines 1142--1167 [] [] [] Package longtable Warning: Column widths have changed (longtable) in table 4.1 on input line 1167. Overfull \hbox (465.03658pt too wide) in paragraph at lines 1179--1268 [] [88] [89]) (/home/neal/python/trunk/Doc/lib/libunicodedata.tex [90]) (/home/neal/python/trunk/Doc/lib/libstringprep.tex [91] [92]) (/home/neal/python/trunk/Doc/lib/libfpformat.tex) Underfull \hbox (badness 10000) in paragraph at lines 50--98 (/home/neal/python/trunk/Doc/lib/datatypes.tex [93] [94] Chapter 5. ) (/home/neal/python/trunk/Doc/lib/libdatetime.tex LaTeX Warning: Reference `module-calendar' on page 95 undefined on input line 5 6. LaTeX Warning: Reference `module-time' on page 95 undefined on input line 57. [95] [96] Underfull \hbox (badness 10000) in paragraph at lines 185--187 \OT1/ptm/m/n/10 The small-est pos-si-ble dif-fer-ence be-tween non-equal \OT1/p cr/m/n/10 timedelta \OT1/ptm/m/n/10 ob-jects, (/usr/share/texmf/tex/latex/psnfss/omlptm.fd) Overfull \hbox (44.65097pt too wide) in paragraph at lines 204--235 [] [97] [98] Underfull \hbox (badness 10000) in paragraph at lines 430--439 \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .month, \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .da y, 0, 0, 0, \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .weekday(), \OT1/ptm/m/it/10 d\OT 1/pcr/m/n/10 .toordinal() - date(\OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .year, 1, [99] Underfull \hbox (badness 10000) in paragraph at lines 464--467 []\OT1/ptm/m/n/10 The ISO cal-en-dar is a widely used vari-ant of the Gre-go-ri an cal-en-dar. See LaTeX Warning: Reference `strftime-behavior' on page 100 undefined on input lin e 507. [100] Underfull \hbox (badness 10000) in paragraph at lines 547--551 \OT1/ptm/m/n/10 Return the cur-rent lo-cal date-time, with \OT1/pcr/m/n/10 tzin fo None\OT1/ptm/m/n/10 . This is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 561--566 []\OT1/ptm/m/n/10 Else \OT1/ptm/m/it/10 tz \OT1/ptm/m/n/10 must be an in-stance of a class \OT1/pcr/m/n/10 tzinfo \OT1/ptm/m/n/10 sub-class, and the cur-rent date Underfull \hbox (badness 10000) in paragraph at lines 561--566 \OT1/ptm/m/n/10 and time are con-verted to \OT1/ptm/m/it/10 tz\OT1/ptm/m/n/10 ' s time zone. In this case the re-sult is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 582--586 []\OT1/ptm/m/n/10 Else \OT1/ptm/m/it/10 tz \OT1/ptm/m/n/10 must be an in-stance of a class \OT1/pcr/m/n/10 tzinfo \OT1/ptm/m/n/10 sub-class, and the times- Underfull \hbox (badness 10000) in paragraph at lines 582--586 \OT1/ptm/m/n/10 tamp is con-verted to \OT1/ptm/m/it/10 tz\OT1/ptm/m/n/10 's tim e zone. In this case the re-sult is equiv-a-lent to [101] Underfull \hbox (badness 5519) in paragraph at lines 646--648 \OT1/ptm/m/n/10 The lat-est rep-re-sentable \OT1/pcr/m/n/10 datetime\OT1/ptm/m/ n/10 , \OT1/pcr/m/n/10 datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, [102] [103] Underfull \hbox (badness 10000) in paragraph at lines 874--888 \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .weekday(), \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .toordinal() - date(\OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .year, 1, 1).toordinal() + 1, dst)) \OT1/ptm/m/n/10 The Underfull \hbox (badness 10000) in paragraph at lines 923--925 \OT1/ptm/m/n/10 Return a 3-tuple, (ISO year, ISO week num-ber, ISO week-day). T he same as [104] Underfull \hbox (badness 5064) in paragraph at lines 960--969 \OT1/ptm/m/n/10 Return a string rep-re-sent-ing the date and time, for ex-am-pl e \OT1/pcr/m/n/10 datetime(2002, 12, 4, 20, Underfull \hbox (badness 10000) in paragraph at lines 960--969 \OT1/pcr/m/n/10 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'\OT1/ptm/m/n/10 . \ OT1/pcr/m/n/10 d.ctime() \OT1/ptm/m/n/10 is equiv-a-lent to LaTeX Warning: Reference `strftime-behavior' on page 105 undefined on input lin e 973. [105] LaTeX Warning: Reference `strftime-behavior' on page 106 undefined on input lin e 1103. [106] [107] [108] [109] [110] [111]) (/home/neal/python/trunk/Doc/lib/libcalendar.tex [112] [113] [114] LaTeX Warning: Reference `module-datetime' on page 115 undefined on input line 302. LaTeX Warning: Reference `module-time' on page 115 undefined on input line 303. ) (/home/neal/python/trunk/Doc/lib/libcollections.tex [115] [116] [117] [118] [119] Overfull \hbox (6.89723pt too wide) in paragraph at lines 343--343 []\OT1/pcr/m/n/9 >>> s = [('red', 1), ('blue', 2), ('red', 3), ('blue', 4), ('r ed', 1), ('blue', 4)][] [120] Overfull \hbox (4.8973pt too wide) in paragraph at lines 376--376 []\OT1/pcr/m/n/9 >>> p = Point(11, y=22) # instantiate with positional or k eyword arguments[] Overfull \hbox (31.89726pt too wide) in paragraph at lines 389--389 []\OT1/pcr/m/n/9 EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade')[] ) (/home/neal/python/trunk/Doc/lib/libheapq.tex [121] [122] [123]) (/home/neal/python/trunk/Doc/lib/libbisect.tex) (/home/neal/python/trunk/Doc/lib/libarray.tex [124] [125] [126] LaTeX Warning: Reference `module-struct' on page 127 undefined on input line 23 0. LaTeX Warning: Reference `module-xdrlib' on page 127 undefined on input line 23 3. [127]) (/home/neal/python/trunk/Doc/lib/libsets.tex LaTeX Warning: Reference `immutable-transforms' on page 128 undefined on input line 51. LaTeX Warning: Reference `immutable-transforms' on page 128 undefined on input line 59. [128] Overfull \hbox (98.60141pt too wide) in paragraph at lines 137--165 [] [129] [130]) (/home/neal/python/trunk/Doc/lib/libsched.tex [131]) (/home/neal/python/trunk/Doc/lib/libmutex.tex [132]) (/home/neal/python/trunk/Doc/lib/libqueue.tex [133]) (/home/neal/python/trunk/Doc/lib/libweakref.tex [134] [135] [136] [137]) (/home/neal/python/trunk/Doc/lib/libuserdict.tex [138] LaTeX Warning: Reference `typesmapping' on page 139 undefined on input line 40. LaTeX Warning: Reference `typesseq' on page 139 undefined on input line 97. [139] LaTeX Warning: Reference `string-methods' on page 140 undefined on input line 1 74. ) (/home/neal/python/trunk/Doc/lib/libtypes.tex [140] [141] Underfull \hbox (badness 10000) in paragraph at lines 200--205 \OT1/ptm/m/n/10 The type of ob-jects de-fined in ex-ten-sion mod-ules with \OT1 /pcr/m/n/10 PyMemberDef\OT1/ptm/m/n/10 , such as [142]) (/home/neal/python/trunk/Doc/lib/libnew.tex) (/home/neal/python/trunk/Doc/lib/libcopy.tex [143] LaTeX Warning: Reference `module-pickle' on page 144 undefined on input line 96 . ) (/home/neal/python/trunk/Doc/lib/libpprint.tex [144] [145] [146]) (/home/neal/python/trunk/Doc/lib/librepr.tex [147]) Underfull \hbox (badness 10000) in paragraph at lines 120--121 (/home/neal/python/trunk/Doc/lib/numeric.tex [148] Chapter 6. ) (/home/neal/python/trunk/Doc/lib/libmath.tex [149] [150] LaTeX Warning: Reference `module-cmath' on page 151 undefined on input line 208 . ) (/home/neal/python/trunk/Doc/lib/libcmath.tex [151] [152]) (/home/neal/python/trunk/Doc/lib/libdecimal.tex [153] [154] [155] [156] Overfull \hbox (21.09727pt too wide) in paragraph at lines 305--305 [] \OT1/pcr/m/n/9 digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6 ' | '7' | '8' | '9'[] [157] [158] [159] [160] [161] [162] [163] [164] [165] Overfull \vbox (959.57pt too high) has occurred while \output is active [166] [167] [168]) (/home/neal/python/trunk/Doc/lib/librandom.tex [169] Underfull \hbox (badness 6575) in paragraph at lines 119--124 \OT1/ptm/m/n/10 Return a ran-domly se-lected el-e-ment from \OT1/pcr/m/n/10 ran ge(\OT1/ptm/m/it/10 start\OT1/pcr/m/n/10 , \OT1/ptm/m/it/10 stop\OT1/pcr/m/n/10 , \OT1/ptm/m/it/10 step\OT1/pcr/m/n/10 )\OT1/ptm/m/n/10 . This is equiv-a-lent to [170] [171]) (/home/neal/python/trunk/Doc/lib/libitertools.tex [172] [173] [174] [175] Overfull \hbox (15.69728pt too wide) in paragraph at lines 323--323 [] \OT1/pcr/m/n/9 yield counter() # yields the fillvalue, or raises IndexError[] [176] [177] [178] [179]) (/home/neal/python/trunk/Doc/lib/libfunctools.tex [180] Overfull \vbox (255.57pt too high) has occurred while \output is active [181] [182]) (/home/neal/python/trunk/Doc/lib/liboperator.tex [183] [184] [185] [186] [187] [188]) (/home/neal/python/trunk/Doc/lib/netdata.tex [189] [190] Chapter 7. ) (/home/neal/python/trunk/Doc/lib/email.tex LaTeX Warning: Reference `module-smtplib' on page 191 undefined on input line 5 8. LaTeX Warning: Reference `module-nntplib' on page 191 undefined on input line 5 9. (/home/neal/python/trunk/Doc/lib/emailmessage.tex [191] [192] [193] [194] [195] [196]) (/home/neal/python/trunk/Doc/lib/emailparser.tex [197] [198] [199]) (/home/neal/python/trunk/Doc/lib/emailgenerator.tex [200]) (/home/neal/python/trunk/Doc/lib/emailmimebase.tex [201] [202]) (/home/neal/python/trunk/Doc/lib/emailheaders.tex [203] [204]) (/home/neal/python/trunk/Doc/lib/emailcharsets.tex [205] [206]) (/home/neal/python/trunk/Doc/lib/emailencoders.tex [207]) (/home/neal/python/trunk/Doc/lib/emailexc.tex [208]) (/home/neal/python/trunk/Doc/lib/emailutil.tex [209] [210]) (/home/neal/python/trunk/Doc/lib/emailiter.tex [211]) [212] [213] [214] [215] [216] [217] [218]) (/home/neal/python/trunk/Doc/lib/libmailcap.tex [219]) (/home/neal/python/trunk/Doc/lib/libmailbox.tex [220] LaTeX Warning: Reference `module-email' on page 221 undefined on input line 18. Underfull \hbox (badness 10000) in paragraph at lines 72--73 [221] [222] [223] [224] [225] [226] (/usr/share/texmf/tex/latex/psnfss/omspcr.fd) [227] [228] [229] [230] [231] [232] [233] [234] [235] [236] [237]) (/home/neal/python/trunk/Doc/lib/libmhlib.tex [238] [239] [240]) (/home/neal/python/trunk/Doc/lib/libmimetools.tex [241] LaTeX Warning: Reference `module-email' on page 242 undefined on input line 61. LaTeX Warning: Reference `module-rfc822' on page 242 undefined on input line 63 . LaTeX Warning: Reference `module-multifile' on page 242 undefined on input line 65. ) (/home/neal/python/trunk/Doc/lib/libmimetypes.tex [242] [243] [244]) (/home/neal/python/trunk/Doc/lib/libmimewriter.tex [245]) (/home/neal/python/trunk/Doc/lib/libmimify.tex [246] LaTeX Warning: Reference `module-quopri' on page 247 undefined on input line 93 . ) (/home/neal/python/trunk/Doc/lib/libmultifile.tex LaTeX Warning: Reference `module-email' on page 247 undefined on input line 43. [247]) (/home/neal/python/trunk/Doc/lib/librfc822.tex [248] [249] LaTeX Warning: Reference `module-email' on page 250 undefined on input line 133 . LaTeX Warning: Reference `module-mailbox' on page 250 undefined on input line 1 35. [250] LaTeX Warning: Reference `module-mimetools' on page 251 undefined on input line 137. [251] Underfull \hbox (badness 7379) in paragraph at lines 254--270 []\OT1/pcr/m/n/10 Message \OT1/ptm/m/n/10 in-stances also sup-port a lim-ited m ap-ping in-ter-face. In par-tic-u-lar: \OT1/ptm/m/it/10 m\OT1/pcr/m/n/10 [name] \OT1/ptm/m/n/10 is like [252]) (/home/neal/python/trunk/Doc/lib/libbase64.tex [253] LaTeX Warning: Reference `module-binascii' on page 254 undefined on input line 163. [254]) (/home/neal/python/trunk/Doc/lib/libbinhex.tex LaTeX Warning: Reference `module-binascii' on page 255 undefined on input line 41. ) (/home/neal/python/trunk/Doc/lib/libbinascii.tex [255] [256] LaTeX Warning: Reference `module-base64' on page 257 undefined on input line 14 0. LaTeX Warning: Reference `module-binhex' on page 257 undefined on input line 14 2. LaTeX Warning: Reference `module-uu' on page 257 undefined on input line 144. LaTeX Warning: Reference `module-quopri' on page 257 undefined on input line 14 6. ) (/home/neal/python/trunk/Doc/lib/libquopri.tex LaTeX Warning: Reference `module-mimify' on page 257 undefined on input line 59 . LaTeX Warning: Reference `module-base64' on page 257 undefined on input line 60 . [257]) (/home/neal/python/trunk/Doc/lib/libuu.tex LaTeX Warning: Reference `module-binascii' on page 258 undefined on input line 57. ) (/home/neal/python/trunk/Doc/lib/markup.tex [258] Chapter 8. ) (/home/neal/python/trunk/Doc/lib/libhtmlparser.tex [259] [260]) (/home/neal/python/trunk/Doc/lib/libsgmllib.tex [261] [262] [263]) (/home/neal/python/trunk/Doc/lib/libhtmllib.tex LaTeX Warning: Reference `module-formatter' on page 264 undefined on input line 81. LaTeX Warning: Reference `module-HTMLParser' on page 264 undefined on input lin e 87. [264] LaTeX Warning: Reference `module-htmlentitydefs' on page 265 undefined on input line 89. LaTeX Warning: Reference `module-sgmllib' on page 265 undefined on input line 9 0. Underfull \hbox (badness 7168) in paragraph at lines 158--165 \OT1/ptm/m/n/10 This mod-ule de-fines three dic-tio-nar-ies, \OT1/pcr/m/n/10 na me2codepoint\OT1/ptm/m/n/10 , \OT1/pcr/m/n/10 codepoint2name\OT1/ptm/m/n/10 , a nd \OT1/pcr/m/n/10 entitydefs\OT1/ptm/m/n/10 . [265]) (/home/neal/python/trunk/Doc/lib/libpyexpat.tex LaTeX Warning: Reference `expaterror-objects' on page 266 undefined on input li ne 36. [266] Underfull \hbox (badness 10000) in paragraph at lines 160--167 \OT1/ptm/m/n/10 Calling this with a true value for \OT1/ptm/m/it/10 flag \OT1/p tm/m/n/10 (the de-fault) will cause Ex-pat to call the [267] [268] [269] [270] [271] [272] [273]) (/home/neal/python/trunk/Doc/lib/xmldom.tex LaTeX Warning: Reference `dom-conformance' on page 274 undefined on input line 71. [274] [275] LaTeX Warning: Reference `dom-implementation-objects' on page 276 undefined on input line 181. LaTeX Warning: Reference `dom-node-objects' on page 276 undefined on input line 183. LaTeX Warning: Reference `dom-nodelist-objects' on page 276 undefined on input line 185. LaTeX Warning: Reference `dom-documenttype-objects' on page 276 undefined on in put line 187. LaTeX Warning: Reference `dom-document-objects' on page 276 undefined on input line 189. LaTeX Warning: Reference `dom-element-objects' on page 276 undefined on input l ine 191. LaTeX Warning: Reference `dom-attr-objects' on page 276 undefined on input line 193. LaTeX Warning: Reference `dom-comment-objects' on page 276 undefined on input l ine 195. LaTeX Warning: Reference `dom-text-objects' on page 276 undefined on input line 197. LaTeX Warning: Reference `dom-pi-objects' on page 276 undefined on input line 1 99. [276] [277] [278] [279] [280] [281] Underfull \hbox (badness 10000) in paragraph at lines 807--810 \OT1/ptm/m/n/10 Exception when a node does not ex-ist in the ref-er-enced con-t ext. For ex-am-ple, [282] [283]) (/home/neal/python/trunk/Doc/lib/xmldomminidom.tex [284] [285] [286] [287] Underfull \hbox (badness 10000) in paragraph at lines 242--246 []\OT1/pcr/m/n/10 const \OT1/ptm/m/n/10 dec-la-ra-tions map to vari-ables in th eir re-spec-tive scope (e.g. ) (/home/neal/python/trunk/Doc/lib/xmldompulldom.tex [288]) (/home/neal/python/trunk/Doc/lib/xmlsax.tex [289] LaTeX Warning: Reference `module-xml.sax.handler' on page 290 undefined on inpu t line 122. LaTeX Warning: Reference `module-xml.sax.saxutils' on page 290 undefined on inp ut line 125. LaTeX Warning: Reference `module-xml.sax.xmlreader' on page 290 undefined on in put line 128. [290]) (/home/neal/python/trunk/Doc/lib/xmlsaxhandler.tex [291] [292] [293] [294]) (/home/neal/python/trunk/Doc/lib/xmlsaxutils.tex [295]) (/home/neal/python/trunk/Doc/lib/xmlsaxreader.tex [296] LaTeX Warning: Reference `attributes-objects' on page 297 undefined on input li ne 74. LaTeX Warning: Reference `attributes-ns-objects' on page 297 undefined on input line 92. [297] Underfull \hbox (badness 10000) in paragraph at lines 159--163 \OT1/ptm/m/n/10 Return the cur-rent set-ting for fea-ture \OT1/ptm/m/it/10 fea- ture-name\OT1/ptm/m/n/10 . If the fea-ture is not rec-og-nized, Underfull \hbox (badness 6188) in paragraph at lines 173--177 \OT1/ptm/m/n/10 Return the cur-rent set-ting for prop-erty \OT1/ptm/m/it/10 pro p-er-ty-name\OT1/ptm/m/n/10 . If the prop-erty is not rec-og-nized, a [298] LaTeX Warning: Reference `attributes-objects' on page 299 undefined on input li ne 330. [299]) (/home/neal/python/trunk/Doc/lib/libetree.tex [300] [301] [302] [303]) (/home/neal/python/trunk/Doc/lib/fileformats.tex [304] Chapter 9. ) (/home/neal/python/trunk/Doc/lib/libcsv.tex LaTeX Warning: Reference `csv-examples' on page 305 undefined on input line 37. LaTeX Warning: Reference `csv-fmt-params' on page 305 undefined on input line 6 8. [305] LaTeX Warning: Reference `csv-fmt-params' on page 306 undefined on input line 1 01. LaTeX Warning: Reference `csv-fmt-params' on page 306 undefined on input line 1 17. [306] [307] LaTeX Warning: Reference `csv-contents' on page 308 undefined on input line 320 . [308] [309]) (/home/neal/python/trunk/Doc/lib/libcfgparser.tex [310] Overfull \vbox (35.57pt too high) has occurred while \output is active [311] Underfull \hbox (badness 10000) in paragraph at lines 22--23 [312] LaTeX Warning: Reference `module-shlex' on page 313 undefined on input line 150 . [313] [314]) (/home/neal/python/trunk/Doc/lib/librobotparser.tex Overfull \hbox (1.49724pt too wide) in paragraph at lines 66--66 []\OT1/pcr/m/n/9 >>> rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search? city=San+Francisco")[] ) (/home/neal/python/trunk/Doc/lib/libnetrc.tex [315]) (/home/neal/python/trunk/Doc/lib/libxdrlib.tex [316] [317] [318]) Underfull \hbox (badness 10000) in paragraph at lines 244--183 (/home/neal/python/trunk/Doc/lib/libcrypto.tex [319] [320] Chapter 10. ) (/home/neal/python/trunk/Doc/lib/libhashlib.tex [321] LaTeX Warning: Reference `module-hmac' on page 322 undefined on input line 107. LaTeX Warning: Reference `module-base64' on page 322 undefined on input line 10 8. ) (/home/neal/python/trunk/Doc/lib/libhmac.tex [322] LaTeX Warning: Reference `module-hashlib' on page 323 undefined on input line 5 3. ) (/home/neal/python/trunk/Doc/lib/libmd5.tex [323] LaTeX Warning: Reference `module-sha' on page 324 undefined on input line 91. ) (/home/neal/python/trunk/Doc/lib/libsha.tex [324]) (/home/neal/python/trunk/Doc/lib/filesys.tex [325] [326] Chapter 11. LaTeX Warning: Reference `bltin-file-objects' on page 327 undefined on input li ne 12. LaTeX Warning: Reference `module-os' on page 327 undefined on input line 17. ) (/home/neal/python/trunk/Doc/lib/libposixpath.tex [327] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [328] [329]) (/home/neal/python/trunk/Doc/lib/libfileinput.tex [330] [331] Underfull \hbox (badness 10000) in paragraph at lines 185--187 []\OT1/ptm/m/n/10 Usage ex-am-ple: `\OT1/pcr/m/n/10 fi = fileinput.FileInput(op enhook=fileinput.hook_- ) (/home/neal/python/trunk/Doc/lib/libstat.tex [332]) (/home/neal/python/trunk/Doc/lib/libstatvfs.tex [333] [334]) (/home/neal/python/trunk/Doc/lib/libfilecmp.tex [335]) (/home/neal/python/trunk/Doc/lib/libtempfile.tex [336] [337]) (/home/neal/python/trunk/Doc/lib/libglob.tex [338] LaTeX Warning: Reference `module-fnmatch' on page 339 undefined on input line 5 0. ) (/home/neal/python/trunk/Doc/lib/libfnmatch.tex [339] LaTeX Warning: Reference `module-glob' on page 340 undefined on input line 85. ) (/home/neal/python/trunk/Doc/lib/liblinecache.tex) (/home/neal/python/trunk/Doc/lib/libshutil.tex [340] [341]) (/home/neal/python/trunk/Doc/lib/libdircache.tex) Underfull \hbox (badness 10000) in paragraph at lines 37--206 [342] (/home/neal/python/trunk/Doc/lib/archiving.tex [343] [344] Chapter 12. ) (/home/neal/python/trunk/Doc/lib/libzlib.tex [345] [346] LaTeX Warning: Reference `module-gzip' on page 347 undefined on input line 193. ) (/home/neal/python/trunk/Doc/lib/libgzip.tex [347] LaTeX Warning: Reference `module-zlib' on page 348 undefined on input line 69. ) (/home/neal/python/trunk/Doc/lib/libbz2.tex Underfull \hbox (badness 5460) in paragraph at lines 19--22 []\OT1/pcr/m/n/10 BZ2File \OT1/ptm/m/n/10 class im-ple-ments a com-plete file i n-ter-face, in-clud-ing \OT1/pcr/m/n/10 readline()\OT1/ptm/m/n/10 , \OT1/pcr/m/ n/10 readlines()\OT1/ptm/m/n/10 , [348] [349]) (/home/neal/python/trunk/Doc/lib/libzipfile.tex LaTeX Warning: Reference `zipfile-objects' on page 350 undefined on input line 38. LaTeX Warning: Reference `zipinfo-objects' on page 350 undefined on input line 55. [350] [351] [352] [353]) (/home/neal/python/trunk/Doc/lib/libtarfile.tex LaTeX Warning: Reference `tarfile-objects' on page 354 undefined on input line 32. LaTeX Warning: Reference `tar-examples' on page 354 undefined on input line 69. [354] LaTeX Warning: Reference `tarfile-objects' on page 355 undefined on input line 85. LaTeX Warning: Reference `module-zipfile' on page 355 undefined on input line 1 63. [355] LaTeX Warning: Reference `tarinfo-objects' on page 356 undefined on input line 181. Underfull \hbox (badness 5878) in paragraph at lines 234--241 []\OT1/ptm/m/n/10 The \OT1/ptm/m/it/10 en-cod-ing \OT1/ptm/m/n/10 ar-gu-ment de -fines the lo-cal char-ac-ter en-cod-ing. It de-faults to the value from LaTeX Warning: Reference `module-tarfile' on page 356 undefined on input line 2 51. [356] [357] [358] [359]) Underfull \hbox (badness 10000) in paragraph at lines 549--214 (/home/neal/python/trunk/Doc/lib/persistence.tex [360] Chapter 13. ) (/home/neal/python/trunk/Doc/lib/libpickle.tex [361] Underfull \hbox (badness 10000) in paragraph at lines 94--95 [362] LaTeX Warning: Reference `pickle-sub' on page 363 undefined on input line 255. [363] LaTeX Warning: Reference `pickle-protocol' on page 364 undefined on input line 347. [364] LaTeX Warning: Reference `pickle-protocol' on page 365 undefined on input line 377. LaTeX Warning: Reference `pickle-sub' on page 365 undefined on input line 433. [365] Underfull \hbox (badness 10000) in paragraph at lines 495--496 [366] LaTeX Warning: Reference `pickle-inst' on page 367 undefined on input line 536. [367] [368] [369] [370] LaTeX Warning: Reference `module-copyreg' on page 371 undefined on input line 8 40. LaTeX Warning: Reference `module-shelve' on page 371 undefined on input line 84 2. LaTeX Warning: Reference `module-copy' on page 371 undefined on input line 844. LaTeX Warning: Reference `module-marshal' on page 371 undefined on input line 8 46. ) (/home/neal/python/trunk/Doc/lib/libcopyreg.tex [371]) (/home/neal/python/trunk/Doc/lib/libshelve.tex [372] [373] LaTeX Warning: Reference `module-anydbm' on page 374 undefined on input line 16 5. LaTeX Warning: Reference `module-bsddb' on page 374 undefined on input line 166 . LaTeX Warning: Reference `module-dbhash' on page 374 undefined on input line 16 8. LaTeX Warning: Reference `module-dbm' on page 374 undefined on input line 169. LaTeX Warning: Reference `module-dumbdbm' on page 374 undefined on input line 1 70. LaTeX Warning: Reference `module-gdbm' on page 374 undefined on input line 171. LaTeX Warning: Reference `module-pickle' on page 374 undefined on input line 17 2. LaTeX Warning: Reference `module-cPickle' on page 374 undefined on input line 1 73. ) (/home/neal/python/trunk/Doc/lib/libmarshal.tex [374] Underfull \hbox (badness 10000) in paragraph at lines 38--39 [375]) (/home/neal/python/trunk/Doc/lib/libanydbm.tex [376] LaTeX Warning: Reference `module-dbhash' on page 377 undefined on input line 77 . LaTeX Warning: Reference `module-dbm' on page 377 undefined on input line 78. LaTeX Warning: Reference `module-dumbdbm' on page 377 undefined on input line 7 9. LaTeX Warning: Reference `module-gdbm' on page 377 undefined on input line 80. LaTeX Warning: Reference `module-shelve' on page 377 undefined on input line 82 . LaTeX Warning: Reference `module-whichdb' on page 377 undefined on input line 8 4. ) (/home/neal/python/trunk/Doc/lib/libwhichdb.tex) (/home/neal/python/trunk/Doc/lib/libdbm.tex [377] LaTeX Warning: Reference `module-anydbm' on page 378 undefined on input line 57 . LaTeX Warning: Reference `module-gdbm' on page 378 undefined on input line 58. LaTeX Warning: Reference `module-whichdb' on page 378 undefined on input line 6 0. ) (/home/neal/python/trunk/Doc/lib/libgdbm.tex [378] LaTeX Warning: Reference `module-anydbm' on page 379 undefined on input line 97 . LaTeX Warning: Reference `module-whichdb' on page 379 undefined on input line 9 9. ) (/home/neal/python/trunk/Doc/lib/libdbhash.tex [379] LaTeX Warning: Reference `module-anydbm' on page 380 undefined on input line 43 . LaTeX Warning: Reference `module-bsddb' on page 380 undefined on input line 44. LaTeX Warning: Reference `module-whichdb' on page 380 undefined on input line 4 6. ) (/home/neal/python/trunk/Doc/lib/libbsddb.tex [380] LaTeX Warning: Reference `module-dbhash' on page 381 undefined on input line 10 6. [381]) (/home/neal/python/trunk/Doc/lib/libdumbdbm.tex [382] [383] LaTeX Warning: Reference `module-anydbm' on page 384 undefined on input line 46 . LaTeX Warning: Reference `module-dbm' on page 384 undefined on input line 47. LaTeX Warning: Reference `module-gdbm' on page 384 undefined on input line 48. LaTeX Warning: Reference `module-shelve' on page 384 undefined on input line 49 . LaTeX Warning: Reference `module-whichdb' on page 384 undefined on input line 5 1. ) (/home/neal/python/trunk/Doc/lib/libsqlite3.tex [384] [385] LaTeX Warning: Reference `sqlite3-Connection-IsolationLevel' on page 386 undefi ned on input line 150. LaTeX Warning: Reference `sqlite3-Types' on page 386 undefined on input line 16 6. [386] No file sqlite3/complete_statement.py. LaTeX Warning: Reference `sqlite3-Controlling-Transactions' on page 387 undefin ed on input line 216. [387] No file sqlite3/collation_reverse.py. [388] No file sqlite3/row_factory.py. No file sqlite3/text_factory.py. No file sqlite3/execute_1.py. No file sqlite3/execute_2.py. [389] No file sqlite3/executemany_1.py. No file sqlite3/executemany_2.py. [390] No file sqlite3/adapter_point_1.py. [391] No file sqlite3/adapter_point_2.py. Underfull \hbox (badness 10000) in paragraph at lines 518--522 []\OT1/ptm/m/n/10 The \OT1/pcr/m/n/10 sqlite3 \OT1/ptm/m/n/10 mod-ule has two d e-fault adapters for Python's built-in \OT1/pcr/m/n/10 datetime.date \OT1/ptm/m /n/10 and No file sqlite3/adapter_datetime.py. LaTeX Warning: Reference `sqlite3-Module-Contents' on page 392 undefined on inp ut line 563. No file sqlite3/converter_point.py. No file sqlite3/pysqlite_datetime.py. [392] No file sqlite3/shortcut_methods.py. ) (/home/neal/python/trunk/Doc/lib/liballos.tex [393] [394] Chapter 14. ) (/home/neal/python/trunk/Doc/lib/libos.tex [395] LaTeX Warning: Reference `os-file-dir' on page 396 undefined on input line 124. [396] [397] [398] LaTeX Warning: Reference `popen2-flow-control' on page 399 undefined on input l ine 409. [399] [400] [401] [402] [403] [404] [405] LaTeX Warning: Reference `os-newstreams' on page 406 undefined on input line 11 87. [406] LaTeX Warning: Reference `os-newstreams' on page 407 undefined on input line 11 99. [407] [408] [409] LaTeX Warning: Reference `os-newstreams' on page 410 undefined on input line 15 79. [410] [411] [412] [413] [414]) (/home/neal/python/trunk/Doc/lib/libtime.tex [415] [416] [417] [418] [419] LaTeX Warning: Reference `module-datetime' on page 420 undefined on input line 460. LaTeX Warning: Reference `module-locale' on page 420 undefined on input line 46 3. LaTeX Warning: Reference `module-calendar' on page 420 undefined on input line 466. ) (/home/neal/python/trunk/Doc/lib/liboptparse.tex [420] [421] [422] [423] LaTeX Warning: Reference `optparse-extending-optparse' on page 424 undefined on input line 311. [424] LaTeX Warning: Reference `optparse-extending-optparse' on page 425 undefined on input line 376. [425] LaTeX Warning: Reference `optparse-reference-guide' on page 426 undefined on in put line 413. LaTeX Warning: Reference `optparse-option-callbacks' on page 426 undefined on i nput line 413. [426] [427] Underfull \hbox (badness 5726) in paragraph at lines 516--519 []\OT1/pcr/m/n/10 optparse \OT1/ptm/m/n/10 ex-pands \OT1/pcr/m/n/10 "%prog" \OT 1/ptm/m/n/10 in the us-age string to the name of the cur-rent pro-gram, i.e. [428] [429] LaTeX Warning: Reference `optparse-conflicts-between-options' on page 430 undef ined on input line 704. [430] LaTeX Warning: Reference `optparse-tutorial' on page 431 undefined on input lin e 728. [431] [432] [433] [434] LaTeX Warning: Reference `optparse-option-callbacks' on page 435 undefined on i nput line 1008. [435] LaTeX Warning: Reference `optparse-option-callbacks' on page 436 undefined on i nput line 1121. LaTeX Warning: Reference `optparse-tutorial' on page 436 undefined on input lin e 1142. LaTeX Warning: Reference `optparse-extending-optparse' on page 436 undefined on input line 1151. [436] [437] [438] [439] [440] [441] [442] [443] [444] [445] [446]) (/home/neal/python/trunk/Doc/lib/libgetopt.tex [447] [448] LaTeX Warning: Reference `module-optparse' on page 449 undefined on input line 153. ) (/home/neal/python/trunk/Doc/lib/liblogging.tex [449] [450] Overfull \hbox (10.29729pt too wide) in paragraph at lines 213--213 []\OT1/pcr/m/n/9 2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset[] [451] [452] Overfull \hbox (240.35738pt too wide) in paragraph at lines 317--328 [] [453] Overfull \hbox (10.29729pt too wide) in paragraph at lines 441--441 []\OT1/pcr/m/n/9 2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset[] [454] [455] LaTeX Warning: Reference `typesseq-strings' on page 456 undefined on input line 599. Overfull \hbox (367.90819pt too wide) in paragraph at lines 603--614 [] [456] [457] [458] [459] Overfull \vbox (288.57pt too high) has occurred while \output is active [460] [461] [462] [463] [464] [465] [466] LaTeX Warning: Reference `typesseq-strings' on page 467 undefined on input line 1411. Overfull \hbox (403.90819pt too wide) in paragraph at lines 1416--1448 [] [467] [468] [469] [470] [471] [472]) (/home/neal/python/trunk/Doc/lib/libgetpass.tex) (/home/neal/python/trunk/Doc/lib/libcurses.tex LaTeX Warning: Reference `module-curses.ascii' on page 473 undefined on input l ine 26. LaTeX Warning: Reference `module-curses.panel' on page 473 undefined on input l ine 28. LaTeX Warning: Reference `module-curses.textpad' on page 473 undefined on input line 30. LaTeX Warning: Reference `module-curses.wrapper' on page 473 undefined on input line 33. [473] [474] [475] [476] [477] [478] [479] [480] [481] [482] [483] [484] [485] Package longtable Warning: Column widths have changed (longtable) in table 14.1 on input line 1169. [486] Package longtable Warning: Column widths have changed (longtable) in table 14.2 on input line 1241. [487] [488]) (/home/neal/python/trunk/Doc/lib/libascii.tex [489] [490] [491]) (/home/neal/python/trunk/Doc/lib/libcursespanel.tex [492]) (/home/neal/python/trunk/Doc/lib/libplatform.tex [493] [494]) (/home/neal/python/trunk/Doc/lib/liberrno.tex [495] [496] [497] [498] [499] [500]) (/home/neal/python/trunk/Doc/lib/libctypes.tex [501] [502] [503] Overfull \hbox (6.48393pt too wide) in paragraph at lines 227--390 [] [504] [505] Overfull \hbox (28.49721pt too wide) in paragraph at lines 459--459 []\OT1/pcr/m/n/9 >>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes[] Overfull \hbox (71.69716pt too wide) in paragraph at lines 459--459 []\OT1/pcr/m/n/9 >>> p = create_string_buffer("Hello") # create a buffer c ontaining a NUL terminated string[] Overfull \hbox (23.09721pt too wide) in paragraph at lines 489--489 []\OT1/pcr/m/n/9 ArgumentError: argument 2: exceptions.TypeError: Don't know ho w to convert parameter 2[] [506] [507] [508] [509] [510] [511] [512] [513] [514] Overfull \hbox (12.29723pt too wide) in paragraph at lines 979--979 []\OT1/pcr/m/n/9 TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance[] [515] [516] [517] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] [518] [519] [520] [521] [522] [523] [524] [525] [526] [527] Overfull \hbox (89.29726pt too wide) in paragraph at lines 1827--1827 []\OT1/pcr/m/n/9 >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "capti on", None), (1, "flags", 0)[] Overfull \hbox (13.69734pt too wide) in paragraph at lines 1856--1856 []\OT1/pcr/m/n/9 >>> GetWindowRect = prototype(("GetWindowRect", windll.user32) , paramflags)[] [528] [529] [530] [531] [532] [533] [534] LaTeX Warning: Reference `ctypes-pointers' on page 535 undefined on input line 2448. LaTeX Warning: Reference `ctypes-arrays' on page 535 undefined on input line 24 49. ) (/home/neal/python/trunk/Doc/lib/libsomeos.tex [535] [536] Chapter 15. ) (/home/neal/python/trunk/Doc/lib/libselect.tex LaTeX Warning: Reference `poll-objects' on page 537 undefined on input line 29. [537]) (/home/neal/python/trunk/Doc/lib/libthread.tex [538] [539]) (/home/neal/python/trunk/Doc/lib/libthreading.tex [540] [541] [542] [543] [544] [545] [546] [547]) (/home/neal/python/trunk/Doc/lib/libdummythread.tex) (/home/neal/python/trunk/Doc/lib/libdummythreading.tex [548]) (/home/neal/python/trunk/Doc/lib/libmmap.tex [549] ! Undefined control sequence. \\methoddesc ...fulllineitems} \ifx #1\@undefined \methodline {#2}{#3} \else... l.92 \begin{methoddesc}[mmap]{close}{} ? ! Emergency stop. \\methoddesc ...fulllineitems} \ifx #1\@undefined \methodline {#2}{#3} \else... l.92 \begin{methoddesc}[mmap]{close}{} Output written on lib.dvi (555 pages, 1939256 bytes). Transcript written on lib.log. *** Session transcript and error messages are in /home/neal/python/trunk/Doc/html/lib/lib.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/trunk/Doc/lib:/home/neal/python/trunk/Doc/commontex:/home/neal/python/trunk/Doc/paper-letter:/home/neal/python/trunk/Doc/texinputs: +++ latex lib make: *** [html/lib/lib.html] Error 1 From buildbot at python.org Mon Apr 2 12:41:31 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Apr 2007 10:41:31 +0000 Subject: [Python-checkins] buildbot failure in x86 cygwin trunk Message-ID: <20070402104131.B6A521E400B@bag.python.org> The Buildbot has detected a new failure of x86 cygwin trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%2520trunk/builds/20 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,neal.norwitz BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Apr 2 17:21:37 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 2 Apr 2007 17:21:37 +0200 (CEST) Subject: [Python-checkins] r54656 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070402152137.6C6231E400A@bag.python.org> Author: guido.van.rossum Date: Mon Apr 2 17:21:36 2007 New Revision: 54656 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Experiment with adapters. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Mon Apr 2 17:21:36 2007 @@ -288,6 +288,9 @@ class _MappingView: + def __new__(cls, *args): + return object.__new__(cls) + def __init__(self, mapping): self._mapping = mapping @@ -544,3 +547,39 @@ if h == -1: h = -2 return h + + +### ADAPTERS ### + + +class AdaptToSequence(Sequence): + + def __new__(cls, *args): + return Sequence.__new__(cls) + + def __init__(self, adaptee): + self.adaptee = adaptee + + def __getitem__(self, index): + return self.adaptee[index] + + def __len__(self): + return len(self.adaptee) + + +class AdaptToMapping(SizeableMapping): + + def __new__(cls, *args): + return SizeableMapping.__new__(cls) + + def __init__(self, adaptee): + self.adaptee = adaptee + + def __getitem__(self, index): + return self.adaptee[index] + + def __len__(self): + return len(self.adaptee) + + def __iter__(self): + return iter(self.adaptee) Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Mon Apr 2 17:21:36 2007 @@ -38,6 +38,33 @@ htl = hash(tuple(l)) self.assertEqual(hcl, htl, repr((l, hcl, htl))) + def test_adapt_to_sequence(self): + a = abc.AdaptToSequence(range(10)) + self.assertEqual(len(a), 10) + self.assertEqual(a[0], 0) + self.assertEqual(a[9], 9) + self.assertEqual(a[-1], 9) + self.assertEqual(list(a), range(10)) + #self.assertEqual(a, range(10)) + # Slicing isn't implemented correctly + + def test_adapt_to_mapping(self): + a = abc.AdaptToMapping({1: 10, 2: 20}) + self.assertEqual(len(a), 2) + self.assertEqual(a[1], 10) + self.assertEqual(a.get(2), 20) + self.assertEqual(a.get(3), None) + self.assertEqual(a.get(4, 42), 42) + self.assertEqual(1 in a, True) + self.assertEqual(2 in a, True) + self.assertEqual(3 in a, False) + self.assertEqual(set(a.keys()), {1, 2}) + self.assertEqual(set(a.items()), {(1, 10), (2, 20)}) + self.assertEqual(set(a.values()), {10, 20}) + #self.assertEqual(a.keys(), {1, 2}) + #self.assertEqual(a.items(), {(1, 10), (2, 20)}) + #self.assertEqual(a.values(), {10, 20}) + if __name__ == "__main__": unittest.main() From python-checkins at python.org Mon Apr 2 19:03:53 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 2 Apr 2007 19:03:53 +0200 (CEST) Subject: [Python-checkins] r54657 - in python/branches/release25-maint: Lib/test/test_array.py Misc/NEWS Modules/arraymodule.c Message-ID: <20070402170353.44A4C1E400A@bag.python.org> Author: raymond.hettinger Date: Mon Apr 2 19:03:46 2007 New Revision: 54657 Modified: python/branches/release25-maint/Lib/test/test_array.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/arraymodule.c Log: SF #1693079 Array module cannot pickle empty arrays Modified: python/branches/release25-maint/Lib/test/test_array.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_array.py (original) +++ python/branches/release25-maint/Lib/test/test_array.py Mon Apr 2 19:03:46 2007 @@ -111,6 +111,21 @@ self.assertEqual(a.x, b.x) self.assertEqual(type(a), type(b)) + def test_pickle_for_empty_array(self): + for protocol in (0, 1, 2): + a = array.array(self.typecode) + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + + a = ArraySubclass(self.typecode) + a.x = 10 + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + self.assertEqual(a.x, b.x) + self.assertEqual(type(a), type(b)) + def test_insert(self): a = array.array(self.typecode, self.example) a.insert(0, self.example[0]) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Apr 2 19:03:46 2007 @@ -134,6 +134,8 @@ Extension Modules ----------------- +- Bug #1693079: The array module can now successfully pickle empty arrays. + - Bug #1688393: Prevent crash in socket.recvfrom if length is negative. - Bug #1622896: fix a rare corner case where the bz2 module raised an Modified: python/branches/release25-maint/Modules/arraymodule.c ============================================================================== --- python/branches/release25-maint/Modules/arraymodule.c (original) +++ python/branches/release25-maint/Modules/arraymodule.c Mon Apr 2 19:03:46 2007 @@ -1147,12 +1147,19 @@ dict = Py_None; Py_INCREF(dict); } - result = Py_BuildValue("O(cs#)O", - array->ob_type, - array->ob_descr->typecode, - array->ob_item, - array->ob_size * array->ob_descr->itemsize, - dict); + if (array->ob_size > 0) { + result = Py_BuildValue("O(cs#)O", + array->ob_type, + array->ob_descr->typecode, + array->ob_item, + array->ob_size * array->ob_descr->itemsize, + dict); + } else { + result = Py_BuildValue("O(c)O", + array->ob_type, + array->ob_descr->typecode, + dict); + } Py_DECREF(dict); return result; } From python-checkins at python.org Mon Apr 2 19:29:30 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 2 Apr 2007 19:29:30 +0200 (CEST) Subject: [Python-checkins] r54658 - in python/trunk: Lib/test/test_array.py Modules/arraymodule.c Message-ID: <20070402172930.EA8071E400B@bag.python.org> Author: raymond.hettinger Date: Mon Apr 2 19:29:30 2007 New Revision: 54658 Modified: python/trunk/Lib/test/test_array.py python/trunk/Modules/arraymodule.c Log: SF #1693079: Cannot save empty array in shelve Modified: python/trunk/Lib/test/test_array.py ============================================================================== --- python/trunk/Lib/test/test_array.py (original) +++ python/trunk/Lib/test/test_array.py Mon Apr 2 19:29:30 2007 @@ -111,6 +111,21 @@ self.assertEqual(a.x, b.x) self.assertEqual(type(a), type(b)) + def test_pickle_for_empty_array(self): + for protocol in (0, 1, 2): + a = array.array(self.typecode) + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + + a = ArraySubclass(self.typecode) + a.x = 10 + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + self.assertEqual(a.x, b.x) + self.assertEqual(type(a), type(b)) + def test_insert(self): a = array.array(self.typecode, self.example) a.insert(0, self.example[0]) Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Mon Apr 2 19:29:30 2007 @@ -1147,12 +1147,19 @@ dict = Py_None; Py_INCREF(dict); } - result = Py_BuildValue("O(cs#)O", - array->ob_type, - array->ob_descr->typecode, - array->ob_item, - array->ob_size * array->ob_descr->itemsize, - dict); + if (array->ob_size > 0) { + result = Py_BuildValue("O(cs#)O", + array->ob_type, + array->ob_descr->typecode, + array->ob_item, + array->ob_size * array->ob_descr->itemsize, + dict); + } else { + result = Py_BuildValue("O(c)O", + array->ob_type, + array->ob_descr->typecode, + dict); + } Py_DECREF(dict); return result; } From python-checkins at python.org Mon Apr 2 19:31:28 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 2 Apr 2007 19:31:28 +0200 (CEST) Subject: [Python-checkins] r54659 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070402173128.F17D81E400A@bag.python.org> Author: guido.van.rossum Date: Mon Apr 2 19:31:27 2007 New Revision: 54659 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Add set adaptation. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Mon Apr 2 19:31:27 2007 @@ -554,11 +554,10 @@ class AdaptToSequence(Sequence): - def __new__(cls, *args): - return Sequence.__new__(cls) - - def __init__(self, adaptee): + def __new__(cls, adaptee): + self = Sequence.__new__(cls) self.adaptee = adaptee + return self def __getitem__(self, index): return self.adaptee[index] @@ -569,11 +568,10 @@ class AdaptToMapping(SizeableMapping): - def __new__(cls, *args): - return SizeableMapping.__new__(cls) - - def __init__(self, adaptee): + def __new__(cls, adaptee): + self = SizeableMapping.__new__(cls) self.adaptee = adaptee + return self def __getitem__(self, index): return self.adaptee[index] @@ -583,3 +581,20 @@ def __iter__(self): return iter(self.adaptee) + + +class AdaptToSet(SizeableSet): + + def __new__(cls, adaptee): + self = SizeableSet.__new__(cls) + self.adaptee = adaptee + return self + + def __contains__(self, elem): + return elem in self.adaptee + + def __iter__(self): + return iter(self.adaptee) + + def __len__(self): + return len(self.adaptee) Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Mon Apr 2 19:31:27 2007 @@ -65,6 +65,13 @@ #self.assertEqual(a.items(), {(1, 10), (2, 20)}) #self.assertEqual(a.values(), {10, 20}) + def test_adapt_to_set(self): + a = abc.AdaptToSet({1, 2, 3}) + self.assertEqual(1 in a, True) + self.assertEqual(2 in a, True) + self.assertEqual(42 in a, False) + self.assertEqual(len(a), 3) + if __name__ == "__main__": unittest.main() From python-checkins at python.org Mon Apr 2 19:39:53 2007 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 2 Apr 2007 19:39:53 +0200 (CEST) Subject: [Python-checkins] r54660 - python/branches/amk-mailbox/Lib/mailbox.py Message-ID: <20070402173953.6EDB61E400A@bag.python.org> Author: andrew.kuchling Date: Mon Apr 2 19:39:52 2007 New Revision: 54660 Modified: python/branches/amk-mailbox/Lib/mailbox.py Log: Simplify MH.remove(). Locking a file and then removing it seems to be dodgy practice, and I don't see what good it does to lock a file you're about to remove completely. Modified: python/branches/amk-mailbox/Lib/mailbox.py ============================================================================== --- python/branches/amk-mailbox/Lib/mailbox.py (original) +++ python/branches/amk-mailbox/Lib/mailbox.py Mon Apr 2 19:39:52 2007 @@ -871,24 +871,9 @@ def remove(self, key): """Remove the keyed message; raise KeyError if it doesn't exist.""" path = os.path.join(self._path, str(key)) - try: - f = open(path, 'rb+') - except IOError, e: - if e.errno == errno.ENOENT: - raise KeyError('No message with key: %s' % key) - else: - raise - try: - if self._locked: - _lock_file(f) - try: - f.close() - os.remove(os.path.join(self._path, str(key))) - finally: - if self._locked: - _unlock_file(f) - finally: - f.close() + if not os.path.exists(path): + raise KeyError('No message with key: %s' % key) + os.remove(path) def __setitem__(self, key, message): """Replace the keyed message; raise KeyError if it doesn't exist.""" From python-checkins at python.org Mon Apr 2 20:08:48 2007 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 2 Apr 2007 20:08:48 +0200 (CEST) Subject: [Python-checkins] r54661 - python/branches/amk-mailbox/Lib/test/test_mailbox.py Message-ID: <20070402180848.6E5931E400A@bag.python.org> Author: andrew.kuchling Date: Mon Apr 2 20:08:43 2007 New Revision: 54661 Modified: python/branches/amk-mailbox/Lib/test/test_mailbox.py Log: Add tests from David Watson that check that message keys don't change after various actions Modified: python/branches/amk-mailbox/Lib/test/test_mailbox.py ============================================================================== --- python/branches/amk-mailbox/Lib/test/test_mailbox.py (original) +++ python/branches/amk-mailbox/Lib/test/test_mailbox.py Mon Apr 2 20:08:43 2007 @@ -122,6 +122,38 @@ self.assert_(len(self._box) == 1) self.assertRaises(KeyError, lambda: self._box[key0]) + def test_double_shorten(self): + # Check that flush() can shorten the mailbox twice + self._test_remove_two_of_three(broken_locking=False) + + def test_remove_with_broken_locking(self): + # Check that a (broken) application releasing the lock and + # then removing messages using the existing keys does not + # delete the wrong messages. + self._test_remove_two_of_three(broken_locking=True) + + def _test_remove_two_of_three(self, broken_locking=False): + self._box.lock() + key0 = self._box.add(self._template % 0) + key1 = self._box.add(self._template % 1) + key2 = self._box.add(self._template % 2) + self._box.flush() + self._box.remove(key0) + self._box.flush() + if broken_locking: + # As the name suggests, code that does this is broken + # (releasing the lock invalidates the keys, in general), + # but ideally mailbox.py should not break it further. + self._box.unlock() + self._box.lock() + self._box.remove(key1) + self._box.flush() + self._box.unlock() + self._box.close() + self._box = self._factory(self._path) + self.assert_(len(self._box) == 1) + self.assert_(self._box.itervalues().next().get_payload() == '2') + def test_get(self): # Retrieve messages using get() key0 = self._box.add(self._template % 0) From nnorwitz at gmail.com Mon Apr 2 23:31:43 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 2 Apr 2007 17:31:43 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20070402213143.GA21308@python.psfb.org> TEXINPUTS=/home/neal/python/trunk/Doc/commontex: python /home/neal/python/trunk/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/lib lib/lib.tex *** Session transcript and error messages are in /home/neal/python/trunk/Doc/html/lib/lib.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex lib This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/trunk/Doc/lib/lib.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/trunk/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/trunk/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/trunk/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/trunk/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/trunk/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/home/neal/python/trunk/Doc/texinputs/underscore.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty) (./lib.pla))) (/home/neal/python/trunk/Doc/commontex/boilerplate.tex (/home/neal/python/trunk/Doc/commontex/patchlevel.tex)) Writing index file lib.idx (./lib.aux LaTeX Warning: Label `dom-objects' multiply defined. ) (/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd) (/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) [1] (/home/neal/python/trunk/Doc/commontex/copyright.tex (/usr/share/texmf/tex/latex/psnfss/omsptm.fd)) [2] Adding blank page after the abstract. [1] [2] (./lib.toc) Adding blank page after the table of contents. [1] [2] (/home/neal/python/trunk/Doc/lib/libintro.tex Chapter 1. (/usr/share/texmf/tex/latex/psnfss/ot1pcr.fd)) (/home/neal/python/trunk/Doc/lib/libobjs.tex [1] [2] Chapter 2. ) (/home/neal/python/trunk/Doc/lib/libfuncs.tex [3] [4] [5] [6] [7] Underfull \hbox (badness 10000) in paragraph at lines 445--449 []\OT1/ptm/m/n/10 Note that \OT1/pcr/m/n/10 filter(function, \OT1/ptm/m/it/10 i t-er-able\OT1/pcr/m/n/10 ) \OT1/ptm/m/n/10 is equiv-a-lent to \OT1/pcr/m/n/10 [ item for item in \OT1/ptm/m/it/10 it-er-able \OT1/pcr/m/n/10 if [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]) (/home/neal/python/trunk/Doc/lib/libexcs.tex Underfull \hbox (badness 10000) in paragraph at lines 78--82 \OT1/ptm/m/n/10 The base class for all built-in ex-cep-tions ex-cept \OT1/pcr/m /n/10 StopIteration\OT1/ptm/m/n/10 , \OT1/pcr/m/n/10 GeneratorExit\OT1/ptm/m/n/ 10 , [18] [19] [20] [21] No file ../../Lib/test/exception_hierarchy.txt. ) (/home/neal/python/trunk/Doc/lib/libconsts.tex) (/home/neal/python/trunk/Doc/lib/libstdtypes.tex [22] Chapter 3. [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] Overfull \hbox (8.48134pt too wide) in paragraph at lines 977--987 [] Overfull \hbox (141.78873pt too wide) in paragraph at lines 994--1019 [] [33] Overfull \hbox (44.61931pt too wide) in paragraph at lines 1103--1135 [] [34] [35] [36] Overfull \hbox (98.60141pt too wide) in paragraph at lines 1315--1343 [] Overfull \hbox (44.38484pt too wide) in paragraph at lines 1405--1461 [] [37] [38] LaTeX Warning: Reference `context-closing' on page 39 undefined on input line 1 583. [39] [40] [41] Underfull \hbox (badness 10000) in paragraph at lines 1836--1843 []\OT1/ptm/m/n/10 An ex-am-ple of a con-text man-ager that re-turns a re-lated ob-ject is the one re-turned by [42] [43] [44]) (/home/neal/python/trunk/Doc/lib/libstrings.tex [45] [46] Chapter 4. (./lib4.syn) Overfull \hbox (5.23152pt too wide) in paragraph at lines 7--8 [][] Underfull \hbox (badness 10000) in paragraph at lines 7--8 ) (/home/neal/python/trunk/Doc/lib/libstring.tex [47] [48] [49] [50] [51]) (/home/neal/python/trunk/Doc/lib/libre.tex [52] [53] [54] [55] [56] [57] [58] [59] [60] [61]) (/home/neal/python/trunk/Doc/lib/libstruct.tex [62] [63] [64]) (/home/neal/python/trunk/Doc/lib/libdifflib.tex [65] [66] [67] [68] [69] [70] [71] [72]) (/home/neal/python/trunk/Doc/lib/libstringio.tex [73] [74]) (/home/neal/python/trunk/Doc/lib/libtextwrap.tex [75] [76]) (/home/neal/python/trunk/Doc/lib/libcodecs.tex [77] Underfull \hbox (badness 5161) in paragraph at lines 52--56 []\OT1/ptm/m/n/10 The fac-tory func-tions must re-turn ob-jects pro-vid-ing the in-ter-faces de-fined by the base classes [78] [79] Overfull \hbox (405.07822pt too wide) in paragraph at lines 288--300 [] [80] [81] [82] [83] [84] [85] [86] Overfull \hbox (254.7505pt too wide) in alignment at lines 820--820 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 820--901 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 901--981 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 981--1062 [] [] [] Overfull \hbox (254.7505pt too wide) in alignment at lines 1062--1142 [] [] [] [87] Overfull \hbox (254.7505pt too wide) in alignment at lines 1142--1167 [] [] [] Overfull \hbox (465.03658pt too wide) in paragraph at lines 1179--1268 [] [88] [89]) (/home/neal/python/trunk/Doc/lib/libunicodedata.tex [90]) (/home/neal/python/trunk/Doc/lib/libstringprep.tex [91] [92]) (/home/neal/python/trunk/Doc/lib/libfpformat.tex) Underfull \hbox (badness 10000) in paragraph at lines 50--98 (/home/neal/python/trunk/Doc/lib/datatypes.tex [93] [94] Chapter 5. (./lib5.syn)) (/home/neal/python/trunk/Doc/lib/libdatetime.tex [95] [96] Underfull \hbox (badness 10000) in paragraph at lines 185--187 \OT1/ptm/m/n/10 The small-est pos-si-ble dif-fer-ence be-tween non-equal \OT1/p cr/m/n/10 timedelta \OT1/ptm/m/n/10 ob-jects, (/usr/share/texmf/tex/latex/psnfss/omlptm.fd) [97] Overfull \hbox (44.65097pt too wide) in paragraph at lines 204--235 [] [98] [99] Underfull \hbox (badness 10000) in paragraph at lines 430--439 \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .month, \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .da y, 0, 0, 0, \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .weekday(), \OT1/ptm/m/it/10 d\OT 1/pcr/m/n/10 .toordinal() - date(\OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .year, 1, Underfull \hbox (badness 10000) in paragraph at lines 464--467 []\OT1/ptm/m/n/10 The ISO cal-en-dar is a widely used vari-ant of the Gre-go-ri an cal-en-dar. See [100] Underfull \hbox (badness 10000) in paragraph at lines 547--551 \OT1/ptm/m/n/10 Return the cur-rent lo-cal date-time, with \OT1/pcr/m/n/10 tzin fo None\OT1/ptm/m/n/10 . This is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 561--566 []\OT1/ptm/m/n/10 Else \OT1/ptm/m/it/10 tz \OT1/ptm/m/n/10 must be an in-stance of a class \OT1/pcr/m/n/10 tzinfo \OT1/ptm/m/n/10 sub-class, and the cur-rent date Underfull \hbox (badness 10000) in paragraph at lines 561--566 \OT1/ptm/m/n/10 and time are con-verted to \OT1/ptm/m/it/10 tz\OT1/ptm/m/n/10 ' s time zone. In this case the re-sult is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 582--586 []\OT1/ptm/m/n/10 Else \OT1/ptm/m/it/10 tz \OT1/ptm/m/n/10 must be an in-stance of a class \OT1/pcr/m/n/10 tzinfo \OT1/ptm/m/n/10 sub-class, and the times- Underfull \hbox (badness 10000) in paragraph at lines 582--586 \OT1/ptm/m/n/10 tamp is con-verted to \OT1/ptm/m/it/10 tz\OT1/ptm/m/n/10 's tim e zone. In this case the re-sult is equiv-a-lent to [101] Underfull \hbox (badness 5519) in paragraph at lines 646--648 \OT1/ptm/m/n/10 The lat-est rep-re-sentable \OT1/pcr/m/n/10 datetime\OT1/ptm/m/ n/10 , \OT1/pcr/m/n/10 datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, [102] [103] Underfull \hbox (badness 10000) in paragraph at lines 874--888 \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .weekday(), \OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .toordinal() - date(\OT1/ptm/m/it/10 d\OT1/pcr/m/n/10 .year, 1, 1).toordinal() + 1, dst)) \OT1/ptm/m/n/10 The [104] Underfull \hbox (badness 10000) in paragraph at lines 923--925 \OT1/ptm/m/n/10 Return a 3-tuple, (ISO year, ISO week num-ber, ISO week-day). T he same as Underfull \hbox (badness 5064) in paragraph at lines 960--969 \OT1/ptm/m/n/10 Return a string rep-re-sent-ing the date and time, for ex-am-pl e \OT1/pcr/m/n/10 datetime(2002, 12, 4, 20, Underfull \hbox (badness 10000) in paragraph at lines 960--969 \OT1/pcr/m/n/10 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'\OT1/ptm/m/n/10 . \ OT1/pcr/m/n/10 d.ctime() \OT1/ptm/m/n/10 is equiv-a-lent to [105] [106] [107] [108] [109] [110] [111] [112]) (/home/neal/python/trunk/Doc/lib/libcalendar.tex [113] [114] [115]) (/home/neal/python/trunk/Doc/lib/libcollections.tex [116] [117] [118] [119] [120] Overfull \hbox (6.89723pt too wide) in paragraph at lines 343--343 []\OT1/pcr/m/n/9 >>> s = [('red', 1), ('blue', 2), ('red', 3), ('blue', 4), ('r ed', 1), ('blue', 4)][] [121] Overfull \hbox (4.8973pt too wide) in paragraph at lines 376--376 []\OT1/pcr/m/n/9 >>> p = Point(11, y=22) # instantiate with positional or k eyword arguments[] Overfull \hbox (31.89726pt too wide) in paragraph at lines 389--389 []\OT1/pcr/m/n/9 EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade')[] ) (/home/neal/python/trunk/Doc/lib/libheapq.tex [122] [123] [124]) (/home/neal/python/trunk/Doc/lib/libbisect.tex) (/home/neal/python/trunk/Doc/lib/libarray.tex [125] [126] [127] [128]) (/home/neal/python/trunk/Doc/lib/libsets.tex [129] Overfull \hbox (98.60141pt too wide) in paragraph at lines 137--165 [] [130] [131]) (/home/neal/python/trunk/Doc/lib/libsched.tex [132]) (/home/neal/python/trunk/Doc/lib/libmutex.tex [133]) (/home/neal/python/trunk/Doc/lib/libqueue.tex [134]) (/home/neal/python/trunk/Doc/lib/libweakref.tex [135] [136] [137] [138]) (/home/neal/python/trunk/Doc/lib/libuserdict.tex [139] [140]) (/home/neal/python/trunk/Doc/lib/libtypes.tex [141] [142] Underfull \hbox (badness 10000) in paragraph at lines 200--205 \OT1/ptm/m/n/10 The type of ob-jects de-fined in ex-ten-sion mod-ules with \OT1 /pcr/m/n/10 PyMemberDef\OT1/ptm/m/n/10 , such as [143]) (/home/neal/python/trunk/Doc/lib/libnew.tex) (/home/neal/python/trunk/Doc/lib/libcopy.tex [144]) (/home/neal/python/trunk/Doc/lib/libpprint.tex [145] [146] [147]) (/home/neal/python/trunk/Doc/lib/librepr.tex [148]) Underfull \hbox (badness 10000) in paragraph at lines 120--121 (/home/neal/python/trunk/Doc/lib/numeric.tex [149] [150] Chapter 6. (./lib6.syn)) (/home/neal/python/trunk/Doc/lib/libmath.tex [151] [152]) (/home/neal/python/trunk/Doc/lib/libcmath.tex [153] [154]) (/home/neal/python/trunk/Doc/lib/libdecimal.tex [155] [156] [157] [158] Overfull \hbox (21.09727pt too wide) in paragraph at lines 305--305 [] \OT1/pcr/m/n/9 digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6 ' | '7' | '8' | '9'[] [159] [160] [161] [162] [163] [164] [165] [166] [167] Overfull \vbox (959.57pt too high) has occurred while \output is active [168] [169] [170]) (/home/neal/python/trunk/Doc/lib/librandom.tex [171] Underfull \hbox (badness 6575) in paragraph at lines 119--124 \OT1/ptm/m/n/10 Return a ran-domly se-lected el-e-ment from \OT1/pcr/m/n/10 ran ge(\OT1/ptm/m/it/10 start\OT1/pcr/m/n/10 , \OT1/ptm/m/it/10 stop\OT1/pcr/m/n/10 , \OT1/ptm/m/it/10 step\OT1/pcr/m/n/10 )\OT1/ptm/m/n/10 . This is equiv-a-lent to [172] [173]) (/home/neal/python/trunk/Doc/lib/libitertools.tex [174] [175] [176] [177] Overfull \hbox (15.69728pt too wide) in paragraph at lines 323--323 [] \OT1/pcr/m/n/9 yield counter() # yields the fillvalue, or raises IndexError[] [178] [179] [180] [181]) (/home/neal/python/trunk/Doc/lib/libfunctools.tex [182] Overfull \vbox (255.57pt too high) has occurred while \output is active [183] [184]) (/home/neal/python/trunk/Doc/lib/liboperator.tex [185] [186] [187] [188] [189] [190]) (/home/neal/python/trunk/Doc/lib/netdata.tex [191] [192] Chapter 7. (./lib7.syn)) (/home/neal/python/trunk/Doc/lib/email.tex [193] LaTeX Warning: Reference `module-smtplib' on page 194 undefined on input line 5 8. LaTeX Warning: Reference `module-nntplib' on page 194 undefined on input line 5 9. (/home/neal/python/trunk/Doc/lib/emailmessage.tex [194] [195] [196] [197] [198] [199]) (/home/neal/python/trunk/Doc/lib/emailparser.tex [200] [201]) (/home/neal/python/trunk/Doc/lib/emailgenerator.tex [202]) (/home/neal/python/trunk/Doc/lib/emailmimebase.tex [203] [204]) (/home/neal/python/trunk/Doc/lib/emailheaders.tex [205] [206]) (/home/neal/python/trunk/Doc/lib/emailcharsets.tex [207] [208] [209]) (/home/neal/python/trunk/Doc/lib/emailencoders.tex) (/home/neal/python/trunk/Doc/lib/emailexc.tex [210]) (/home/neal/python/trunk/Doc/lib/emailutil.tex [211] [212]) (/home/neal/python/trunk/Doc/lib/emailiter.tex [213]) [214] [215] [216] [217] [218] [219] [220]) (/home/neal/python/trunk/Doc/lib/libmailcap.tex [221]) (/home/neal/python/trunk/Doc/lib/libmailbox.tex [222] Underfull \hbox (badness 10000) in paragraph at lines 72--73 [223] [224] [225] [226] [227] [228] (/usr/share/texmf/tex/latex/psnfss/omspcr.fd) [229] [230] [231] [232] [233] [234] [235] [236] [237] [238] [239]) (/home/neal/python/trunk/Doc/lib/libmhlib.tex [240] [241] [242]) (/home/neal/python/trunk/Doc/lib/libmimetools.tex [243]) (/home/neal/python/trunk/Doc/lib/libmimetypes.tex [244] [245] [246]) (/home/neal/python/trunk/Doc/lib/libmimewriter.tex [247]) (/home/neal/python/trunk/Doc/lib/libmimify.tex [248]) (/home/neal/python/trunk/Doc/lib/libmultifile.tex [249]) (/home/neal/python/trunk/Doc/lib/librfc822.tex [250] [251] [252] [253] Underfull \hbox (badness 7379) in paragraph at lines 254--270 []\OT1/pcr/m/n/10 Message \OT1/ptm/m/n/10 in-stances also sup-port a lim-ited m ap-ping in-ter-face. In par-tic-u-lar: \OT1/ptm/m/it/10 m\OT1/pcr/m/n/10 [name] \OT1/ptm/m/n/10 is like [254]) (/home/neal/python/trunk/Doc/lib/libbase64.tex [255] [256]) (/home/neal/python/trunk/Doc/lib/libbinhex.tex) (/home/neal/python/trunk/Doc/lib/libbinascii.tex [257] [258]) (/home/neal/python/trunk/Doc/lib/libquopri.tex [259]) (/home/neal/python/trunk/Doc/lib/libuu.tex) (/home/neal/python/trunk/Doc/lib/markup.tex [260] Chapter 8. (./lib8.syn)) (/home/neal/python/trunk/Doc/lib/libhtmlparser.tex [261] [262]) (/home/neal/python/trunk/Doc/lib/libsgmllib.tex [263] [264] [265]) (/home/neal/python/trunk/Doc/lib/libhtmllib.tex [266] LaTeX Warning: Reference `module-formatter' on page 267 undefined on input line 81. Underfull \hbox (badness 7168) in paragraph at lines 158--165 \OT1/ptm/m/n/10 This mod-ule de-fines three dic-tio-nar-ies, \OT1/pcr/m/n/10 na me2codepoint\OT1/ptm/m/n/10 , \OT1/pcr/m/n/10 codepoint2name\OT1/ptm/m/n/10 , a nd \OT1/pcr/m/n/10 entitydefs\OT1/ptm/m/n/10 . [267]) (/home/neal/python/trunk/Doc/lib/libpyexpat.tex [268] Underfull \hbox (badness 10000) in paragraph at lines 160--167 \OT1/ptm/m/n/10 Calling this with a true value for \OT1/ptm/m/it/10 flag \OT1/p tm/m/n/10 (the de-fault) will cause Ex-pat to call the [269] [270] [271] [272] [273] [274] [275]) (/home/neal/python/trunk/Doc/lib/xmldom.tex [276] [277] [278] [279] [280] [281] [282] [283] [284] Underfull \hbox (badness 10000) in paragraph at lines 807--810 \OT1/ptm/m/n/10 Exception when a node does not ex-ist in the ref-er-enced con-t ext. For ex-am-ple, [285]) (/home/neal/python/trunk/Doc/lib/xmldomminidom.tex [286] [287] [288] [289] Underfull \hbox (badness 10000) in paragraph at lines 242--246 []\OT1/pcr/m/n/10 const \OT1/ptm/m/n/10 dec-la-ra-tions map to vari-ables in th eir re-spec-tive scope (e.g. [290]) (/home/neal/python/trunk/Doc/lib/xmldompulldom.tex) (/home/neal/python/trunk/Doc/lib/xmlsax.tex [291] [292]) (/home/neal/python/trunk/Doc/lib/xmlsaxhandler.tex [293] [294] [295] [296]) (/home/neal/python/trunk/Doc/lib/xmlsaxutils.tex [297]) (/home/neal/python/trunk/Doc/lib/xmlsaxreader.tex [298] [299] Underfull \hbox (badness 10000) in paragraph at lines 159--163 \OT1/ptm/m/n/10 Return the cur-rent set-ting for fea-ture \OT1/ptm/m/it/10 fea- ture-name\OT1/ptm/m/n/10 . If the fea-ture is not rec-og-nized, Underfull \hbox (badness 6188) in paragraph at lines 173--177 \OT1/ptm/m/n/10 Return the cur-rent set-ting for prop-erty \OT1/ptm/m/it/10 pro p-er-ty-name\OT1/ptm/m/n/10 . If the prop-erty is not rec-og-nized, a [300] [301]) (/home/neal/python/trunk/Doc/lib/libetree.tex [302] [303] [304] [305] [306]) (/home/neal/python/trunk/Doc/lib/fileformats.tex [307] [308] Chapter 9. (./lib9.syn)) (/home/neal/python/trunk/Doc/lib/libcsv.tex [309] [310] [311] [312] [313]) (/home/neal/python/trunk/Doc/lib/libcfgparser.tex [314] Overfull \vbox (35.57pt too high) has occurred while \output is active [315] Underfull \hbox (badness 10000) in paragraph at lines 22--23 [316] LaTeX Warning: Reference `module-shlex' on page 317 undefined on input line 150 . [317] [318]) (/home/neal/python/trunk/Doc/lib/librobotparser.tex Overfull \hbox (1.49724pt too wide) in paragraph at lines 66--66 []\OT1/pcr/m/n/9 >>> rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search? city=San+Francisco")[] ) (/home/neal/python/trunk/Doc/lib/libnetrc.tex [319]) (/home/neal/python/trunk/Doc/lib/libxdrlib.tex [320] [321] [322]) Underfull \hbox (badness 10000) in paragraph at lines 244--183 (/home/neal/python/trunk/Doc/lib/libcrypto.tex [323] [324] Chapter 10. (./lib10.syn)) (/home/neal/python/trunk/Doc/lib/libhashlib.tex [325]) (/home/neal/python/trunk/Doc/lib/libhmac.tex [326]) (/home/neal/python/trunk/Doc/lib/libmd5.tex [327]) (/home/neal/python/trunk/Doc/lib/libsha.tex [328]) (/home/neal/python/trunk/Doc/lib/filesys.tex [329] [330] Chapter 11. (./lib11.syn)) (/home/neal/python/trunk/Doc/lib/libposixpath.tex [331] [332] (/usr/share/texmf/tex/latex/psnfss/omsphv.fd) [333]) (/home/neal/python/trunk/Doc/lib/libfileinput.tex [334] [335] Underfull \hbox (badness 10000) in paragraph at lines 185--187 []\OT1/ptm/m/n/10 Usage ex-am-ple: `\OT1/pcr/m/n/10 fi = fileinput.FileInput(op enhook=fileinput.hook_- ) (/home/neal/python/trunk/Doc/lib/libstat.tex [336]) (/home/neal/python/trunk/Doc/lib/libstatvfs.tex [337] [338]) (/home/neal/python/trunk/Doc/lib/libfilecmp.tex [339]) (/home/neal/python/trunk/Doc/lib/libtempfile.tex [340] [341]) (/home/neal/python/trunk/Doc/lib/libglob.tex [342]) (/home/neal/python/trunk/Doc/lib/libfnmatch.tex [343]) (/home/neal/python/trunk/Doc/lib/liblinecache.tex) (/home/neal/python/trunk/Doc/lib/libshutil.tex [344] [345]) (/home/neal/python/trunk/Doc/lib/libdircache.tex) Underfull \hbox (badness 10000) in paragraph at lines 37--206 [346] (/home/neal/python/trunk/Doc/lib/archiving.tex [347] [348] Chapter 12. (./lib12.syn)) (/home/neal/python/trunk/Doc/lib/libzlib.tex [349] [350]) (/home/neal/python/trunk/Doc/lib/libgzip.tex [351]) (/home/neal/python/trunk/Doc/lib/libbz2.tex Underfull \hbox (badness 5460) in paragraph at lines 19--22 []\OT1/pcr/m/n/10 BZ2File \OT1/ptm/m/n/10 class im-ple-ments a com-plete file i n-ter-face, in-clud-ing \OT1/pcr/m/n/10 readline()\OT1/ptm/m/n/10 , \OT1/pcr/m/ n/10 readlines()\OT1/ptm/m/n/10 , [352] [353]) (/home/neal/python/trunk/Doc/lib/libzipfile.tex [354] [355] [356] [357]) (/home/neal/python/trunk/Doc/lib/libtarfile.tex [358] [359] Underfull \hbox (badness 5878) in paragraph at lines 234--241 []\OT1/ptm/m/n/10 The \OT1/ptm/m/it/10 en-cod-ing \OT1/ptm/m/n/10 ar-gu-ment de -fines the lo-cal char-ac-ter en-cod-ing. It de-faults to the value from [360] [361] [362] [363]) Underfull \hbox (badness 10000) in paragraph at lines 549--214 (/home/neal/python/trunk/Doc/lib/persistence.tex [364] Chapter 13. (./lib13.syn)) (/home/neal/python/trunk/Doc/lib/libpickle.tex [365] Underfull \hbox (badness 10000) in paragraph at lines 94--95 [366] [367] [368] [369] Underfull \hbox (badness 10000) in paragraph at lines 495--496 [370] [371] [372] [373] [374] [375]) (/home/neal/python/trunk/Doc/lib/libcopyreg.tex [376]) (/home/neal/python/trunk/Doc/lib/libshelve.tex [377] [378]) (/home/neal/python/trunk/Doc/lib/libmarshal.tex [379] Underfull \hbox (badness 10000) in paragraph at lines 38--39 [380]) (/home/neal/python/trunk/Doc/lib/libanydbm.tex [381]) (/home/neal/python/trunk/Doc/lib/libwhichdb.tex) (/home/neal/python/trunk/Doc/lib/libdbm.tex [382]) (/home/neal/python/trunk/Doc/lib/libgdbm.tex [383]) (/home/neal/python/trunk/Doc/lib/libdbhash.tex [384]) (/home/neal/python/trunk/Doc/lib/libbsddb.tex [385] [386]) (/home/neal/python/trunk/Doc/lib/libdumbdbm.tex [387] [388]) (/home/neal/python/trunk/Doc/lib/libsqlite3.tex [389] [390] [391] No file sqlite3/complete_statement.py. [392] No file sqlite3/collation_reverse.py. [393] No file sqlite3/row_factory.py. No file sqlite3/text_factory.py. No file sqlite3/execute_1.py. No file sqlite3/execute_2.py. [394] No file sqlite3/executemany_1.py. No file sqlite3/executemany_2.py. [395] No file sqlite3/adapter_point_1.py. [396] No file sqlite3/adapter_point_2.py. Underfull \hbox (badness 10000) in paragraph at lines 518--522 []\OT1/ptm/m/n/10 The \OT1/pcr/m/n/10 sqlite3 \OT1/ptm/m/n/10 mod-ule has two d e-fault adapters for Python's built-in \OT1/pcr/m/n/10 datetime.date \OT1/ptm/m /n/10 and No file sqlite3/adapter_datetime.py. No file sqlite3/converter_point.py. No file sqlite3/pysqlite_datetime.py. [397] No file sqlite3/shortcut_methods.py. ) (/home/neal/python/trunk/Doc/lib/liballos.tex [398] [399] [400] Chapter 14. (./lib14.syn)) (/home/neal/python/trunk/Doc/lib/libos.tex [401] [402] [403] [404] LaTeX Warning: Reference `popen2-flow-control' on page 405 undefined on input l ine 409. [405] [406] [407] [408] [409] [410] [411] [412] [413] [414] [415] [416] [417] [418] [419] [420]) (/home/neal/python/trunk/Doc/lib/libtime.tex [421] [422] [423] [424] [425] LaTeX Warning: Reference `module-locale' on page 426 undefined on input line 46 3. ) (/home/neal/python/trunk/Doc/lib/liboptparse.tex [426] [427] [428] [429] [430] [431] [432] [433] Underfull \hbox (badness 5726) in paragraph at lines 516--519 []\OT1/pcr/m/n/10 optparse \OT1/ptm/m/n/10 ex-pands \OT1/pcr/m/n/10 "%prog" \OT 1/ptm/m/n/10 in the us-age string to the name of the cur-rent pro-gram, i.e. [434] [435] [436] [437] [438] [439] [440] [441] [442] [443] [444] [445] [446] [447] [448] [449] [450] [451] [452]) (/home/neal/python/trunk/Doc/lib/libgetopt.tex [453] [454]) (/home/neal/python/trunk/Doc/lib/liblogging.tex [455] [456] Overfull \hbox (10.29729pt too wide) in paragraph at lines 213--213 []\OT1/pcr/m/n/9 2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset[] [457] [458] Overfull \hbox (240.35738pt too wide) in paragraph at lines 317--328 [] [459] Overfull \hbox (10.29729pt too wide) in paragraph at lines 441--441 []\OT1/pcr/m/n/9 2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset[] [460] [461] Overfull \hbox (367.90819pt too wide) in paragraph at lines 603--614 [] [462] [463] [464] [465] Overfull \vbox (288.57pt too high) has occurred while \output is active [466] [467] [468] [469] [470] [471] [472] Overfull \hbox (403.90819pt too wide) in paragraph at lines 1416--1448 [] [473] [474] [475] [476] [477] [478]) (/home/neal/python/trunk/Doc/lib/libgetpass.tex) (/home/neal/python/trunk/Doc/lib/libcurses.tex [479] [480] [481] [482] [483] [484] [485] [486] [487] [488] [489] [490] [491] [492] [493] [494]) (/home/neal/python/trunk/Doc/lib/libascii.tex [495] [496] [497]) (/home/neal/python/trunk/Doc/lib/libcursespanel.tex [498]) (/home/neal/python/trunk/Doc/lib/libplatform.tex [499] [500]) (/home/neal/python/trunk/Doc/lib/liberrno.tex [501] [502] [503] [504] [505] [506]) (/home/neal/python/trunk/Doc/lib/libctypes.tex [507] [508] [509] Overfull \hbox (6.48393pt too wide) in paragraph at lines 227--390 [] [510] [511] Overfull \hbox (28.49721pt too wide) in paragraph at lines 459--459 []\OT1/pcr/m/n/9 >>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes[] Overfull \hbox (71.69716pt too wide) in paragraph at lines 459--459 []\OT1/pcr/m/n/9 >>> p = create_string_buffer("Hello") # create a buffer c ontaining a NUL terminated string[] Overfull \hbox (23.09721pt too wide) in paragraph at lines 489--489 []\OT1/pcr/m/n/9 ArgumentError: argument 2: exceptions.TypeError: Don't know ho w to convert parameter 2[] [512] [513] [514] [515] [516] [517] [518] [519] [520] Overfull \hbox (12.29723pt too wide) in paragraph at lines 979--979 []\OT1/pcr/m/n/9 TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance[] [521] [522] [523] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] Overfull \hbox (17.69722pt too wide) in paragraph at lines 1142--1142 []\OT1/pcr/m/n/9 py_cmp_func [] [524] [525] [526] [527] [528] [529] [530] [531] [532] [533] Overfull \hbox (89.29726pt too wide) in paragraph at lines 1827--1827 []\OT1/pcr/m/n/9 >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "capti on", None), (1, "flags", 0)[] Overfull \hbox (13.69734pt too wide) in paragraph at lines 1856--1856 []\OT1/pcr/m/n/9 >>> GetWindowRect = prototype(("GetWindowRect", windll.user32) , paramflags)[] [534] [535] [536] [537] [538] [539] [540]) (/home/neal/python/trunk/Doc/lib/libsomeos.tex [541] [542] Chapter 15. (./lib15.syn)) (/home/neal/python/trunk/Doc/lib/libselect.tex [543]) (/home/neal/python/trunk/Doc/lib/libthread.tex [544] [545]) (/home/neal/python/trunk/Doc/lib/libthreading.tex [546] [547] [548] [549] [550] [551] [552] [553]) (/home/neal/python/trunk/Doc/lib/libdummythread.tex) (/home/neal/python/trunk/Doc/lib/libdummythreading.tex [554]) (/home/neal/python/trunk/Doc/lib/libmmap.tex [555] ! Undefined control sequence. \\methoddesc ...fulllineitems} \ifx #1\@undefined \methodline {#2}{#3} \else... l.92 \begin{methoddesc}[mmap]{close}{} ? ! Emergency stop. \\methoddesc ...fulllineitems} \ifx #1\@undefined \methodline {#2}{#3} \else... l.92 \begin{methoddesc}[mmap]{close}{} Output written on lib.dvi (561 pages, 1949192 bytes). Transcript written on lib.log. *** Session transcript and error messages are in /home/neal/python/trunk/Doc/html/lib/lib.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/trunk/Doc/lib:/home/neal/python/trunk/Doc/commontex:/home/neal/python/trunk/Doc/paper-letter:/home/neal/python/trunk/Doc/texinputs: +++ latex lib make: *** [html/lib/lib.html] Error 1 From python-checkins at python.org Tue Apr 3 00:39:13 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 00:39:13 +0200 (CEST) Subject: [Python-checkins] r54662 - in python/branches/release25-maint: Lib/test/test_re.py Misc/NEWS Modules/arraymodule.c Message-ID: <20070402223913.0C4511E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 00:39:08 2007 New Revision: 54662 Modified: python/branches/release25-maint/Lib/test/test_re.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/arraymodule.c Log: Array module's buffer interface can now handle empty arrays. Modified: python/branches/release25-maint/Lib/test/test_re.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_re.py (original) +++ python/branches/release25-maint/Lib/test/test_re.py Tue Apr 3 00:39:08 2007 @@ -604,6 +604,13 @@ self.assertEqual(iter.next().span(), (4, 4)) self.assertRaises(StopIteration, iter.next) + def test_empty_array(self): + # SF buf 1647541 + import array + for typecode in 'cbBuhHiIlLfd': + a = array.array(typecode) + self.assertEqual(re.compile("bla").match(a), None) + self.assertEqual(re.compile("").match(a).groups(), ()) def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Apr 3 00:39:08 2007 @@ -134,6 +134,8 @@ Extension Modules ----------------- +- Bug #1647541: Array module's buffer interface can now handle empty arrays. + - Bug #1693079: The array module can now successfully pickle empty arrays. - Bug #1688393: Prevent crash in socket.recvfrom if length is negative. Modified: python/branches/release25-maint/Modules/arraymodule.c ============================================================================== --- python/branches/release25-maint/Modules/arraymodule.c (original) +++ python/branches/release25-maint/Modules/arraymodule.c Tue Apr 3 00:39:08 2007 @@ -1745,6 +1745,8 @@ (objobjargproc)array_ass_subscr }; +static const void *emptybuf = ""; + static Py_ssize_t array_buffer_getreadbuf(arrayobject *self, Py_ssize_t index, const void **ptr) { @@ -1754,6 +1756,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } @@ -1766,6 +1770,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } From python-checkins at python.org Tue Apr 3 00:54:22 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 00:54:22 +0200 (CEST) Subject: [Python-checkins] r54663 - in python/trunk: Lib/test/test_re.py Modules/arraymodule.c Message-ID: <20070402225422.F09781E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 00:54:21 2007 New Revision: 54663 Modified: python/trunk/Lib/test/test_re.py python/trunk/Modules/arraymodule.c Log: Array module's buffer interface can now handle empty arrays. Modified: python/trunk/Lib/test/test_re.py ============================================================================== --- python/trunk/Lib/test/test_re.py (original) +++ python/trunk/Lib/test/test_re.py Tue Apr 3 00:54:21 2007 @@ -601,6 +601,13 @@ self.assertEqual(iter.next().span(), (4, 4)) self.assertRaises(StopIteration, iter.next) + def test_empty_array(self): + # SF buf 1647541 + import array + for typecode in 'cbBuhHiIlLfd': + a = array.array(typecode) + self.assertEqual(re.compile("bla").match(a), None) + self.assertEqual(re.compile("").match(a).groups(), ()) def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Tue Apr 3 00:54:21 2007 @@ -1745,6 +1745,8 @@ (objobjargproc)array_ass_subscr }; +static const void *emptybuf = ""; + static Py_ssize_t array_buffer_getreadbuf(arrayobject *self, Py_ssize_t index, const void **ptr) { @@ -1754,6 +1756,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } @@ -1766,6 +1770,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } From python-checkins at python.org Tue Apr 3 01:55:42 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Apr 2007 01:55:42 +0200 (CEST) Subject: [Python-checkins] r54664 - in python/trunk/Lib: copy_reg.py test/test_array.py test/test_descr.py Message-ID: <20070402235542.959B71E400A@bag.python.org> Author: guido.van.rossum Date: Tue Apr 3 01:55:37 2007 New Revision: 54664 Modified: python/trunk/Lib/copy_reg.py python/trunk/Lib/test/test_array.py python/trunk/Lib/test/test_descr.py Log: Fix warnings about object.__init__() signature. Two (test_array and test_descr) were bug IMO; the third (copy_reg) is a work-around which recognizes that object.__init__() doesn't do anything. Modified: python/trunk/Lib/copy_reg.py ============================================================================== --- python/trunk/Lib/copy_reg.py (original) +++ python/trunk/Lib/copy_reg.py Tue Apr 3 01:55:37 2007 @@ -48,7 +48,8 @@ obj = object.__new__(cls) else: obj = base.__new__(cls, state) - base.__init__(obj, state) + if base.__init__ != object.__init__: + base.__init__(obj, state) return obj _HEAPTYPE = 1<<9 Modified: python/trunk/Lib/test/test_array.py ============================================================================== --- python/trunk/Lib/test/test_array.py (original) +++ python/trunk/Lib/test/test_array.py Tue Apr 3 01:55:37 2007 @@ -728,7 +728,6 @@ return array.array.__new__(cls, 'c', s) def __init__(self, s, color='blue'): - array.array.__init__(self, 'c', s) self.color = color def strip(self): Modified: python/trunk/Lib/test/test_descr.py ============================================================================== --- python/trunk/Lib/test/test_descr.py (original) +++ python/trunk/Lib/test/test_descr.py Tue Apr 3 01:55:37 2007 @@ -2305,7 +2305,6 @@ __slots__ = ['prec'] def __init__(self, value=0.0, prec=12): self.prec = int(prec) - float.__init__(self, value) def __repr__(self): return "%.*g" % (self.prec, self) vereq(repr(precfloat(1.1)), "1.1") From python-checkins at python.org Tue Apr 3 02:01:14 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 02:01:14 +0200 (CEST) Subject: [Python-checkins] r54665 - python/branches/release25-maint/Lib/bisect.py Message-ID: <20070403000114.95E831E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 02:01:09 2007 New Revision: 54665 Modified: python/branches/release25-maint/Lib/bisect.py Log: SF 1602378 Clarify docstrings for bisect Modified: python/branches/release25-maint/Lib/bisect.py ============================================================================== --- python/branches/release25-maint/Lib/bisect.py (original) +++ python/branches/release25-maint/Lib/bisect.py Tue Apr 3 02:01:09 2007 @@ -23,8 +23,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in - a[i:] have e > x. So if x already appears in the list, i points just - beyond the rightmost x already there. + a[i:] have e > x. So if x already appears in the list, a.insert(x) will + insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. @@ -62,8 +62,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e < x, and all e in - a[i:] have e >= x. So if x already appears in the list, i points just - before the leftmost x already there. + a[i:] have e >= x. So if x already appears in the list, a.insert(x) will + insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. From python-checkins at python.org Tue Apr 3 02:02:12 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 02:02:12 +0200 (CEST) Subject: [Python-checkins] r54666 - python/trunk/Lib/bisect.py Message-ID: <20070403000212.E2B141E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 02:02:11 2007 New Revision: 54666 Modified: python/trunk/Lib/bisect.py Log: SF 1602378 Clarify docstrings for bisect Modified: python/trunk/Lib/bisect.py ============================================================================== --- python/trunk/Lib/bisect.py (original) +++ python/trunk/Lib/bisect.py Tue Apr 3 02:02:11 2007 @@ -23,8 +23,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in - a[i:] have e > x. So if x already appears in the list, i points just - beyond the rightmost x already there. + a[i:] have e > x. So if x already appears in the list, a.insert(x) will + insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. @@ -62,8 +62,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e < x, and all e in - a[i:] have e >= x. So if x already appears in the list, i points just - before the leftmost x already there. + a[i:] have e >= x. So if x already appears in the list, a.insert(x) will + insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. From python-checkins at python.org Tue Apr 3 03:38:01 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 03:38:01 +0200 (CEST) Subject: [Python-checkins] r54667 - python/branches/release25-maint/Doc/tut/tut.tex Message-ID: <20070403013801.A48161E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 03:37:56 2007 New Revision: 54667 Modified: python/branches/release25-maint/Doc/tut/tut.tex Log: SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes Modified: python/branches/release25-maint/Doc/tut/tut.tex ============================================================================== --- python/branches/release25-maint/Doc/tut/tut.tex (original) +++ python/branches/release25-maint/Doc/tut/tut.tex Tue Apr 3 03:37:56 2007 @@ -4329,8 +4329,7 @@ \end{verbatim} -The only rule necessary to explain the semantics is the resolution -rule used for class attribute references. This is depth-first, +For old-style classes, the only rule is depth-first, left-to-right. Thus, if an attribute is not found in \class{DerivedClassName}, it is searched in \class{Base1}, then (recursively) in the base classes of \class{Base1}, and only if it is @@ -4345,16 +4344,26 @@ rule makes no differences between direct and inherited attributes of \class{Base1}.) -It is clear that indiscriminate use of multiple inheritance is a -maintenance nightmare, given the reliance in Python on conventions to -avoid accidental name conflicts. A well-known problem with multiple -inheritance is a class derived from two classes that happen to have a -common base class. While it is easy enough to figure out what happens -in this case (the instance will have a single copy of ``instance -variables'' or data attributes used by the common base class), it is -not clear that these semantics are in any way useful. +For new-style classes, the method resolution order changes dynamically +to support cooperative calls to \function{super()}. This approach +is known in some other multiple-inheritance languages as call-next-method +and is more powerful than the super call found in single-inheritance languages. + +With new-style classes, dynamic ordering is necessary because all +cases of multiple inheritance exhibit one or more diamond relationships +(where one at least one of the parent classes can be accessed through +multiple paths from the bottommost class). For example, all new-style +classes inherit from \class{object}, so any case of multiple inheritance +provides more than one path to reach \class{object}. To keep the +base classes from being accessed more than once, the dynamic algorithm +linearizes the search order in a way that preserves the left-to-right +ordering specified in each class, that calls each parent only once, and +that is monotonic (meaning that a class can be subclassed without affecting +the precedence order of its parents). Taken together, these properties +make it possible to design reliable and extensible classes with +multiple inheritance. For more detail, see +\url{http://www.python.org/download/releases/2.3/mro/}. -%% XXX Add rules for new-style MRO? \section{Private Variables \label{private}} From python-checkins at python.org Tue Apr 3 03:39:45 2007 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 3 Apr 2007 03:39:45 +0200 (CEST) Subject: [Python-checkins] r54668 - python/trunk/Doc/tut/tut.tex Message-ID: <20070403013945.BCE7C1E400A@bag.python.org> Author: raymond.hettinger Date: Tue Apr 3 03:39:43 2007 New Revision: 54668 Modified: python/trunk/Doc/tut/tut.tex Log: SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes Modified: python/trunk/Doc/tut/tut.tex ============================================================================== --- python/trunk/Doc/tut/tut.tex (original) +++ python/trunk/Doc/tut/tut.tex Tue Apr 3 03:39:43 2007 @@ -4329,8 +4329,7 @@ \end{verbatim} -The only rule necessary to explain the semantics is the resolution -rule used for class attribute references. This is depth-first, +For old-style classes, the only rule is depth-first, left-to-right. Thus, if an attribute is not found in \class{DerivedClassName}, it is searched in \class{Base1}, then (recursively) in the base classes of \class{Base1}, and only if it is @@ -4345,16 +4344,26 @@ rule makes no differences between direct and inherited attributes of \class{Base1}.) -It is clear that indiscriminate use of multiple inheritance is a -maintenance nightmare, given the reliance in Python on conventions to -avoid accidental name conflicts. A well-known problem with multiple -inheritance is a class derived from two classes that happen to have a -common base class. While it is easy enough to figure out what happens -in this case (the instance will have a single copy of ``instance -variables'' or data attributes used by the common base class), it is -not clear that these semantics are in any way useful. +For new-style classes, the method resolution order changes dynamically +to support cooperative calls to \function{super()}. This approach +is known in some other multiple-inheritance languages as call-next-method +and is more powerful than the super call found in single-inheritance languages. + +With new-style classes, dynamic ordering is necessary because all +cases of multiple inheritance exhibit one or more diamond relationships +(where one at least one of the parent classes can be accessed through +multiple paths from the bottommost class). For example, all new-style +classes inherit from \class{object}, so any case of multiple inheritance +provides more than one path to reach \class{object}. To keep the +base classes from being accessed more than once, the dynamic algorithm +linearizes the search order in a way that preserves the left-to-right +ordering specified in each class, that calls each parent only once, and +that is monotonic (meaning that a class can be subclassed without affecting +the precedence order of its parents). Taken together, these properties +make it possible to design reliable and extensible classes with +multiple inheritance. For more detail, see +\url{http://www.python.org/download/releases/2.3/mro/}. -%% XXX Add rules for new-style MRO? \section{Private Variables \label{private}} From python-checkins at python.org Tue Apr 3 06:36:07 2007 From: python-checkins at python.org (matthias.klose) Date: Tue, 3 Apr 2007 06:36:07 +0200 (CEST) Subject: [Python-checkins] r54669 - in python/trunk: Misc/NEWS Modules/_localemodule.c Message-ID: <20070403043607.95EED1E4014@bag.python.org> Author: matthias.klose Date: Tue Apr 3 06:35:59 2007 New Revision: 54669 Modified: python/trunk/Misc/NEWS python/trunk/Modules/_localemodule.c Log: - Fix an off-by-one bug in locale.strxfrm(). patch taken from http://bugs.debian.org/416934. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Apr 3 06:35:59 2007 @@ -681,6 +681,9 @@ - Bug #1633621: if curses.resizeterm() or curses.resize_term() is called, update _curses.LINES, _curses.COLS, curses.LINES and curses.COLS. +- Fix an off-by-one bug in locale.strxfrm(). + + Tests ----- Modified: python/trunk/Modules/_localemodule.c ============================================================================== --- python/trunk/Modules/_localemodule.c (original) +++ python/trunk/Modules/_localemodule.c Tue Apr 3 06:35:59 2007 @@ -360,7 +360,7 @@ buf = PyMem_Malloc(n1); if (!buf) return PyErr_NoMemory(); - n2 = strxfrm(buf, s, n1); + n2 = strxfrm(buf, s, n1) + 1; if (n2 > n1) { /* more space needed */ buf = PyMem_Realloc(buf, n2); From python-checkins at python.org Tue Apr 3 06:39:36 2007 From: python-checkins at python.org (matthias.klose) Date: Tue, 3 Apr 2007 06:39:36 +0200 (CEST) Subject: [Python-checkins] r54670 - in python/branches/release25-maint: Misc/NEWS Modules/_localemodule.c Message-ID: <20070403043936.E0E2F1E400A@bag.python.org> Author: matthias.klose Date: Tue Apr 3 06:39:34 2007 New Revision: 54670 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_localemodule.c Log: - Fix an off-by-one bug in locale.strxfrm(). Patch taken from http://bugs.debian.org/416934. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Apr 3 06:39:34 2007 @@ -220,6 +220,8 @@ - Bug #1633621: if curses.resizeterm() or curses.resize_term() is called, update _curses.LINES, _curses.COLS, curses.LINES and curses.COLS. +- Fix an off-by-one bug in locale.strxfrm(). + Library ------- Modified: python/branches/release25-maint/Modules/_localemodule.c ============================================================================== --- python/branches/release25-maint/Modules/_localemodule.c (original) +++ python/branches/release25-maint/Modules/_localemodule.c Tue Apr 3 06:39:34 2007 @@ -360,7 +360,7 @@ buf = PyMem_Malloc(n1); if (!buf) return PyErr_NoMemory(); - n2 = strxfrm(buf, s, n1); + n2 = strxfrm(buf, s, n1) + 1; if (n2 > n1) { /* more space needed */ buf = PyMem_Realloc(buf, n2); From python-checkins at python.org Tue Apr 3 09:04:30 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 3 Apr 2007 09:04:30 +0200 (CEST) Subject: [Python-checkins] r54671 - python/trunk/Doc/texinputs/python.sty Message-ID: <20070403070430.EDC991E400A@bag.python.org> Author: georg.brandl Date: Tue Apr 3 09:04:27 2007 New Revision: 54671 Modified: python/trunk/Doc/texinputs/python.sty Log: Fix the strange case of \begin{methoddesc}[NNTP]{...} where \ifx#1\@undefined ended up comparing N and N, therefore executing the true part of the conditional, blowing up at \@undefined. Modified: python/trunk/Doc/texinputs/python.sty ============================================================================== --- python/trunk/Doc/texinputs/python.sty (original) +++ python/trunk/Doc/texinputs/python.sty Tue Apr 3 09:04:27 2007 @@ -612,7 +612,7 @@ \newenvironment{cfuncdesc}[4][\py at badkey]{ \begin{fulllineitems} \cfuncline{#2}{#3}{#4} - \ifx#1\@undefined\else% + \ifx\@undefined#1\relax\else% \emph{Return value: \textbf{#1}.}\\ \fi }{\end{fulllineitems}} @@ -629,7 +629,7 @@ \newenvironment{ctypedesc}[2][\py at badkey]{ \begin{fulllineitems} \item[\bfcode{#2}% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% \index{#2@{\py at idxcode{#2}} (C type)} \else% \index{#2@{\py at idxcode{#1}} (C type)} @@ -712,7 +712,7 @@ % \begin{methoddesc}[classname]{methodname}{args} \newcommand{\methodline}[3][\@undefined]{ \methodlineni{#2}{#3} - \ifx#1\@undefined + \ifx\@undefined#1\relax \index{#2@{\py at idxcode{#2()}} (\py at thisclass\ method)} \else \index{#2@{\py at idxcode{#2()}} (#1 method)} @@ -720,7 +720,7 @@ } \newenvironment{methoddesc}[3][\@undefined]{ \begin{fulllineitems} - \ifx#1\@undefined + \ifx\@undefined#1\relax \methodline{#2}{#3} \else \def\py at thisclass{#1} @@ -740,7 +740,7 @@ % object data attribute -------------------------------------------------- % \begin{memberdesc}[classname]{membername} \newcommand{\memberline}[2][\py at classbadkey]{% - \ifx#1\@undefined + \ifx\@undefined#1\relax \memberlineni{#2} \index{#2@{\py at idxcode{#2}} (\py at thisclass\ attribute)} \else @@ -750,7 +750,7 @@ } \newenvironment{memberdesc}[2][\py at classbadkey]{ \begin{fulllineitems} - \ifx#1\@undefined + \ifx\@undefined#1\relax \memberline{#2} \else \def\py at thisclass{#1} @@ -1046,14 +1046,14 @@ % \versionchanged[short explanation]{2.0} % \newcommand{\versionadded}[2][\py at badkey]{% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% { New in version #2. }% \else% { New in version #2:\ #1. }% \fi% } \newcommand{\versionchanged}[2][\py at badkey]{% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% { Changed in version #2. }% \else% { Changed in version #2:\ #1. }% From python-checkins at python.org Tue Apr 3 16:05:12 2007 From: python-checkins at python.org (facundo.batista) Date: Tue, 3 Apr 2007 16:05:12 +0200 (CEST) Subject: [Python-checkins] r54672 - in python/trunk: Doc/lib/libpoplib.tex Lib/test/test_socket_ssl.py Message-ID: <20070403140512.DFFDD1E401E@bag.python.org> Author: facundo.batista Date: Tue Apr 3 16:05:08 2007 New Revision: 54672 Modified: python/trunk/Doc/lib/libpoplib.tex python/trunk/Lib/test/test_socket_ssl.py Log: Now using unittest for the tests infraestructure. Also split the tests in those who need the network, and that who doesn't. Modified: python/trunk/Doc/lib/libpoplib.tex ============================================================================== --- python/trunk/Doc/lib/libpoplib.tex (original) +++ python/trunk/Doc/lib/libpoplib.tex Tue Apr 3 16:05:08 2007 @@ -50,8 +50,9 @@ One exception is defined as an attribute of the \module{poplib} module: \begin{excdesc}{error_proto} -Exception raised on any errors. The reason for the exception is -passed to the constructor as a string. +Exception raised on any errors from this module (errors from +\module{socket} module are not caught). The reason for the exception +is passed to the constructor as a string. \end{excdesc} \begin{seealso} Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Tue Apr 3 16:05:08 2007 @@ -1,129 +1,133 @@ # Test just the SSL support in the socket module, in a moderately bogus way. import sys +import unittest from test import test_support import socket import errno - -# Optionally test SSL support. This requires the 'network' resource as given -# on the regrtest command line. -skip_expected = not (test_support.is_resource_enabled('network') and - hasattr(socket, "ssl")) - -def test_basic(): - test_support.requires('network') - - import urllib - - if test_support.verbose: - print "test_basic ..." - - socket.RAND_status() - try: - socket.RAND_egd(1) - except TypeError: - pass - else: - print "didn't raise TypeError" - socket.RAND_add("this is a random string", 75.0) - - with test_support.transient_internet(): - f = urllib.urlopen('https://sf.net') - buf = f.read() - f.close() - -def test_timeout(): - test_support.requires('network') - - def error_msg(extra_msg): - print >> sys.stderr, """\ - WARNING: an attempt to connect to %r %s, in - test_timeout. That may be legitimate, but is not the outcome we hoped - for. If this message is seen often, test_timeout should be changed to - use a more reliable address.""" % (ADDR, extra_msg) - - if test_support.verbose: - print "test_timeout ..." - - # A service which issues a welcome banner (without need to write - # anything). - # XXX ("gmail.org", 995) has been unreliable so far, from time to time - # XXX non-responsive for hours on end (& across all buildbot slaves, - # XXX so that's not just a local thing). - ADDR = "gmail.org", 995 - - s = socket.socket() - s.settimeout(30.0) - try: - s.connect(ADDR) - except socket.timeout: - error_msg('timed out') - return - except socket.error, exc: # In case connection is refused. - if exc.args[0] == errno.ECONNREFUSED: - error_msg('was refused') - return - else: - raise - - ss = socket.ssl(s) - # Read part of return welcome banner twice. - ss.read(1) - ss.read(1) - s.close() - -def test_rude_shutdown(): - if test_support.verbose: - print "test_rude_shutdown ..." - - try: - import threading - except ImportError: - return - - # Some random port to connect to. - PORT = [9934] - - listener_ready = threading.Event() - listener_gone = threading.Event() - - # `listener` runs in a thread. It opens a socket listening on PORT, and - # sits in an accept() until the main thread connects. Then it rudely - # closes the socket, and sets Event `listener_gone` to let the main thread - # know the socket is gone. - def listener(): - s = socket.socket() - PORT[0] = test_support.bind_port(s, '', PORT[0]) - s.listen(5) - listener_ready.set() - s.accept() - s = None # reclaim the socket object, which also closes it - listener_gone.set() - - def connector(): - listener_ready.wait() - s = socket.socket() - s.connect(('localhost', PORT[0])) - listener_gone.wait() +import threading +import subprocess +import time + +# Optionally test SSL support, if we have it in the tested platform +skip_expected = not hasattr(socket, "ssl") + +class ConnectedTests(unittest.TestCase): + + def testBasic(self): + import urllib + + if test_support.verbose: + print "test_basic ..." + + socket.RAND_status() try: - ssl_sock = socket.ssl(s) - except socket.sslerror: + socket.RAND_egd(1) + except TypeError: pass else: - raise test_support.TestFailed( + print "didn't raise TypeError" + socket.RAND_add("this is a random string", 75.0) + + with test_support.transient_internet(): + f = urllib.urlopen('https://sf.net') + buf = f.read() + f.close() + + def testTimeout(self): + def error_msg(extra_msg): + print >> sys.stderr, """\ + WARNING: an attempt to connect to %r %s, in + test_timeout. That may be legitimate, but is not the outcome we + hoped for. If this message is seen often, test_timeout should be + changed to use a more reliable address.""" % (ADDR, extra_msg) + + if test_support.verbose: + print "test_timeout ..." + + # A service which issues a welcome banner (without need to write + # anything). + # XXX ("gmail.org", 995) has been unreliable so far, from time to + # XXX time non-responsive for hours on end (& across all buildbot + # XXX slaves, so that's not just a local thing). + ADDR = "gmail.org", 995 + + s = socket.socket() + s.settimeout(30.0) + try: + s.connect(ADDR) + except socket.timeout: + error_msg('timed out') + return + except socket.error, exc: # In case connection is refused. + if exc.args[0] == errno.ECONNREFUSED: + error_msg('was refused') + return + else: + raise + + ss = socket.ssl(s) + # Read part of return welcome banner twice. + ss.read(1) + ss.read(1) + s.close() + +class BasicTests(unittest.TestCase): + + def testRudeShutdown(self): + if test_support.verbose: + print "test_rude_shutdown ..." + + # Some random port to connect to. + PORT = [9934] + + listener_ready = threading.Event() + listener_gone = threading.Event() + + # `listener` runs in a thread. It opens a socket listening on + # PORT, and sits in an accept() until the main thread connects. + # Then it rudely closes the socket, and sets Event `listener_gone` + # to let the main thread know the socket is gone. + def listener(): + s = socket.socket() + PORT[0] = test_support.bind_port(s, '', PORT[0]) + s.listen(5) + listener_ready.set() + s.accept() + s = None # reclaim the socket object, which also closes it + listener_gone.set() + + def connector(): + listener_ready.wait() + s = socket.socket() + s.connect(('localhost', PORT[0])) + listener_gone.wait() + try: + ssl_sock = socket.ssl(s) + except socket.sslerror: + pass + else: + raise test_support.TestFailed( 'connecting to closed SSL socket should have failed') + + t = threading.Thread(target=listener) + t.start() + connector() + t.join() - t = threading.Thread(target=listener) - t.start() - connector() - t.join() def test_main(): if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") - test_rude_shutdown() - test_basic() - test_timeout() + + tests = [BasicTests] + + if test_support.is_resource_enabled('network'): + tests.append(ConnectedTests) + + thread_info = test_support.threading_setup() + test_support.run_unittest(*tests) + test_support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() From fdrake at acm.org Tue Apr 3 16:09:49 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue, 3 Apr 2007 10:09:49 -0400 Subject: [Python-checkins] r54671 - python/trunk/Doc/texinputs/python.sty In-Reply-To: <20070403070430.EDC991E400A@bag.python.org> References: <20070403070430.EDC991E400A@bag.python.org> Message-ID: <200704031009.49510.fdrake@acm.org> On Tuesday 03 April 2007 03:04, georg.brandl wrote: > Modified: > python/trunk/Doc/texinputs/python.sty > Log: > Fix the strange case of Yay Georg! This one had me stumped (and yes, I really was looking into it last night). Thanks! -Fred -- Fred L. Drake, Jr. From buildbot at python.org Tue Apr 3 16:10:21 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 14:10:21 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20070403141022.54C381E400C@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%2520trunk/builds/1639 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Apr 3 16:47:04 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 14:47:04 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070403144705.299BB1E4011@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/353 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista,georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 2 tests failed: test_os test_urllib ====================================================================== ERROR: test_makedir (test.test_os.MakedirTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 384, in setUp os.mkdir(test_support.TESTFN) WindowsError: [Error 183] Cannot create a file when that file already exists: '@test' ====================================================================== ERROR: test_access (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 451, in test_access self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) TypeError: utime() arg 2 must be a tuple (atime, mtime) ====================================================================== FAIL: test_traversal (test.test_os.WalkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 313, in test_traversal self.assertEqual(len(all), 4) AssertionError: 5 != 4 ====================================================================== FAIL: test_chdir (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 442, in test_chdir self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) AssertionError: WindowsError not raised sincerely, -The Buildbot From python-checkins at python.org Tue Apr 3 18:08:14 2007 From: python-checkins at python.org (walter.doerwald) Date: Tue, 3 Apr 2007 18:08:14 +0200 (CEST) Subject: [Python-checkins] r54673 - python/trunk/Lib/test/test_structmembers.py python/trunk/Lib/test/test_warnings.py Message-ID: <20070403160814.BB70C1E4008@bag.python.org> Author: walter.doerwald Date: Tue Apr 3 18:08:10 2007 New Revision: 54673 Modified: python/trunk/Lib/test/test_structmembers.py python/trunk/Lib/test/test_warnings.py Log: Move the functionality for catching warnings in test_warnings.py into a separate class to that reusing the functionality in test_structmembers.py doesn't rerun the tests from test_warnings.py. Modified: python/trunk/Lib/test/test_structmembers.py ============================================================================== --- python/trunk/Lib/test/test_structmembers.py (original) +++ python/trunk/Lib/test/test_structmembers.py Tue Apr 3 18:08:10 2007 @@ -39,7 +39,7 @@ ts.T_ULONG=ULONG_MAX self.assertEquals(ts.T_ULONG, ULONG_MAX) -class TestWarnings(test.test_warnings.TestModule): +class TestWarnings(test.test_warnings.CatchWarningTest): def has_warned(self): self.assertEqual(test.test_warnings.msg.category, exceptions.RuntimeWarning.__name__) Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Tue Apr 3 18:08:10 2007 @@ -20,7 +20,7 @@ msg.filename = os.path.basename(filename) msg.lineno = lineno -class TestModule(unittest.TestCase): +class CatchWarningTest(unittest.TestCase): def setUp(self): global msg @@ -35,6 +35,8 @@ warnings.filters = self._filters[:] warnings.showwarning = self._showwarning +class TestModule(CatchWarningTest): + def test_warn_default_category(self): for i in range(4): text = 'multi %d' %i # Different text on each call From python-checkins at python.org Tue Apr 3 18:16:27 2007 From: python-checkins at python.org (walter.doerwald) Date: Tue, 3 Apr 2007 18:16:27 +0200 (CEST) Subject: [Python-checkins] r54674 - python/trunk/Lib/test/test_warnings.py Message-ID: <20070403161627.3AA961E4015@bag.python.org> Author: walter.doerwald Date: Tue Apr 3 18:16:24 2007 New Revision: 54674 Modified: python/trunk/Lib/test/test_warnings.py Log: Document that CatchWarningTests is reused by test_structmembers.py. Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Tue Apr 3 18:16:24 2007 @@ -21,6 +21,8 @@ msg.lineno = lineno class CatchWarningTest(unittest.TestCase): + # base class used for catching warnings issued by the + # warning framework (this is reused by test_structmembers.py) def setUp(self): global msg From buildbot at python.org Tue Apr 3 18:35:26 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 16:35:26 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070403163526.2F78E1E4012@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/181 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 3 tests failed: test_cProfile test_frozen test_os ====================================================================== ERROR: test_makedir (test.test_os.MakedirTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 384, in setUp os.mkdir(test_support.TESTFN) WindowsError: [Error 183] Cannot create a file when that file already exists: '@test' ====================================================================== ERROR: test_access (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 451, in test_access self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) TypeError: utime() arg 2 must be a tuple (atime, mtime) ====================================================================== FAIL: test_traversal (test.test_os.WalkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 313, in test_traversal self.assertEqual(len(all), 4) AssertionError: 5 != 4 ====================================================================== FAIL: test_chdir (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 442, in test_chdir self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) AssertionError: WindowsError not raised sincerely, -The Buildbot From collinw at gmail.com Tue Apr 3 18:47:34 2007 From: collinw at gmail.com (Collin Winter) Date: Tue, 3 Apr 2007 11:47:34 -0500 Subject: [Python-checkins] r54674 - python/trunk/Lib/test/test_warnings.py In-Reply-To: <20070403161627.3AA961E4015@bag.python.org> References: <20070403161627.3AA961E4015@bag.python.org> Message-ID: <43aa6ff70704030947y29f9d8diba694366e3d92355@mail.gmail.com> On 4/3/07, walter.doerwald wrote: > Author: walter.doerwald > Date: Tue Apr 3 18:16:24 2007 > New Revision: 54674 > > Modified: > python/trunk/Lib/test/test_warnings.py > Log: > Document that CatchWarningTests is reused by test_structmembers.py. Why not move this into test_support? Collin Winter From walter at livinglogic.de Tue Apr 3 18:48:25 2007 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Tue, 03 Apr 2007 18:48:25 +0200 Subject: [Python-checkins] r54674 - python/trunk/Lib/test/test_warnings.py In-Reply-To: <43aa6ff70704030947y29f9d8diba694366e3d92355@mail.gmail.com> References: <20070403161627.3AA961E4015@bag.python.org> <43aa6ff70704030947y29f9d8diba694366e3d92355@mail.gmail.com> Message-ID: <46128559.1070608@livinglogic.de> Collin Winter wrote: > On 4/3/07, walter.doerwald wrote: >> Author: walter.doerwald >> Date: Tue Apr 3 18:16:24 2007 >> New Revision: 54674 >> >> Modified: >> python/trunk/Lib/test/test_warnings.py >> Log: >> Document that CatchWarningTests is reused by test_structmembers.py. > > Why not move this into test_support? Good idea! There might be other tests that could use this. I'm working on it. Servus, Walter From python-checkins at python.org Tue Apr 3 18:53:49 2007 From: python-checkins at python.org (walter.doerwald) Date: Tue, 3 Apr 2007 18:53:49 +0200 (CEST) Subject: [Python-checkins] r54675 - python/trunk/Lib/test/test_warnings.py python/trunk/Lib/test/warning_tests.py Message-ID: <20070403165349.BE9741E4008@bag.python.org> Author: walter.doerwald Date: Tue Apr 3 18:53:43 2007 New Revision: 54675 Added: python/trunk/Lib/test/warning_tests.py Modified: python/trunk/Lib/test/test_warnings.py Log: Add tests for the filename. Test that the stacklevel is handled correctly. Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Tue Apr 3 18:53:43 2007 @@ -3,6 +3,8 @@ import unittest from test import test_support +import warning_tests + # The warnings module isn't easily tested, because it relies on module # globals to store configuration information. setUp() and tearDown() # preserve the current settings to avoid bashing them while running tests. @@ -97,6 +99,28 @@ warnings._setoption('error::Warning::0') self.assertRaises(UserWarning, warnings.warn, 'convert to error') + def test_filename(self): + warning_tests.inner("spam1") + self.assertEqual(msg.filename, "warning_tests.py") + warning_tests.outer("spam2") + self.assertEqual(msg.filename, "warning_tests.py") + + def test_stacklevel(self): + # Test stacklevel argument + # make sure all messages are different, so the warning won't be skipped + warning_tests.inner("spam3", stacklevel=1) + self.assertEqual(msg.filename, "warning_tests.py") + warning_tests.outer("spam4", stacklevel=1) + self.assertEqual(msg.filename, "warning_tests.py") + + warning_tests.inner("spam5", stacklevel=2) + self.assertEqual(msg.filename, "test_warnings.py") + warning_tests.outer("spam6", stacklevel=2) + self.assertEqual(msg.filename, "warning_tests.py") + + warning_tests.inner("spam7", stacklevel=9999) + self.assertEqual(msg.filename, "sys") + def test_main(verbose=None): # Obscure hack so that this test passes after reloads or repeated calls Added: python/trunk/Lib/test/warning_tests.py ============================================================================== --- (empty file) +++ python/trunk/Lib/test/warning_tests.py Tue Apr 3 18:53:43 2007 @@ -0,0 +1,9 @@ +# Helper module for testing the skipmodules argument of warnings.warn() + +import warnings + +def outer(message, stacklevel=1): + inner(message, stacklevel) + +def inner(message, stacklevel=1): + warnings.warn(message, stacklevel=stacklevel) From buildbot at python.org Tue Apr 3 19:17:51 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 17:17:51 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070403171751.D73FB1E4008@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/436 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socketserver Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 81, in run svr = svrcls(self.__addr, self.__hdlrcls) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 331, in __init__ self.server_bind() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 342, in server_bind self.socket.bind(self.server_address) File "", line 1, in bind error: (98, 'Address already in use') Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 212, in test_main testall() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 195, in testall testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 144, in testloop testfunc(proto, addr) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 64, in teststream buf = data = receive(s, 100) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 46, in receive return sock.recv(n) error: (104, 'Connection reset by peer') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Apr 3 19:29:51 2007 From: python-checkins at python.org (facundo.batista) Date: Tue, 3 Apr 2007 19:29:51 +0200 (CEST) Subject: [Python-checkins] r54676 - python/trunk/Lib/test/ssl_cert.pem python/trunk/Lib/test/ssl_key.pem python/trunk/Lib/test/test_socket_ssl.py Message-ID: <20070403172951.014231E4011@bag.python.org> Author: facundo.batista Date: Tue Apr 3 19:29:48 2007 New Revision: 54676 Added: python/trunk/Lib/test/ssl_cert.pem python/trunk/Lib/test/ssl_key.pem Modified: python/trunk/Lib/test/test_socket_ssl.py Log: Added a SSL server to test_socket_ssl.py to be able to test locally. Now, it checks if have openssl available and run those specific tests (it starts openssl at the beggining of all the tests and then kills it at the end). Added: python/trunk/Lib/test/ssl_cert.pem ============================================================================== --- (empty file) +++ python/trunk/Lib/test/ssl_cert.pem Tue Apr 3 19:29:48 2007 @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICLDCCAdYCAQAwDQYJKoZIhvcNAQEEBQAwgaAxCzAJBgNVBAYTAlBUMRMwEQYD +VQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5ldXJv +bmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMTEmJy +dXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZpMB4X +DTk2MDkwNTAzNDI0M1oXDTk2MTAwNTAzNDI0M1owgaAxCzAJBgNVBAYTAlBUMRMw +EQYDVQQIEwpRdWVlbnNsYW5kMQ8wDQYDVQQHEwZMaXNib2ExFzAVBgNVBAoTDk5l +dXJvbmlvLCBMZGEuMRgwFgYDVQQLEw9EZXNlbnZvbHZpbWVudG8xGzAZBgNVBAMT +EmJydXR1cy5uZXVyb25pby5wdDEbMBkGCSqGSIb3DQEJARYMc2FtcG9AaWtpLmZp +MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNw +L4lYKbpzzlmC5beaQXeQ2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAATAN +BgkqhkiG9w0BAQQFAANBAFqPEKFjk6T6CKTHvaQeEAsX0/8YHPHqH/9AnhSjrwuX +9EBc0n6bVGhN7XaXd6sJ7dym9sbsWxb+pJdurnkxjx4= +-----END CERTIFICATE----- Added: python/trunk/Lib/test/ssl_key.pem ============================================================================== --- (empty file) +++ python/trunk/Lib/test/ssl_key.pem Tue Apr 3 19:29:48 2007 @@ -0,0 +1,9 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIBPAIBAAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNwL4lYKbpzzlmC5beaQXeQ +2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAAQJBALjkK+jc2+iihI98riEF +oudmkNziSRTYjnwjx8mCoAjPWviB3c742eO3FG4/soi1jD9A5alihEOXfUzloenr +8IECIQD3B5+0l+68BA/6d76iUNqAAV8djGTzvxnCxycnxPQydQIhAMXt4trUI3nc +a+U8YL2HPFA3gmhBsSICbq2OptOCnM7hAiEA6Xi3JIQECob8YwkRj29DU3/4WYD7 +WLPgsQpwo1GuSpECICGsnWH5oaeD9t9jbFoSfhJvv0IZmxdcLpRcpslpeWBBAiEA +6/5B8J0GHdJq89FHwEG/H2eVVUYu5y/aD6sgcm+0Avg= +-----END RSA PRIVATE KEY----- Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Tue Apr 3 19:29:48 2007 @@ -8,6 +8,9 @@ import threading import subprocess import time +import ctypes +import os +import urllib # Optionally test SSL support, if we have it in the tested platform skip_expected = not hasattr(socket, "ssl") @@ -15,11 +18,6 @@ class ConnectedTests(unittest.TestCase): def testBasic(self): - import urllib - - if test_support.verbose: - print "test_basic ..." - socket.RAND_status() try: socket.RAND_egd(1) @@ -42,9 +40,6 @@ hoped for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR, extra_msg) - if test_support.verbose: - print "test_timeout ..." - # A service which issues a welcome banner (without need to write # anything). # XXX ("gmail.org", 995) has been unreliable so far, from time to @@ -75,9 +70,6 @@ class BasicTests(unittest.TestCase): def testRudeShutdown(self): - if test_support.verbose: - print "test_rude_shutdown ..." - # Some random port to connect to. PORT = [9934] @@ -115,7 +107,68 @@ connector() t.join() +class OpenSSLTests(unittest.TestCase): + + def testBasic(self): + time.sleep(.2) + s = socket.socket() + s.connect(("localhost", 4433)) + ss = socket.ssl(s) + ss.write("Foo\n") + i = ss.read(4) + self.assertEqual(i, "Foo\n") + + +def haveOpenSSL(): + try: + s = subprocess.Popen("openssl rand 1".split(), stdout=subprocess.PIPE) + s.stdout.read(1) + except OSError, err: + if err.errno == 2: + return False + raise + return True + +class OpenSSLServer(threading.Thread): + def __init__(self): + self.s = None + self.keepServing = True + threading.Thread.__init__(self) + + def run(self): + if os.access("ssl_cert.pem", os.F_OK): + cert_file = "ssl_cert.pem" + elif os.access("./Lib/test/ssl_cert.pem", os.F_OK): + cert_file = "./Lib/test/ssl_cert.pem" + else: + raise ValueError("No cert file found!") + if os.access("ssl_key.pem", os.F_OK): + key_file = "ssl_key.pem" + elif os.access("./Lib/test/ssl_key.pem", os.F_OK): + key_file = "./Lib/test/ssl_key.pem" + else: + raise ValueError("No cert file found!") + cmd = "openssl s_server -cert %s -key %s -quiet" % (cert_file, key_file) + self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + while self.keepServing: + time.sleep(.5) + l = self.s.stdout.readline() + self.s.stdin.write(l) + + def shutdown(self): + self.keepServing = False + if not self.s: + return + if sys.platform == "win32": + handle = ctypes.windll.kernel32.OpenProcess(1, False, self.s.pid) + ctypes.windll.kernel32.TerminateProcess(handle, -1) + ctypes.windll.kernel32.CloseHandle(handle) + else: + os.kill(self.s.pid, 15) + def test_main(): if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") @@ -125,9 +178,25 @@ if test_support.is_resource_enabled('network'): tests.append(ConnectedTests) + # in these platforms we can kill the openssl process + if sys.platform in ("sunos5", "darwin", "linux1", + "linux2", "win32", "hp-ux11"): + if haveOpenSSL(): + haveServer = True + tests.append(OpenSSLTests) + else: + haveServer = False + + if haveServer: + server = OpenSSLServer() + server.start() + thread_info = test_support.threading_setup() test_support.run_unittest(*tests) test_support.threading_cleanup(*thread_info) + if haveServer: + server.shutdown() + if __name__ == "__main__": test_main() From buildbot at python.org Tue Apr 3 20:27:19 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 18:27:19 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070403182719.75CF61E400E@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/356 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 5 tests failed: test_extcall test_os test_profile test_urllib test_urllib2net ====================================================================== ERROR: test_makedir (test.test_os.MakedirTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 384, in setUp os.mkdir(test_support.TESTFN) WindowsError: [Error 183] Cannot create a file when that file already exists: '@test' ====================================================================== ERROR: test_access (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 451, in test_access self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) TypeError: utime() arg 2 must be a tuple (atime, mtime) ====================================================================== FAIL: test_traversal (test.test_os.WalkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 313, in test_traversal self.assertEqual(len(all), 4) AssertionError: 5 != 4 ====================================================================== FAIL: test_chdir (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_os.py", line 442, in test_chdir self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) AssertionError: WindowsError not raised sincerely, -The Buildbot From python-checkins at python.org Tue Apr 3 20:33:37 2007 From: python-checkins at python.org (walter.doerwald) Date: Tue, 3 Apr 2007 20:33:37 +0200 (CEST) Subject: [Python-checkins] r54677 - in python/trunk: Lib/test/test_structmembers.py Lib/test/test_support.py Lib/test/test_warnings.py Misc/NEWS Message-ID: <20070403183337.17E611E4008@bag.python.org> Author: walter.doerwald Date: Tue Apr 3 20:33:29 2007 New Revision: 54677 Modified: python/trunk/Lib/test/test_structmembers.py python/trunk/Lib/test/test_support.py python/trunk/Lib/test/test_warnings.py python/trunk/Misc/NEWS Log: Implement a contextmanager test.test_support.catch_warning that can be used to catch the last warning issued by the warning framework. Change test_warnings.py and test_structmembers.py to use this new contextmanager. Modified: python/trunk/Lib/test/test_structmembers.py ============================================================================== --- python/trunk/Lib/test/test_structmembers.py (original) +++ python/trunk/Lib/test/test_structmembers.py Tue Apr 3 20:33:29 2007 @@ -4,7 +4,7 @@ INT_MAX, INT_MIN, UINT_MAX, \ LONG_MAX, LONG_MIN, ULONG_MAX -import warnings, exceptions, unittest, test.test_warnings +import warnings, exceptions, unittest from test import test_support ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) @@ -39,34 +39,39 @@ ts.T_ULONG=ULONG_MAX self.assertEquals(ts.T_ULONG, ULONG_MAX) -class TestWarnings(test.test_warnings.CatchWarningTest): - def has_warned(self): - self.assertEqual(test.test_warnings.msg.category, - exceptions.RuntimeWarning.__name__) +class TestWarnings(unittest.TestCase): + def has_warned(self, w): + self.assert_(w.category is RuntimeWarning) def test_byte_max(self): - ts.T_BYTE=CHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MAX+1 + self.has_warned(w) def test_byte_min(self): - ts.T_BYTE=CHAR_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MIN-1 + self.has_warned(w) def test_ubyte_max(self): - ts.T_UBYTE=UCHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_UBYTE=UCHAR_MAX+1 + self.has_warned(w) def test_short_max(self): - ts.T_SHORT=SHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MAX+1 + self.has_warned(w) def test_short_min(self): - ts.T_SHORT=SHRT_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MIN-1 + self.has_warned(w) def test_ushort_max(self): - ts.T_USHORT=USHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_USHORT=USHRT_MAX+1 + self.has_warned(w) Modified: python/trunk/Lib/test/test_support.py ============================================================================== --- python/trunk/Lib/test/test_support.py (original) +++ python/trunk/Lib/test/test_support.py Tue Apr 3 20:33:29 2007 @@ -282,6 +282,42 @@ finally: warnings.filters = original_filters +class WarningMessage(object): + "Holds the result of the latest showwarning() call" + def __init__(self): + self.message = None + self.category = None + self.filename = None + self.lineno = None + + def _showwarning(self, message, category, filename, lineno, file=None): + self.message = message + self.category = category + self.filename = filename + self.lineno = lineno + + at contextlib.contextmanager +def catch_warning(): + """ + Guard the warnings filter from being permanently changed and record the + data of the last warning that has been issued. + + Use like this: + + with catch_warning as w: + warnings.warn("foo") + assert str(w.message) == "foo" + """ + warning = WarningMessage() + original_filters = warnings.filters[:] + original_showwarning = warnings.showwarning + warnings.showwarning = warning._showwarning + try: + yield warning + finally: + warnings.showwarning = original_showwarning + warnings.filters = original_filters + class EnvironmentVarGuard(object): """Class to help protect the environment variable properly. Can be used as Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Tue Apr 3 20:33:29 2007 @@ -5,121 +5,95 @@ import warning_tests -# The warnings module isn't easily tested, because it relies on module -# globals to store configuration information. setUp() and tearDown() -# preserve the current settings to avoid bashing them while running tests. - -# To capture the warning messages, a replacement for showwarning() is -# used to save warning information in a global variable. - -class WarningMessage: - "Holds results of latest showwarning() call" - pass - -def showwarning(message, category, filename, lineno, file=None): - msg.message = str(message) - msg.category = category.__name__ - msg.filename = os.path.basename(filename) - msg.lineno = lineno - -class CatchWarningTest(unittest.TestCase): - # base class used for catching warnings issued by the - # warning framework (this is reused by test_structmembers.py) - +class TestModule(unittest.TestCase): def setUp(self): - global msg - msg = WarningMessage() - self._filters = warnings.filters[:] - self._showwarning = warnings.showwarning - warnings.showwarning = showwarning - self.ignored = [w[2].__name__ for w in self._filters + self.ignored = [w[2].__name__ for w in warnings.filters if w[0]=='ignore' and w[1] is None and w[3] is None] - def tearDown(self): - warnings.filters = self._filters[:] - warnings.showwarning = self._showwarning - -class TestModule(CatchWarningTest): - def test_warn_default_category(self): - for i in range(4): - text = 'multi %d' %i # Different text on each call - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') + with test_support.catch_warning() as w: + for i in range(4): + text = 'multi %d' %i # Different text on each call + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) def test_warn_specific_category(self): - text = 'None' - for category in [DeprecationWarning, FutureWarning, - PendingDeprecationWarning, RuntimeWarning, - SyntaxWarning, UserWarning, Warning]: - if category.__name__ in self.ignored: - text = 'filtered out' + category.__name__ - warnings.warn(text, category) - self.assertNotEqual(msg.message, text) - else: - text = 'unfiltered %s' % category.__name__ - warnings.warn(text, category) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, category.__name__) + with test_support.catch_warning() as w: + text = 'None' + for category in [DeprecationWarning, FutureWarning, + PendingDeprecationWarning, RuntimeWarning, + SyntaxWarning, UserWarning, Warning]: + if category.__name__ in self.ignored: + text = 'filtered out' + category.__name__ + warnings.warn(text, category) + self.assertNotEqual(w.message, text) + else: + text = 'unfiltered %s' % category.__name__ + warnings.warn(text, category) + self.assertEqual(str(w.message), text) + self.assert_(w.category is category) def test_filtering(self): + with test_support.catch_warning() as w: + warnings.filterwarnings("error", "", Warning, "", 0) + self.assertRaises(UserWarning, warnings.warn, 'convert to error') - warnings.filterwarnings("error", "", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'convert to error') + warnings.resetwarnings() + text = 'handle normally' + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) + + warnings.filterwarnings("ignore", "", Warning, "", 0) + text = 'filtered out' + warnings.warn(text) + self.assertNotEqual(str(w.message), text) - warnings.resetwarnings() - text = 'handle normally' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') - - warnings.filterwarnings("ignore", "", Warning, "", 0) - text = 'filtered out' - warnings.warn(text) - self.assertNotEqual(msg.message, text) - - warnings.resetwarnings() - warnings.filterwarnings("error", "hex*", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'hex/oct') - text = 'nonmatching text' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') + warnings.resetwarnings() + warnings.filterwarnings("error", "hex*", Warning, "", 0) + self.assertRaises(UserWarning, warnings.warn, 'hex/oct') + text = 'nonmatching text' + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) def test_options(self): # Uses the private _setoption() function to test the parsing # of command-line warning arguments - self.assertRaises(warnings._OptionError, - warnings._setoption, '1:2:3:4:5:6') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'bogus::Warning') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'ignore:2::4:-5') - warnings._setoption('error::Warning::0') - self.assertRaises(UserWarning, warnings.warn, 'convert to error') + with test_support.guard_warnings_filter(): + self.assertRaises(warnings._OptionError, + warnings._setoption, '1:2:3:4:5:6') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'bogus::Warning') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'ignore:2::4:-5') + warnings._setoption('error::Warning::0') + self.assertRaises(UserWarning, warnings.warn, 'convert to error') def test_filename(self): - warning_tests.inner("spam1") - self.assertEqual(msg.filename, "warning_tests.py") - warning_tests.outer("spam2") - self.assertEqual(msg.filename, "warning_tests.py") + with test_support.catch_warning() as w: + warning_tests.inner("spam1") + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + warning_tests.outer("spam2") + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") def test_stacklevel(self): # Test stacklevel argument # make sure all messages are different, so the warning won't be skipped - warning_tests.inner("spam3", stacklevel=1) - self.assertEqual(msg.filename, "warning_tests.py") - warning_tests.outer("spam4", stacklevel=1) - self.assertEqual(msg.filename, "warning_tests.py") - - warning_tests.inner("spam5", stacklevel=2) - self.assertEqual(msg.filename, "test_warnings.py") - warning_tests.outer("spam6", stacklevel=2) - self.assertEqual(msg.filename, "warning_tests.py") + with test_support.catch_warning() as w: + warning_tests.inner("spam3", stacklevel=1) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + warning_tests.outer("spam4", stacklevel=1) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + + warning_tests.inner("spam5", stacklevel=2) + self.assertEqual(os.path.basename(w.filename), "test_warnings.py") + warning_tests.outer("spam6", stacklevel=2) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") - warning_tests.inner("spam7", stacklevel=9999) - self.assertEqual(msg.filename, "sys") + warning_tests.inner("spam7", stacklevel=9999) + self.assertEqual(os.path.basename(w.filename), "sys") def test_main(verbose=None): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Apr 3 20:33:29 2007 @@ -713,6 +713,9 @@ - Fix bsddb test_basics.test06_Transactions to check the version number properly. +- test.test_support.catch_warning is a new context manager that can be used + to catch the warnings issued by the warning framework. + Tools ----- From buildbot at python.org Tue Apr 3 21:01:05 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Apr 2007 19:01:05 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070403190106.356041E4011@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/185 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 4 tests failed: test_os test_profile test_socket_ssl test_urllib ====================================================================== ERROR: test_makedir (test.test_os.MakedirTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 384, in setUp os.mkdir(test_support.TESTFN) WindowsError: [Error 183] Cannot create a file when that file already exists: '@test' ====================================================================== ERROR: test_access (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 451, in test_access self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) TypeError: utime() arg 2 must be a tuple (atime, mtime) ====================================================================== FAIL: test_traversal (test.test_os.WalkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 313, in test_traversal self.assertEqual(len(all), 4) AssertionError: 5 != 4 ====================================================================== FAIL: test_chdir (test.test_os.Win32ErrorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_os.py", line 442, in test_chdir self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) AssertionError: WindowsError not raised ====================================================================== ERROR: testBasic (test.test_socket_ssl.OpenSSLTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_socket_ssl.py", line 115, in testBasic s.connect(("localhost", 4433)) File "", line 1, in connect error: (10061, 'Connection refused') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_socket_ssl.py", line 144, in run raise ValueError("No cert file found!") ValueError: No cert file found! Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_socket_ssl.py", line 144, in run raise ValueError("No cert file found!") ValueError: No cert file found! sincerely, -The Buildbot From python-checkins at python.org Tue Apr 3 23:15:37 2007 From: python-checkins at python.org (facundo.batista) Date: Tue, 3 Apr 2007 23:15:37 +0200 (CEST) Subject: [Python-checkins] r54678 - python/trunk/Lib/test/test_socket_ssl.py Message-ID: <20070403211537.527091E4031@bag.python.org> Author: facundo.batista Date: Tue Apr 3 23:15:34 2007 New Revision: 54678 Modified: python/trunk/Lib/test/test_socket_ssl.py Log: Changed the whole structure of startup and checking if the server is available. Hope to not get more false alarms. Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Tue Apr 3 23:15:34 2007 @@ -110,32 +110,24 @@ class OpenSSLTests(unittest.TestCase): def testBasic(self): - time.sleep(.2) s = socket.socket() s.connect(("localhost", 4433)) ss = socket.ssl(s) ss.write("Foo\n") i = ss.read(4) self.assertEqual(i, "Foo\n") + s.close() -def haveOpenSSL(): - try: - s = subprocess.Popen("openssl rand 1".split(), stdout=subprocess.PIPE) - s.stdout.read(1) - except OSError, err: - if err.errno == 2: - return False - raise - return True - class OpenSSLServer(threading.Thread): def __init__(self): self.s = None self.keepServing = True - threading.Thread.__init__(self) + self._external() + if self.haveServer: + threading.Thread.__init__(self) - def run(self): + def _external(self): if os.access("ssl_cert.pem", os.F_OK): cert_file = "ssl_cert.pem" elif os.access("./Lib/test/ssl_cert.pem", os.F_OK): @@ -149,10 +141,27 @@ else: raise ValueError("No cert file found!") - cmd = "openssl s_server -cert %s -key %s -quiet" % (cert_file, key_file) - self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, + try: + cmd = "openssl s_server -cert %s -key %s -quiet" % (cert_file, key_file) + self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + time.sleep(1) + except: + self.haveServer = False + else: + # let's try if it is actually up + try: + s = socket.socket() + s.connect(("localhost", 4433)) + s.close() + assert self.s.stdout.readline() == "ERROR\n" + except: + self.haveServer = False + else: + self.haveServer = True + + def run(self): while self.keepServing: time.sleep(.5) l = self.s.stdout.readline() @@ -181,22 +190,23 @@ # in these platforms we can kill the openssl process if sys.platform in ("sunos5", "darwin", "linux1", "linux2", "win32", "hp-ux11"): - if haveOpenSSL(): - haveServer = True - tests.append(OpenSSLTests) - else: - haveServer = False - if haveServer: server = OpenSSLServer() - server.start() + if server.haveServer: + tests.append(OpenSSLTests) + server.start() + else: + server = None thread_info = test_support.threading_setup() - test_support.run_unittest(*tests) - test_support.threading_cleanup(*thread_info) - if haveServer: - server.shutdown() + try: + test_support.run_unittest(*tests) + finally: + if server is not None and server.haveServer: + server.shutdown() + + test_support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() From nnorwitz at gmail.com Tue Apr 3 23:38:35 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 3 Apr 2007 17:38:35 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20070403213835.GA7785@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Exception in thread reader 4: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread reader 3: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread reader 2: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread writer 1: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 245, in writerThread self.assertEqual(data, self.makeData(key)) File "/tmp/python-test/local/lib/python2.6/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1038-1038-1038-1038-1038' Exception in thread writer 0: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/tmp/python-test/local/lib/python2.6/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0002-0002-0002-0002-0002' Exception in thread writer 2: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/tmp/python-test/local/lib/python2.6/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2000-2000-2000-2000-2000' test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7325 refs] [7325 refs] [7325 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7700 refs] [7700 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test test_smtplib failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_smtplib.py", line 39, in testBasic smtp = smtplib.SMTP("localhost", 9091) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 248, in __init__ (code, msg) = self.connect(host, port) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 304, in connect self.sock = self._get_socket(host, port, self.timeout) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 282, in _get_socket return socket.create_connection((port, host), timeout) File "/tmp/python-test/local/lib/python2.6/socket.py", line 443, in create_connection raise error, msg error: (111, 'Connection refused') test_socket test_socket_ssl test_socketserver test test_socketserver crashed -- : (111, 'Connection refused') test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7320 refs] [7321 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7321 refs] [8869 refs] [7536 refs] [7321 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] . [7320 refs] [7320 refs] this bit of output is from a test of stdout in a different process ... [7320 refs] [7320 refs] [7536 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7320 refs] [7320 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7324 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 301 tests OK. 2 tests failed: test_smtplib test_socketserver 21 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_ioctl test_macfs test_macostools test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl warning: DBTxn aborted in destructor. No prior commit() or abort(). [488836 refs] From buildbot at python.org Wed Apr 4 02:09:02 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 00:09:02 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20070404000903.156F31E4008@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/732 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "./Lib/test/regrtest.py", line 1384, in main() File "./Lib/test/regrtest.py", line 416, in main e = _ExpectedSkips() File "./Lib/test/regrtest.py", line 1321, in __init__ from test import test_socket_ssl File "/home/pybot/buildarea/trunk.klose-debian-mips/build/Lib/test/test_socket_ssl.py", line 11, in import ctypes File "/home/pybot/buildarea/trunk.klose-debian-mips/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Apr 4 02:17:13 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 4 Apr 2007 02:17:13 +0200 (CEST) Subject: [Python-checkins] r54679 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070404001713.1FD271E400A@bag.python.org> Author: guido.van.rossum Date: Wed Apr 4 02:17:12 2007 New Revision: 54679 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Move the index and slice helpers to global functions. Add proper slice support for AdaptToSequence. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Wed Apr 4 02:17:12 2007 @@ -406,6 +406,56 @@ ### SEQUENCES ### +def _index(i): + # Internal helper to raise TypeError for non-integer(-castable) values + if not isinstance(i, int): + if not hasattr(i, "__index__"): + raise TypeError + i = i.__index__() + if not isinstance(i, int): + raise TypeError + return i + + +def _slice(slc, size): + # Internal helper to normalize a slice into start, stop, step + # ints; arguments are a slice object and the length of the + # sequence. + # XXX A problem this shares with Python 2: a[n-1:-1:-1] (where n + # is len(a)) returns an empty slice because the stop value is + # normalized to n-1. + start, stop, step = slc.start, slc.stop, slc.step + + if start is not None: + start = _index(start) + if start < 0: + start += size + if stop is not None: + stop = _index(stop) + if stop < 0: + stop += size + if step is not None: + step = _index(step) + + if step is None: + step = 1 + if step == 0: + raise ValueError + if step < 0: + if start is None: + start = size - 1 + if stop is None: + stop = -1 + else: + if start is None: + start = 0 + if stop is None: + stop = size + + return start, stop, step + + + class Sequence(Sizeable, Iterable): """A minimal sequence. @@ -418,44 +468,14 @@ giving an iterable providing the elements. """ - def __index(self, i): - # Internal helper to raise TypeError for non-integer(-castable) values - if not isinstance(i, int): - if not hasattr(i, "__index__"): - raise TypeError - i = i.__index__() - if not isinstance(i, int): - raise TypeError - return i - @abstractmethod def __getitem__(self, index): if isinstance(index, slice): - return self.__getslice(index) - index = self.__index(index) - raise IndexError - - def __getslice(self, slc): - # XXX Would be nice to make this generally available? - start, stop, step = slc.start, slc.stop, slc.step - for index in start, stop, step: - if index is not None: - self.__index(index) - if step is None: - step = 1 - if step == 0: - raise ValueError - if step < 0: - if start is None: - start = len(self) - 1 - if stop is None: - stop = -1 + start, stop, step = _slice(index, len(self)) + return self.__class__(self[i] for i in range(start, stop, step)) else: - if start is None: - start = 0 - if stop is None: - stop = len(self) - return self.__class__(self[i] for i in range(start, stop, step)) + index = _index(index) + raise IndexError @abstractmethod def __len__(self): @@ -491,7 +511,7 @@ # XXX Looks like we need an ABC to indicate integer-ness... if not isinstance(repeat, int) and not hasattr(repeat, "__index__"): return NotImplemented - repeat = self.__index(repeat) + repeat = _index(repeat) return self.__class__(elem for i in range(repeat) for elem in self) def __eq__(self, other): @@ -555,12 +575,17 @@ class AdaptToSequence(Sequence): def __new__(cls, adaptee): - self = Sequence.__new__(cls) - self.adaptee = adaptee - return self + if not hasattr(adaptee, "__getitem__"): + # Hack so that the self.__class__() calls above work + adaptee = list(adaptee) + obj = Sequence.__new__(cls) + obj.adaptee = adaptee + return obj def __getitem__(self, index): - return self.adaptee[index] + if isinstance(index, slice): + return super(AdaptToSequence, self).__getitem__(index) + return self.adaptee[_index(index)] def __len__(self): return len(self.adaptee) Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Wed Apr 4 02:17:12 2007 @@ -46,7 +46,9 @@ self.assertEqual(a[-1], 9) self.assertEqual(list(a), range(10)) #self.assertEqual(a, range(10)) - # Slicing isn't implemented correctly + b = a[1:-1] + self.assertEqual(b.__class__, abc.AdaptToSequence) + self.assertEqual(list(b), range(1, 9)) def test_adapt_to_mapping(self): a = abc.AdaptToMapping({1: 10, 2: 20}) From python-checkins at python.org Wed Apr 4 08:41:20 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 4 Apr 2007 08:41:20 +0200 (CEST) Subject: [Python-checkins] r54680 - peps/trunk/pep-0000.txt peps/trunk/pep-3117.txt Message-ID: <20070404064120.D10971E4005@bag.python.org> Author: georg.brandl Date: Wed Apr 4 08:41:20 2007 New Revision: 54680 Added: peps/trunk/pep-3117.txt Modified: peps/trunk/pep-0000.txt Log: Checkin PEP 3117. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Wed Apr 4 08:41:20 2007 @@ -115,6 +115,7 @@ S 3108 Standard Library Reorganization Cannon S 3114 Renaming iterator.next() to iterator.__next__() Yee S 3116 New I/O Stutzbach, Verdone, GvR + S 3117 Postfix Type Declarations Brandl Finished PEPs (done, implemented in Subversion) @@ -468,6 +469,7 @@ S 3114 Renaming iterator.next() to iterator.__next__() Yee SA 3115 Metaclasses in Python 3000 Talin S 3116 New I/O Stutzbach, Verdone, GvR + S 3117 Postfix Type Declarations Brandl Key Added: peps/trunk/pep-3117.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3117.txt Wed Apr 4 08:41:20 2007 @@ -0,0 +1,236 @@ +PEP: 3117 +Title: Postfix type declarations +Version: $Revision: $ +Last-Modified: $Date: $ +Author: Georg Brandl +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 01-Apr-2007 +Python-Version: 3.0 + + +Abstract +======== + +This PEP proposes the addition of a postfix type declaration syntax to +Python. It also specifies a new ``typedef`` statement which is used to create +new mappings between types and declarators. + +Its acceptance will greatly enhance the Python user experience as well as +eliminate one of the warts that deter users of other programming languages from +switching to Python. + + +Rationale +========= + +Python has long suffered from the lack of explicit type declarations. Being one +of the few aspects in which the language deviates from its Zen, this wart has +sparked many a discussion between Python heretics and members of the PSU (for +a few examples, see [EX1]_, [EX2]_ or [EX3]_), and it also made it a large-scale +enterprise success unlikely. + +However, if one wants to put an end to this misery, a decent Pythonic syntax +must be found. In almost all languages that have them, type declarations lack +this quality: they are verbose, often needing *multiple words* for a single +type, or they are hard to comprehend (e.g., a certain language uses completely +unrelated [#]_ adjectives like ``dim`` for type declaration). + +Therefore, this PEP combines the move to type declarations with another bold +move that will once again prove that Python is not only future-proof but +future-embracing: the introduction of Unicode characters as an integral +constituent of source code. + +Unicode makes it possible to express much more with much less characters, which +is in accordance with the Zen ("Readability counts.") [ZEN]_. Additionally, it +eliminates the need for a separate type declaration statement, and last but not +least, it makes Python measure up to Perl 6, which already uses Unicode for its +operators. [#]_ + + +Specification +============= + +When the type declaration mode is in operation, the grammar is changed so that +each ``NAME`` must consist of two parts: a name and a type declarator, which is +exactly one Unicode character. + +The declarator uniquely specifies the type of the name, and if it occurs on the +left hand side of an expression, this type is enforced: an ``InquisitionError`` +exception is raised if the returned type doesn't match the declared type. [#]_ + +Also, function call result types have to be specified. If the result of the call +does not have the declared type, an ``InquisitionError`` is raised. Caution: the +declarator for the result should not be confused with the declarator for the +function object (see the example below). + +Type declarators after names that are only read, not assigned to, are not strictly +necessary but enforced anyway (see the Python Zen: "Explicit is better than +implicit."). + +The mapping between types and declarators is not static. It can be completely +customized by the programmer, but for convenience there are some predefined +mappings for some built-in types: + +========================= =================================================== +Type Declarator +========================= =================================================== +``object`` ? (REPLACEMENT CHARACTER) +``int`` ? (DOUBLE-STRUCK CAPITAL N) +``float`` ? (ESTIMATED SYMBOL) +``bool`` ? (CHECK MARK) +``complex`` ? (DOUBLE-STRUCK CAPITAL C) +``str`` ? (LOWER RIGHT PENCIL) +``unicode`` ? (BLACK NIB) +``tuple`` ? (PARENTHESIZED LATIN SMALL LETTER T) +``list`` ? (HOT SPRINGS) +``dict`` ? (DOUBLE-ENDED MULTIMAP) +``set`` ? (EMPTY SET) (*Note:* this is also for full sets) +``frozenset`` ? (SNOWMAN) +``datetime`` ? (WATCH) +``function`` ? (LATIN SMALL LETTER LAMBDA WITH STROKE) +``generator`` ? (ATOM SYMBOL) +``Exception`` ? (ELECTRIC ARROW) +========================= =================================================== + +The declarator for the ``None`` type is a zero-width space. + +These characters should be obvious and easy to remember and type for every +programmer. + + +Unicode replacement units +========================= + +Since even in our modern, globalized world there are still some old-fashioned +rebels who can't or don't want to use Unicode in their source code, and since +Python is a forgiving language, a fallback is provided for those: + +Instead of the single Unicode character, they can type ``name${UNICODE NAME OF +THE DECLARATOR}$``. For example, these two function definitions are equivalent:: + + def foo?(x?): + return None + +and :: + + def foo${LATIN SMALL LETTER LAMBDA WITH STROKE}$(x${DOUBLE-STRUCK CAPITAL C}$): + return None${ZERO WIDTH NO-BREAK SPACE}$ + +This is still easy to read and makes the full power of type-annotated Python +available to ASCII believers. + + +The ``typedef`` statement +========================= + +The mapping between types and declarators can be extended with this new statement. + +The syntax is as follows:: + + typedef_stmt ::= "typedef" expr DECLARATOR + +where ``expr`` resolves to a type object. For convenience, the ``typedef`` statement +can also be mixed with the ``class`` statement for new classes, like so:: + + typedef class Foo?(object?): + pass + + +Example +======= + +This is the standard ``os.path.normpath`` function, converted to type declaration +syntax:: + + def normpath?(path?)?: + """Normalize path, eliminating double slashes, etc.""" + if path? == '': + return '.' + initial_slashes? = path?.startswith?('/')? + # POSIX allows one or two initial slashes, but treats three or more + # as single slash. + if (initial_slashes? and + path?.startswith?('//')? and not path?.startswith?('///')?)?: + initial_slashes? = 2 + comps? = path?.split?('/')? + new_comps? = []? + for comp? in comps?: + if comp? in ('', '.')?: + continue + if (comp? != '..' or (not initial_slashes? and not new_comps?)? or + (new_comps? and new_comps?[-1]? == '..')?)?: + new_comps?.append?(comp?) + elif new_comps?: + new_comps?.pop?()? + comps? = new_comps? + path? = '/'.join(comps?)? + if initial_slashes?: + path? = '/'*initial_slashes? + path? + return path? or '.' + +As you can clearly see, the type declarations add expressiveness, while at the +same time they make the code look much more professional. + + +Compatibility issues +==================== + +To enable type declaration mode, one has to write:: + + from __future__ import type_declarations + +which enables Unicode parsing of the source [#]_, makes ``typedef`` a keyword +and enforces correct types for all assignments and function calls. + + +References +========== + + +.. [EX1] http://mail.python.org/pipermail/python-list/2003-June/210588.html + +.. [EX2] http://mail.python.org/pipermail/python-list/2000-May/034685.html + +.. [EX3] http://groups.google.com/group/comp.lang.python/browse_frm/thread/6ae8c6add913635a/de40d4ffe9bd4304?lnk=gst&q=type+declarations&rnum=6 + +.. [#] Though, if you know the language in question, it may not be *that* unrelated. + +.. [ZEN] http://www.python.org/dev/peps/pep-0020/ + +.. [#] Well, it would, if there was a Perl 6. + +.. [#] Since the name ``TypeError`` is already in use, this name has been chosen + for obvious reasons. + +.. [#] The encoding in which the code is written is read from a standard coding + cookie. There will also be an autodetection mechanism, invoked by ``from + __future__ import encoding_hell``. + + +Acknowledgements +================ + +Many thanks go to Armin Ronacher, Alexander Schremmer and Marek Kubica who helped +find the most suitable and mnemonic declarator for built-in types. + +Thanks also to the Unicode Consortium for including all those useful characters +in the Unicode standard. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + coding: utf-8 + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: From nnorwitz at gmail.com Wed Apr 4 10:13:48 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 4 Apr 2007 04:13:48 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070404081348.GA774@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7325 refs] [7325 refs] [7325 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7700 refs] [7700 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 118, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 168, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7320 refs] [7321 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7321 refs] [8869 refs] [7536 refs] [7321 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] [7320 refs] . [7320 refs] [7320 refs] this bit of output is from a test of stdout in a different process ... [7320 refs] [7320 refs] [7536 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7320 refs] [7320 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7324 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [479173 refs] From python-checkins at python.org Wed Apr 4 16:10:40 2007 From: python-checkins at python.org (facundo.batista) Date: Wed, 4 Apr 2007 16:10:40 +0200 (CEST) Subject: [Python-checkins] r54681 - python/trunk/Lib/test/test_socket_ssl.py Message-ID: <20070404141040.CB0A11E4008@bag.python.org> Author: facundo.batista Date: Wed Apr 4 16:10:40 2007 New Revision: 54681 Modified: python/trunk/Lib/test/test_socket_ssl.py Log: Fixed the way that the .pem files are looked for, and changed how to kill the process in win32 to use the _handle attribute. Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Wed Apr 4 16:10:40 2007 @@ -8,7 +8,6 @@ import threading import subprocess import time -import ctypes import os import urllib @@ -128,18 +127,14 @@ threading.Thread.__init__(self) def _external(self): - if os.access("ssl_cert.pem", os.F_OK): - cert_file = "ssl_cert.pem" - elif os.access("./Lib/test/ssl_cert.pem", os.F_OK): - cert_file = "./Lib/test/ssl_cert.pem" - else: - raise ValueError("No cert file found!") - if os.access("ssl_key.pem", os.F_OK): - key_file = "ssl_key.pem" - elif os.access("./Lib/test/ssl_key.pem", os.F_OK): - key_file = "./Lib/test/ssl_key.pem" - else: - raise ValueError("No cert file found!") + # let's find the .pem files + curdir = os.path.dirname(__file__) or os.curdir + cert_file = os.path.join(curdir, "ssl_cert.pem") + if not os.access(cert_file, os.F_OK): + raise ValueError("No cert file found! (tried %r)" % cert_file) + key_file = os.path.join(curdir, "ssl_key.pem") + if not os.access(key_file, os.F_OK): + raise ValueError("No key file found! (tried %r)" % key_file) try: cmd = "openssl s_server -cert %s -key %s -quiet" % (cert_file, key_file) @@ -172,9 +167,7 @@ if not self.s: return if sys.platform == "win32": - handle = ctypes.windll.kernel32.OpenProcess(1, False, self.s.pid) - ctypes.windll.kernel32.TerminateProcess(handle, -1) - ctypes.windll.kernel32.CloseHandle(handle) + subprocess.TerminateProcess(int(self.s._handle), -1) else: os.kill(self.s.pid, 15) From python-checkins at python.org Wed Apr 4 19:43:06 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 4 Apr 2007 19:43:06 +0200 (CEST) Subject: [Python-checkins] r54682 - python/trunk/Lib/test/test_socketserver.py Message-ID: <20070404174306.8E2DD1E4005@bag.python.org> Author: guido.van.rossum Date: Wed Apr 4 19:43:02 2007 New Revision: 54682 Modified: python/trunk/Lib/test/test_socketserver.py Log: Fix a race condition in this test -- instead of assuming that it will take the test server thread at most 0.5 seconds to get ready, use an event variable. Modified: python/trunk/Lib/test/test_socketserver.py ============================================================================== --- python/trunk/Lib/test/test_socketserver.py (original) +++ python/trunk/Lib/test/test_socketserver.py Wed Apr 4 19:43:02 2007 @@ -74,6 +74,7 @@ self.__addr = addr self.__svrcls = svrcls self.__hdlrcls = hdlrcls + self.ready = threading.Event() def run(self): class svrcls(MyMixinServer, self.__svrcls): pass @@ -87,6 +88,7 @@ if self.__addr != svr.socket.getsockname(): raise RuntimeError('server_address was %s, expected %s' % (self.__addr, svr.socket.getsockname())) + self.ready.set() if verbose: print "thread: serving three times" svr.serve_a_few() if verbose: print "thread: done" @@ -139,7 +141,9 @@ t.start() if verbose: print "server running" for i in range(NREQ): - time.sleep(DELAY) + t.ready.wait(10*DELAY) + if not t.ready.isSet(): + raise RuntimeError("Server not ready within a reasonable time") if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" From python-checkins at python.org Wed Apr 4 20:14:18 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 4 Apr 2007 20:14:18 +0200 (CEST) Subject: [Python-checkins] r54683 - python/trunk/Lib/test/test_dis.py Message-ID: <20070404181418.05C831E4005@bag.python.org> Author: collin.winter Date: Wed Apr 4 20:14:17 2007 New Revision: 54683 Modified: python/trunk/Lib/test/test_dis.py Log: Clean up imports. Modified: python/trunk/Lib/test/test_dis.py ============================================================================== --- python/trunk/Lib/test/test_dis.py (original) +++ python/trunk/Lib/test/test_dis.py Wed Apr 4 20:14:17 2007 @@ -1,11 +1,11 @@ -from test.test_support import verify, verbose, TestFailed, run_unittest +# Minimal tests for dis module + +from test.test_support import verbose, run_unittest +import unittest import sys import dis import StringIO -# Minimal tests for dis module - -import unittest def _f(a): print a From python-checkins at python.org Wed Apr 4 20:16:27 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 4 Apr 2007 20:16:27 +0200 (CEST) Subject: [Python-checkins] r54684 - python/trunk/Lib/test/test___all__.py Message-ID: <20070404181627.6616C1E4005@bag.python.org> Author: collin.winter Date: Wed Apr 4 20:16:24 2007 New Revision: 54684 Modified: python/trunk/Lib/test/test___all__.py Log: Stop using test_support.verify(). Modified: python/trunk/Lib/test/test___all__.py ============================================================================== --- python/trunk/Lib/test/test___all__.py (original) +++ python/trunk/Lib/test/test___all__.py Wed Apr 4 20:16:24 2007 @@ -1,7 +1,5 @@ import unittest -from test import test_support - -from test.test_support import verify, verbose +from test.test_support import verbose, run_unittest import sys import warnings @@ -22,15 +20,15 @@ # Silent fail here seems the best route since some modules # may not be available in all environments. return - verify(hasattr(sys.modules[modname], "__all__"), - "%s has no __all__ attribute" % modname) + self.failUnless(hasattr(sys.modules[modname], "__all__"), + "%s has no __all__ attribute" % modname) names = {} exec "from %s import *" % modname in names - if names.has_key("__builtins__"): + if "__builtins__" in names: del names["__builtins__"] keys = set(names) all = set(sys.modules[modname].__all__) - verify(keys==all, "%s != %s" % (keys, all)) + self.assertEqual(keys, all) def test_all(self): if not sys.platform.startswith('java'): @@ -181,7 +179,7 @@ def test_main(): - test_support.run_unittest(AllTest) + run_unittest(AllTest) if __name__ == "__main__": test_main() From python-checkins at python.org Wed Apr 4 20:30:42 2007 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Apr 2007 20:30:42 +0200 (CEST) Subject: [Python-checkins] r54685 - in python/trunk: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c Message-ID: <20070404183042.928261E400E@bag.python.org> Author: martin.v.loewis Date: Wed Apr 4 20:30:36 2007 New Revision: 54685 Modified: python/trunk/Lib/test/test_os.py python/trunk/Misc/NEWS python/trunk/Modules/posixmodule.c Log: Bug #1686475: Support stat'ing open files on Windows again. Will backport to 2.5. Modified: python/trunk/Lib/test/test_os.py ============================================================================== --- python/trunk/Lib/test/test_os.py (original) +++ python/trunk/Lib/test/test_os.py Wed Apr 4 20:30:36 2007 @@ -240,6 +240,15 @@ os.utime(self.fname, (t1, t1)) self.assertEquals(os.stat(self.fname).st_mtime, t1) + def test_1686475(self): + # Verify that an open file can be stat'ed + try: + os.stat(r"c:\pagefile.sys") + except WindowsError, e: + if e == 2: # file does not exist; cannot run test + return + self.fail("Could not stat pagefile.sys") + from test import mapping_tests class EnvironTests(mapping_tests.BasicTestMappingProtocol): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Apr 4 20:30:36 2007 @@ -589,6 +589,8 @@ Extension Modules ----------------- +- Bug #1686475: Support stat'ing open files on Windows again. + - Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters with ASCII value less than 32. Also, it correctly quotes dots only if they occur on a single line, as opposed to the previous behavior of Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Wed Apr 4 20:30:36 2007 @@ -844,14 +844,48 @@ *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); } +static BOOL +attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL +attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + static BOOL WINAPI Py_GetFileAttributesExA(LPCSTR pszFile, GET_FILEEX_INFO_LEVELS level, LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAA FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -873,17 +907,7 @@ accept). */ if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileA(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir(pszFile, pfad); } static BOOL WINAPI @@ -892,8 +916,6 @@ LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAW FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -915,17 +937,7 @@ accept). */ if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileW(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir_w(pszFile, pfad); } static int @@ -936,10 +948,20 @@ char *dot; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code != 0) @@ -964,10 +986,20 @@ WIN32_FILE_ATTRIBUTE_DATA info; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir_w(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code < 0) From python-checkins at python.org Wed Apr 4 20:30:59 2007 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Apr 2007 20:30:59 +0200 (CEST) Subject: [Python-checkins] r54686 - in python/branches/release25-maint: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c Message-ID: <20070404183059.A048C1E400A@bag.python.org> Author: martin.v.loewis Date: Wed Apr 4 20:30:56 2007 New Revision: 54686 Modified: python/branches/release25-maint/Lib/test/test_os.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/posixmodule.c Log: Bug #1686475: Support stat'ing open files on Windows again. Modified: python/branches/release25-maint/Lib/test/test_os.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_os.py (original) +++ python/branches/release25-maint/Lib/test/test_os.py Wed Apr 4 20:30:56 2007 @@ -231,6 +231,15 @@ os.utime(self.fname, (t1, t1)) self.assertEquals(os.stat(self.fname).st_mtime, t1) + def test_1686475(self): + # Verify that an open file can be stat'ed + try: + os.stat(r"c:\pagefile.sys") + except WindowsError, e: + if e == 2: # file does not exist; cannot run test + return + self.fail("Could not stat pagefile.sys") + from test import mapping_tests class EnvironTests(mapping_tests.BasicTestMappingProtocol): Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed Apr 4 20:30:56 2007 @@ -134,6 +134,8 @@ Extension Modules ----------------- +- Bug #1686475: Support stat'ing open files on Windows again. + - Bug #1647541: Array module's buffer interface can now handle empty arrays. - Bug #1693079: The array module can now successfully pickle empty arrays. Modified: python/branches/release25-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release25-maint/Modules/posixmodule.c (original) +++ python/branches/release25-maint/Modules/posixmodule.c Wed Apr 4 20:30:56 2007 @@ -844,14 +844,48 @@ *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); } +static BOOL +attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL +attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + static BOOL WINAPI Py_GetFileAttributesExA(LPCSTR pszFile, GET_FILEEX_INFO_LEVELS level, LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAA FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -873,17 +907,7 @@ accept). */ if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileA(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir(pszFile, pfad); } static BOOL WINAPI @@ -892,8 +916,6 @@ LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAW FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -915,17 +937,7 @@ accept). */ if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileW(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir_w(pszFile, pfad); } static int @@ -936,10 +948,20 @@ char *dot; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code != 0) @@ -964,10 +986,20 @@ WIN32_FILE_ATTRIBUTE_DATA info; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir_w(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code < 0) From python-checkins at python.org Wed Apr 4 20:33:44 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 4 Apr 2007 20:33:44 +0200 (CEST) Subject: [Python-checkins] r54687 - python/trunk/Lib/test/test_getopt.py Message-ID: <20070404183344.0616E1E4008@bag.python.org> Author: collin.winter Date: Wed Apr 4 20:33:40 2007 New Revision: 54687 Modified: python/trunk/Lib/test/test_getopt.py Log: Make test_getopt use unittest. Modified: python/trunk/Lib/test/test_getopt.py ============================================================================== --- python/trunk/Lib/test/test_getopt.py (original) +++ python/trunk/Lib/test/test_getopt.py Wed Apr 4 20:33:40 2007 @@ -1,180 +1,179 @@ # test_getopt.py # David Goodger 2000-08-19 +from test.test_support import verbose, run_doctest, run_unittest +import unittest + import getopt -from getopt import GetoptError -from test.test_support import verify, verbose, run_doctest import os -def expectException(teststr, expected, failure=AssertionError): - """Executes a statement passed in teststr, and raises an exception - (failure) if the expected exception is *not* raised.""" - try: - exec teststr - except expected: - pass - else: - raise failure - -old_posixly_correct = os.environ.get("POSIXLY_CORRECT") -if old_posixly_correct is not None: - del os.environ["POSIXLY_CORRECT"] - -if verbose: - print 'Running tests on getopt.short_has_arg' -verify(getopt.short_has_arg('a', 'a:')) -verify(not getopt.short_has_arg('a', 'a')) -expectException("tmp = getopt.short_has_arg('a', 'b')", GetoptError) -expectException("tmp = getopt.short_has_arg('a', '')", GetoptError) - -if verbose: - print 'Running tests on getopt.long_has_args' -has_arg, option = getopt.long_has_args('abc', ['abc=']) -verify(has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abc']) -verify(not has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abcd']) -verify(not has_arg) -verify(option == 'abcd') -expectException("has_arg, option = getopt.long_has_args('abc', ['def'])", - GetoptError) -expectException("has_arg, option = getopt.long_has_args('abc', [])", - GetoptError) -expectException("has_arg, option = " + \ - "getopt.long_has_args('abc', ['abcd','abcde'])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_shorts' -opts, args = getopt.do_shorts([], 'a', 'a', []) -verify(opts == [('-a', '')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a1', 'a:', []) -verify(opts == [('-a', '1')]) -verify(args == []) -#opts, args = getopt.do_shorts([], 'a=1', 'a:', []) -#verify(opts == [('-a', '1')]) -#verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) -verify(opts == [('-a', '1')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) -verify(opts == [('-a', '1')]) -verify(args == ['2']) -expectException("opts, args = getopt.do_shorts([], 'a1', 'a', [])", - GetoptError) -expectException("opts, args = getopt.do_shorts([], 'a', 'a:', [])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_longs' -opts, args = getopt.do_longs([], 'abc', ['abc'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) -verify(opts == [('--abc', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) -verify(opts == [('--abcd', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -# Much like the preceding, except with a non-alpha character ("-") in -# option name that precedes "="; failed in -# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470 -opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) -verify(opts == [('--foo', '42')]) -verify(args == []) -expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])", - GetoptError) -expectException("opts, args = getopt.do_longs([], 'abc', ['abc='], [])", - GetoptError) - -# note: the empty string between '-a' and '--beta' is significant: -# it simulates an empty string option argument ('-a ""') on the command line. -cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', '', - '--beta', 'arg1', 'arg2'] - -if verbose: - print 'Running tests on getopt.getopt' -opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) -verify(opts == [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''), - ('-a', '3'), ('-a', ''), ('--beta', '')] ) -# Note ambiguity of ('-b', '') and ('-a', '') above. This must be -# accounted for in the code that calls getopt(). -verify(args == ['arg1', 'arg2']) - -expectException( - "opts, args = getopt.getopt(cmdline, 'a:b', ['alpha', 'beta'])", - GetoptError) - -# Test handling of GNU style scanning mode. -if verbose: - print 'Running tests on getopt.gnu_getopt' -cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] -# GNU style -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', ''), ('-b', '1'), ('--alpha', ''), ('--beta', '2')]) -verify(args == ['arg1']) -# Posix style via + -opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) -# Posix style via POSIXLY_CORRECT -os.environ["POSIXLY_CORRECT"] = "1" -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) - - -if old_posixly_correct is None: - del os.environ["POSIXLY_CORRECT"] -else: - os.environ["POSIXLY_CORRECT"] = old_posixly_correct - -#------------------------------------------------------------------------------ - -libreftest = """ -Examples from the Library Reference: Doc/lib/libgetopt.tex - -An example using only Unix style options: - - ->>> import getopt ->>> args = '-a -b -cfoo -d bar a1 a2'.split() ->>> args -['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'abc:d:') ->>> optlist -[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] ->>> args -['a1', 'a2'] - -Using long option names is equally easy: - - ->>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' ->>> args = s.split() ->>> args -['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'x', [ -... 'condition=', 'output-file=', 'testing']) ->>> optlist -[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] ->>> args -['a1', 'a2'] - -""" - -__test__ = {'libreftest' : libreftest} - -import sys -run_doctest(sys.modules[__name__], verbose) - -#------------------------------------------------------------------------------ +sentinel = object() -if verbose: - print "Module getopt: tests completed successfully." +class GetoptTests(unittest.TestCase): + def setUp(self): + self.old_posixly_correct = os.environ.get("POSIXLY_CORRECT", sentinel) + if self.old_posixly_correct is not sentinel: + del os.environ["POSIXLY_CORRECT"] + + def tearDown(self): + if self.old_posixly_correct is sentinel: + os.environ.pop("POSIXLY_CORRECT", None) + else: + os.environ["POSIXLY_CORRECT"] = self.old_posixly_correct + + def assertError(self, *args, **kwargs): + self.assertRaises(getopt.GetoptError, *args, **kwargs) + + def test_short_has_arg(self): + self.failUnless(getopt.short_has_arg('a', 'a:')) + self.failIf(getopt.short_has_arg('a', 'a')) + self.assertError(getopt.short_has_arg, 'a', 'b') + + def test_long_has_args(self): + has_arg, option = getopt.long_has_args('abc', ['abc=']) + self.failUnless(has_arg) + self.assertEqual(option, 'abc') + + has_arg, option = getopt.long_has_args('abc', ['abc']) + self.failIf(has_arg) + self.assertEqual(option, 'abc') + + has_arg, option = getopt.long_has_args('abc', ['abcd']) + self.failIf(has_arg) + self.assertEqual(option, 'abcd') + + self.assertError(getopt.long_has_args, 'abc', ['def']) + self.assertError(getopt.long_has_args, 'abc', []) + self.assertError(getopt.long_has_args, 'abc', ['abcd','abcde']) + + def test_do_shorts(self): + opts, args = getopt.do_shorts([], 'a', 'a', []) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a1', 'a:', []) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, []) + + #opts, args = getopt.do_shorts([], 'a=1', 'a:', []) + #self.assertEqual(opts, [('-a', '1')]) + #self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, ['2']) + + self.assertError(getopt.do_shorts, [], 'a1', 'a', []) + self.assertError(getopt.do_shorts, [], 'a', 'a:', []) + + def test_do_longs(self): + opts, args = getopt.do_longs([], 'abc', ['abc'], []) + self.assertEqual(opts, [('--abc', '')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) + self.assertEqual(opts, [('--abc', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) + self.assertEqual(opts, [('--abcd', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) + self.assertEqual(opts, [('--abc', '')]) + self.assertEqual(args, []) + + # Much like the preceding, except with a non-alpha character ("-") in + # option name that precedes "="; failed in + # http://python.org/sf/126863 + opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) + self.assertEqual(opts, [('--foo', '42')]) + self.assertEqual(args, []) + + self.assertError(getopt.do_longs, [], 'abc=1', ['abc'], []) + self.assertError(getopt.do_longs, [], 'abc', ['abc='], []) + + def test_getopt(self): + # note: the empty string between '-a' and '--beta' is significant: + # it simulates an empty string option argument ('-a ""') on the + # command line. + cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', + '', '--beta', 'arg1', 'arg2'] + + opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) + self.assertEqual(opts, [('-a', '1'), ('-b', ''), + ('--alpha', '2'), ('--beta', ''), + ('-a', '3'), ('-a', ''), ('--beta', '')]) + # Note ambiguity of ('-b', '') and ('-a', '') above. This must be + # accounted for in the code that calls getopt(). + self.assertEqual(args, ['arg1', 'arg2']) + + self.assertError(getopt.getopt, cmdline, 'a:b', ['alpha', 'beta']) + + def test_gnu_getopt(self): + # Test handling of GNU style scanning mode. + cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] + + # GNU style + opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) + self.assertEqual(args, ['arg1']) + self.assertEqual(opts, [('-a', ''), ('-b', '1'), + ('--alpha', ''), ('--beta', '2')]) + + # Posix style via + + opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) + + # Posix style via POSIXLY_CORRECT + os.environ["POSIXLY_CORRECT"] = "1" + opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) + + def test_libref_examples(self): + s = """ + Examples from the Library Reference: Doc/lib/libgetopt.tex + + An example using only Unix style options: + + + >>> import getopt + >>> args = '-a -b -cfoo -d bar a1 a2'.split() + >>> args + ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] + >>> optlist, args = getopt.getopt(args, 'abc:d:') + >>> optlist + [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] + >>> args + ['a1', 'a2'] + + Using long option names is equally easy: + + + >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' + >>> args = s.split() + >>> args + ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] + >>> optlist, args = getopt.getopt(args, 'x', [ + ... 'condition=', 'output-file=', 'testing']) + >>> optlist + [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] + >>> args + ['a1', 'a2'] + """ + + import new + m = new.module("libreftest", s) + run_doctest(m, verbose) + + +def test_main(): + run_unittest(GetoptTests) + +if __name__ == "__main__": + test_main() From buildbot at python.org Wed Apr 4 20:36:01 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 18:36:01 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20070404183601.6B1741E4005@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.5/builds/244 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Wed Apr 4 20:36:31 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 4 Apr 2007 20:36:31 +0200 (CEST) Subject: [Python-checkins] r54688 - python/trunk/Lib/test/test_softspace.py Message-ID: <20070404183631.05C491E4005@bag.python.org> Author: collin.winter Date: Wed Apr 4 20:36:30 2007 New Revision: 54688 Modified: python/trunk/Lib/test/test_softspace.py Log: Make test_softspace use unittest. Modified: python/trunk/Lib/test/test_softspace.py ============================================================================== --- python/trunk/Lib/test/test_softspace.py (original) +++ python/trunk/Lib/test/test_softspace.py Wed Apr 4 20:36:30 2007 @@ -1,14 +1,23 @@ -from test import test_support +from test.test_support import run_unittest +import unittest import StringIO -# SF bug 480215: softspace confused in nested print -f = StringIO.StringIO() -class C: - def __str__(self): - print >> f, 'a' - return 'b' +class SoftspaceTests(unittest.TestCase): + def test_bug_480215(self): + # SF bug 480215: softspace confused in nested print + f = StringIO.StringIO() + class C: + def __str__(self): + print >> f, 'a' + return 'b' -print >> f, C(), 'c ', 'd\t', 'e' -print >> f, 'f', 'g' -# In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' -test_support.vereq(f.getvalue(), 'a\nb c d\te\nf g\n') + print >> f, C(), 'c ', 'd\t', 'e' + print >> f, 'f', 'g' + # In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' + self.assertEqual(f.getvalue(), 'a\nb c d\te\nf g\n') + +def test_main(): + run_unittest(SoftspaceTests) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Wed Apr 4 20:38:47 2007 From: python-checkins at python.org (ziga.seilnacht) Date: Wed, 4 Apr 2007 20:38:47 +0200 (CEST) Subject: [Python-checkins] r54689 - python/trunk/Lib/test/test_os.py Message-ID: <20070404183847.F30EB1E4005@bag.python.org> Author: ziga.seilnacht Date: Wed Apr 4 20:38:47 2007 New Revision: 54689 Modified: python/trunk/Lib/test/test_os.py Log: Fix WalkTests.test_traversal() on Windows. The cleanup in MakedirTests.setUp() can now be removed. Modified: python/trunk/Lib/test/test_os.py ============================================================================== --- python/trunk/Lib/test/test_os.py (original) +++ python/trunk/Lib/test/test_os.py Wed Apr 4 20:38:47 2007 @@ -313,9 +313,9 @@ f.close() if hasattr(os, "symlink"): os.symlink(os.path.abspath(t2_path), link_path) + sub2_tree = (sub2_path, ["link"], ["tmp3"]) else: - # it must be a directory because the test expects that - os.mkdir(link_path) + sub2_tree = (sub2_path, [], ["tmp3"]) # Walk top-down. all = list(os.walk(walk_path)) @@ -328,7 +328,7 @@ self.assertEqual(all[0], (walk_path, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) self.assertEqual(all[2 + flipped], (sub11_path, [], [])) - self.assertEqual(all[3 - 2 * flipped], (sub2_path, ["link"], ["tmp3"])) + self.assertEqual(all[3 - 2 * flipped], sub2_tree) # Prune the search. all = [] @@ -340,7 +340,7 @@ dirs.remove('SUB1') self.assertEqual(len(all), 2) self.assertEqual(all[0], (walk_path, ["SUB2"], ["tmp1"])) - self.assertEqual(all[1], (sub2_path, ["link"], ["tmp3"])) + self.assertEqual(all[1], sub2_tree) # Walk bottom-up. all = list(os.walk(walk_path, topdown=False)) @@ -353,27 +353,28 @@ self.assertEqual(all[3], (walk_path, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[flipped], (sub11_path, [], [])) self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) - self.assertEqual(all[2 - 2 * flipped], (sub2_path, ["link"], ["tmp3"])) + self.assertEqual(all[2 - 2 * flipped], sub2_tree) - # Walk, following symlinks. - for root, dirs, files in os.walk(walk_path, followlinks=True): - if root == link_path: - self.assertEqual(dirs, []) - self.assertEqual(files, ["tmp4"]) - break - else: - self.fail("Didn't follow symlink with followlinks=True") - + if hasattr(os, "symlink"): + # Walk, following symlinks. + for root, dirs, files in os.walk(walk_path, followlinks=True): + if root == link_path: + self.assertEqual(dirs, []) + self.assertEqual(files, ["tmp4"]) + break + else: + self.fail("Didn't follow symlink with followlinks=True") + def tearDown(self): # Tear everything down. This is a decent use for bottom-up on # Windows, which doesn't have a recursive delete command. The # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): for name in files: - os.remove(join(root, name)) + os.remove(os.path.join(root, name)) for name in dirs: - dirname = join(root, name) + dirname = os.path.join(root, name) if not os.path.islink(dirname): os.rmdir(dirname) else: @@ -382,14 +383,6 @@ class MakedirTests (unittest.TestCase): def setUp(self): - try: - os.rmdir(test_support.TESTFN) - except OSError: - pass - try: - os.unlink(test_support.TESTFN) - except OSError: - pass os.mkdir(test_support.TESTFN) def test_makedir(self): From buildbot at python.org Wed Apr 4 21:55:42 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 19:55:42 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070404195543.A0B751E400D@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/190 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: collin.winter,martin.v.loewis,ziga.seilnacht Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib ====================================================================== ERROR: test_copy (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 202, in test_copy test_support.TESTFN), second_temp) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 89, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 225, in retrieve tfp = open(filename, 'wb') IOError: [Errno 13] Permission denied: '@test.2' ====================================================================== ERROR: test_reporthook (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 227, in test_reporthook second_temp, hooktester) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 89, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 225, in retrieve tfp = open(filename, 'wb') IOError: [Errno 13] Permission denied: '@test.2' sincerely, -The Buildbot From nnorwitz at gmail.com Wed Apr 4 22:13:42 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 4 Apr 2007 16:13:42 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070404201342.GA30702@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [479720 refs] From python-checkins at python.org Wed Apr 4 22:32:04 2007 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 4 Apr 2007 22:32:04 +0200 (CEST) Subject: [Python-checkins] r54690 - in python/branches/release25-maint: Lib/test/test_struct.py Misc/NEWS Modules/_struct.c Message-ID: <20070404203204.D19FE1E4002@bag.python.org> Author: raymond.hettinger Date: Wed Apr 4 22:32:03 2007 New Revision: 54690 Modified: python/branches/release25-maint/Lib/test/test_struct.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_struct.c Log: Bug #1563759: struct.unpack doens't support buffer protocol objects Modified: python/branches/release25-maint/Lib/test/test_struct.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_struct.py (original) +++ python/branches/release25-maint/Lib/test/test_struct.py Wed Apr 4 22:32:03 2007 @@ -612,8 +612,14 @@ assertRaises(struct.error, pack_into, small_buf, 0, test_string) assertRaises(struct.error, pack_into, small_buf, 2, test_string) +def test_unpack_with_buffer(): + # SF bug 1563759: struct.unpack doens't support buffer protocol objects + data = array.array('B', '\x12\x34\x56\x78') + value, = struct.unpack('>I', data) + vereq(value, 0x12345678) # Test methods to pack and unpack from buffers rather than strings. test_unpack_from() test_pack_into() test_pack_into_fn() +test_unpack_with_buffer() Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed Apr 4 22:32:03 2007 @@ -134,6 +134,8 @@ Extension Modules ----------------- +- Bug #1563759: struct.unpack doens't support buffer protocol objects + - Bug #1686475: Support stat'ing open files on Windows again. - Bug #1647541: Array module's buffer interface can now handle empty arrays. Modified: python/branches/release25-maint/Modules/_struct.c ============================================================================== --- python/branches/release25-maint/Modules/_struct.c (original) +++ python/branches/release25-maint/Modules/_struct.c Wed Apr 4 22:32:03 2007 @@ -1485,17 +1485,31 @@ static PyObject * s_unpack(PyObject *self, PyObject *inputstr) { + char *start; + int len; + PyObject * args; PyStructObject *soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (inputstr == NULL || !PyString_Check(inputstr) || - PyString_GET_SIZE(inputstr) != soself->s_size) { + if (inputstr != NULL && PyString_Check(inputstr) && + PyString_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + } + args = PyTuple_Pack(1, inputstr); + if (args == NULL) + return NULL; + if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) { + Py_DECREF(args); + return NULL; + } + Py_DECREF(args); + if (soself->s_size != len) { PyErr_Format(StructError, "unpack requires a string argument of length %zd", soself->s_size); return NULL; } - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + return s_unpack_internal(soself, start); } PyDoc_STRVAR(s_unpack_from__doc__, From buildbot at python.org Wed Apr 4 22:47:44 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 20:47:44 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo 2.5 Message-ID: <20070404204744.493971E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%25202.5/builds/270 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: make: *** [buildbottest] Segmentation fault (core dumped) sincerely, -The Buildbot From buildbot at python.org Wed Apr 4 23:12:01 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 21:12:01 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070404211201.B8A061E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/362 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: collin.winter,martin.v.loewis,ziga.seilnacht Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib ====================================================================== ERROR: test_copy (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_urllib.py", line 202, in test_copy test_support.TESTFN), second_temp) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\urllib.py", line 89, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\urllib.py", line 225, in retrieve tfp = open(filename, 'wb') IOError: [Errno 13] Permission denied: '@test.2' ====================================================================== ERROR: test_reporthook (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_urllib.py", line 227, in test_reporthook second_temp, hooktester) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\urllib.py", line 89, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\urllib.py", line 225, in retrieve tfp = open(filename, 'wb') IOError: [Errno 13] Permission denied: '@test.2' sincerely, -The Buildbot From buildbot at python.org Wed Apr 4 23:28:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Apr 2007 21:28:32 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070404212832.BF6EB1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/238 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_struct Traceback (most recent call last): File "./Lib/test/regrtest.py", line 549, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_struct.py", line 625, in test_unpack_with_buffer() File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_struct.py", line 618, in test_unpack_with_buffer value, = struct.unpack('>I', data) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/struct.py", line 87, in unpack return o.unpack(s) error: unpack requires a string argument of length 4 sincerely, -The Buildbot From python-checkins at python.org Wed Apr 4 23:57:15 2007 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 4 Apr 2007 23:57:15 +0200 (CEST) Subject: [Python-checkins] r54691 - python/branches/release25-maint/Modules/_struct.c Message-ID: <20070404215715.009791E4002@bag.python.org> Author: raymond.hettinger Date: Wed Apr 4 23:57:12 2007 New Revision: 54691 Modified: python/branches/release25-maint/Modules/_struct.c Log: Fix-up error-exits on struct_unpack(). Modified: python/branches/release25-maint/Modules/_struct.c ============================================================================== --- python/branches/release25-maint/Modules/_struct.c (original) +++ python/branches/release25-maint/Modules/_struct.c Wed Apr 4 23:57:12 2007 @@ -1487,29 +1487,33 @@ { char *start; int len; - PyObject * args; + PyObject *args=NULL, *result; PyStructObject *soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (inputstr != NULL && PyString_Check(inputstr) && + if (inputstr == NULL) + goto fail; + if (PyString_Check(inputstr) && PyString_GET_SIZE(inputstr) == soself->s_size) { return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); } args = PyTuple_Pack(1, inputstr); if (args == NULL) return NULL; - if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) { - Py_DECREF(args); - return NULL; - } + if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) + goto fail; + if (soself->s_size != len) + goto fail; + result = s_unpack_internal(soself, start); Py_DECREF(args); - if (soself->s_size != len) { - PyErr_Format(StructError, - "unpack requires a string argument of length %zd", - soself->s_size); - return NULL; - } - return s_unpack_internal(soself, start); + return result; + +fail: + Py_XDECREF(args); + PyErr_Format(StructError, + "unpack requires a string argument of length %zd", + soself->s_size); + return NULL; } PyDoc_STRVAR(s_unpack_from__doc__, From python-checkins at python.org Thu Apr 5 06:52:07 2007 From: python-checkins at python.org (anthony.baxter) Date: Thu, 5 Apr 2007 06:52:07 +0200 (CEST) Subject: [Python-checkins] r54692 - in python/branches/release25-maint: Doc/commontex/boilerplate.tex Doc/commontex/license.tex Include/patchlevel.h LICENSE Lib/idlelib/NEWS.txt Lib/idlelib/idlever.py Misc/NEWS Misc/RPM/python-2.5.spec README Message-ID: <20070405045207.E94FD1E4002@bag.python.org> Author: anthony.baxter Date: Thu Apr 5 06:52:06 2007 New Revision: 54692 Modified: python/branches/release25-maint/Doc/commontex/boilerplate.tex python/branches/release25-maint/Doc/commontex/license.tex python/branches/release25-maint/Include/patchlevel.h python/branches/release25-maint/LICENSE python/branches/release25-maint/Lib/idlelib/NEWS.txt python/branches/release25-maint/Lib/idlelib/idlever.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Misc/RPM/python-2.5.spec python/branches/release25-maint/README Log: preparing for 2.5.1c1 Modified: python/branches/release25-maint/Doc/commontex/boilerplate.tex ============================================================================== --- python/branches/release25-maint/Doc/commontex/boilerplate.tex (original) +++ python/branches/release25-maint/Doc/commontex/boilerplate.tex Thu Apr 5 06:52:06 2007 @@ -5,5 +5,5 @@ Email: \email{docs at python.org} } -\date{19th September, 2006} % XXX update before final release! +\date{5th April, 2007} % XXX update before final release! \input{patchlevel} % include Python version information Modified: python/branches/release25-maint/Doc/commontex/license.tex ============================================================================== --- python/branches/release25-maint/Doc/commontex/license.tex (original) +++ python/branches/release25-maint/Doc/commontex/license.tex Thu Apr 5 06:52:06 2007 @@ -51,6 +51,7 @@ \linev{2.4.2}{2.4.1}{2005}{PSF}{yes} \linev{2.4.3}{2.4.2}{2006}{PSF}{yes} \linev{2.5}{2.4}{2006}{PSF}{yes} + \linev{2.5.1}{2.5}{2007}{PSF}{yes} \end{tablev} \note{GPL-compatible doesn't mean that we're distributing Modified: python/branches/release25-maint/Include/patchlevel.h ============================================================================== --- python/branches/release25-maint/Include/patchlevel.h (original) +++ python/branches/release25-maint/Include/patchlevel.h Thu Apr 5 06:52:06 2007 @@ -21,12 +21,12 @@ /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 5 -#define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.5" +#define PY_VERSION "2.5.1c1" /* Subversion Revision number of this file (not of the repository) */ #define PY_PATCHLEVEL_REVISION "$Revision$" Modified: python/branches/release25-maint/LICENSE ============================================================================== --- python/branches/release25-maint/LICENSE (original) +++ python/branches/release25-maint/LICENSE Thu Apr 5 06:52:06 2007 @@ -53,6 +53,7 @@ 2.4.2 2.4.1 2005 PSF yes 2.4.3 2.4.2 2006 PSF yes 2.5 2.4 2006 PSF yes + 2.5.1 2.5 2007 PSF yes Footnotes: Modified: python/branches/release25-maint/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/release25-maint/Lib/idlelib/NEWS.txt (original) +++ python/branches/release25-maint/Lib/idlelib/NEWS.txt Thu Apr 5 06:52:06 2007 @@ -1,3 +1,8 @@ +What's New in IDLE 1.2.1c1? +=========================== + +*Release date: 05-APR-2007* + What's New in IDLE 1.2? ======================= Modified: python/branches/release25-maint/Lib/idlelib/idlever.py ============================================================================== --- python/branches/release25-maint/Lib/idlelib/idlever.py (original) +++ python/branches/release25-maint/Lib/idlelib/idlever.py Thu Apr 5 06:52:06 2007 @@ -1 +1 @@ -IDLE_VERSION = "1.2" +IDLE_VERSION = "1.2.1c1" Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Apr 5 06:52:06 2007 @@ -7,7 +7,7 @@ What's New in Python 2.5.1c1? ============================= -*Release date: XX-XXX-XXXX* +*Release date: 05-APR-2007* Core and builtins ----------------- Modified: python/branches/release25-maint/Misc/RPM/python-2.5.spec ============================================================================== --- python/branches/release25-maint/Misc/RPM/python-2.5.spec (original) +++ python/branches/release25-maint/Misc/RPM/python-2.5.spec Thu Apr 5 06:52:06 2007 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.5 +%define version 2.5.1 %define libvers 2.5 %define release 1pydotorg %define __prefix /usr Modified: python/branches/release25-maint/README ============================================================================== --- python/branches/release25-maint/README (original) +++ python/branches/release25-maint/README Thu Apr 5 06:52:06 2007 @@ -1,5 +1,5 @@ -This is Python version 2.5 -========================== +This is Python version 2.5.1 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Python Software Foundation. From python-checkins at python.org Thu Apr 5 07:06:51 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 5 Apr 2007 07:06:51 +0200 (CEST) Subject: [Python-checkins] r54693 - python/branches/release25-maint/Modules/_struct.c Message-ID: <20070405050651.D8E7C1E4002@bag.python.org> Author: neal.norwitz Date: Thu Apr 5 07:06:49 2007 New Revision: 54693 Modified: python/branches/release25-maint/Modules/_struct.c Log: Fix unpack so it works on 64-bit platforms. Modified: python/branches/release25-maint/Modules/_struct.c ============================================================================== --- python/branches/release25-maint/Modules/_struct.c (original) +++ python/branches/release25-maint/Modules/_struct.c Thu Apr 5 07:06:49 2007 @@ -1486,7 +1486,7 @@ s_unpack(PyObject *self, PyObject *inputstr) { char *start; - int len; + Py_ssize_t len; PyObject *args=NULL, *result; PyStructObject *soself = (PyStructObject *)self; assert(PyStruct_Check(self)); From nnorwitz at gmail.com Thu Apr 5 07:11:17 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 4 Apr 2007 22:11:17 -0700 Subject: [Python-checkins] r54693 - python/branches/release25-maint/Modules/_struct.c In-Reply-To: <20070405050651.D8E7C1E4002@bag.python.org> References: <20070405050651.D8E7C1E4002@bag.python.org> Message-ID: FYI Anthony approved this via IM. -- n On 4/4/07, neal.norwitz wrote: > Author: neal.norwitz > Date: Thu Apr 5 07:06:49 2007 > New Revision: 54693 > > Modified: > python/branches/release25-maint/Modules/_struct.c > Log: > Fix unpack so it works on 64-bit platforms. > > Modified: python/branches/release25-maint/Modules/_struct.c > ============================================================================== > --- python/branches/release25-maint/Modules/_struct.c (original) > +++ python/branches/release25-maint/Modules/_struct.c Thu Apr 5 07:06:49 2007 > @@ -1486,7 +1486,7 @@ > s_unpack(PyObject *self, PyObject *inputstr) > { > char *start; > - int len; > + Py_ssize_t len; > PyObject *args=NULL, *result; > PyStructObject *soself = (PyStructObject *)self; > assert(PyStruct_Check(self)); > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From nnorwitz at gmail.com Thu Apr 5 07:20:07 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 5 Apr 2007 01:20:07 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20070405052007.GA29217@python.psfb.org> TEXINPUTS=/home/neal/python/r25/Doc/commontex: python /home/neal/python/r25/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r25/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r25/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r25/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r25/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r25/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r25/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r25/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/home/neal/python/r25/Doc/texinputs/underscore.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r25/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r25/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r25/Doc/api:/home/neal/python/r25/Doc/commontex:/home/neal/python/r25/Doc/paper-letter:/home/neal/python/r25/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From python-checkins at python.org Thu Apr 5 08:37:36 2007 From: python-checkins at python.org (anthony.baxter) Date: Thu, 5 Apr 2007 08:37:36 +0200 (CEST) Subject: [Python-checkins] r54694 - python/tags/r251c1 Message-ID: <20070405063736.5CD3A1E4014@bag.python.org> Author: anthony.baxter Date: Thu Apr 5 08:37:33 2007 New Revision: 54694 Added: python/tags/r251c1/ - copied from r54693, python/branches/release25-maint/ Log: Tagging for release of Python 2.5.1c1 From buildbot at python.org Thu Apr 5 08:50:15 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Apr 2007 06:50:15 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070405065015.E27EA1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/241 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_signal Traceback (most recent call last): File "./Lib/test/regrtest.py", line 549, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_signal.py", line 143, in print "KeyboardInterrupt (the alarm() went off)" File "/net/ringneck/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_signal.py", line 49, in handlerB raise HandlerBCalled, args HandlerBCalled: (30, ) sincerely, -The Buildbot From nnorwitz at gmail.com Thu Apr 5 10:13:42 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 5 Apr 2007 04:13:42 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070405081342.GA12607@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [479720 refs] From python-checkins at python.org Thu Apr 5 20:00:07 2007 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 5 Apr 2007 20:00:07 +0200 (CEST) Subject: [Python-checkins] r54695 - in python/trunk: Lib/test/test_struct.py Modules/_struct.c Message-ID: <20070405180007.98D751E400B@bag.python.org> Author: raymond.hettinger Date: Thu Apr 5 20:00:03 2007 New Revision: 54695 Modified: python/trunk/Lib/test/test_struct.py python/trunk/Modules/_struct.c Log: Bug #1563759: struct.unpack doens't support buffer protocol objects Modified: python/trunk/Lib/test/test_struct.py ============================================================================== --- python/trunk/Lib/test/test_struct.py (original) +++ python/trunk/Lib/test/test_struct.py Thu Apr 5 20:00:03 2007 @@ -614,11 +614,19 @@ assertRaises(struct.error, pack_into, small_buf, 0, test_string) assertRaises(struct.error, pack_into, small_buf, 2, test_string) +def test_unpack_with_buffer(): + # SF bug 1563759: struct.unpack doens't support buffer protocol objects + data1 = array.array('B', '\x12\x34\x56\x78') + data2 = buffer('......\x12\x34\x56\x78......', 6, 4) + for data in [data1, data2]: + value, = struct.unpack('>I', data) + vereq(value, 0x12345678) # Test methods to pack and unpack from buffers rather than strings. test_unpack_from() test_pack_into() test_pack_into_fn() +test_unpack_with_buffer() def test_bool(): for prefix in tuple("<>!=")+('',): Modified: python/trunk/Modules/_struct.c ============================================================================== --- python/trunk/Modules/_struct.c (original) +++ python/trunk/Modules/_struct.c Thu Apr 5 20:00:03 2007 @@ -1534,17 +1534,35 @@ static PyObject * s_unpack(PyObject *self, PyObject *inputstr) { + char *start; + Py_ssize_t len; + PyObject *args=NULL, *result; PyStructObject *soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (inputstr == NULL || !PyString_Check(inputstr) || - PyString_GET_SIZE(inputstr) != soself->s_size) { - PyErr_Format(StructError, - "unpack requires a string argument of length %zd", - soself->s_size); - return NULL; - } - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + if (inputstr == NULL) + goto fail; + if (PyString_Check(inputstr) && + PyString_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + } + args = PyTuple_Pack(1, inputstr); + if (args == NULL) + return NULL; + if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) + goto fail; + if (soself->s_size != len) + goto fail; + result = s_unpack_internal(soself, start); + Py_DECREF(args); + return result; + +fail: + Py_XDECREF(args); + PyErr_Format(StructError, + "unpack requires a string argument of length %zd", + soself->s_size); + return NULL; } PyDoc_STRVAR(s_unpack_from__doc__, From python-checkins at python.org Thu Apr 5 20:25:15 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 5 Apr 2007 20:25:15 +0200 (CEST) Subject: [Python-checkins] r54696 - peps/trunk/pep-3116.txt Message-ID: <20070405182515.6C04B1E4002@bag.python.org> Author: guido.van.rossum Date: Thu Apr 5 20:25:11 2007 New Revision: 54696 Modified: peps/trunk/pep-3116.txt Log: Update by Mark Russell -- clarify readinto(), and qualify tell()/seek() on textio buffers. Modified: peps/trunk/pep-3116.txt ============================================================================== --- peps/trunk/pep-3116.txt (original) +++ peps/trunk/pep-3116.txt Thu Apr 5 20:25:11 2007 @@ -72,11 +72,11 @@ ``.readinto(b: bytes) -> int`` - Read up to ``n`` bytes from the object and stores them in + Read up to ``len(b)`` bytes from the object and stores them in ``b``, returning the number of bytes read. Like .read, fewer - than ``n`` bytes may be read, and 0 indicates end of file. + than ``len(b)`` bytes may be read, and 0 indicates end of file. ``None`` is returned if a non-blocking object has no bytes - available. + available. The length of ``b`` is never changed. ``.write(b: bytes) -> int`` @@ -100,7 +100,7 @@ ``.writable() -> bool`` - Returns ``True`` if the object was opened write writing, + Returns ``True`` if the object was opened for writing, ``False`` otherwise. If ``False``, ``.write()`` and ``.truncate()`` will raise an ``IOError`` if called. @@ -277,14 +277,32 @@ ``.write(s: str) -> None`` -``TextIOBase`` implementations also provide several methods that are -pass-throughs to the underlaying ``BufferedIOBase`` objects: + ``.tell() -> object`` - ``.seek(pos: int, whence: int = 0) -> None`` + Return a cookie describing the current file position. + The only supported use for the cookie is with .seek() + with whence set to 0 (i.e. absolute seek). - ``.tell() -> int`` + ``.seek(pos: object, whence: int = 0) -> None`` - ``.truncate(pos: int = None) -> None`` + Seek to position ``pos``. If ``pos`` is non-zero, it must + be a cookie returned from ``.tell()`` and ``whence`` must be zero. + + ``.truncate(pos: object = None) -> None`` + + Like ``BufferedIOBase.truncate()``, except that ``pos`` (if + not ``None``) must be a cookie previously returned by ``.tell()``. + +Unlike with raw I/O, the units for .seek() are not specified - some +implementations (e.g. ``StringIO``) use characters and others +(e.g. ``TextIOWrapper``) use bytes. The special case for zero is to +allow going to the start or end of a stream without a prior +``.tell()``. An implementation could include stream encoder state in +the cookie returned from ``.tell()``. + + +``TextIOBase`` implementations also provide several methods that are +pass-throughs to the underlaying ``BufferedIOBase`` objects: ``.flush() -> None`` From python-checkins at python.org Thu Apr 5 22:05:12 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 5 Apr 2007 22:05:12 +0200 (CEST) Subject: [Python-checkins] r54697 - python/trunk/Lib/test/test_long_future.py Message-ID: <20070405200512.1A17D1E4015@bag.python.org> Author: collin.winter Date: Thu Apr 5 22:05:07 2007 New Revision: 54697 Modified: python/trunk/Lib/test/test_long_future.py Log: Convert test_long_future to use unittest. Modified: python/trunk/Lib/test/test_long_future.py ============================================================================== --- python/trunk/Lib/test/test_long_future.py (original) +++ python/trunk/Lib/test/test_long_future.py Thu Apr 5 22:05:07 2007 @@ -3,53 +3,53 @@ # test_long.py instead. In the meantime, it's too obscure to try to # trick just part of test_long into using future division. -from test.test_support import TestFailed, verify, verbose +import unittest +from test.test_support import run_unittest -def test_true_division(): - if verbose: - print "long true division" - huge = 1L << 40000 - mhuge = -huge - verify(huge / huge == 1.0) - verify(mhuge / mhuge == 1.0) - verify(huge / mhuge == -1.0) - verify(mhuge / huge == -1.0) - verify(1 / huge == 0.0) - verify(1L / huge == 0.0) - verify(1 / mhuge == 0.0) - verify(1L / mhuge == 0.0) - verify((666 * huge + (huge >> 1)) / huge == 666.5) - verify((666 * mhuge + (mhuge >> 1)) / mhuge == 666.5) - verify((666 * huge + (huge >> 1)) / mhuge == -666.5) - verify((666 * mhuge + (mhuge >> 1)) / huge == -666.5) - verify(huge / (huge << 1) == 0.5) - verify((1000000 * huge) / huge == 1000000) - - namespace = {'huge': huge, 'mhuge': mhuge} - - for overflow in ["float(huge)", "float(mhuge)", - "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", - "mhuge / 100", "mhuge / 100L"]: - try: - eval(overflow, namespace) - except OverflowError: - pass - else: - raise TestFailed("expected OverflowError from %r" % overflow) - - for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge", - "100 / mhuge", "100L / mhuge"]: - result = eval(underflow, namespace) - if result != 0.0: - raise TestFailed("expected underflow to 0 from %r" % underflow) - - for zero in ["huge / 0", "huge / 0L", - "mhuge / 0", "mhuge / 0L"]: - try: - eval(zero, namespace) - except ZeroDivisionError: - pass - else: - raise TestFailed("expected ZeroDivisionError from %r" % zero) - -test_true_division() +class TrueDivisionTests(unittest.TestCase): + def test(self): + huge = 1L << 40000 + mhuge = -huge + self.assertEqual(huge / huge, 1.0) + self.assertEqual(mhuge / mhuge, 1.0) + self.assertEqual(huge / mhuge, -1.0) + self.assertEqual(mhuge / huge, -1.0) + self.assertEqual(1 / huge, 0.0) + self.assertEqual(1L / huge, 0.0) + self.assertEqual(1 / mhuge, 0.0) + self.assertEqual(1L / mhuge, 0.0) + self.assertEqual((666 * huge + (huge >> 1)) / huge, 666.5) + self.assertEqual((666 * mhuge + (mhuge >> 1)) / mhuge, 666.5) + self.assertEqual((666 * huge + (huge >> 1)) / mhuge, -666.5) + self.assertEqual((666 * mhuge + (mhuge >> 1)) / huge, -666.5) + self.assertEqual(huge / (huge << 1), 0.5) + self.assertEqual((1000000 * huge) / huge, 1000000) + + namespace = {'huge': huge, 'mhuge': mhuge} + + for overflow in ["float(huge)", "float(mhuge)", + "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", + "mhuge / 100", "mhuge / 100L"]: + # XXX(cwinter) this test doesn't pass when converted to + # use assertRaises. + try: + eval(overflow, namespace) + self.fail("expected OverflowError from %r" % overflow) + except OverflowError: + pass + + for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge", + "100 / mhuge", "100L / mhuge"]: + result = eval(underflow, namespace) + self.assertEqual(result, 0.0, + "expected underflow to 0 from %r" % underflow) + + for zero in ["huge / 0", "huge / 0L", "mhuge / 0", "mhuge / 0L"]: + self.assertRaises(ZeroDivisionError, eval, zero, namespace) + + +def test_main(): + run_unittest(TrueDivisionTests) + +if __name__ == "__main__": + test_main() From python-checkins at python.org Thu Apr 5 22:09:02 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 5 Apr 2007 22:09:02 +0200 (CEST) Subject: [Python-checkins] r54698 - python/trunk/Lib/test/test_normalization.py Message-ID: <20070405200902.BD8541E4005@bag.python.org> Author: collin.winter Date: Thu Apr 5 22:08:56 2007 New Revision: 54698 Modified: python/trunk/Lib/test/test_normalization.py Log: Convert test_normalization to use unittest. Modified: python/trunk/Lib/test/test_normalization.py ============================================================================== --- python/trunk/Lib/test/test_normalization.py (original) +++ python/trunk/Lib/test/test_normalization.py Thu Apr 5 22:08:56 2007 @@ -1,5 +1,6 @@ -from test.test_support import (verbose, TestFailed, TestSkipped, verify, - open_urlresource) +from test.test_support import run_unittest, open_urlresource +import unittest + import sys import os from unicodedata import normalize @@ -28,61 +29,66 @@ if x > sys.maxunicode: raise RangeError return u"".join([unichr(x) for x in data]) + +class NormalizationTest(unittest.TestCase): + def test_main(self): + part1_data = {} + for line in open_urlresource(TESTDATAURL): + if '#' in line: + line = line.split('#')[0] + line = line.strip() + if not line: + continue + if line.startswith("@Part"): + part = line.split()[0] + continue + if part == "@Part3": + # XXX we don't support PRI #29 yet, so skip these tests for now + continue + try: + c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] + except RangeError: + # Skip unsupported characters; + # try atleast adding c1 if we are in part1 + if part == "@Part1": + try: + c1 = unistr(line.split(';')[0]) + except RangeError: + pass + else: + part1_data[c1] = 1 + continue + + # Perform tests + self.failUnless(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) + self.failUnless(c4 == NFC(c4) == NFC(c5), line) + self.failUnless(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) + self.failUnless(c5 == NFD(c4) == NFD(c5), line) + self.failUnless(c4 == NFKC(c1) == NFKC(c2) == \ + NFKC(c3) == NFKC(c4) == NFKC(c5), + line) + self.failUnless(c5 == NFKD(c1) == NFKD(c2) == \ + NFKD(c3) == NFKD(c4) == NFKD(c5), + line) -def test_main(): - part1_data = {} - for line in open_urlresource(TESTDATAURL): - if '#' in line: - line = line.split('#')[0] - line = line.strip() - if not line: - continue - if line.startswith("@Part"): - part = line.split()[0] - continue - if part == "@Part3": - # XXX we don't support PRI #29 yet, so skip these tests for now - continue - try: - c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] - except RangeError: - # Skip unsupported characters; - # try atleast adding c1 if we are in part1 + # Record part 1 data if part == "@Part1": - try: - c1=unistr(line.split(';')[0]) - except RangeError: - pass - else: - part1_data[c1] = 1 - continue - - if verbose: - print line - - # Perform tests - verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) - verify(c4 == NFC(c4) == NFC(c5), line) - verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) - verify(c5 == NFD(c4) == NFD(c5), line) - verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), - line) - verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), - line) - - # Record part 1 data - if part == "@Part1": - part1_data[c1] = 1 - - # Perform tests for all other data - for c in range(sys.maxunicode+1): - X = unichr(c) - if X in part1_data: - continue - assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c + part1_data[c1] = 1 + + # Perform tests for all other data + for c in range(sys.maxunicode+1): + X = unichr(c) + if X in part1_data: + continue + self.failUnless(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c) + + def test_bug_834676(self): + # Check for bug 834676 + normalize('NFC', u'\ud55c\uae00') - # Check for bug 834676 - normalize('NFC',u'\ud55c\uae00') + +def test_main(): + run_unittest(NormalizationTest) if __name__ == "__main__": test_main() From nnorwitz at gmail.com Thu Apr 5 22:13:46 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 5 Apr 2007 16:13:46 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070405201346.GA17628@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [479722 refs] From python-checkins at python.org Fri Apr 6 03:12:00 2007 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Apr 2007 03:12:00 +0200 (CEST) Subject: [Python-checkins] r54699 - python/trunk/Doc/lib/libctypes.tex Message-ID: <20070406011200.DE71F1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Apr 6 03:11:58 2007 New Revision: 54699 Modified: python/trunk/Doc/lib/libctypes.tex Log: Some grammar fixes Modified: python/trunk/Doc/lib/libctypes.tex ============================================================================== --- python/trunk/Doc/lib/libctypes.tex (original) +++ python/trunk/Doc/lib/libctypes.tex Fri Apr 6 03:11:58 2007 @@ -7,21 +7,21 @@ \versionadded{2.5} \code{ctypes} is a foreign function library for Python. It provides C -compatible data types, and allows to call functions in dlls/shared +compatible data types, and allows calling functions in dlls/shared libraries. It can be used to wrap these libraries in pure Python. \subsection{ctypes tutorial\label{ctypes-ctypes-tutorial}} -Note: The code samples in this tutorial uses \code{doctest} to make sure +Note: The code samples in this tutorial use \code{doctest} to make sure that they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. -Note: Quite some code samples references the ctypes \class{c{\_}int} type. +Note: Some code sample references the ctypes \class{c{\_}int} type. This type is an alias to the \class{c{\_}long} type on 32-bit systems. So, you should not be confused if \class{c{\_}long} is printed if you would -expect \class{c{\_}int} - they are actually the same type. +expect \class{c{\_}int} --- they are actually the same type. \subsubsection{Loading dynamic link libraries\label{ctypes-loading-dynamic-link-libraries}} @@ -38,7 +38,7 @@ automatically raise \class{WindowsError} Python exceptions when the function call fails. -Here are some examples for Windows, note that \code{msvcrt} is the MS +Here are some examples for Windows. Note that \code{msvcrt} is the MS standard C library containing most standard C functions, and uses the cdecl calling convention: \begin{verbatim} From nnorwitz at gmail.com Fri Apr 6 10:13:55 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 6 Apr 2007 04:13:55 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070406081355.GA24121@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [479971 refs] From python-checkins at python.org Fri Apr 6 17:09:23 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 6 Apr 2007 17:09:23 +0200 (CEST) Subject: [Python-checkins] r54700 - peps/trunk/pep-0008.txt Message-ID: <20070406150923.3CD6D1E4003@bag.python.org> Author: guido.van.rossum Date: Fri Apr 6 17:09:21 2007 New Revision: 54700 Modified: peps/trunk/pep-0008.txt Log: Add words discouraging overly-broad except clauses. Modified: peps/trunk/pep-0008.txt ============================================================================== --- peps/trunk/pep-0008.txt (original) +++ peps/trunk/pep-0008.txt Fri Apr 6 17:09:21 2007 @@ -689,6 +689,28 @@ the exception propagate upwards with 'raise'. 'try...finally' is a better way to handle this case. + - Additionally, for all try/except clauses, limit the 'try' clause + to the absolute minimum amount of code necessary. Again, this + avoids masking bugs. + + Yes: + + try: + value = collection[key] + except KeyError: + return key_not_found(key) + else: + return handle_value(value) + + No: + + try: + # Too broad! + return handle_value(collection[key]) + except KeyError: + # Will also catch KeyError raised by handle_value() + return key_not_found(key) + - Use string methods instead of the string module. String methods are always much faster and share the same API with From brett at python.org Fri Apr 6 20:27:19 2007 From: brett at python.org (Brett Cannon) Date: Fri, 6 Apr 2007 11:27:19 -0700 Subject: [Python-checkins] Python Regression Test Failures opt (1) In-Reply-To: <20070406081355.GA24121@python.psfb.org> References: <20070406081355.GA24121@python.psfb.org> Message-ID: On 4/6/07, Neal Norwitz wrote: > > [SNIP] > test_socket_ssl > test test_socket_ssl failed -- Traceback (most recent call last): > File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", > line 117, in testBasic > self.assertEqual(i, "Foo\n") > AssertionError: 'ERRO' != 'Foo\n' > > test_socketserver > test_socketserver skipped -- Use of the `network' resource not enabled > test_softspace > test_sort > Exception in thread Thread-43: > Traceback (most recent call last): > File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in > __bootstrap > self.run() > File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", > line 163, in run > self.s.stdin.write(l) > IOError: [Errno 32] Broken pipe Anyone know what caused these two tests to start failing? -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070406/0f2cc124/attachment.html From python-checkins at python.org Fri Apr 6 21:27:44 2007 From: python-checkins at python.org (collin.winter) Date: Fri, 6 Apr 2007 21:27:44 +0200 (CEST) Subject: [Python-checkins] r54704 - python/trunk/Lib/test/test_stringprep.py Message-ID: <20070406192744.ED21C1E4012@bag.python.org> Author: collin.winter Date: Fri Apr 6 21:27:40 2007 New Revision: 54704 Modified: python/trunk/Lib/test/test_stringprep.py Log: Convert test_stringprep to use unittest. Modified: python/trunk/Lib/test/test_stringprep.py ============================================================================== --- python/trunk/Lib/test/test_stringprep.py (original) +++ python/trunk/Lib/test/test_stringprep.py Fri Apr 6 21:27:40 2007 @@ -1,88 +1,96 @@ # To fully test this module, we would need a copy of the stringprep tables. # Since we don't have them, this test checks only a few codepoints. -from test.test_support import verify, vereq +import unittest +from test import test_support -import stringprep from stringprep import * -verify(in_table_a1(u"\u0221")) -verify(not in_table_a1(u"\u0222")) - -verify(in_table_b1(u"\u00ad")) -verify(not in_table_b1(u"\u00ae")) - -verify(map_table_b2(u"\u0041"), u"\u0061") -verify(map_table_b2(u"\u0061"), u"\u0061") - -verify(map_table_b3(u"\u0041"), u"\u0061") -verify(map_table_b3(u"\u0061"), u"\u0061") - -verify(in_table_c11(u"\u0020")) -verify(not in_table_c11(u"\u0021")) - -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) - -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) - -verify(in_table_c11_c12(u"\u00a0")) -verify(not in_table_c11_c12(u"\u00a1")) - -verify(in_table_c21(u"\u001f")) -verify(not in_table_c21(u"\u0020")) - -verify(in_table_c22(u"\u009f")) -verify(not in_table_c22(u"\u00a0")) - -verify(in_table_c21_c22(u"\u009f")) -verify(not in_table_c21_c22(u"\u00a0")) - -verify(in_table_c3(u"\ue000")) -verify(not in_table_c3(u"\uf900")) - -verify(in_table_c4(u"\uffff")) -verify(not in_table_c4(u"\u0000")) - -verify(in_table_c5(u"\ud800")) -verify(not in_table_c5(u"\ud7ff")) - -verify(in_table_c6(u"\ufff9")) -verify(not in_table_c6(u"\ufffe")) - -verify(in_table_c7(u"\u2ff0")) -verify(not in_table_c7(u"\u2ffc")) - -verify(in_table_c8(u"\u0340")) -verify(not in_table_c8(u"\u0342")) - -# C.9 is not in the bmp -# verify(in_table_c9(u"\U000E0001")) -# verify(not in_table_c8(u"\U000E0002")) - -verify(in_table_d1(u"\u05be")) -verify(not in_table_d1(u"\u05bf")) - -verify(in_table_d2(u"\u0041")) -verify(not in_table_d2(u"\u0040")) - -# This would generate a hash of all predicates. However, running -# it is quite expensive, and only serves to detect changes in the -# unicode database. Instead, stringprep.py asserts the version of -# the database. - -# import hashlib -# predicates = [k for k in dir(stringprep) if k.startswith("in_table")] -# predicates.sort() -# for p in predicates: -# f = getattr(stringprep, p) -# # Collect all BMP code points -# data = ["0"] * 0x10000 -# for i in range(0x10000): -# if f(unichr(i)): -# data[i] = "1" -# data = "".join(data) -# h = hashlib.sha1() -# h.update(data) -# print p, h.hexdigest() +class StringprepTests(unittest.TestCase): + def test(self): + self.failUnless(in_table_a1(u"\u0221")) + self.failIf(in_table_a1(u"\u0222")) + + self.failUnless(in_table_b1(u"\u00ad")) + self.failIf(in_table_b1(u"\u00ae")) + + self.failUnless(map_table_b2(u"\u0041"), u"\u0061") + self.failUnless(map_table_b2(u"\u0061"), u"\u0061") + + self.failUnless(map_table_b3(u"\u0041"), u"\u0061") + self.failUnless(map_table_b3(u"\u0061"), u"\u0061") + + self.failUnless(in_table_c11(u"\u0020")) + self.failIf(in_table_c11(u"\u0021")) + + self.failUnless(in_table_c12(u"\u00a0")) + self.failIf(in_table_c12(u"\u00a1")) + + self.failUnless(in_table_c12(u"\u00a0")) + self.failIf(in_table_c12(u"\u00a1")) + + self.failUnless(in_table_c11_c12(u"\u00a0")) + self.failIf(in_table_c11_c12(u"\u00a1")) + + self.failUnless(in_table_c21(u"\u001f")) + self.failIf(in_table_c21(u"\u0020")) + + self.failUnless(in_table_c22(u"\u009f")) + self.failIf(in_table_c22(u"\u00a0")) + + self.failUnless(in_table_c21_c22(u"\u009f")) + self.failIf(in_table_c21_c22(u"\u00a0")) + + self.failUnless(in_table_c3(u"\ue000")) + self.failIf(in_table_c3(u"\uf900")) + + self.failUnless(in_table_c4(u"\uffff")) + self.failIf(in_table_c4(u"\u0000")) + + self.failUnless(in_table_c5(u"\ud800")) + self.failIf(in_table_c5(u"\ud7ff")) + + self.failUnless(in_table_c6(u"\ufff9")) + self.failIf(in_table_c6(u"\ufffe")) + + self.failUnless(in_table_c7(u"\u2ff0")) + self.failIf(in_table_c7(u"\u2ffc")) + + self.failUnless(in_table_c8(u"\u0340")) + self.failIf(in_table_c8(u"\u0342")) + + # C.9 is not in the bmp + # self.failUnless(in_table_c9(u"\U000E0001")) + # self.failIf(in_table_c8(u"\U000E0002")) + + self.failUnless(in_table_d1(u"\u05be")) + self.failIf(in_table_d1(u"\u05bf")) + + self.failUnless(in_table_d2(u"\u0041")) + self.failIf(in_table_d2(u"\u0040")) + + # This would generate a hash of all predicates. However, running + # it is quite expensive, and only serves to detect changes in the + # unicode database. Instead, stringprep.py asserts the version of + # the database. + + # import hashlib + # predicates = [k for k in dir(stringprep) if k.startswith("in_table")] + # predicates.sort() + # for p in predicates: + # f = getattr(stringprep, p) + # # Collect all BMP code points + # data = ["0"] * 0x10000 + # for i in range(0x10000): + # if f(unichr(i)): + # data[i] = "1" + # data = "".join(data) + # h = hashlib.sha1() + # h.update(data) + # print p, h.hexdigest() + +def test_main(): + test_support.run_unittest(StringprepTests) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Fri Apr 6 21:32:34 2007 From: python-checkins at python.org (collin.winter) Date: Fri, 6 Apr 2007 21:32:34 +0200 (CEST) Subject: [Python-checkins] r54705 - python/trunk/Lib/test/test_crypt.py Message-ID: <20070406193234.8C3B51E400A@bag.python.org> Author: collin.winter Date: Fri Apr 6 21:32:32 2007 New Revision: 54705 Modified: python/trunk/Lib/test/test_crypt.py Log: Import cleanup in test_crypt. Modified: python/trunk/Lib/test/test_crypt.py ============================================================================== --- python/trunk/Lib/test/test_crypt.py (original) +++ python/trunk/Lib/test/test_crypt.py Fri Apr 6 21:32:32 2007 @@ -3,7 +3,7 @@ Roger E. Masse """ -from test.test_support import verify, verbose +from test.test_support import verbose import crypt c = crypt.crypt('mypassword', 'ab') From python-checkins at python.org Fri Apr 6 22:00:10 2007 From: python-checkins at python.org (collin.winter) Date: Fri, 6 Apr 2007 22:00:10 +0200 (CEST) Subject: [Python-checkins] r54706 - python/trunk/Lib/test/test_gc.py Message-ID: <20070406200010.55CBE1E400E@bag.python.org> Author: collin.winter Date: Fri Apr 6 22:00:05 2007 New Revision: 54706 Modified: python/trunk/Lib/test/test_gc.py Log: Convert test_gc to use unittest. Modified: python/trunk/Lib/test/test_gc.py ============================================================================== --- python/trunk/Lib/test/test_gc.py (original) +++ python/trunk/Lib/test/test_gc.py Fri Apr 6 22:00:05 2007 @@ -1,391 +1,12 @@ -from test.test_support import verify, verbose, TestFailed, vereq +import unittest +from test.test_support import verbose, run_unittest import sys import gc import weakref -def expect(actual, expected, name): - if actual != expected: - raise TestFailed, "test_%s: actual %r, expected %r" % ( - name, actual, expected) - -def expect_nonzero(actual, name): - if actual == 0: - raise TestFailed, "test_%s: unexpected zero" % name - -def run_test(name, thunk): - if verbose: - print "testing %s..." % name, - thunk() - if verbose: - print "ok" - -def test_list(): - l = [] - l.append(l) - gc.collect() - del l - expect(gc.collect(), 1, "list") - -def test_dict(): - d = {} - d[1] = d - gc.collect() - del d - expect(gc.collect(), 1, "dict") - -def test_tuple(): - # since tuples are immutable we close the loop with a list - l = [] - t = (l,) - l.append(t) - gc.collect() - del t - del l - expect(gc.collect(), 2, "tuple") - -def test_class(): - class A: - pass - A.a = A - gc.collect() - del A - expect_nonzero(gc.collect(), "class") - -def test_newstyleclass(): - class A(object): - pass - gc.collect() - del A - expect_nonzero(gc.collect(), "staticclass") - -def test_instance(): - class A: - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "instance") - -def test_newinstance(): - class A(object): - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance") - class B(list): - pass - class C(B, A): - pass - a = C() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance(2)") - del B, C - expect_nonzero(gc.collect(), "newinstance(3)") - A.a = A() - del A - expect_nonzero(gc.collect(), "newinstance(4)") - expect(gc.collect(), 0, "newinstance(5)") - -def test_method(): - # Tricky: self.__init__ is a bound method, it references the instance. - class A: - def __init__(self): - self.init = self.__init__ - a = A() - gc.collect() - del a - expect_nonzero(gc.collect(), "method") - -def test_finalizer(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A: - def __del__(self): pass - class B: - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_finalizer_newclass(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A(object): - def __del__(self): pass - class B(object): - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_function(): - # Tricky: f -> d -> f, code should call d.clear() after the exec to - # break the cycle. - d = {} - exec("def f(): pass\n") in d - gc.collect() - del d - expect(gc.collect(), 2, "function") - -def test_frame(): - def f(): - frame = sys._getframe() - gc.collect() - f() - expect(gc.collect(), 1, "frame") - - -def test_saveall(): - # Verify that cyclic garbage like lists show up in gc.garbage if the - # SAVEALL option is enabled. - - # First make sure we don't save away other stuff that just happens to - # be waiting for collection. - gc.collect() - vereq(gc.garbage, []) # if this fails, someone else created immortal trash - - L = [] - L.append(L) - id_L = id(L) - - debug = gc.get_debug() - gc.set_debug(debug | gc.DEBUG_SAVEALL) - del L - gc.collect() - gc.set_debug(debug) - - vereq(len(gc.garbage), 1) - obj = gc.garbage.pop() - vereq(id(obj), id_L) - -def test_del(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A: - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_del_newclass(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A(object): - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_get_count(): - gc.collect() - expect(gc.get_count(), (0, 0, 0), "get_count()") - a = dict() - expect(gc.get_count(), (1, 0, 0), "get_count()") - -def test_collect_generations(): - gc.collect() - a = dict() - gc.collect(0) - expect(gc.get_count(), (0, 1, 0), "collect(0)") - gc.collect(1) - expect(gc.get_count(), (0, 0, 1), "collect(1)") - gc.collect(2) - expect(gc.get_count(), (0, 0, 0), "collect(1)") - -class Ouch: - n = 0 - def __del__(self): - Ouch.n = Ouch.n + 1 - if Ouch.n % 17 == 0: - gc.collect() - -def test_trashcan(): - # "trashcan" is a hack to prevent stack overflow when deallocating - # very deeply nested tuples etc. It works in part by abusing the - # type pointer and refcount fields, and that can yield horrible - # problems when gc tries to traverse the structures. - # If this test fails (as it does in 2.0, 2.1 and 2.2), it will - # most likely die via segfault. - - # Note: In 2.3 the possibility for compiling without cyclic gc was - # removed, and that in turn allows the trashcan mechanism to work - # via much simpler means (e.g., it never abuses the type pointer or - # refcount fields anymore). Since it's much less likely to cause a - # problem now, the various constants in this expensive (we force a lot - # of full collections) test are cut back from the 2.2 version. - gc.enable() - N = 150 - for count in range(2): - t = [] - for i in range(N): - t = [t, Ouch()] - u = [] - for i in range(N): - u = [u, Ouch()] - v = {} - for i in range(N): - v = {1: v, 2: Ouch()} - gc.disable() - -class Boom: - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom(): - a = Boom() - b = Boom() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ - # (to see whether a and b have __del__ methods), and __getattr__ deletes - # the internal "attr" attributes as a side effect. That causes the - # trash cycle to get reclaimed via refcounts falling to 0, thus mutating - # the trash graph as a side effect of merely asking whether __del__ - # exists. This used to (before 2.3b1) crash Python. Now __getattr__ - # isn't called. - expect(gc.collect(), 4, "boom") - expect(len(gc.garbage), garbagelen, "boom") - -class Boom2: - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2(): - a = Boom2() - b = Boom2() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # Much like test_boom(), except that __getattr__ doesn't break the - # cycle until the second time gc checks for __del__. As of 2.3b1, - # there isn't a second time, so this simply cleans up the trash cycle. - # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed - # this way. - expect(gc.collect(), 4, "boom2") - expect(len(gc.garbage), garbagelen, "boom2") - -# boom__new and boom2_new are exactly like boom and boom2, except use -# new-style classes. - -class Boom_New(object): - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom_new(): - a = Boom_New() - b = Boom_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom_new") - expect(len(gc.garbage), garbagelen, "boom_new") - -class Boom2_New(object): - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2_new(): - a = Boom2_New() - b = Boom2_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom2_new") - expect(len(gc.garbage), garbagelen, "boom2_new") - -def test_get_referents(): - alist = [1, 3, 5] - got = gc.get_referents(alist) - got.sort() - expect(got, alist, "get_referents") - - atuple = tuple(alist) - got = gc.get_referents(atuple) - got.sort() - expect(got, alist, "get_referents") - - adict = {1: 3, 5: 7} - expected = [1, 3, 5, 7] - got = gc.get_referents(adict) - got.sort() - expect(got, expected, "get_referents") - - got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) - got.sort() - expect(got, [0, 0] + range(5), "get_referents") - - expect(gc.get_referents(1, 'a', 4j), [], "get_referents") - +### Support code +############################################################################### + # Bug 1055820 has several tests of longstanding bugs involving weakrefs and # cyclic gc. @@ -410,217 +31,556 @@ # gc collects it. self.wr = weakref.ref(C1055820(666), it_happened) -def test_bug1055820b(): - # Corresponds to temp2b.py in the bug report. - ouch = [] - def callback(ignored): - ouch[:] = [wr() for wr in WRs] - - Cs = [C1055820(i) for i in range(2)] - WRs = [weakref.ref(c, callback) for c in Cs] - c = None - - gc.collect() - expect(len(ouch), 0, "bug1055820b") - # Make the two instances trash, and collect again. The bug was that - # the callback materialized a strong reference to an instance, but gc - # cleared the instance's dict anyway. - Cs = None - gc.collect() - expect(len(ouch), 2, "bug1055820b") # else the callbacks didn't run - for x in ouch: - # If the callback resurrected one of these guys, the instance - # would be damaged, with an empty __dict__. - expect(x, None, "bug1055820b") - -def test_bug1055820c(): - # Corresponds to temp2c.py in the bug report. This is pretty elaborate. - - c0 = C1055820(0) - # Move c0 into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_c0_alive = c0 - del c0.loop # now only c1 keeps c0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - ouch = [] - def callback(ignored): - ouch[:] = [c2wr()] - - # The callback gets associated with a wr on an object in generation 2. - c0wr = weakref.ref(c0, callback) - - c0 = c1 = c2 = None - - # What we've set up: c0, c1, and c2 are all trash now. c0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There's also - # a global weakref to c0 (c0wr), and that does have a callback, and that - # callback references c2 via c2wr(). - # - # c0 has a wr with callback, which references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see c0 at all, and c0 is the only object - # that has a weakref with a callback. gc clears c1 and c2. Clearing c1 - # has the side effect of dropping the refcount on c0 to 0, so c0 goes - # away (despite that it's in an older generation) and c0's wr callback - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - junk = [] - i = 0 - detector = GC_Detector() - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820c") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820c") # else the callback wasn't invoked - for x in ouch: - # If the callback resurrected c2, the instance would be damaged, - # with an empty __dict__. - expect(x, None, "bug1055820c") - -def test_bug1055820d(): - # Corresponds to temp2d.py in the bug report. This is very much like - # test_bug1055820c, but uses a __del__ method instead of a weakref - # callback to sneak in a resurrection of cyclic trash. - - ouch = [] - class D(C1055820): - def __del__(self): - ouch[:] = [c2wr()] +### Tests +############################################################################### + +class GCTests(unittest.TestCase): + def test_list(self): + l = [] + l.append(l) + gc.collect() + del l + self.assertEqual(gc.collect(), 1) + + def test_dict(self): + d = {} + d[1] = d + gc.collect() + del d + self.assertEqual(gc.collect(), 1) + + def test_tuple(self): + # since tuples are immutable we close the loop with a list + l = [] + t = (l,) + l.append(t) + gc.collect() + del t + del l + self.assertEqual(gc.collect(), 2) + + def test_class(self): + class A: + pass + A.a = A + gc.collect() + del A + self.assertNotEqual(gc.collect(), 0) + + def test_newstyleclass(self): + class A(object): + pass + gc.collect() + del A + self.assertNotEqual(gc.collect(), 0) + + def test_instance(self): + class A: + pass + a = A() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + + def test_newinstance(self): + class A(object): + pass + a = A() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + class B(list): + pass + class C(B, A): + pass + a = C() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + del B, C + self.assertNotEqual(gc.collect(), 0) + A.a = A() + del A + self.assertNotEqual(gc.collect(), 0) + self.assertEqual(gc.collect(), 0) + + def test_method(self): + # Tricky: self.__init__ is a bound method, it references the instance. + class A: + def __init__(self): + self.init = self.__init__ + a = A() + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + + def test_finalizer(self): + # A() is uncollectable if it is part of a cycle, make sure it shows up + # in gc.garbage. + class A: + def __del__(self): pass + class B: + pass + a = A() + a.a = a + id_a = id(a) + b = B() + b.b = b + gc.collect() + del a + del b + self.assertNotEqual(gc.collect(), 0) + for obj in gc.garbage: + if id(obj) == id_a: + del obj.a + break + else: + self.fail("didn't find obj in garbage (finalizer)") + gc.garbage.remove(obj) + + def test_finalizer_newclass(self): + # A() is uncollectable if it is part of a cycle, make sure it shows up + # in gc.garbage. + class A(object): + def __del__(self): pass + class B(object): + pass + a = A() + a.a = a + id_a = id(a) + b = B() + b.b = b + gc.collect() + del a + del b + self.assertNotEqual(gc.collect(), 0) + for obj in gc.garbage: + if id(obj) == id_a: + del obj.a + break + else: + self.fail("didn't find obj in garbage (finalizer)") + gc.garbage.remove(obj) + + def test_function(self): + # Tricky: f -> d -> f, code should call d.clear() after the exec to + # break the cycle. + d = {} + exec("def f(): pass\n") in d + gc.collect() + del d + self.assertEqual(gc.collect(), 2) + + def test_frame(self): + def f(): + frame = sys._getframe() + gc.collect() + f() + self.assertEqual(gc.collect(), 1) + + def test_saveall(self): + # Verify that cyclic garbage like lists show up in gc.garbage if the + # SAVEALL option is enabled. + + # First make sure we don't save away other stuff that just happens to + # be waiting for collection. + gc.collect() + # if this fails, someone else created immortal trash + self.assertEqual(gc.garbage, []) + + L = [] + L.append(L) + id_L = id(L) + + debug = gc.get_debug() + gc.set_debug(debug | gc.DEBUG_SAVEALL) + del L + gc.collect() + gc.set_debug(debug) - d0 = D(0) - # Move all the above into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_d0_alive = d0 - del d0.loop # now only c1 keeps d0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - d0 = c1 = c2 = None - - # What we've set up: d0, c1, and c2 are all trash now. d0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There are no - # other weakrefs. - # - # d0 has a __del__ method that references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see d0 at all. gc clears c1 and c2. - # Clearing c1 has the side effect of dropping the refcount on d0 to 0, so - # d0 goes away (despite that it's in an older generation) and d0's __del__ - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - detector = GC_Detector() - junk = [] - i = 0 - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820d") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820d") # else __del__ wasn't invoked - for x in ouch: - # If __del__ resurrected c2, the instance would be damaged, with an - # empty __dict__. - expect(x, None, "bug1055820d") - - -def test_all(): - gc.collect() # Delete 2nd generation garbage - run_test("lists", test_list) - run_test("dicts", test_dict) - run_test("tuples", test_tuple) - run_test("classes", test_class) - run_test("new style classes", test_newstyleclass) - run_test("instances", test_instance) - run_test("new instances", test_newinstance) - run_test("methods", test_method) - run_test("functions", test_function) - run_test("frames", test_frame) - run_test("finalizers", test_finalizer) - run_test("finalizers (new class)", test_finalizer_newclass) - run_test("__del__", test_del) - run_test("__del__ (new class)", test_del_newclass) - run_test("get_count()", test_get_count) - run_test("collect(n)", test_collect_generations) - run_test("saveall", test_saveall) - run_test("trashcan", test_trashcan) - run_test("boom", test_boom) - run_test("boom2", test_boom2) - run_test("boom_new", test_boom_new) - run_test("boom2_new", test_boom2_new) - run_test("get_referents", test_get_referents) - run_test("bug1055820b", test_bug1055820b) + self.assertEqual(len(gc.garbage), 1) + obj = gc.garbage.pop() + self.assertEqual(id(obj), id_L) + + def test_del(self): + # __del__ methods can trigger collection, make this to happen + thresholds = gc.get_threshold() + gc.enable() + gc.set_threshold(1) + + class A: + def __del__(self): + dir(self) + a = A() + del a - gc.enable() - try: - run_test("bug1055820c", test_bug1055820c) - finally: gc.disable() + gc.set_threshold(*thresholds) - gc.enable() - try: - run_test("bug1055820d", test_bug1055820d) - finally: + def test_del_newclass(self): + # __del__ methods can trigger collection, make this to happen + thresholds = gc.get_threshold() + gc.enable() + gc.set_threshold(1) + + class A(object): + def __del__(self): + dir(self) + a = A() + del a + + gc.disable() + gc.set_threshold(*thresholds) + + def test_get_count(self): + gc.collect() + self.assertEqual(gc.get_count(), (0, 0, 0)) + a = dict() + self.assertEqual(gc.get_count(), (1, 0, 0)) + + def test_collect_generations(self): + gc.collect() + a = dict() + gc.collect(0) + self.assertEqual(gc.get_count(), (0, 1, 0)) + gc.collect(1) + self.assertEqual(gc.get_count(), (0, 0, 1)) + gc.collect(2) + self.assertEqual(gc.get_count(), (0, 0, 0)) + + def test_trashcan(self): + class Ouch: + n = 0 + def __del__(self): + Ouch.n = Ouch.n + 1 + if Ouch.n % 17 == 0: + gc.collect() + + # "trashcan" is a hack to prevent stack overflow when deallocating + # very deeply nested tuples etc. It works in part by abusing the + # type pointer and refcount fields, and that can yield horrible + # problems when gc tries to traverse the structures. + # If this test fails (as it does in 2.0, 2.1 and 2.2), it will + # most likely die via segfault. + + # Note: In 2.3 the possibility for compiling without cyclic gc was + # removed, and that in turn allows the trashcan mechanism to work + # via much simpler means (e.g., it never abuses the type pointer or + # refcount fields anymore). Since it's much less likely to cause a + # problem now, the various constants in this expensive (we force a lot + # of full collections) test are cut back from the 2.2 version. + gc.enable() + N = 150 + for count in range(2): + t = [] + for i in range(N): + t = [t, Ouch()] + u = [] + for i in range(N): + u = [u, Ouch()] + v = {} + for i in range(N): + v = {1: v, 2: Ouch()} + gc.disable() + + def test_boom(self): + class Boom: + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + a = Boom() + b = Boom() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # a<->b are in a trash cycle now. Collection will invoke + # Boom.__getattr__ (to see whether a and b have __del__ methods), and + # __getattr__ deletes the internal "attr" attributes as a side effect. + # That causes the trash cycle to get reclaimed via refcounts falling to + # 0, thus mutating the trash graph as a side effect of merely asking + # whether __del__ exists. This used to (before 2.3b1) crash Python. + # Now __getattr__ isn't called. + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom2(self): + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get + # reclaimed this way. + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom_new(self): + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom2_new(self): + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_get_referents(self): + alist = [1, 3, 5] + got = gc.get_referents(alist) + got.sort() + self.assertEqual(got, alist) + + atuple = tuple(alist) + got = gc.get_referents(atuple) + got.sort() + self.assertEqual(got, alist) + + adict = {1: 3, 5: 7} + expected = [1, 3, 5, 7] + got = gc.get_referents(adict) + got.sort() + self.assertEqual(got, expected) + + got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) + got.sort() + self.assertEqual(got, [0, 0] + range(5)) + + self.assertEqual(gc.get_referents(1, 'a', 4j), []) + + def test_bug1055820b(self): + # Corresponds to temp2b.py in the bug report. + + ouch = [] + def callback(ignored): + ouch[:] = [wr() for wr in WRs] + + Cs = [C1055820(i) for i in range(2)] + WRs = [weakref.ref(c, callback) for c in Cs] + c = None + + gc.collect() + self.assertEqual(len(ouch), 0) + # Make the two instances trash, and collect again. The bug was that + # the callback materialized a strong reference to an instance, but gc + # cleared the instance's dict anyway. + Cs = None + gc.collect() + self.assertEqual(len(ouch), 2) # else the callbacks didn't run + for x in ouch: + # If the callback resurrected one of these guys, the instance + # would be damaged, with an empty __dict__. + self.assertEqual(x, None) + +class GCTogglingTests(unittest.TestCase): + def setUp(self): + gc.enable() + + def tearDown(self): gc.disable() + + def test_bug1055820c(self): + # Corresponds to temp2c.py in the bug report. This is pretty + # elaborate. + + c0 = C1055820(0) + # Move c0 into generation 2. + gc.collect() + + c1 = C1055820(1) + c1.keep_c0_alive = c0 + del c0.loop # now only c1 keeps c0 alive + + c2 = C1055820(2) + c2wr = weakref.ref(c2) # no callback! + + ouch = [] + def callback(ignored): + ouch[:] = [c2wr()] -def test(): - if verbose: - print "disabling automatic collection" + # The callback gets associated with a wr on an object in generation 2. + c0wr = weakref.ref(c0, callback) + + c0 = c1 = c2 = None + + # What we've set up: c0, c1, and c2 are all trash now. c0 is in + # generation 2. The only thing keeping it alive is that c1 points to + # it. c1 and c2 are in generation 0, and are in self-loops. There's a + # global weakref to c2 (c2wr), but that weakref has no callback. + # There's also a global weakref to c0 (c0wr), and that does have a + # callback, and that callback references c2 via c2wr(). + # + # c0 has a wr with callback, which references c2wr + # ^ + # | + # | Generation 2 above dots + #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . + # | Generation 0 below dots + # | + # | + # ^->c1 ^->c2 has a wr but no callback + # | | | | + # <--v <--v + # + # So this is the nightmare: when generation 0 gets collected, we see + # that c2 has a callback-free weakref, and c1 doesn't even have a + # weakref. Collecting generation 0 doesn't see c0 at all, and c0 is + # the only object that has a weakref with a callback. gc clears c1 + # and c2. Clearing c1 has the side effect of dropping the refcount on + # c0 to 0, so c0 goes away (despite that it's in an older generation) + # and c0's wr callback triggers. That in turn materializes a reference + # to c2 via c2wr(), but c2 gets cleared anyway by gc. + + # We want to let gc happen "naturally", to preserve the distinction + # between generations. + junk = [] + i = 0 + detector = GC_Detector() + while not detector.gc_happened: + i += 1 + if i > 10000: + self.fail("gc didn't happen after 10000 iterations") + self.assertEqual(len(ouch), 0) + junk.append([]) # this will eventually trigger gc + + self.assertEqual(len(ouch), 1) # else the callback wasn't invoked + for x in ouch: + # If the callback resurrected c2, the instance would be damaged, + # with an empty __dict__. + self.assertEqual(x, None) + + def test_bug1055820d(self): + # Corresponds to temp2d.py in the bug report. This is very much like + # test_bug1055820c, but uses a __del__ method instead of a weakref + # callback to sneak in a resurrection of cyclic trash. + + ouch = [] + class D(C1055820): + def __del__(self): + ouch[:] = [c2wr()] + + d0 = D(0) + # Move all the above into generation 2. + gc.collect() + + c1 = C1055820(1) + c1.keep_d0_alive = d0 + del d0.loop # now only c1 keeps d0 alive + + c2 = C1055820(2) + c2wr = weakref.ref(c2) # no callback! + + d0 = c1 = c2 = None + + # What we've set up: d0, c1, and c2 are all trash now. d0 is in + # generation 2. The only thing keeping it alive is that c1 points to + # it. c1 and c2 are in generation 0, and are in self-loops. There's + # a global weakref to c2 (c2wr), but that weakref has no callback. + # There are no other weakrefs. + # + # d0 has a __del__ method that references c2wr + # ^ + # | + # | Generation 2 above dots + #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . + # | Generation 0 below dots + # | + # | + # ^->c1 ^->c2 has a wr but no callback + # | | | | + # <--v <--v + # + # So this is the nightmare: when generation 0 gets collected, we see + # that c2 has a callback-free weakref, and c1 doesn't even have a + # weakref. Collecting generation 0 doesn't see d0 at all. gc clears + # c1 and c2. Clearing c1 has the side effect of dropping the refcount + # on d0 to 0, so d0 goes away (despite that it's in an older + # generation) and d0's __del__ triggers. That in turn materializes + # a reference to c2 via c2wr(), but c2 gets cleared anyway by gc. + + # We want to let gc happen "naturally", to preserve the distinction + # between generations. + detector = GC_Detector() + junk = [] + i = 0 + while not detector.gc_happened: + i += 1 + if i > 10000: + self.fail("gc didn't happen after 10000 iterations") + self.assertEqual(len(ouch), 0) + junk.append([]) # this will eventually trigger gc + + self.assertEqual(len(ouch), 1) # else __del__ wasn't invoked + for x in ouch: + # If __del__ resurrected c2, the instance would be damaged, with an + # empty __dict__. + self.assertEqual(x, None) + +def test_main(): enabled = gc.isenabled() gc.disable() - verify(not gc.isenabled()) + assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: - test_all() + gc.collect() # Delete 2nd generation garbage + run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default @@ -628,9 +588,9 @@ print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() - verify(gc.isenabled()) + assert gc.isenabled() if not enabled: gc.disable() - - -test() + +if __name__ == "__main__": + test_main() From python-checkins at python.org Fri Apr 6 22:03:11 2007 From: python-checkins at python.org (collin.winter) Date: Fri, 6 Apr 2007 22:03:11 +0200 (CEST) Subject: [Python-checkins] r54707 - python/trunk/Lib/test/test_module.py Message-ID: <20070406200311.F318B1E400A@bag.python.org> Author: collin.winter Date: Fri Apr 6 22:03:11 2007 New Revision: 54707 Modified: python/trunk/Lib/test/test_module.py Log: Convert test_module to use unittest. Modified: python/trunk/Lib/test/test_module.py ============================================================================== --- python/trunk/Lib/test/test_module.py (original) +++ python/trunk/Lib/test/test_module.py Fri Apr 6 22:03:11 2007 @@ -1,48 +1,61 @@ # Test the module type - -from test.test_support import verify, vereq, verbose, TestFailed +import unittest +from test.test_support import verbose, run_unittest import sys -module = type(sys) - -# An uninitialized module has no __dict__ or __name__, and __doc__ is None -foo = module.__new__(module) -verify(foo.__dict__ is None) -try: - s = foo.__name__ -except AttributeError: - pass -else: - raise TestFailed, "__name__ = %s" % repr(s) -vereq(foo.__doc__, module.__doc__) - -# Regularly initialized module, no docstring -foo = module("foo") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, None) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": None}) - -# ASCII docstring -foo = module("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc"}) - -# Unicode docstring -foo = module("foo", u"foodoc\u1234") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, u"foodoc\u1234") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": u"foodoc\u1234"}) - -# Reinitialization should not replace the __dict__ -foo.bar = 42 -d = foo.__dict__ -foo.__init__("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.bar, 42) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc", "bar": 42}) -verify(foo.__dict__ is d) +ModuleType = type(sys) -if verbose: - print "All OK" +class ModuleTests(unittest.TestCase): + def test_uninitialized(self): + # An uninitialized module has no __dict__ or __name__, + # and __doc__ is None + foo = ModuleType.__new__(ModuleType) + self.failUnless(foo.__dict__ is None) + try: + s = foo.__name__ + self.fail("__name__ = %s" % repr(s)) + except AttributeError: + pass + self.assertEqual(foo.__doc__, ModuleType.__doc__) + + def test_no_docstring(self): + # Regularly initialized module, no docstring + foo = ModuleType("foo") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, None) + self.assertEqual(foo.__dict__, {"__name__": "foo", "__doc__": None}) + + def test_ascii_docstring(self): + # ASCII docstring + foo = ModuleType("foo", "foodoc") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, "foodoc") + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": "foodoc"}) + + def test_unicode_docstring(self): + # Unicode docstring + foo = ModuleType("foo", u"foodoc\u1234") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, u"foodoc\u1234") + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": u"foodoc\u1234"}) + + def test_reinit(self): + # Reinitialization should not replace the __dict__ + foo = ModuleType("foo", u"foodoc\u1234") + foo.bar = 42 + d = foo.__dict__ + foo.__init__("foo", "foodoc") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, "foodoc") + self.assertEqual(foo.bar, 42) + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": "foodoc", "bar": 42}) + self.failUnless(foo.__dict__ is d) + +def test_main(): + run_unittest(ModuleTests) + +if __name__ == '__main__': + test_main() From nnorwitz at gmail.com Fri Apr 6 22:15:52 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 6 Apr 2007 16:15:52 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070406201552.GA8517@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [480169 refs] From python-checkins at python.org Sat Apr 7 06:40:44 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 7 Apr 2007 06:40:44 +0200 (CEST) Subject: [Python-checkins] r54711 - python/trunk/Lib/test/test_fileinput.py Message-ID: <20070407044044.1153F1E4006@bag.python.org> Author: collin.winter Date: Sat Apr 7 06:40:43 2007 New Revision: 54711 Modified: python/trunk/Lib/test/test_fileinput.py Log: Convert test_fileinput to use unittest. Modified: python/trunk/Lib/test/test_fileinput.py ============================================================================== --- python/trunk/Lib/test/test_fileinput.py (original) +++ python/trunk/Lib/test/test_fileinput.py Sat Apr 7 06:40:43 2007 @@ -3,7 +3,9 @@ Nick Mathewson ''' -from test.test_support import verify, verbose, TESTFN, TestFailed +import unittest +from test.test_support import verbose, TESTFN, run_unittest +from test.test_support import unlink as safe_unlink import sys, os, re from StringIO import StringIO from fileinput import FileInput, hook_encoded @@ -22,206 +24,202 @@ f.close() return name -pat = re.compile(r'LINE (\d+) OF FILE (\d+)') - def remove_tempfiles(*names): for name in names: - try: - os.unlink(name) - except: - pass - -def runTests(t1, t2, t3, t4, bs=0, round=0): - start = 1 + round*6 - if verbose: - print '%s. Simple iteration (bs=%s)' % (start+0, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - lines = list(fi) - fi.close() - verify(len(lines) == 31) - verify(lines[4] == 'Line 5 of file 1\n') - verify(lines[30] == 'Line 1 of file 4\n') - verify(fi.lineno() == 31) - verify(fi.filename() == t4) - - if verbose: - print '%s. Status variables (bs=%s)' % (start+1, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - s = "x" - while s and s != 'Line 6 of file 2\n': - s = fi.readline() - verify(fi.filename() == t2) - verify(fi.lineno() == 21) - verify(fi.filelineno() == 6) - verify(not fi.isfirstline()) - verify(not fi.isstdin()) - - if verbose: - print '%s. Nextfile (bs=%s)' % (start+2, bs) - fi.nextfile() - verify(fi.readline() == 'Line 1 of file 3\n') - verify(fi.lineno() == 22) - fi.close() - - if verbose: - print '%s. Stdin (bs=%s)' % (start+3, bs) - fi = FileInput(files=(t1, t2, t3, t4, '-'), bufsize=bs) - savestdin = sys.stdin - try: - sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n") + safe_unlink(name) + +class BufferSizesTests(unittest.TestCase): + def test_buffer_sizes(self): + # First, run the tests with default and teeny buffer size. + for round, bs in (0, 0), (1, 30): + try: + t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)]) + t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)]) + t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)]) + t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)]) + self.buffer_size_test(t1, t2, t3, t4, bs, round) + finally: + remove_tempfiles(t1, t2, t3, t4) + + def buffer_size_test(self, t1, t2, t3, t4, bs=0, round=0): + pat = re.compile(r'LINE (\d+) OF FILE (\d+)') + + start = 1 + round*6 + if verbose: + print '%s. Simple iteration (bs=%s)' % (start+0, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) lines = list(fi) - verify(len(lines) == 33) - verify(lines[32] == 'Line 2 of stdin\n') - verify(fi.filename() == '') + fi.close() + self.assertEqual(len(lines), 31) + self.assertEqual(lines[4], 'Line 5 of file 1\n') + self.assertEqual(lines[30], 'Line 1 of file 4\n') + self.assertEqual(fi.lineno(), 31) + self.assertEqual(fi.filename(), t4) + + if verbose: + print '%s. Status variables (bs=%s)' % (start+1, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) + s = "x" + while s and s != 'Line 6 of file 2\n': + s = fi.readline() + self.assertEqual(fi.filename(), t2) + self.assertEqual(fi.lineno(), 21) + self.assertEqual(fi.filelineno(), 6) + self.failIf(fi.isfirstline()) + self.failIf(fi.isstdin()) + + if verbose: + print '%s. Nextfile (bs=%s)' % (start+2, bs) + fi.nextfile() + self.assertEqual(fi.readline(), 'Line 1 of file 3\n') + self.assertEqual(fi.lineno(), 22) + fi.close() + + if verbose: + print '%s. Stdin (bs=%s)' % (start+3, bs) + fi = FileInput(files=(t1, t2, t3, t4, '-'), bufsize=bs) + savestdin = sys.stdin + try: + sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n") + lines = list(fi) + self.assertEqual(len(lines), 33) + self.assertEqual(lines[32], 'Line 2 of stdin\n') + self.assertEqual(fi.filename(), '') + fi.nextfile() + finally: + sys.stdin = savestdin + + if verbose: + print '%s. Boundary conditions (bs=%s)' % (start+4, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) + self.assertEqual(fi.lineno(), 0) + self.assertEqual(fi.filename(), None) fi.nextfile() - finally: - sys.stdin = savestdin + self.assertEqual(fi.lineno(), 0) + self.assertEqual(fi.filename(), None) - if verbose: - print '%s. Boundary conditions (bs=%s)' % (start+4, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - verify(fi.lineno() == 0) - verify(fi.filename() == None) - fi.nextfile() - verify(fi.lineno() == 0) - verify(fi.filename() == None) - - if verbose: - print '%s. Inplace (bs=%s)' % (start+5, bs) - savestdout = sys.stdout - try: - fi = FileInput(files=(t1, t2, t3, t4), inplace=1, bufsize=bs) + if verbose: + print '%s. Inplace (bs=%s)' % (start+5, bs) + savestdout = sys.stdout + try: + fi = FileInput(files=(t1, t2, t3, t4), inplace=1, bufsize=bs) + for line in fi: + line = line[:-1].upper() + print line + fi.close() + finally: + sys.stdout = savestdout + + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) for line in fi: - line = line[:-1].upper() - print line + self.assertEqual(line[-1], '\n') + m = pat.match(line[:-1]) + self.assertNotEqual(m, None) + self.assertEqual(int(m.group(1)), fi.filelineno()) fi.close() - finally: - sys.stdout = savestdout + +class FileInputTests(unittest.TestCase): + def test_zero_byte_files(self): + try: + t1 = writeTmp(1, [""]) + t2 = writeTmp(2, [""]) + t3 = writeTmp(3, ["The only line there is.\n"]) + t4 = writeTmp(4, [""]) + fi = FileInput(files=(t1, t2, t3, t4)) + + line = fi.readline() + self.assertEqual(line, 'The only line there is.\n') + self.assertEqual(fi.lineno(), 1) + self.assertEqual(fi.filelineno(), 1) + self.assertEqual(fi.filename(), t3) + + line = fi.readline() + self.failIf(line) + self.assertEqual(fi.lineno(), 1) + self.assertEqual(fi.filelineno(), 0) + self.assertEqual(fi.filename(), t4) + fi.close() + finally: + remove_tempfiles(t1, t2, t3, t4) + + def test_files_that_dont_end_with_newline(self): + try: + t1 = writeTmp(1, ["A\nB\nC"]) + t2 = writeTmp(2, ["D\nE\nF"]) + fi = FileInput(files=(t1, t2)) + lines = list(fi) + self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"]) + self.assertEqual(fi.filelineno(), 3) + self.assertEqual(fi.lineno(), 6) + finally: + remove_tempfiles(t1, t2) + + def test_unicode_filenames(self): + try: + t1 = writeTmp(1, ["A\nB"]) + encoding = sys.getfilesystemencoding() + if encoding is None: + encoding = 'ascii' + fi = FileInput(files=unicode(t1, encoding)) + lines = list(fi) + self.assertEqual(lines, ["A\n", "B"]) + finally: + remove_tempfiles(t1) + + def test_fileno(self): + try: + t1 = writeTmp(1, ["A\nB"]) + t2 = writeTmp(2, ["C\nD"]) + fi = FileInput(files=(t1, t2)) + self.assertEqual(fi.fileno(), -1) + line = fi.next() + self.assertNotEqual(fi.fileno(), -1) + fi.nextfile() + self.assertEqual(fi.fileno(), -1) + line = list(fi) + self.assertEqual(fi.fileno(), -1) + finally: + remove_tempfiles(t1, t2) + + def test_opening_mode(self): + try: + # invalid mode, should raise ValueError + fi = FileInput(mode="w") + self.fail("FileInput should reject invalid mode argument") + except ValueError: + pass + try: + # try opening in universal newline mode + t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb") + fi = FileInput(files=t1, mode="U") + lines = list(fi) + self.assertEqual(lines, ["A\n", "B\n", "C\n", "D"]) + finally: + remove_tempfiles(t1) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - for line in fi: - verify(line[-1] == '\n') - m = pat.match(line[:-1]) - verify(m != None) - verify(int(m.group(1)) == fi.filelineno()) - fi.close() - - -def writeFiles(): - global t1, t2, t3, t4 - t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)]) - t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)]) - t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)]) - t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)]) - -# First, run the tests with default and teeny buffer size. -for round, bs in (0, 0), (1, 30): - try: - writeFiles() - runTests(t1, t2, t3, t4, bs, round) - finally: - remove_tempfiles(t1, t2, t3, t4) - -# Next, check for proper behavior with 0-byte files. -if verbose: - print "13. 0-byte files" -try: - t1 = writeTmp(1, [""]) - t2 = writeTmp(2, [""]) - t3 = writeTmp(3, ["The only line there is.\n"]) - t4 = writeTmp(4, [""]) - fi = FileInput(files=(t1, t2, t3, t4)) - line = fi.readline() - verify(line == 'The only line there is.\n') - verify(fi.lineno() == 1) - verify(fi.filelineno() == 1) - verify(fi.filename() == t3) - line = fi.readline() - verify(not line) - verify(fi.lineno() == 1) - verify(fi.filelineno() == 0) - verify(fi.filename() == t4) - fi.close() -finally: - remove_tempfiles(t1, t2, t3, t4) - -if verbose: - print "14. Files that don't end with newline" -try: - t1 = writeTmp(1, ["A\nB\nC"]) - t2 = writeTmp(2, ["D\nE\nF"]) - fi = FileInput(files=(t1, t2)) - lines = list(fi) - verify(lines == ["A\n", "B\n", "C", "D\n", "E\n", "F"]) - verify(fi.filelineno() == 3) - verify(fi.lineno() == 6) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "15. Unicode filenames" -try: - t1 = writeTmp(1, ["A\nB"]) - encoding = sys.getfilesystemencoding() - if encoding is None: - encoding = 'ascii' - fi = FileInput(files=unicode(t1, encoding)) - lines = list(fi) - verify(lines == ["A\n", "B"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "16. fileno()" -try: - t1 = writeTmp(1, ["A\nB"]) - t2 = writeTmp(2, ["C\nD"]) - fi = FileInput(files=(t1, t2)) - verify(fi.fileno() == -1) - line = fi.next() - verify(fi.fileno() != -1) - fi.nextfile() - verify(fi.fileno() == -1) - line = list(fi) - verify(fi.fileno() == -1) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "17. Specify opening mode" -try: - # invalid mode, should raise ValueError - fi = FileInput(mode="w") - raise TestFailed("FileInput should reject invalid mode argument") -except ValueError: - pass -try: - # try opening in universal newline mode - t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb") - fi = FileInput(files=t1, mode="U") - lines = list(fi) - verify(lines == ["A\n", "B\n", "C\n", "D"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "18. Test file opening hook" -try: - # cannot use openhook and inplace mode - fi = FileInput(inplace=1, openhook=lambda f,m: None) - raise TestFailed("FileInput should raise if both inplace " - "and openhook arguments are given") -except ValueError: - pass -try: - fi = FileInput(openhook=1) - raise TestFailed("FileInput should check openhook for being callable") -except ValueError: - pass -try: - t1 = writeTmp(1, ["A\nB"], mode="wb") - fi = FileInput(files=t1, openhook=hook_encoded("rot13")) - lines = list(fi) - verify(lines == ["N\n", "O"]) -finally: - remove_tempfiles(t1) + def test_file_opening_hook(self): + try: + # cannot use openhook and inplace mode + fi = FileInput(inplace=1, openhook=lambda f,m: None) + self.fail("FileInput should raise if both inplace " + "and openhook arguments are given") + except ValueError: + pass + try: + fi = FileInput(openhook=1) + self.fail("FileInput should check openhook for being callable") + except ValueError: + pass + try: + t1 = writeTmp(1, ["A\nB"], mode="wb") + fi = FileInput(files=t1, openhook=hook_encoded("rot13")) + lines = list(fi) + self.assertEqual(lines, ["N\n", "O"]) + finally: + remove_tempfiles(t1) + +def test_main(): + run_unittest(BufferSizesTests, FileInputTests) + +if __name__ == "__main__": + test_main() From nnorwitz at gmail.com Sat Apr 7 10:13:44 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 7 Apr 2007 04:13:44 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070407081344.GA15773@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482130 refs] From glenn.rossie at pandora.be Sat Apr 7 21:25:43 2007 From: glenn.rossie at pandora.be (izzy green) Date: Sat, 7 Apr 2007 20:25:43 +0100 Subject: [Python-checkins] Cheap Codeine Tylenol3 Online - USA Pharmacy Message-ID: <000501c7794a$88d0e200$ec725351@izzything> please can you help me?how do i order?my name is glenn and i live in belgium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070407/def399d8/attachment.htm From nnorwitz at gmail.com Sat Apr 7 22:13:37 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 7 Apr 2007 16:13:37 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070407201337.GA12230@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482122 refs] From python-checkins at python.org Sun Apr 8 06:29:33 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 8 Apr 2007 06:29:33 +0200 (CEST) Subject: [Python-checkins] r54712 - in python/trunk: Doc/lib/libstdtypes.tex Misc/NEWS Message-ID: <20070408042933.E9C041E4009@bag.python.org> Author: brett.cannon Date: Sun Apr 8 06:29:32 2007 New Revision: 54712 Modified: python/trunk/Doc/lib/libstdtypes.tex python/trunk/Misc/NEWS Log: Doc that file.next() has undefined behaviour when called on a file opened with 'w'. Closes bug #1569057. To be backported once 2.5 branch is unfrozen. Modified: python/trunk/Doc/lib/libstdtypes.tex ============================================================================== --- python/trunk/Doc/lib/libstdtypes.tex (original) +++ python/trunk/Doc/lib/libstdtypes.tex Sun Apr 8 06:29:32 2007 @@ -1615,14 +1615,15 @@ iterator, typically in a \keyword{for} loop (for example, \code{for line in f: print line}), the \method{next()} method is called repeatedly. This method returns the next input line, or raises -\exception{StopIteration} when \EOF{} is hit. In order to make a -\keyword{for} loop the most efficient way of looping over the lines of -a file (a very common operation), the \method{next()} method uses a -hidden read-ahead buffer. As a consequence of using a read-ahead -buffer, combining \method{next()} with other file methods (like -\method{readline()}) does not work right. However, using -\method{seek()} to reposition the file to an absolute position will -flush the read-ahead buffer. +\exception{StopIteration} when \EOF{} is hit when the file is open for +reading (behavior is undefined when the file is open for writing). In +order to make a \keyword{for} loop the most efficient way of looping +over the lines of a file (a very common operation), the +\method{next()} method uses a hidden read-ahead buffer. As a +consequence of using a read-ahead buffer, combining \method{next()} +with other file methods (like \method{readline()}) does not work +right. However, using \method{seek()} to reposition the file to an +absolute position will flush the read-ahead buffer. \versionadded{2.3} \end{methoddesc} Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Apr 8 06:29:32 2007 @@ -736,6 +736,9 @@ Documentation ------------- +- Bug #1569057: Document that calling file.next() when the file is open for + writing is undefined. + - Patch #1489771: the syntax rules in Python Reference Manual were updated to reflect the current Python syntax. From nnorwitz at gmail.com Sun Apr 8 10:13:51 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 8 Apr 2007 04:13:51 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070408081351.GA16204@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482124 refs] From python-checkins at python.org Sun Apr 8 18:51:34 2007 From: python-checkins at python.org (guido.van.rossum) Date: Sun, 8 Apr 2007 18:51:34 +0200 (CEST) Subject: [Python-checkins] r54713 - peps/trunk/pep-3100.txt Message-ID: <20070408165134.A9B021E400A@bag.python.org> Author: guido.van.rossum Date: Sun Apr 8 18:51:33 2007 New Revision: 54713 Modified: peps/trunk/pep-3100.txt Log: Clarify what to use instead of callable(). Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Sun Apr 8 18:51:33 2007 @@ -179,7 +179,7 @@ * ``apply()``: use ``f(*args, **kw)`` instead [2]_ [done] * ``buffer()``: must die (use a bytes() type instead) (?) [2]_ -* ``callable()``: just call the object and catch the exception??? [2]_ +* ``callable()``: just use hasattr(x, '__call__') (?) [2]_ * ``compile()``: put in ``sys`` (or perhaps in a module of its own) [2]_ * ``coerce()``: no longer needed [2]_ * ``execfile()``, ``reload()``: use ``exec()`` [2]_ From nnorwitz at gmail.com Sun Apr 8 22:13:24 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 8 Apr 2007 16:13:24 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070408201324.GA7876@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482131 refs] From python-checkins at python.org Mon Apr 9 01:59:24 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 9 Apr 2007 01:59:24 +0200 (CEST) Subject: [Python-checkins] r54716 - sandbox/trunk/2to3/fixes/fix_dict.py sandbox/trunk/2to3/fixes/util.py Message-ID: <20070408235924.36A441E4009@bag.python.org> Author: collin.winter Date: Mon Apr 9 01:59:23 2007 New Revision: 54716 Modified: sandbox/trunk/2to3/fixes/fix_dict.py sandbox/trunk/2to3/fixes/util.py Log: Add LParen and RParen macros. Modified: sandbox/trunk/2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/fixes/fix_dict.py Mon Apr 9 01:59:23 2007 @@ -26,7 +26,7 @@ import patcomp from pgen2 import token from fixes import basefix -from fixes.util import Name, Call, lparen_leaf, rparen_leaf +from fixes.util import Name, Call, LParen, RParen class FixDict(basefix.BaseFix): @@ -55,9 +55,7 @@ args = head + [pytree.Node(syms.trailer, [pytree.Leaf(token.DOT, '.'), Name(method)]), - pytree.Node(syms.trailer, - [lparen_leaf.clone(), - rparen_leaf.clone()])] + pytree.Node(syms.trailer, [LParen(), RParen()])] new = pytree.Node(syms.power, args) if not special: new.set_prefix("") Modified: sandbox/trunk/2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/fixes/util.py Mon Apr 9 01:59:23 2007 @@ -11,14 +11,16 @@ ass_leaf = Leaf(token.EQUAL, "=") ass_leaf.set_prefix(" ") -comma_leaf = Leaf(token.COMMA, ",") -lparen_leaf = Leaf(token.LPAR, "(") -rparen_leaf = Leaf(token.RPAR, ")") - ########################################################### ### Common node-construction "macros" ########################################################### +def LParen(): + return Leaf(token.LPAR, "(") + +def RParen(): + return Leaf(token.RPAR, ")") + def Assign(target, source): """Build an assignment statement""" if not isinstance(target, tuple): @@ -41,9 +43,9 @@ def Comma(): """A comma leaf""" - return comma_leaf.clone() + return Leaf(token.COMMA, ",") -def ArgList(args, lparen=lparen_leaf, rparen=rparen_leaf): +def ArgList(args, lparen=LParen(), rparen=RParen()): """A parenthesised argument list, used by Call()""" return Node(syms.trailer, [lparen.clone(), From python-checkins at python.org Mon Apr 9 03:01:11 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 9 Apr 2007 03:01:11 +0200 (CEST) Subject: [Python-checkins] r54721 - in sandbox/trunk/2to3: pytree.py tests/test_pytree.py Message-ID: <20070409010111.80ADD1E4009@bag.python.org> Author: collin.winter Date: Mon Apr 9 03:01:09 2007 New Revision: 54721 Modified: sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py Log: Add a remove() method to pytree.Base. Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Mon Apr 9 03:01:09 2007 @@ -131,6 +131,18 @@ if self.parent: self.parent.changed() self.was_changed = True + + def remove(self): + """Remove the node from the tree.""" + if self.parent: + children = list(self.parent.children) + for i, node in enumerate(self.parent.children): + if node is self: + self.parent.changed() + del children[i] + self.parent.children = tuple(children) + self.parent = None + break class Node(Base): Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Mon Apr 9 03:01:09 2007 @@ -177,6 +177,36 @@ self.assertEqual(n1.get_prefix(), prefix) self.assertEqual(l1.get_prefix(), prefix) self.assertEqual(l2.get_prefix(), "_") + + def testRemove(self): + l1 = pytree.Leaf(100, "foo") + n1 = pytree.Node(1000, [l1]) + n2 = pytree.Node(1000, [n1]) + + n1.remove() + self.failIf(n2 in n2.children) + self.assertEqual(l1.parent, n1) + self.assertEqual(n1.parent, None) + self.assertEqual(n2.parent, None) + self.failIf(n1.was_changed) + self.failUnless(n2.was_changed) + + l1.remove() + self.failIf(l1 in n1.children) + self.assertEqual(l1.parent, None) + self.assertEqual(n1.parent, None) + self.assertEqual(n2.parent, None) + self.failUnless(n1.was_changed) + self.failUnless(n2.was_changed) + + def testRemoveParentless(self): + n1 = pytree.Node(1000, []) + n1.remove() + self.assertEqual(n1.parent, None) + + l1 = pytree.Leaf(100, "foo") + l1.remove() + self.assertEqual(l1.parent, None) class TestPatterns(support.TestCase): From facundobatista at gmail.com Mon Apr 9 03:07:00 2007 From: facundobatista at gmail.com (Facundo Batista) Date: Sun, 8 Apr 2007 22:07:00 -0300 Subject: [Python-checkins] Python Regression Test Failures opt (1) In-Reply-To: References: <20070406081355.GA24121@python.psfb.org> Message-ID: 2007/4/6, Brett Cannon : > "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", > line 117, in testBasic > > self.assertEqual (i, "Foo\n") > > AssertionError: 'ERRO' != 'Foo\n' > ... > ... > Anyone know what caused these two tests to start failing? Sorry for the delay, I've been in a four days vacation here, and no internet connection. This is my fault, I added local test (using openssl) to test_socket_ssl.py. The problem for which that test fails should be fixed, though (I mean, you shouldn't be getting that error in current trunk). I checked with buildbots, and all pass the tests ok, except the following: - sparc-solaris10-gcc: test_socket_ssl skipped (socket module has no ssl support) - X86 XP: test_socket_ssl passes ok (fails in test_urllib). - X86 W2K: test_socket_ssl passes ok (fails in test_urllib). - X86 OpenBSD: does not check out from SVN. - Alpha True64 5.1: bad system call in test_posix, it doesn't get to test_socket_ssl. Neil, where did you see this fail? Regards, -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ From nnorwitz at gmail.com Mon Apr 9 03:30:09 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 8 Apr 2007 18:30:09 -0700 Subject: [Python-checkins] Python Regression Test Failures opt (1) In-Reply-To: References: <20070406081355.GA24121@python.psfb.org> Message-ID: On 4/8/07, Facundo Batista wrote: > 2007/4/6, Brett Cannon : > > > "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", > > line 117, in testBasic > > > self.assertEqual (i, "Foo\n") > > > AssertionError: 'ERRO' != 'Foo\n' > > ... > > ... > > Anyone know what caused these two tests to start failing? > > Sorry for the delay, I've been in a four days vacation here, and no > internet connection. > > This is my fault, I added local test (using openssl) to > test_socket_ssl.py. The problem for which that test fails should be > fixed, though (I mean, you shouldn't be getting that error in current > trunk). > > I checked with buildbots, and all pass the tests ok, except the following: > > - sparc-solaris10-gcc: test_socket_ssl skipped (socket module has no > ssl support) > - X86 XP: test_socket_ssl passes ok (fails in test_urllib). > - X86 W2K: test_socket_ssl passes ok (fails in test_urllib). > - X86 OpenBSD: does not check out from SVN. > - Alpha True64 5.1: bad system call in test_posix, it doesn't get to > test_socket_ssl. > > Neil, where did you see this fail? Note: the machine that runs this is also one of the buildbots. The difference is that this is run in opt (ie, -O) mode. This script is Misc/build.sh. The relevant lines are: $PYTHON -O $REGRTEST_ARGS >& build/$F Which the only thing that's of interest is that python is run with -O. Hopefully if you run the test with -O you will be able to reproduce it. (Python is configured --with-pydebug.) n From python-checkins at python.org Mon Apr 9 03:49:31 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 9 Apr 2007 03:49:31 +0200 (CEST) Subject: [Python-checkins] r54722 - in sandbox/trunk/2to3: fixes/fix_except.py fixes/fix_intern.py fixes/fix_raise.py fixes/fix_throw.py fixes/util.py pytree.py tests/test_pytree.py tests/test_util.py Message-ID: <20070409014931.7DD7E1E4009@bag.python.org> Author: collin.winter Date: Mon Apr 9 03:49:30 2007 New Revision: 54722 Modified: sandbox/trunk/2to3/fixes/fix_except.py sandbox/trunk/2to3/fixes/fix_intern.py sandbox/trunk/2to3/fixes/fix_raise.py sandbox/trunk/2to3/fixes/fix_throw.py sandbox/trunk/2to3/fixes/util.py sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py sandbox/trunk/2to3/tests/test_util.py Log: Convert node.children from a tuple to a list. Having it be a tuple meant jumping through casting hoops in order to modify the children; a list will enable more direct, more readable child manipulation. Modified: sandbox/trunk/2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/fixes/fix_except.py Mon Apr 9 03:49:30 2007 @@ -67,7 +67,7 @@ # Insert "old_N = new_N" as the first statement in # the except body. This loop skips leading whitespace # and indents - suite_stmts = list(e_suite.children) + suite_stmts = e_suite.children for i, stmt in enumerate(suite_stmts): if isinstance(stmt, pytree.Node): break @@ -81,7 +81,7 @@ assign.parent = e_suite suite_stmts = suite_stmts[:i] + [assign] + suite_stmts - e_suite.children = tuple(suite_stmts) + e_suite.children = suite_stmts children = [c.clone() for c in node.children[:3]] + try_cleanup return pytree.Node(node.type, children) Modified: sandbox/trunk/2to3/fixes/fix_intern.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_intern.py (original) +++ sandbox/trunk/2to3/fixes/fix_intern.py Mon Apr 9 03:49:30 2007 @@ -35,13 +35,12 @@ newarglist = pytree.Node(syms.arglist, [obj.clone()]) after = results["after"] if after: - after = tuple([n.clone() for n in after]) + after = [n.clone() for n in after] new = pytree.Node(syms.power, Attr(Name("sys"), Name("intern")) + - (pytree.Node(syms.trailer, + [pytree.Node(syms.trailer, [results["lpar"].clone(), newarglist, - results["rpar"].clone()]),) - + after) + results["rpar"].clone()])] + after) new.set_prefix(node.get_prefix()) return new Modified: sandbox/trunk/2to3/fixes/fix_raise.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_raise.py (original) +++ sandbox/trunk/2to3/fixes/fix_raise.py Mon Apr 9 03:49:30 2007 @@ -73,10 +73,8 @@ tb.set_prefix("") e = Call(exc, args) - with_tb = Attr(e, Name('with_traceback')) - call_wtb = list(with_tb + (ArgList([tb]),)) - - new = pytree.Node(syms.simple_stmt, [Name("raise")] + call_wtb) + with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] + new = pytree.Node(syms.simple_stmt, [Name("raise")] + with_tb) new.set_prefix(node.get_prefix()) return new else: Modified: sandbox/trunk/2to3/fixes/fix_throw.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_throw.py (original) +++ sandbox/trunk/2to3/fixes/fix_throw.py Mon Apr 9 03:49:30 2007 @@ -52,9 +52,7 @@ tb.set_prefix("") e = Call(exc, args) - with_tb = Attr(e, Name('with_traceback')) - call_wtb = list(with_tb + (ArgList([tb]),)) - - throw_args.replace(pytree.Node(syms.power, call_wtb)) + with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] + throw_args.replace(pytree.Node(syms.power, with_tb)) else: throw_args.replace(Call(exc, args)) Modified: sandbox/trunk/2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/fixes/util.py Mon Apr 9 03:49:30 2007 @@ -23,13 +23,13 @@ def Assign(target, source): """Build an assignment statement""" - if not isinstance(target, tuple): - target = (target,) - if not isinstance(source, tuple): + if not isinstance(target, list): + target = [target] + if not isinstance(source, list): source.set_prefix(" ") - source = (source,) + source = [source] - return Node(syms.atom, target + (ass_leaf.clone(),) + source) + return Node(syms.atom, target + [ass_leaf.clone()] + source) def Name(name, prefix=None): """Return a NAME leaf""" @@ -37,9 +37,8 @@ def Attr(obj, attr): """A node tuple for obj.attr""" - return (obj, - Node(syms.trailer, [Leaf(token.DOT, '.'), - attr])) + return [obj, + Node(syms.trailer, [Leaf(token.DOT, '.'), attr])] def Comma(): """A comma leaf""" @@ -157,9 +156,8 @@ return child elif child.type == syms.simple_stmt: if child.children[0].type == syms.expr_stmt: - n = _find(name, child.children[0].children[0]) - if n: - return n + if _find(name, child.children[0].children[0]): + return child.children[0] _block_syms = set([syms.funcdef, syms.classdef, syms.trailer]) def _find(name, node): Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Mon Apr 9 03:49:30 2007 @@ -159,7 +159,7 @@ """ assert type >= 256, type self.type = type - self.children = tuple(children) + self.children = list(children) for ch in self.children: assert ch.parent is None, repr(ch) ch.parent = self @@ -435,7 +435,7 @@ assert content is None, repr(content) if content is not None: assert not isinstance(content, basestring), repr(content) - content = tuple(content) + content = list(content) for i, item in enumerate(content): assert isinstance(item, BasePattern), (i, item) if isinstance(item, WildcardPattern): @@ -548,7 +548,7 @@ if results is not None: results.update(r) if self.name: - results[self.name] = tuple(nodes) + results[self.name] = list(nodes) return True return False Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Mon Apr 9 03:49:30 2007 @@ -75,14 +75,14 @@ l2 = pytree.Leaf(200, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(n1.type, 1000) - self.assertEqual(n1.children, (l1, l2)) + self.assertEqual(n1.children, [l1, l2]) def testNodeRepr(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(repr(n1), - "Node(1000, (%s, %s))" % (repr(l1), repr(l2))) + "Node(1000, [%s, %s])" % (repr(l1), repr(l2))) def testNodeStr(self): l1 = pytree.Leaf(100, "foo") @@ -121,7 +121,7 @@ l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2, l3]) - self.assertEqual(n1.children, (l1, l2, l3)) + self.assertEqual(n1.children, [l1, l2, l3]) self.failIf(n1.was_changed) l2new = pytree.Leaf(100, "-") l2.replace(l2new) @@ -271,12 +271,12 @@ self.assertEqual(sorted(r.keys()), ["pl", "pn", "pw"]) self.assertEqual(r["pl"], l1) self.assertEqual(r["pn"], n2) - self.assertEqual(r["pw"], (n2,)) + self.assertEqual(r["pw"], [n2]) # But this is equivalent - self.assertEqual(r, {"pl": l1, "pn": n2, "pw": (n2,)}) + self.assertEqual(r, {"pl": l1, "pn": n2, "pw": [n2]}) r = {} self.assertEqual(pw.match_seq([l1, l3], r), True) - self.assertEqual(r, {"pl": l3, "pw": (l1, l3)}) + self.assertEqual(r, {"pl": l3, "pw": [l1, l3]}) self.assert_(r["pl"] is l3) r = {} @@ -306,7 +306,7 @@ c, r = matches[0] self.assertEqual(c, 1) self.assertEqual(str(r["pr"]), "abcdef") - self.assertEqual(r["pw"], (la, lb, lc, ld, le, lf)) + self.assertEqual(r["pw"], [la, lb, lc, ld, le, lf]) for c in "abcdef": self.assertEqual(r["p" + c], pytree.Leaf(1, c)) @@ -318,10 +318,10 @@ l1 = pytree.Leaf(7, "(") l2 = pytree.Leaf(3, "x") l3 = pytree.Leaf(8, ")") - node = pytree.Node(331, (l1, l2, l3)) + node = pytree.Node(331, [l1, l2, l3]) r = {} self.assert_(pattern.match(node, r)) - self.assertEqual(r["args"], (l2,)) + self.assertEqual(r["args"], [l2]) if __name__ == "__main__": Modified: sandbox/trunk/2to3/tests/test_util.py ============================================================================== --- sandbox/trunk/2to3/tests/test_util.py (original) +++ sandbox/trunk/2to3/tests/test_util.py Mon Apr 9 03:49:30 2007 @@ -71,7 +71,7 @@ from fixes.util import Attr, Name attr = Attr(Name("a"), Name("b")) - self.assertEqual(type(attr), tuple) + self.assertEqual(type(attr), list) class Test_Name(MacroTestCase): From python-checkins at python.org Mon Apr 9 06:43:59 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 9 Apr 2007 06:43:59 +0200 (CEST) Subject: [Python-checkins] r54723 - in sandbox/trunk/2to3: pytree.py tests/test_pytree.py Message-ID: <20070409044359.F31651E400B@bag.python.org> Author: collin.winter Date: Mon Apr 9 06:43:55 2007 New Revision: 54723 Modified: sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py Log: Make pytree.Base.remove() return the old node index. Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Mon Apr 9 06:43:55 2007 @@ -133,16 +133,15 @@ self.was_changed = True def remove(self): - """Remove the node from the tree.""" + """Remove the node from the tree. Returns the position of the node + in its parent's children before it was removed.""" if self.parent: - children = list(self.parent.children) for i, node in enumerate(self.parent.children): if node is self: self.parent.changed() - del children[i] - self.parent.children = tuple(children) + del self.parent.children[i] self.parent = None - break + return i class Node(Base): Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Mon Apr 9 06:43:55 2007 @@ -180,18 +180,20 @@ def testRemove(self): l1 = pytree.Leaf(100, "foo") - n1 = pytree.Node(1000, [l1]) + l2 = pytree.Leaf(100, "foo") + n1 = pytree.Node(1000, [l1, l2]) n2 = pytree.Node(1000, [n1]) - - n1.remove() - self.failIf(n2 in n2.children) + + self.assertEqual(n1.remove(), 0) + self.failIf(n1 in n2.children) self.assertEqual(l1.parent, n1) self.assertEqual(n1.parent, None) self.assertEqual(n2.parent, None) self.failIf(n1.was_changed) self.failUnless(n2.was_changed) - - l1.remove() + + self.assertEqual(l2.remove(), 1) + self.assertEqual(l1.remove(), 0) self.failIf(l1 in n1.children) self.assertEqual(l1.parent, None) self.assertEqual(n1.parent, None) From python-checkins at python.org Mon Apr 9 07:51:33 2007 From: python-checkins at python.org (nick.coghlan) Date: Mon, 9 Apr 2007 07:51:33 +0200 (CEST) Subject: [Python-checkins] r54724 - peps/trunk/pep-0000.txt peps/trunk/pep-3118.txt Message-ID: <20070409055133.DCF741E4009@bag.python.org> Author: nick.coghlan Date: Mon Apr 9 07:51:32 2007 New Revision: 54724 Added: peps/trunk/pep-3118.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Add enhanced buffer interface PEP from Travis Oliphant Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon Apr 9 07:51:32 2007 @@ -116,7 +116,7 @@ S 3114 Renaming iterator.next() to iterator.__next__() Yee S 3116 New I/O Stutzbach, Verdone, GvR S 3117 Postfix Type Declarations Brandl - + S 3118 Revising the buffer protocol Oliphant, Banks Finished PEPs (done, implemented in Subversion) @@ -470,6 +470,7 @@ SA 3115 Metaclasses in Python 3000 Talin S 3116 New I/O Stutzbach, Verdone, GvR S 3117 Postfix Type Declarations Brandl + S 3118 Revising the buffer protocol Oliphant, Banks Key @@ -495,6 +496,7 @@ Altis, Kevin altis at semi-retired.com Ascher, David davida at activestate.com Astrand, Peter astrand at lysator.liu.se + Banks, Carl pythondev at aerojockey.com Barrett, Paul barrett at stsci.edu Batista, Facundo facundo at taniquetil.com.ar Baxter, Anthony anthony at interlink.com.au Added: peps/trunk/pep-3118.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3118.txt Mon Apr 9 07:51:32 2007 @@ -0,0 +1,608 @@ +PEP: 3118 +Title: Revising the buffer protocol +Version: $Revision$ +Last-Modified: $Date$ +Authors: Travis Oliphant , Carl Banks +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 28-Aug-2006 +Python-Version: 3000 + +Abstract +======== + +This PEP proposes re-designing the buffer interface (PyBufferProcs +function pointers) to improve the way Python allows memory sharing +in Python 3.0 + +In particular, it is proposed that the character buffer portion +of the API be elminated and the multiple-segment portion be +re-designed in conjunction with allowing for strided memory +to be shared. In addition, the new buffer interface will +allow the sharing of any multi-dimensional nature of the +memory and what data-format the memory contains. + +This interface will allow any extension module to either +create objects that share memory or create algorithms that +use and manipulate raw memory from arbitrary objects that +export the interface. + + +Rationale +========= + +The Python 2.X buffer protocol allows different Python types to +exchange a pointer to a sequence of internal buffers. This +functionality is *extremely* useful for sharing large segments of +memory between different high-level objects, but it is too limited and +has issues: + +1. There is the little used "sequence-of-segments" option + (bf_getsegcount) that is not well motivated. + +2. There is the apparently redundant character-buffer option + (bf_getcharbuffer) + +3. There is no way for a consumer to tell the buffer-API-exporting + object it is "finished" with its view of the memory and + therefore no way for the exporting object to be sure that it is + safe to reallocate the pointer to the memory that it owns (for + example, the array object reallocating its memory after sharing + it with the buffer object which held the original pointer led + to the infamous buffer-object problem). + +4. Memory is just a pointer with a length. There is no way to + describe what is "in" the memory (float, int, C-structure, etc.) + +5. There is no shape information provided for the memory. But, + several array-like Python types could make use of a standard + way to describe the shape-interpretation of the memory + (wxPython, GTK, pyQT, CVXOPT, PyVox, Audio and Video + Libraries, ctypes, NumPy, data-base interfaces, etc.) + +6. There is no way to share discontiguous memory (except through + the sequence of segments notion). + + There are two widely used libraries that use the concept of + discontiguous memory: PIL and NumPy. Their view of discontiguous + arrays is different, though. The proposed buffer interface allows + sharing of either memory model. Exporters will use only one + approach and consumers may choose to support discontiguous + arrays of each type however they choose. + + NumPy uses the notion of constant striding in each dimension as its + basic concept of an array. With this concept, a simple sub-region + of a larger array can be described without copying the data. T + Thus, stride information is the additional information that must be + shared. + + The PIL uses a more opaque memory representation. Sometimes an + image is contained in a contiguous segment of memory, but sometimes + it is contained in an array of pointers to the contiguous segments + (usually lines) of the image. The PIL is where the idea of multiple + buffer segments in the original buffer interface came from. + + NumPy's strided memory model is used more often in computational + libraries and because it is so simple it makes sense to support + memory sharing using this model. The PIL memory model is sometimes + used in C-code where a 2-d array can be then accessed using double + pointer indirection: e.g. image[i][j]. + + The buffer interface should allow the object to export either of these + memory models. Consumers are free to either require contiguous memory + or write code to handle one or both of these memory models. + +Proposal Overview +================= + +* Eliminate the char-buffer and multiple-segment sections of the + buffer-protocol. + +* Unify the read/write versions of getting the buffer. + +* Add a new function to the interface that should be called when + the consumer object is "done" with the memory area. + +* Add a new variable to allow the interface to describe what is in + memory (unifying what is currently done now in struct and + array) + +* Add a new variable to allow the protocol to share shape information + +* Add a new variable for sharing stride information + +* Add a new mechanism for sharing arrays that must + be accessed using pointer indirection. + +* Fix all objects in the core and the standard library to conform + to the new interface + +* Extend the struct module to handle more format specifiers + +* Extend the buffer object into a new memory object which places + a Python veneer around the buffer interface. + +* Add a few functions to make it easy to copy contiguous data + in and out of object supporting the buffer interface. + +Specification +============= + +While the new specification allows for complicated memory sharing. +Simple contiguous buffers of bytes can still be obtained from an +object. In fact, the new protocol allows a standard mechanism for +doing this even if the original object is not represented as a +contiguous chunk of memory. + +The easiest way is to use the provided C-API to obtain a contiguous +chunk of memory like the old buffer protocol allowed. + + +Change the PyBufferProcs structure to + +:: + + typedef struct { + getbufferproc bf_getbuffer; + releasebufferproc bf_releasebuffer; + } + + +:: + + typedef int (*getbufferproc)(PyObject *obj, struct bufferinfo *view) + +This function returns 0 on success and -1 on failure (and raises an +error). The first variable is the "exporting" object. The second +argument is the address to a bufferinfo structure. If view is NULL, +then no information is returned but a lock on the memory is still +obtained. In this case, releasebuffer should also be called with NULL. + +The bufferinfo structure is:: + + struct bufferinfo { + void *buf; + Py_ssize_t len; + int readonly; + char *format; + int ndims; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + }; + +Upon return from getbufferproc, the bufferinfo structure is filled in +with relevant information about the buffer. This same bufferinfo +structure must be passed to bf_releasebuffer (if available) when the +consumer is done with the memory. The caller is responsible for +keeping a reference to obj until releasebuffer is called. + + +The members of the bufferinfo structure are: + + +buf + a pointer to the start of the memory for the object + +len + the total bytes of memory the object uses. This should be the + same as the product of the shape array multiplied by the number of + bytes per item of memory. + +readonly + an integer variable to hold whether or not the memory is + readonly. 1 means the memory is readonly, zero means the + memory is writeable. + + +format + a format-string (following extended struct syntax) indicating what + is in each element of of memory. The number of elements is len / + itemsize, where itemsize is the number of bytes implied by the + format. For standard unsigned bytes use a format string of "B". + +ndims + a variable storing the number of dimensions the memory represents. + Should be >=0. + +shape + an array of ``Py_ssize_t`` of length ``ndims`` indicating the + shape of the memory as an N-D array. Note that ``((*shape)[0] * + ... * (*shape)[ndims-1])*itemsize = len``. This can be NULL + to indicate 1-d arrays. + +strides + address of a ``Py_ssize_t*`` variable that will be filled with a + pointer to an array of ``Py_ssize_t`` of length ``*ndims`` + indicating the number of bytes to skip to get to the next element + in each dimension. If this is NULL, then the memory is assumed to + be C-style contigous with the last dimension varying the fastest. + +suboffsets + address of a ``Py_ssize_t *`` variable that will be filled with a + pointer to an array of ``Py_ssize_t`` of length ``*ndims``. If + these suboffset numbers are >=0, then the value stored along the + indicated dimension is a pointer and the suboffset value dictates + how many bytes to add to the pointer after de-referencing. A + suboffset value that it negative indicates that no de-referencing + should occur (striding in a contiguous memory block). If all + suboffsets are negative (i.e. no de-referencing is needed, then + this must be NULL. + + For clarity, here is a function that returns a pointer to the + element in an N-D array pointed to by an N-dimesional index when + there are both strides and suboffsets.:: + + void* get_item_pointer(int ndim, void* buf, Py_ssize_t* strides, + Py_ssize_t* suboffsets, Py_ssize_t *indices) { + char* pointer = (char*)buf; + int i; + for (i = 0; i < ndim; i++) { + pointer += strides[i]*indices[i]; + if (suboffsets[i] >=0 ) { + pointer = *((char**)pointer) + suboffsets[i]; + } + } + return (void*)pointer; + } + + Notice the suboffset is added "after" the dereferencing occurs. + Thus slicing in the ith dimension would add to the suboffsets in + the i-1st dimension. Slicing in the first dimension would change + the location of the starting pointer directly (i.e. buf would + be modified). + + +The exporter is responsible for making sure the memory pointed to by +buf, format, shape, strides, and suboffsets is valid until +releasebuffer is called. If the exporter wants to be able to change +shape, strides, and/or suboffsets before releasebuffer is called then +it should allocate those arrays when getbuffer is called and free them +when releasebuffer is called. + + +The same bufferinfo struct should be used in the other buffer +interface call. The caller is responsible for the memory of the +bufferinfo object itself. + +``typedef int (*releasebufferproc)(PyObject *obj, struct bufferinfo *view)`` + Callers of getbufferproc must make sure that this function is + called when memory previously acquired from the object is no + longer needed. The exporter of the interface must make sure that + any memory pointed to in the bufferinfo structure remains valid + until releasebuffer is called. + + Both of these routines are optional for a type object + + If the releasebuffer function is not provided then it does not ever + need to be called. + +Exporters will need to define a releasebuffer function if they can +re-allocate their memory, strides, shape, suboffsets, or format +variables which they might share through the struct bufferinfo. +Several mechanisms could be used to keep track of how many getbuffer +calls have been made and shared. Either a single variable could be +used to keep track of how many "views" have been exported, or a +linked-list of bufferinfo structures filled in could be maintained in +each objet. All that is needed is to ensure that any memory shared +through the bufferinfo structure remains valid until releasebuffer is +called on that memory. + + +New C-API calls are proposed +============================ + +:: + + int PyObject_CheckBuffer(PyObject *obj) + +Return 1 if the getbuffer function is available otherwise 0. + +:: + + PyObject *PyObject_GetBuffer(PyObject *obj) + +Return a memory-view object from an object that defines the buffer interface. +If make_ro is non-zero then request that the memory is made read-only until +release buffer is called. + +A memory-view object is an extended buffer object that should replace +the buffer object in Python 3K. It's C-structure is:: + + typedef struct { + PyObject_HEAD + PyObject *base; + struct bufferinfo view; + int itemsize; + int flags; + } PyMemoryViewObject; + +This is very similar to the current buffer object except offset has +been removed because ptr can just be modified by offset and a single +offset is not sufficient. Also the hash has been removed because +using the buffer object as a hash even if it is read-only is rarely +useful. + +Also, the format, ndims, shape, strides, and suboffsets have been +added. These additions will allow multi-dimensional slicing of the +memory-view object which can be added at some point. This object +always owns it's own shape, strides, and suboffsets arrays and it's +own format string, but always borrows the memory from the object +pointed to by base. + +The itemsize is a convenience and specifies the number of bytes +indicated by the format string if positive. + +This object never reallocates ptr, shape, strides, subboffsets or +format and therefore does not need to keep track of how many views it +has exported. + +It exports a view using the base object. It releases a view by releasing +the view on the base object. Because, it will never re-allocate memory, +it does not need to keep track of how many it has exported but simple +reference counting will suffice. + +:: + + int PyObject_SizeFromFormat(char *) + +Return the implied itemsize of the data-format area from a struct-style +description. + +:: + + int PyObject_GetContiguous(PyObject *obj, void **buf, Py_ssize_t *len, + int fortran) + +Return a contiguous chunk of memory representing the buffer. If a +copy is made then return 1. If no copy was needed return 0. If an +error occurred in probing the buffer interface, then return -1. The +contiguous chunk of memory is pointed to by ``*buf`` and the length of +that memory is ``*len``. If the object is multi-dimensional, then if +fortran is 1, the first dimension of the underlying array will vary +the fastest in the buffer. If fortran is 0, then the last dimension +will vary the fastest (C-style contiguous). If fortran is -1, then it +does not matter and you will get whatever the object decides is easiest. + +:: + + int PyObject_CopyToObject(PyObject *obj, void *buf, Py_ssize_t len, + int fortran) + +Copy ``len`` bytes of data pointed to by the contiguous chunk of +memory pointed to by ``buf`` into the buffer exported by obj. Return +0 on success and return -1 and raise an error on failure. If the +object does not have a writeable buffer, then an error is raised. If +fortran is 1, then if the object is multi-dimensional, then the data +will be copied into the array in Fortran-style (first dimension varies +the fastest). If fortran is 0, then the data will be copied into the +array in C-style (last dimension varies the fastest). If fortran is -1, then +it does not matter and the copy will be made in whatever way is +easiest. + +The last two C-API calls allow a standard way of getting data in and +out of Python objects into contiguous memory areas no matter how it is +actually stored. These calls use the extended buffer interface to perform +their work. + +:: + + int PyObject_IsContiguous(struct bufferinfo *view); + +Return 1 if the memory defined by the view object is C-style +contiguous. Return 0 otherwise. + +:: + + void PyObject_FillContiguousStrides(int *ndims, Py_ssize_t *shape, + int itemsize, + Py_ssize_t *strides) + +Fill the strides array with byte-strides of a contiguous array of the +given shape with the given number of bytes per element. + + + +Additions to the struct string-syntax +===================================== + +The struct string-syntax is missing some characters to fully +implement data-format descriptions already available elsewhere (in +ctypes and NumPy for example). The Python 2.5 specification is +at http://docs.python.org/lib/module-struct.html + +Here are the proposed additions: + + +================ =========== +Character Description +================ =========== +'t' bit (number before states how many bits) +'?' platform _Bool type +'g' long double +'c' ucs-1 (latin-1) encoding +'u' ucs-2 +'w' ucs-4 +'O' pointer to Python Object +'Z' complex (whatever the next specifier is) +'&' specific pointer (prefix before another charater) +'T{}' structure (detailed layout inside {}) +'(k1,k2,...,kn)' multi-dimensional array of whatever follows +':name:' optional name of the preceeding element +'X{}' pointer to a function (optional function + signature inside {}) +' ' ignored (allow better readability) +================ =========== + +The struct module will be changed to understand these as well and +return appropriate Python objects on unpacking. Un-packing a +long-double will return a decimal object. Unpacking 'u' or +'w' will return Python unicode. Unpacking a multi-dimensional +array will return a list of lists. Un-packing a pointer will +return a ctypes pointer object. Un-packing a bit will return a +Python Bool. Spaces in the struct-string syntax will be ignored. +Unpacking a named-object will return a Python class with attributes +having those names. + +Endian-specification ('=','>','<') is also allowed inside the +string so that it can change if needed. The previously-specified +endian string is in force until changed. The default endian is '='. + +According to the struct-module, a number can preceed a character +code to specify how many of that type there are. The +(k1,k2,...,kn) extension also allows specifying if the data is +supposed to be viewed as a (C-style contiguous, last-dimension +varies the fastest) multi-dimensional array of a particular format. + +Functions should be added to ctypes to create a ctypes object from +a struct description, and add long-double, and ucs-2 to ctypes. + +Examples of Data-Format Descriptions +==================================== + +Here are some examples of C-structures and how they would be +represented using the struct-style syntax: + +float + 'f' +complex double + 'Zd' +RGB Pixel data + 'BBB' or 'B:r: B:g: B:b:' +Mixed endian (weird but possible) + '>i:big: buf = self->lines; + view->len = self->height*self->width; + view->readonly = 0; + view->ndims = 2; + self->shape_array[0] = height; + self->shape_array[1] = width; + view->shape = &self->shape_array; + self->stride_array[0] = sizeof(struct rgba*); + self->stride_array[1] = sizeof(struct rgba); + view->strides = &self->stride_array; + view->suboffsets = suboffsets; + + self->view_count ++; + + return 0; + } + + + int Image_releasebuffer(PyObject *self, struct bufferinfo *view) { + self->view_count--; + return 0; + } + + + +Copyright +========= + +This PEP is placed in the public domain + From nnorwitz at gmail.com Mon Apr 9 10:13:17 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 9 Apr 2007 04:13:17 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070409081317.GA30819@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482115 refs] From python-checkins at python.org Mon Apr 9 11:03:04 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 9 Apr 2007 11:03:04 +0200 (CEST) Subject: [Python-checkins] r54725 - peps/trunk/pep-3117.txt Message-ID: <20070409090304.42F2E1E400A@bag.python.org> Author: georg.brandl Date: Mon Apr 9 11:03:03 2007 New Revision: 54725 Modified: peps/trunk/pep-3117.txt (contents, props changed) Log: Add missing keywords. Modified: peps/trunk/pep-3117.txt ============================================================================== --- peps/trunk/pep-3117.txt (original) +++ peps/trunk/pep-3117.txt Mon Apr 9 11:03:03 2007 @@ -1,7 +1,7 @@ PEP: 3117 Title: Postfix type declarations -Version: $Revision: $ -Last-Modified: $Date: $ +Version: $Revision$ +Last-Modified: $Date$ Author: Georg Brandl Status: Draft Type: Standards Track From python-checkins at python.org Mon Apr 9 18:16:14 2007 From: python-checkins at python.org (vinay.sajip) Date: Mon, 9 Apr 2007 18:16:14 +0200 (CEST) Subject: [Python-checkins] r54726 - python/trunk/Lib/logging/handlers.py Message-ID: <20070409161614.8446F1E400A@bag.python.org> Author: vinay.sajip Date: Mon Apr 9 18:16:10 2007 New Revision: 54726 Modified: python/trunk/Lib/logging/handlers.py Log: Added optional timeout to SocketHandler.makeSocket (SF #1695948) Modified: python/trunk/Lib/logging/handlers.py ============================================================================== --- python/trunk/Lib/logging/handlers.py (original) +++ python/trunk/Lib/logging/handlers.py Mon Apr 9 18:16:10 2007 @@ -361,12 +361,14 @@ self.retryMax = 30.0 self.retryFactor = 2.0 - def makeSocket(self): + def makeSocket(self, timeout=1): """ A factory method which allows subclasses to define the precise type of socket they want. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if hasattr(s, 'settimeout'): + s.settimeout(timeout) s.connect((self.host, self.port)) return s From buildbot at python.org Mon Apr 9 18:42:04 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Apr 2007 16:42:04 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070409164204.875751E400A@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/449 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,vinay.sajip Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Apr 9 21:10:31 2007 From: python-checkins at python.org (ziga.seilnacht) Date: Mon, 9 Apr 2007 21:10:31 +0200 (CEST) Subject: [Python-checkins] r54727 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070409191031.E9D7C1E4014@bag.python.org> Author: ziga.seilnacht Date: Mon Apr 9 21:10:29 2007 New Revision: 54727 Modified: python/trunk/Lib/test/test_urllib.py Log: Patch #1695862: remove old test directory that causes test_urllib failures on Windows buildbots. The change is a one time fix and will be removed after a successful buildbot run. Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Mon Apr 9 21:10:29 2007 @@ -547,6 +547,20 @@ def test_main(): + # cleanup old test dir on Windows buildbots + old_test_path = test_support.TESTFN + ".2" + if os.path.isdir(old_test_path): + for root, dirs, files in os.walk(old_test_path, topdown=False): + for name in files: + os.remove(os.path.join(root, name)) + for name in dirs: + dirname = os.path.join(root, name) + if not os.path.islink(dirname): + os.rmdir(dirname) + else: + os.remove(dirname) + os.rmdir(old_test_path) + test_support.run_unittest( urlopen_FileTests, urlopen_HttpTests, From nnorwitz at gmail.com Mon Apr 9 22:13:44 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 9 Apr 2007 16:13:44 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070409201344.GA19138@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 117, in testBasic self.assertEqual(i, "Foo\n") AssertionError: 'ERRO' != 'Foo\n' test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort Exception in thread Thread-43: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 163, in run self.s.stdin.write(l) IOError: [Errno 32] Broken pipe test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_socket_ssl 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482130 refs] From python-checkins at python.org Tue Apr 10 05:00:43 2007 From: python-checkins at python.org (facundo.batista) Date: Tue, 10 Apr 2007 05:00:43 +0200 (CEST) Subject: [Python-checkins] r54729 - python/trunk/Lib/test/test_socket_ssl.py Message-ID: <20070410030043.DBDED1E400D@bag.python.org> Author: facundo.batista Date: Tue Apr 10 05:00:37 2007 New Revision: 54729 Modified: python/trunk/Lib/test/test_socket_ssl.py Log: Minor fix to the tests pass ok even with -O. Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Tue Apr 10 05:00:37 2007 @@ -150,7 +150,8 @@ s = socket.socket() s.connect(("localhost", 4433)) s.close() - assert self.s.stdout.readline() == "ERROR\n" + if self.s.stdout.readline() != "ERROR\n": + raise ValuError except: self.haveServer = False else: From facundobatista at gmail.com Tue Apr 10 05:29:06 2007 From: facundobatista at gmail.com (Facundo Batista) Date: Tue, 10 Apr 2007 00:29:06 -0300 Subject: [Python-checkins] Python Regression Test Failures opt (1) In-Reply-To: References: <20070406081355.GA24121@python.psfb.org> Message-ID: 2007/4/8, Neal Norwitz : > Note: the machine that runs this is also one of the buildbots. The > difference is that this is run in opt (ie, -O) mode. This script is > Misc/build.sh. The relevant lines are: > $PYTHON -O $REGRTEST_ARGS >& build/$F > > Which the only thing that's of interest is that python is run with -O. > Hopefully if you run the test with -O you will be able to reproduce Aha! It was an assert, that as wasn't being used, just skipped an important readline(). Failed also in my machine when running with -O. Changed it, commited it. I see everything OK. Could you p-p-please check again? Regards, -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ From python-checkins at python.org Tue Apr 10 06:44:54 2007 From: python-checkins at python.org (collin.winter) Date: Tue, 10 Apr 2007 06:44:54 +0200 (CEST) Subject: [Python-checkins] r54730 - python/trunk/Lib/test/test_socket_ssl.py Message-ID: <20070410044454.248981E400D@bag.python.org> Author: collin.winter Date: Tue Apr 10 06:44:49 2007 New Revision: 54730 Modified: python/trunk/Lib/test/test_socket_ssl.py Log: Typo fix. Modified: python/trunk/Lib/test/test_socket_ssl.py ============================================================================== --- python/trunk/Lib/test/test_socket_ssl.py (original) +++ python/trunk/Lib/test/test_socket_ssl.py Tue Apr 10 06:44:49 2007 @@ -151,7 +151,7 @@ s.connect(("localhost", 4433)) s.close() if self.s.stdout.readline() != "ERROR\n": - raise ValuError + raise ValueError except: self.haveServer = False else: From python-checkins at python.org Tue Apr 10 11:45:07 2007 From: python-checkins at python.org (nick.coghlan) Date: Tue, 10 Apr 2007 11:45:07 +0200 (CEST) Subject: [Python-checkins] r54731 - peps/trunk/pep-3118.txt Message-ID: <20070410094507.510E81E400D@bag.python.org> Author: nick.coghlan Date: Tue Apr 10 11:45:04 2007 New Revision: 54731 Modified: peps/trunk/pep-3118.txt Log: PEP 3118 updates from Travis Modified: peps/trunk/pep-3118.txt ============================================================================== --- peps/trunk/pep-3118.txt (original) +++ peps/trunk/pep-3118.txt Tue Apr 10 11:45:04 2007 @@ -135,8 +135,8 @@ doing this even if the original object is not represented as a contiguous chunk of memory. -The easiest way is to use the provided C-API to obtain a contiguous -chunk of memory like the old buffer protocol allowed. +The easiest way to obtain a simple contiguous chunk of memory is +to use the provided C-API to obtain a chunk of memory. Change the PyBufferProcs structure to @@ -151,13 +151,64 @@ :: - typedef int (*getbufferproc)(PyObject *obj, struct bufferinfo *view) + typedef int (*getbufferproc)(PyObject *obj, struct bufferinfo *view, int flags) This function returns 0 on success and -1 on failure (and raises an error). The first variable is the "exporting" object. The second argument is the address to a bufferinfo structure. If view is NULL, then no information is returned but a lock on the memory is still -obtained. In this case, releasebuffer should also be called with NULL. +obtained. In this case, the corresponding releasebuffer should also +be called with NULL. + +The third argument indicates what kind of buffer the exporter is allowed to return. It tells the +exporter what elements the bufferinfo structure the consumer is going to make use of. This +allows the exporter to simplify and/or raise an error if it can't support the operation. + +It also allows the caller to make a request for a simple "view" and +receive it or have an error raised if it's not possible. + +All of the following assume that at least buf, len, and readonly will be +utilized by the caller. + + Py_BUF_SIMPLE + The returned buffer will only be assumed to be readable (the object + may or may not have writeable memory). Only the buf, len, and + readonly variables may be accessed. The format will be + assumed to be unsigned bytes. This is a "stand-alone" flag constant. + It never needs to be \|'d to the others. + + Py_BUF_WRITEABLE + The returned buffer must be writeable. If it cannot be, then raise an error. + + Py_BUF_READONLY + The returned buffer must be readonly and the underlying object should make + its memory readonly if that is possible. + + Py_BUF_FORMAT + The consumer will be using the format string information so make sure that + member is filled correctly. + + Py_BUF_SHAPE + The consumer can (and might) make use of using the ndims and shape members of the structure + so make sure they are filled in correctly. + + Py_BUF_STRIDES (implies SHAPE) + The consumer can (and might) make use of the strides member of the structure (as well + as ndims and shape) + + Py_BUF_OFFSETS (implies STRIDES) + The consumer can (and might) make use of the suboffsets member (as well as + ndims, shape, and strides) + +Thus, the consumer simply wanting an contiguous chunk of bytes from +the object would use Py_BUF_SIMPLE, while a consumer that understands +how to make use of the most complicated cases would use +Py_BUF_OFFSETS. + +There is a C-API that simple exporting objects can use to fill-in the +buffer info structure correctly according to the provided flags if a +contiguous chunk of memory is all that can be exported. + The bufferinfo structure is:: @@ -170,18 +221,19 @@ Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; + void *internal; }; -Upon return from getbufferproc, the bufferinfo structure is filled in +Before calling this function, the bufferinfo structure can be filled with +whatever. Upon return from getbufferproc, the bufferinfo structure is filled in with relevant information about the buffer. This same bufferinfo structure must be passed to bf_releasebuffer (if available) when the consumer is done with the memory. The caller is responsible for -keeping a reference to obj until releasebuffer is called. - +keeping a reference to obj until releasebuffer is called (i.e. this +call does not alter the reference count of obj). The members of the bufferinfo structure are: - buf a pointer to the start of the memory for the object @@ -195,29 +247,28 @@ readonly. 1 means the memory is readonly, zero means the memory is writeable. - -format - a format-string (following extended struct syntax) indicating what - is in each element of of memory. The number of elements is len / - itemsize, where itemsize is the number of bytes implied by the - format. For standard unsigned bytes use a format string of "B". +format + a NULL-terminated format-string (following the struct-style syntax + including extensions) indicating what is in each element of + memory. The number of elements is len / itemsize, where itemsize + is the number of bytes implied by the format. For standard + unsigned bytes use a format string of "B". ndims a variable storing the number of dimensions the memory represents. - Should be >=0. + Must be >=0. shape an array of ``Py_ssize_t`` of length ``ndims`` indicating the shape of the memory as an N-D array. Note that ``((*shape)[0] * - ... * (*shape)[ndims-1])*itemsize = len``. This can be NULL - to indicate 1-d arrays. + ... * (*shape)[ndims-1])*itemsize = len``. strides address of a ``Py_ssize_t*`` variable that will be filled with a pointer to an array of ``Py_ssize_t`` of length ``*ndims`` indicating the number of bytes to skip to get to the next element - in each dimension. If this is NULL, then the memory is assumed to - be C-style contigous with the last dimension varying the fastest. + in each dimension. For C-style contiguous arrays (where the + last-dimension varies the fastest) this must be filled in. suboffsets address of a ``Py_ssize_t *`` variable that will be filled with a @@ -249,22 +300,30 @@ Notice the suboffset is added "after" the dereferencing occurs. Thus slicing in the ith dimension would add to the suboffsets in - the i-1st dimension. Slicing in the first dimension would change + the (i-1)st dimension. Slicing in the first dimension would change the location of the starting pointer directly (i.e. buf would be modified). + +internal + This is for use internally by the exporting object. For example, + this might be re-cast as an integer by the exporter and used to + store flags about whether or not the shape, strides, and suboffsets + arrays must be freed when the buffer is released. The consumer + should never touch this value. The exporter is responsible for making sure the memory pointed to by buf, format, shape, strides, and suboffsets is valid until releasebuffer is called. If the exporter wants to be able to change shape, strides, and/or suboffsets before releasebuffer is called then -it should allocate those arrays when getbuffer is called and free them -when releasebuffer is called. +it should allocate those arrays when getbuffer is called (pointing to +them in the buffer-info structure provided) and free them when +releasebuffer is called. -The same bufferinfo struct should be used in the other buffer +The same bufferinfo struct should be used in the release-buffer interface call. The caller is responsible for the memory of the -bufferinfo object itself. +bufferinfo structure itself. ``typedef int (*releasebufferproc)(PyObject *obj, struct bufferinfo *view)`` Callers of getbufferproc must make sure that this function is @@ -285,9 +344,11 @@ calls have been made and shared. Either a single variable could be used to keep track of how many "views" have been exported, or a linked-list of bufferinfo structures filled in could be maintained in -each objet. All that is needed is to ensure that any memory shared -through the bufferinfo structure remains valid until releasebuffer is -called on that memory. +each object. + +All that is specifically required by the exporter, however, is to +ensure that any memory shared through the bufferinfo structure remains +valid until releasebuffer is called on the bufferinfo structure. New C-API calls are proposed @@ -301,7 +362,25 @@ :: - PyObject *PyObject_GetBuffer(PyObject *obj) + int PyObject_GetBuffer(PyObject *obj, struct bufferinfo *view, int flags) + +This is a C-API version of the getbuffer function call. It checks to +make sure object has the required function pointer and issues the +call. Returns -1 and raises an error on failure and returns 0 on +success. + +:: + + int PyObject_ReleaseBuffer(PyObject *obj, struct bufferinfo *view) + +This is a C-API version of the releasebuffer function call. It checks to +make sure the object has the required function pointer and issues the call. Returns 0 +on success and -1 (with an error raised) on failure. This function always +succeeds if there is no releasebuffer function for the object. + +:: + + PyObject *PyObject_GetMemoryView(PyObject *obj) Return a memory-view object from an object that defines the buffer interface. If make_ro is non-zero then request that the memory is made read-only until @@ -320,9 +399,9 @@ This is very similar to the current buffer object except offset has been removed because ptr can just be modified by offset and a single -offset is not sufficient. Also the hash has been removed because -using the buffer object as a hash even if it is read-only is rarely -useful. +offset is not sufficient for the sub-offsets. Also the hash has been +removed because using the buffer object as a hash even if it is +read-only is rarely useful. Also, the format, ndims, shape, strides, and suboffsets have been added. These additions will allow multi-dimensional slicing of the @@ -338,10 +417,10 @@ format and therefore does not need to keep track of how many views it has exported. -It exports a view using the base object. It releases a view by releasing -the view on the base object. Because, it will never re-allocate memory, -it does not need to keep track of how many it has exported but simple -reference counting will suffice. +It exports a view using the base object. It releases a view by +releasing the view on the base object. Because, it will never +re-allocate memory, it does not need to keep track of how many it has +exported but simple reference counting will suffice. :: @@ -363,7 +442,8 @@ fortran is 1, the first dimension of the underlying array will vary the fastest in the buffer. If fortran is 0, then the last dimension will vary the fastest (C-style contiguous). If fortran is -1, then it -does not matter and you will get whatever the object decides is easiest. +does not matter and you will get whatever the object decides is more +efficient. :: @@ -378,8 +458,8 @@ will be copied into the array in Fortran-style (first dimension varies the fastest). If fortran is 0, then the data will be copied into the array in C-style (last dimension varies the fastest). If fortran is -1, then -it does not matter and the copy will be made in whatever way is -easiest. +it does not matter and the copy will be made in whatever way is more +efficient. The last two C-API calls allow a standard way of getting data in and out of Python objects into contiguous memory areas no matter how it is @@ -388,20 +468,29 @@ :: - int PyObject_IsContiguous(struct bufferinfo *view); + int PyObject_IsContiguous(struct bufferinfo *view, int fortran); -Return 1 if the memory defined by the view object is C-style -contiguous. Return 0 otherwise. +Return 1 if the memory defined by the view object is C-style (fortran = 0) +or Fortran-style (fortran = 1) contiguous. Return 0 otherwise. :: void PyObject_FillContiguousStrides(int *ndims, Py_ssize_t *shape, int itemsize, - Py_ssize_t *strides) + Py_ssize_t *strides, int fortran) -Fill the strides array with byte-strides of a contiguous array of the -given shape with the given number of bytes per element. +Fill the strides array with byte-strides of a contiguous (C-style if +fortran is 0 or Fortran-style if fortran is 1) array of the given +shape with the given number of bytes per element. + +:: + int PyObject_FillBufferInfo(struct bufferinfo *view, void *buf, Py_ssize_t len, + int readonly, int infoflags) + +Fills in a buffer-info structure correctly for an exporter that can only share +a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success +and -1 (with raising an error) on error Additions to the struct string-syntax @@ -432,18 +521,18 @@ ':name:' optional name of the preceeding element 'X{}' pointer to a function (optional function signature inside {}) -' ' ignored (allow better readability) +' \n\t' ignored (allow better readability) -- this may already be true ================ =========== The struct module will be changed to understand these as well and return appropriate Python objects on unpacking. Un-packing a -long-double will return a decimal object. Unpacking 'u' or -'w' will return Python unicode. Unpacking a multi-dimensional -array will return a list of lists. Un-packing a pointer will -return a ctypes pointer object. Un-packing a bit will return a -Python Bool. Spaces in the struct-string syntax will be ignored. -Unpacking a named-object will return a Python class with attributes -having those names. +long-double will return a decimal object or a ctypes long-double. +Unpacking 'u' or 'w' will return Python unicode. Unpacking a +multi-dimensional array will return a list of lists. Un-packing a +pointer will return a ctypes pointer object. Un-packing a bit will +return a Python Bool. Spaces in the struct-string syntax will be +ignored. Unpacking a named-object will return a Python class with +attributes having those names. Endian-specification ('=','>','<') is also allowed inside the string so that it can change if needed. The previously-specified @@ -483,7 +572,13 @@ unsigned char cval; } sub; } - 'i:ival: T{H:sval: B:bval: B:cval:}:sub:' + """i:ival: + T{ + H:sval: + B:bval: + B:cval: + }:sub: + """ Nested array :: @@ -493,6 +588,7 @@ } 'i:ival: (16,4)d:data:' + Code to be affected =================== @@ -513,6 +609,10 @@ Issues and Details ================== +It is intended that this PEP will be back-ported to Python 2.6 by +adding the C-API and the two functions to the existing buffer +protocol. + The proposed locking mechanism relies entirely on the exporter object to not invalidate any of the memory pointed to by the buffer structure until a corresponding releasebuffer is called. If it wants to be able @@ -527,7 +627,7 @@ because strided memory is very common when interfacing with compute libraries. -Also with this approach it should be possible to write generic code +Also, with this approach it should be possible to write generic code that works with both kinds of memory. Memory management of the format string, the shape array, the strides @@ -535,6 +635,20 @@ the responsibility of the exporting object. The consumer should not set these pointers to any other memory or try to free them. +Several ideas were discussed and rejected: + + Having a "releaser" object whose release-buffer was called. This + was deemed unacceptable because it caused the protocol to be + asymmetric (you called release on something different than you + "got" the buffer from). It also complicated the protocol without + providing a real benefit. + + Passing all the struct variables separately into the function. + This had the advantage that it allowed one to set NULL to + variables that were not of interest, but it also made the function + call more difficult. The flags variable allows the same + ability of consumers to be "simple" in how they call the protocol. + Code ======== @@ -542,6 +656,8 @@ this proposal but will welcome any help. + + Examples ========= @@ -572,7 +688,7 @@ So what does ImageObject's getbuffer do? Leaving error checking out:: - int Image_getbuffer(PyObject *self, struct bufferinfo *view) { + int Image_getbuffer(PyObject *self, struct bufferinfo *view, int flags) { static Py_ssize_t suboffsets[2] = { -1, 0 }; @@ -600,6 +716,58 @@ } +Ex. 2 +----------- + +This example shows how an object that wants to expose a contiguous +chunk of memory (which will never be re-allocated while the object is +alive) would do that.:: + + int myobject_getbuffer(PyObject *self, struct bufferinfo *view, int flags) { + + void *buf; + Py_ssize_t len; + int readonly=0; + + buf = /* Point to buffer */ + len = /* Set to size of buffer */ + readonly = /* Set to 1 if readonly */ + + return PyObject_FillBufferInfo(view, buf, len, readonly, flags); + } + + /* No releasebuffer is necessary because the memory will never + be re-allocated so the locking mechanism is not needed + */ + +Ex. 3 +----------- + +A consumer that wants to only get a simple contiguous chunk of bytes +from a Python object, obj would do the following:: + + + struct bufferinfo view; + int ret; + + if (PyObject_GetBuffer(obj, &view, Py_BUF_SIMPLE) < 0) { + /* error return */ + } + + /* Now, view.buf is the pointer to memory + view.len is the length + view.readonly is whether or not the memory is read-only. + */ + + + /* After using the information and you don't need it anymore */ + + if (PyObject_ReleaseBuffer(obj, &view) < 0) { + /* error return */ + } + + + Copyright ========= From python-checkins at python.org Tue Apr 10 14:58:49 2007 From: python-checkins at python.org (facundo.batista) Date: Tue, 10 Apr 2007 14:58:49 +0200 (CEST) Subject: [Python-checkins] r54732 - python/trunk/Lib/decimal.py Message-ID: <20070410125849.EB6091E400D@bag.python.org> Author: facundo.batista Date: Tue Apr 10 14:58:45 2007 New Revision: 54732 Modified: python/trunk/Lib/decimal.py Log: General clean-up. Lot of margin corrections, comments, some typos. Exceptions now are raised in the new style. And a mockup class is now also new style. Thanks Santiago Pereson. Modified: python/trunk/Lib/decimal.py ============================================================================== --- python/trunk/Lib/decimal.py (original) +++ python/trunk/Lib/decimal.py Tue Apr 10 14:58:45 2007 @@ -29,8 +29,8 @@ Decimal floating point has finite precision with arbitrarily large bounds. -The purpose of the module is to support arithmetic using familiar -"schoolhouse" rules and to avoid the some of tricky representation +The purpose of this module is to support arithmetic using familiar +"schoolhouse" rules and to avoid some of the tricky representation issues associated with binary floating point. The package is especially useful for financial applications or for contexts where users have expectations that are at odds with binary floating point (for instance, @@ -136,7 +136,7 @@ import copy as _copy -#Rounding +# Rounding ROUND_DOWN = 'ROUND_DOWN' ROUND_HALF_UP = 'ROUND_HALF_UP' ROUND_HALF_EVEN = 'ROUND_HALF_EVEN' @@ -145,11 +145,11 @@ ROUND_UP = 'ROUND_UP' ROUND_HALF_DOWN = 'ROUND_HALF_DOWN' -#Rounding decision (not part of the public API) +# Rounding decision (not part of the public API) NEVER_ROUND = 'NEVER_ROUND' # Round in division (non-divmod), sqrt ONLY ALWAYS_ROUND = 'ALWAYS_ROUND' # Every operation rounds at end. -#Errors +# Errors class DecimalException(ArithmeticError): """Base exception class. @@ -179,9 +179,9 @@ This occurs and signals clamped if the exponent of a result has been altered in order to fit the constraints of a specific concrete - representation. This may occur when the exponent of a zero result would - be outside the bounds of a representation, or when a large normal - number would have an encoded exponent that cannot be represented. In + representation. This may occur when the exponent of a zero result would + be outside the bounds of a representation, or when a large normal + number would have an encoded exponent that cannot be represented. In this latter case, the exponent is reduced to fit and the corresponding number of zero digits are appended to the coefficient ("fold-down"). """ @@ -194,8 +194,8 @@ Something creates a signaling NaN -INF + INF - 0 * (+-)INF - (+-)INF / (+-)INF + 0 * (+-)INF + (+-)INF / (+-)INF x % 0 (+-)INF % x x._rescale( non-integer ) @@ -207,7 +207,7 @@ """ def handle(self, context, *args): if args: - if args[0] == 1: #sNaN, must drop 's' but keep diagnostics + if args[0] == 1: # sNaN, must drop 's' but keep diagnostics return Decimal( (args[1]._sign, args[1]._int, 'n') ) return NaN @@ -216,11 +216,11 @@ This occurs and signals invalid-operation if an string is being converted to a number and it does not conform to the numeric string - syntax. The result is [0,qNaN]. + syntax. The result is [0,qNaN]. """ def handle(self, context, *args): - return (0, (0,), 'n') #Passed to something which uses a tuple. + return (0, (0,), 'n') # Passed to something which uses a tuple. class DivisionByZero(DecimalException, ZeroDivisionError): """Division by 0. @@ -245,7 +245,7 @@ This occurs and signals invalid-operation if the integer result of a divide-integer or remainder operation had too many digits (would be - longer than precision). The result is [0,qNaN]. + longer than precision). The result is [0,qNaN]. """ def handle(self, context, *args): @@ -256,12 +256,12 @@ This occurs and signals invalid-operation if division by zero was attempted (during a divide-integer, divide, or remainder operation), and - the dividend is also zero. The result is [0,qNaN]. + the dividend is also zero. The result is [0,qNaN]. """ def handle(self, context, tup=None, *args): if tup is not None: - return (NaN, NaN) #for 0 %0, 0 // 0 + return (NaN, NaN) # for 0 %0, 0 // 0 return NaN class Inexact(DecimalException): @@ -269,7 +269,7 @@ This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded and any discarded digits - were non-zero), or if an overflow or underflow condition occurs. The + were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The inexact signal may be tested (or trapped) to determine if a given @@ -281,11 +281,11 @@ """Invalid context. Unknown rounding, for example. This occurs and signals invalid-operation if an invalid context was - detected during an operation. This can occur if contexts are not checked + detected during an operation. This can occur if contexts are not checked on creation and either the precision exceeds the capability of the underlying concrete representation or an unknown or unsupported rounding - was specified. These aspects of the context need only be checked when - the values are required to be used. The result is [0,qNaN]. + was specified. These aspects of the context need only be checked when + the values are required to be used. The result is [0,qNaN]. """ def handle(self, context, *args): @@ -296,7 +296,7 @@ This occurs and signals rounded whenever the result of an operation is rounded (that is, some zero or non-zero digits were discarded from the - coefficient), or if an overflow or underflow condition occurs. The + coefficient), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The rounded signal may be tested (or trapped) to determine if a given @@ -309,7 +309,7 @@ This occurs and signals subnormal whenever the result of a conversion or operation is subnormal (that is, its adjusted exponent is less than - Emin, before any rounding). The result in all cases is unchanged. + Emin, before any rounding). The result in all cases is unchanged. The subnormal signal may be tested (or trapped) to determine if a given or operation (or sequence of operations) yielded a subnormal result. @@ -328,13 +328,13 @@ For round-half-up and round-half-even (and for round-half-down and round-up, if implemented), the result of the operation is [sign,inf], - where sign is the sign of the intermediate result. For round-down, the + where sign is the sign of the intermediate result. For round-down, the result is the largest finite number that can be represented in the - current precision, with the sign of the intermediate result. For + current precision, with the sign of the intermediate result. For round-ceiling, the result is the same as for round-down if the sign of - the intermediate result is 1, or is [0,inf] otherwise. For round-floor, + the intermediate result is 1, or is [0,inf] otherwise. For round-floor, the result is the same as for round-down if the sign of the intermediate - result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded + result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded will also be raised. """ @@ -360,10 +360,10 @@ This occurs and signals underflow if a result is inexact and the adjusted exponent of the result would be smaller (more negative) than the smallest value that can be handled by the implementation (the value - Emin). That is, the result is both inexact and subnormal. + Emin). That is, the result is both inexact and subnormal. The result after an underflow will be a subnormal number rounded, if - necessary, so that its exponent is not less than Etiny. This may result + necessary, so that its exponent is not less than Etiny. This may result in 0 with the sign of the intermediate result and an exponent of Etiny. In all cases, Inexact, Rounded, and Subnormal will also be raised. @@ -379,7 +379,7 @@ DivisionUndefined:InvalidOperation, InvalidContext:InvalidOperation} -##### Context Functions ####################################### +##### Context Functions ################################################## # The getcontext() and setcontext() function manage access to a thread-local # current context. Py2.4 offers direct support for thread locals. If that @@ -392,7 +392,7 @@ except ImportError: # Python was compiled without threads; create a mock object instead import sys - class MockThreading: + class MockThreading(object): def local(self, sys=sys): return sys.modules[__name__] threading = MockThreading() @@ -403,8 +403,8 @@ except AttributeError: - #To fix reloading, force it to create a new context - #Old contexts have different exceptions in their dicts, making problems. + # To fix reloading, force it to create a new context + # Old contexts have different exceptions in their dicts, making problems. if hasattr(threading.currentThread(), '__decimal_context__'): del threading.currentThread().__decimal_context__ @@ -469,14 +469,14 @@ ctx.prec += 2 # Rest of sin calculation algorithm # uses a precision 2 greater than normal - return +s # Convert result to normal precision + return +s # Convert result to normal precision def sin(x): with localcontext(ExtendedContext): # Rest of sin calculation algorithm # uses the Extended Context from the # General Decimal Arithmetic Specification - return +s # Convert result to normal context + return +s # Convert result to normal context """ # The string below can't be included in the docstring until Python 2.6 @@ -502,7 +502,7 @@ return _ContextManager(ctx) -##### Decimal class ########################################### +##### Decimal class ####################################################### class Decimal(object): """Floating point class for decimal arithmetic.""" @@ -518,7 +518,7 @@ >>> Decimal('3.14') # string input Decimal("3.14") - >>> Decimal((0, (3, 1, 4), -2)) # tuple input (sign, digit_tuple, exponent) + >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal("3.14") >>> Decimal(314) # int or long Decimal("314") @@ -557,13 +557,13 @@ # tuple/list conversion (possibly from as_tuple()) if isinstance(value, (list,tuple)): if len(value) != 3: - raise ValueError, 'Invalid arguments' + raise ValueError('Invalid arguments') if value[0] not in (0,1): - raise ValueError, 'Invalid sign' + raise ValueError('Invalid sign') for digit in value[1]: if not isinstance(digit, (int,long)) or digit < 0: - raise ValueError, "The second value in the tuple must be composed of non negative integer elements." - + raise ValueError("The second value in the tuple must be" + "composed of non negative integer elements.") self._sign = value[0] self._int = tuple(value[1]) if value[2] in ('F','n','N'): @@ -596,22 +596,23 @@ if _isnan(value): sig, sign, diag = _isnan(value) self._is_special = True - if len(diag) > context.prec: #Diagnostic info too long + if len(diag) > context.prec: # Diagnostic info too long self._sign, self._int, self._exp = \ context._raise_error(ConversionSyntax) return self if sig == 1: - self._exp = 'n' #qNaN - else: #sig == 2 - self._exp = 'N' #sNaN + self._exp = 'n' # qNaN + else: # sig == 2 + self._exp = 'N' # sNaN self._sign = sign - self._int = tuple(map(int, diag)) #Diagnostic info + self._int = tuple(map(int, diag)) # Diagnostic info return self try: self._sign, self._int, self._exp = _string2exact(value) except ValueError: self._is_special = True - self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) + self._sign, self._int, self._exp = \ + context._raise_error(ConversionSyntax) return self raise TypeError("Cannot convert %r to Decimal" % value) @@ -694,15 +695,15 @@ if self._is_special or other._is_special: ans = self._check_nans(other, context) if ans: - return 1 # Comparison involving NaN's always reports self > other + return 1 # Comparison involving NaN's always reports self > other # INF = INF return cmp(self._isinfinity(), other._isinfinity()) if not self and not other: - return 0 #If both 0, sign comparison isn't certain. + return 0 # If both 0, sign comparison isn't certain. - #If different signs, neg one is less + # If different signs, neg one is less if other._sign < self._sign: return -1 if self._sign < other._sign: @@ -713,7 +714,7 @@ if self_adjusted == other_adjusted and \ self._int + (0,)*(self._exp - other._exp) == \ other._int + (0,)*(other._exp - self._exp): - return 0 #equal, except in precision. ([0]*(-x) = []) + return 0 # equal, except in precision. ([0]*(-x) = []) elif self_adjusted > other_adjusted and self._int[0] != 0: return (-1)**self._sign elif self_adjusted < other_adjusted and other._int[0] != 0: @@ -724,7 +725,7 @@ context = getcontext() context = context._shallow_copy() - rounding = context._set_rounding(ROUND_UP) #round away from 0 + rounding = context._set_rounding(ROUND_UP) # round away from 0 flags = context._ignore_all_flags() res = self.__sub__(other, context=context) @@ -762,7 +763,7 @@ if other is NotImplemented: return other - #compare(NaN, NaN) = NaN + # Compare(NaN, NaN) = NaN if (self._is_special or other and other._is_special): ans = self._check_nans(other, context) if ans: @@ -823,11 +824,11 @@ tmp = map(str, self._int) numdigits = len(self._int) leftdigits = self._exp + numdigits - if eng and not self: #self = 0eX wants 0[.0[0]]eY, not [[0]0]0eY - if self._exp < 0 and self._exp >= -6: #short, no need for e/E + if eng and not self: # self = 0eX wants 0[.0[0]]eY, not [[0]0]0eY + if self._exp < 0 and self._exp >= -6: # short, no need for e/E s = '-'*self._sign + '0.' + '0'*(abs(self._exp)) return s - #exp is closest mult. of 3 >= self._exp + # exp is closest mult. of 3 >= self._exp exp = ((self._exp - 1)// 3 + 1) * 3 if exp != self._exp: s = '0.'+'0'*(exp - self._exp) @@ -839,7 +840,7 @@ else: s += 'e' if exp > 0: - s += '+' #0.0e+3, not 0.0e3 + s += '+' # 0.0e+3, not 0.0e3 s += str(exp) s = '-'*self._sign + s return s @@ -979,19 +980,19 @@ return ans if self._isinfinity(): - #If both INF, same sign => same as both, opposite => error. + # If both INF, same sign => same as both, opposite => error. if self._sign != other._sign and other._isinfinity(): return context._raise_error(InvalidOperation, '-INF + INF') return Decimal(self) if other._isinfinity(): - return Decimal(other) #Can't both be infinity here + return Decimal(other) # Can't both be infinity here shouldround = context._rounding_decision == ALWAYS_ROUND exp = min(self._exp, other._exp) negativezero = 0 if context.rounding == ROUND_FLOOR and self._sign != other._sign: - #If the answer is 0, the sign should be negative, in this case. + # If the answer is 0, the sign should be negative, in this case. negativezero = 1 if not self and not other: @@ -1026,19 +1027,19 @@ return Decimal((negativezero, (0,), exp)) if op1.int < op2.int: op1, op2 = op2, op1 - #OK, now abs(op1) > abs(op2) + # OK, now abs(op1) > abs(op2) if op1.sign == 1: result.sign = 1 op1.sign, op2.sign = op2.sign, op1.sign else: result.sign = 0 - #So we know the sign, and op1 > 0. + # So we know the sign, and op1 > 0. elif op1.sign == 1: result.sign = 1 op1.sign, op2.sign = (0, 0) else: result.sign = 0 - #Now, op1 > abs(op2) > 0 + # Now, op1 > abs(op2) > 0 if op2.sign == 0: result.int = op1.int + op2.int @@ -1096,7 +1097,8 @@ if ans: return ans - return Decimal(self) # Must be infinite, and incrementing makes no difference + # Must be infinite, and incrementing makes no difference + return Decimal(self) L = list(self._int) L[-1] += 1 @@ -1152,7 +1154,7 @@ if not self or not other: ans = Decimal((resultsign, (0,), resultexp)) if shouldround: - #Fixing in case the exponent is out of bounds + # Fixing in case the exponent is out of bounds ans = ans._fix(context) return ans @@ -1171,7 +1173,7 @@ op1 = _WorkRep(self) op2 = _WorkRep(other) - ans = Decimal( (resultsign, map(int, str(op1.int * op2.int)), resultexp)) + ans = Decimal((resultsign, map(int, str(op1.int * op2.int)), resultexp)) if shouldround: ans = ans._fix(context) @@ -1264,12 +1266,11 @@ sign, 1) return context._raise_error(DivisionByZero, 'x / 0', sign) - #OK, so neither = 0, INF or NaN - + # OK, so neither = 0, INF or NaN shouldround = context._rounding_decision == ALWAYS_ROUND - #If we're dividing into ints, and self < other, stop. - #self.__abs__(0) does not round. + # If we're dividing into ints, and self < other, stop. + # self.__abs__(0) does not round. if divmod and (self.__abs__(0, context) < other.__abs__(0, context)): if divmod == 1 or divmod == 3: @@ -1281,7 +1282,7 @@ ans2) elif divmod == 2: - #Don't round the mod part, if we don't need it. + # Don't round the mod part, if we don't need it. return (Decimal( (sign, (0,), 0) ), Decimal(self)) op1 = _WorkRep(self) @@ -1330,7 +1331,7 @@ op1.exp -= 1 if res.exp == 0 and divmod and op2.int > op1.int: - #Solves an error in precision. Same as a previous block. + # Solves an error in precision. Same as a previous block. if res.int >= prec_limit and shouldround: return context._raise_error(DivisionImpossible) @@ -1416,7 +1417,7 @@ # ignored in the calling function. context = context._shallow_copy() flags = context._ignore_flags(Rounded, Inexact) - #keep DivisionImpossible flags + # Keep DivisionImpossible flags (side, r) = self.__divmod__(other, context=context) if r._isnan(): @@ -1439,7 +1440,7 @@ if r < comparison: r._sign, comparison._sign = s1, s2 - #Get flags now + # Get flags now self.__divmod__(other, context=context) return r._fix(context) r._sign, comparison._sign = s1, s2 @@ -1461,7 +1462,8 @@ if r > comparison or decrease and r == comparison: r._sign, comparison._sign = s1, s2 context.prec += 1 - if len(side.__add__(Decimal(1), context=context)._int) >= context.prec: + numbsquant = len(side.__add__(Decimal(1), context=context)._int) + if numbsquant >= context.prec: context.prec -= 1 return context._raise_error(DivisionImpossible)[1] context.prec -= 1 @@ -1496,7 +1498,7 @@ context = getcontext() return context._raise_error(InvalidContext) elif self._isinfinity(): - raise OverflowError, "Cannot convert infinity to long" + raise OverflowError("Cannot convert infinity to long") if self._exp >= 0: s = ''.join(map(str, self._int)) + '0'*self._exp else: @@ -1550,13 +1552,13 @@ context._raise_error(Clamped) return ans ans = ans._rescale(Etiny, context=context) - #It isn't zero, and exp < Emin => subnormal + # It isn't zero, and exp < Emin => subnormal context._raise_error(Subnormal) if context.flags[Inexact]: context._raise_error(Underflow) else: if ans: - #Only raise subnormal if non-zero. + # Only raise subnormal if non-zero. context._raise_error(Subnormal) else: Etop = context.Etop() @@ -1573,7 +1575,8 @@ return ans context._raise_error(Inexact) context._raise_error(Rounded) - return context._raise_error(Overflow, 'above Emax', ans._sign) + c = context._raise_error(Overflow, 'above Emax', ans._sign) + return c return ans def _round(self, prec=None, rounding=None, context=None): @@ -1633,18 +1636,18 @@ ans = Decimal( (temp._sign, tmp, temp._exp - expdiff)) return ans - #OK, but maybe all the lost digits are 0. + # OK, but maybe all the lost digits are 0. lostdigits = self._int[expdiff:] if lostdigits == (0,) * len(lostdigits): ans = Decimal( (temp._sign, temp._int[:prec], temp._exp - expdiff)) - #Rounded, but not Inexact + # Rounded, but not Inexact context._raise_error(Rounded) return ans # Okay, let's round and lose data this_function = getattr(temp, self._pick_rounding_function[rounding]) - #Now we've got the rounding function + # Now we've got the rounding function if prec != context.prec: context = context._shallow_copy() @@ -1740,7 +1743,7 @@ context = getcontext() if self._is_special or n._is_special or n.adjusted() > 8: - #Because the spot << doesn't work with really big exponents + # Because the spot << doesn't work with really big exponents if n._isinfinity() or n.adjusted() > 8: return context._raise_error(InvalidOperation, 'x ** INF') @@ -1770,9 +1773,10 @@ return Infsign[sign] return Decimal( (sign, (0,), 0) ) - #with ludicrously large exponent, just raise an overflow and return inf. - if not modulo and n > 0 and (self._exp + len(self._int) - 1) * n > context.Emax \ - and self: + # With ludicrously large exponent, just raise an overflow + # and return inf. + if not modulo and n > 0 and \ + (self._exp + len(self._int) - 1) * n > context.Emax and self: tmp = Decimal('inf') tmp._sign = sign @@ -1792,7 +1796,7 @@ context = context._shallow_copy() context.prec = firstprec + elength + 1 if n < 0: - #n is a long now, not Decimal instance + # n is a long now, not Decimal instance n = -n mul = Decimal(1).__div__(mul, context=context) @@ -1801,7 +1805,7 @@ spot <<= 1 spot >>= 1 - #Spot is the highest power of 2 less than n + # spot is the highest power of 2 less than n while spot: val = val.__mul__(val, context=context) if val._isinfinity(): @@ -1859,7 +1863,7 @@ if exp._isinfinity() or self._isinfinity(): if exp._isinfinity() and self._isinfinity(): - return self #if both are inf, it is OK + return self # if both are inf, it is OK if context is None: context = getcontext() return context._raise_error(InvalidOperation, @@ -1963,13 +1967,13 @@ return Decimal(self) if not self: - #exponent = self._exp / 2, using round_down. - #if self._exp < 0: + # exponent = self._exp / 2, using round_down. + # if self._exp < 0: # exp = (self._exp+1) // 2 - #else: + # else: exp = (self._exp) // 2 if self._sign == 1: - #sqrt(-0) = -0 + # sqrt(-0) = -0 return Decimal( (1, (0,), exp)) else: return Decimal( (0, (0,), exp)) @@ -2004,8 +2008,7 @@ context=context), context=context) ans._exp -= 1 + tmp.adjusted() // 2 - #ans is now a linear approximation. - + # ans is now a linear approximation. Emax, Emin = context.Emax, context.Emin context.Emax, context.Emin = DefaultContext.Emax, DefaultContext.Emin @@ -2020,12 +2023,12 @@ if context.prec == maxp: break - #round to the answer's precision-- the only error can be 1 ulp. + # Round to the answer's precision-- the only error can be 1 ulp. context.prec = firstprec prevexp = ans.adjusted() ans = ans._round(context=context) - #Now, check if the other last digits are better. + # Now, check if the other last digits are better. context.prec = firstprec + 1 # In case we rounded up another digit and we should actually go lower. if prevexp != ans.adjusted(): @@ -2057,10 +2060,10 @@ context._raise_error(Rounded) context._raise_error(Inexact) else: - #Exact answer, so let's set the exponent right. - #if self._exp < 0: + # Exact answer, so let's set the exponent right. + # if self._exp < 0: # exp = (self._exp +1)// 2 - #else: + # else: exp = self._exp // 2 context.prec += ans._exp - exp ans = ans._rescale(exp, context=context) @@ -2081,7 +2084,7 @@ return other if self._is_special or other._is_special: - # if one operand is a quiet NaN and the other is number, then the + # If one operand is a quiet NaN and the other is number, then the # number is always returned sn = self._isnan() on = other._isnan() @@ -2095,13 +2098,13 @@ ans = self c = self.__cmp__(other) if c == 0: - # if both operands are finite and equal in numerical value + # If both operands are finite and equal in numerical value # then an ordering is applied: # - # if the signs differ then max returns the operand with the + # If the signs differ then max returns the operand with the # positive sign and min returns the operand with the negative sign # - # if the signs are the same then the exponent is used to select + # If the signs are the same then the exponent is used to select # the result. if self._sign != other._sign: if self._sign: @@ -2122,7 +2125,7 @@ def min(self, other, context=None): """Returns the smaller value. - like min(self, other) except if one is not a number, returns + Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. """ other = _convert_other(other) @@ -2130,7 +2133,7 @@ return other if self._is_special or other._is_special: - # if one operand is a quiet NaN and the other is number, then the + # If one operand is a quiet NaN and the other is number, then the # number is always returned sn = self._isnan() on = other._isnan() @@ -2144,13 +2147,13 @@ ans = self c = self.__cmp__(other) if c == 0: - # if both operands are finite and equal in numerical value + # If both operands are finite and equal in numerical value # then an ordering is applied: # - # if the signs differ then max returns the operand with the + # If the signs differ then max returns the operand with the # positive sign and min returns the operand with the negative sign # - # if the signs are the same then the exponent is used to select + # If the signs are the same then the exponent is used to select # the result. if self._sign != other._sign: if other._sign: @@ -2185,11 +2188,11 @@ """Return the adjusted exponent of self""" try: return self._exp + len(self._int) - 1 - #If NaN or Infinity, self._exp is string + # If NaN or Infinity, self._exp is string except TypeError: return 0 - # support for pickling, copy, and deepcopy + # Support for pickling, copy, and deepcopy def __reduce__(self): return (self.__class__, (str(self),)) @@ -2203,13 +2206,14 @@ return self # My components are also immutable return self.__class__(str(self)) -##### Context class ########################################### +##### Context class ####################################################### # get rounding method function: -rounding_functions = [name for name in Decimal.__dict__.keys() if name.startswith('_round_')] +rounding_functions = [name for name in Decimal.__dict__.keys() + if name.startswith('_round_')] for name in rounding_functions: - #name is like _round_half_even, goes to the global ROUND_HALF_EVEN value. + # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value. globalname = name[1:].upper() val = globals()[globalname] Decimal._pick_rounding_function[val] = name @@ -2236,7 +2240,7 @@ Contains: prec - precision (for use in rounding, division, square roots..) - rounding - rounding type. (how you round) + rounding - rounding type (how you round) _rounding_decision - ALWAYS_ROUND, NEVER_ROUND -- do you round? traps - If traps[exception] = 1, then the exception is raised when it is caused. Otherwise, a value is @@ -2277,9 +2281,13 @@ def __repr__(self): """Show the current context.""" s = [] - s.append('Context(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' % vars(self)) - s.append('flags=[' + ', '.join([f.__name__ for f, v in self.flags.items() if v]) + ']') - s.append('traps=[' + ', '.join([t.__name__ for t, v in self.traps.items() if v]) + ']') + s.append('Context(prec=%(prec)d, rounding=%(rounding)s, ' + 'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' + % vars(self)) + names = [f.__name__ for f, v in self.flags.items() if v] + s.append('flags=[' + ', '.join(names) + ']') + names = [t.__name__ for t, v in self.traps.items() if v] + s.append('traps=[' + ', '.join(names) + ']') return ', '.join(s) + ')' def clear_flags(self): @@ -2296,9 +2304,9 @@ def copy(self): """Returns a deep copy from self.""" - nc = Context(self.prec, self.rounding, self.traps.copy(), self.flags.copy(), - self._rounding_decision, self.Emin, self.Emax, - self.capitals, self._clamp, self._ignored_flags) + nc = Context(self.prec, self.rounding, self.traps.copy(), + self.flags.copy(), self._rounding_decision, self.Emin, + self.Emax, self.capitals, self._clamp, self._ignored_flags) return nc __copy__ = copy @@ -2312,16 +2320,16 @@ """ error = _condition_map.get(condition, condition) if error in self._ignored_flags: - #Don't touch the flag + # Don't touch the flag return error().handle(self, *args) self.flags[error] += 1 if not self.traps[error]: - #The errors define how to handle themselves. + # The errors define how to handle themselves. return condition().handle(self, *args) # Errors should only be risked on copies of the context - #self._ignored_flags = [] + # self._ignored_flags = [] raise error, explanation def _ignore_all_flags(self): @@ -2345,7 +2353,7 @@ def __hash__(self): """A Context cannot be hashed.""" # We inherit object.__hash__, so we must deny this explicitly - raise TypeError, "Cannot hash a Context." + raise TypeError("Cannot hash a Context.") def Etiny(self): """Returns Etiny (= Emin - prec + 1)""" @@ -2400,12 +2408,12 @@ d = Decimal(num, context=self) return d._fix(self) - #Methods + # Methods def abs(self, a): """Returns the absolute value of the operand. If the operand is negative, the result is the same as using the minus - operation on the operand. Otherwise, the result is the same as using + operation on the operand. Otherwise, the result is the same as using the plus operation on the operand. >>> ExtendedContext.abs(Decimal('2.1')) @@ -2507,8 +2515,8 @@ If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as as though by the compare - operation. If they are numerically equal then the left-hand operand - is chosen as the result. Otherwise the maximum (closer to positive + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the maximum (closer to positive infinity) of the two operands is chosen as the result. >>> ExtendedContext.max(Decimal('3'), Decimal('2')) @@ -2527,8 +2535,8 @@ If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as as though by the compare - operation. If they are numerically equal then the left-hand operand - is chosen as the result. Otherwise the minimum (closer to negative + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the minimum (closer to negative infinity) of the two operands is chosen as the result. >>> ExtendedContext.min(Decimal('3'), Decimal('2')) @@ -2617,14 +2625,14 @@ The right-hand operand must be a whole number whose integer part (after any exponent has been applied) has no more than 9 digits and whose - fractional part (if any) is all zeros before any rounding. The operand + fractional part (if any) is all zeros before any rounding. The operand may be positive, negative, or zero; if negative, the absolute value of the power is used, and the left-hand operand is inverted (divided into 1) before use. If the increased precision needed for the intermediate calculations - exceeds the capabilities of the implementation then an Invalid operation - condition is raised. + exceeds the capabilities of the implementation then an Invalid + operation condition is raised. If, when raising to a negative power, an underflow occurs during the division into 1, the operation is not halted at that point but @@ -2662,18 +2670,18 @@ return a.__pow__(b, modulo, context=self) def quantize(self, a, b): - """Returns a value equal to 'a' (rounded) and having the exponent of 'b'. + """Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand - operand. It may be rounded using the current rounding setting (if the + operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a positive power of ten (if the exponent is being decreased), or is unchanged (if the exponent is already equal to that of the right-hand operand). Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision then an Invalid - operation condition is raised. This guarantees that, unless there is an - error condition, the exponent of the result of a quantize is always + operation condition is raised. This guarantees that, unless there is + an error condition, the exponent of the result of a quantize is always equal to that of the right-hand operand. Also unlike other operations, quantize will never raise Underflow, even @@ -2716,9 +2724,9 @@ """Returns the remainder from integer division. The result is the residue of the dividend after the operation of - calculating integer division as described for divide-integer, rounded to - precision digits if necessary. The sign of the result, if non-zero, is - the same as that of the original dividend. + calculating integer division as described for divide-integer, rounded + to precision digits if necessary. The sign of the result, if + non-zero, is the same as that of the original dividend. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the @@ -2742,7 +2750,7 @@ def remainder_near(self, a, b): """Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one - is chosen). If the result is equal to 0 then its sign will be the + is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail under the same conditions as integer division @@ -2784,7 +2792,7 @@ return a.same_quantum(b) def sqrt(self, a): - """Returns the square root of a non-negative number to context precision. + """Square root of a non-negative number to context precision. If the result must be inexact, it is rounded using the round-half-even algorithm. @@ -2845,7 +2853,7 @@ as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting, except that no flags will - be set. The rounding mode is taken from the context. + be set. The rounding mode is taken from the context. >>> ExtendedContext.to_integral(Decimal('2.1')) Decimal("2") @@ -2920,8 +2928,9 @@ other_len = len(str(other.int)) if numdigits > (other_len + prec + 1 - tmp_len): # If the difference in adjusted exps is > prec+1, we know - # other is insignificant, so might as well put a 1 after the precision. - # (since this is only for addition.) Also stops use of massive longs. + # other is insignificant, so might as well put a 1 after the + # precision (since this is only for addition). Also stops + # use of massive longs. extend = prec + 2 - tmp_len if extend <= 0: @@ -2944,13 +2953,13 @@ Used on _WorkRep instances during division. """ adjust = 0 - #If op1 is smaller, make it larger + # If op1 is smaller, make it larger while op2.int > op1.int: op1.int *= 10 op1.exp -= 1 adjust += 1 - #If op2 is too small, make it larger + # If op2 is too small, make it larger while op1.int >= (10 * op2.int): op2.int *= 10 op2.exp -= 1 @@ -2958,7 +2967,7 @@ return op1, op2, adjust -##### Helper Functions ######################################## +##### Helper Functions #################################################### def _convert_other(other): """Convert other to Decimal. @@ -2999,16 +3008,16 @@ if not num: return 0 - #get the sign, get rid of trailing [+-] + # Get the sign, get rid of trailing [+-] sign = 0 if num[0] == '+': num = num[1:] - elif num[0] == '-': #elif avoids '+-nan' + elif num[0] == '-': # elif avoids '+-nan' num = num[1:] sign = 1 if num.startswith('nan'): - if len(num) > 3 and not num[3:].isdigit(): #diagnostic info + if len(num) > 3 and not num[3:].isdigit(): # diagnostic info return 0 return (1, sign, num[3:].lstrip('0')) if num.startswith('snan'): @@ -3018,7 +3027,7 @@ return 0 -##### Setup Specific Contexts ################################ +##### Setup Specific Contexts ############################################ # The default context prototype used by Context() # Is mutable, so that new contexts can have different default values @@ -3051,19 +3060,19 @@ ) -##### Useful Constants (internal use only) #################### +##### Useful Constants (internal use only) ################################ -#Reusable defaults +# Reusable defaults Inf = Decimal('Inf') negInf = Decimal('-Inf') -#Infsign[sign] is infinity w/ that sign +# Infsign[sign] is infinity w/ that sign Infsign = (Inf, negInf) NaN = Decimal('NaN') -##### crud for parsing strings ################################# +##### crud for parsing strings ############################################# import re # There's an optional sign at the start, and an optional exponent @@ -3083,13 +3092,15 @@ ([eE](?P[-+]? \d+))? # \s* $ -""", re.VERBOSE).match #Uncomment the \s* to allow leading or trailing spaces. +""", re.VERBOSE).match # Uncomment the \s* to allow leading or trailing spaces. del re -# return sign, n, p s.t. float string value == -1**sign * n * 10**p exactly - def _string2exact(s): + """Return sign, n, p s.t. + + Float string value == -1**sign * n * 10**p exactly + """ m = _parser(s) if m is None: raise ValueError("invalid literal for Decimal: %r" % s) From python at rcn.com Tue Apr 10 18:03:00 2007 From: python at rcn.com (Raymond Hettinger) Date: Tue, 10 Apr 2007 12:03:00 -0400 (EDT) Subject: [Python-checkins] r54732 - python/trunk/Lib/decimal.py Message-ID: <20070410120300.BEU16324@ms09.lnh.mail.rcn.net> I don't think patches like this are a good idea. For almost zero benefit, we've lost the clean info in "svn ann" and lost having the code in Py2.6 exactly match Py2.5 and Py2.4 (so it will now be more difficult to backport and validate real bug fixes). When the exceptions were changed to new-style, I hope there was a speed-up, that there is no change in semantics, and that the code still runs under Py2.3 as promised in the header. Raymond ----------------------------------------------------------------- Modified: python/trunk/Lib/decimal.py Log: General clean-up. Lot of margin corrections, comments, some typos. Exceptions now are raised in the new style. And a mockup class is now also new style. Thanks Santiago Pereson. From facundobatista at gmail.com Tue Apr 10 19:31:53 2007 From: facundobatista at gmail.com (Facundo Batista) Date: Tue, 10 Apr 2007 14:31:53 -0300 Subject: [Python-checkins] r54732 - python/trunk/Lib/decimal.py In-Reply-To: <20070410120300.BEU16324@ms09.lnh.mail.rcn.net> References: <20070410120300.BEU16324@ms09.lnh.mail.rcn.net> Message-ID: 2007/4/10, Raymond Hettinger : > I don't think patches like this are a good idea. For almost > zero benefit, we've lost the clean info in "svn ann" and lost > having the code in Py2.6 exactly match Py2.5 and Py2.4 > (so it will now be more difficult to backport and validate > real bug fixes). Well. This is the first step in "me started working on decimal again". The Decimal spec changed: it has new operations, but also changed the behaviour of some already-present operations (right now I'm pulling my hair because of a corner case of rounding that must behave different in quantize). What I don't know is: these changes will be considered as "bugs" and backported to <2.6, or it will be considered as little changes that will join the bigger changes in 2.6? If the former, I agree with you that this change should be reversed (note that I didn't realize these losses at its moment, but everybody learns, ;). What do you think? > When the exceptions were changed to new-style, I hope there > was a speed-up, that there is no change in semantics, and > that the code still runs under Py2.3 as promised in the header. It changed from "ValueError, 'foo'" to "ValueError('foo')". Don't remember when this was introduced in the language, though (didn't find it overlooking the "What's new" docs...). Thank you! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ From python-checkins at python.org Tue Apr 10 19:44:36 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Apr 2007 19:44:36 +0200 (CEST) Subject: [Python-checkins] r54734 - sandbox/trunk/import_in_py/import_diagram.dot sandbox/trunk/import_in_py/import_diagram.svg Message-ID: <20070410174436.799101E400F@bag.python.org> Author: brett.cannon Date: Tue Apr 10 19:44:33 2007 New Revision: 54734 Added: sandbox/trunk/import_in_py/import_diagram.dot (contents, props changed) sandbox/trunk/import_in_py/import_diagram.svg (contents, props changed) Log: Add a Graphviz DOT file and the corresponding SVG file that diagrams the control flow of import. Added: sandbox/trunk/import_in_py/import_diagram.dot ============================================================================== --- (empty file) +++ sandbox/trunk/import_in_py/import_diagram.dot Tue Apr 10 19:44:33 2007 @@ -0,0 +1,72 @@ +/* XXX For inputs to a function, can use dashed or dotted lines; that way solid + * lines are just for control flow. */ +digraph Import { + compound=true; + + /* Input. */ + subgraph cluster_input { + label="Input"; + color=blue; + node [shape=ellipse]; + + module_name [width=2]; + globals [width=1.5]; + locals [width=1.5]; + fromlist [width=1.5]; + level [width=1.5]; + } + + /* Output. */ + subgraph cluster_output { + label="Output"; + color=blue; + node [shape=ellipse]; + + return [width=1.5]; + ImportError [width=2]; + } + + /* All work that occurs while the import lock is held. */ + subgraph cluster_import_locking { + label="Import Lock Held"; + color=blue; + + /* Name resolution needed? */ + if_name_resolution [shape=diamond, + label="level != 0 and \n '__name__'", + width=3, height=1.5]; + + /* Name resolution cluster. */ + subgraph cluster_name_resolution { + label="Make name absolute"; + color=blue; + + pkg_level_adjust [shape=box, + label="level - 1 \n if '__path__' \n else level", + width=2, height=1]; + + test_depth [shape=diamond, label="Depth < level", + width=2.5]; + + adjust_name [shape=box, label="Adjust name", width=1.75]; + + pkg_level_adjust -> test_depth; + test_depth -> ImportError [label="True"]; + test_depth -> adjust_name [label="False"]; + } + if_name_resolution -> pkg_level_adjust [label="True"]; + + /* Name is absolute. */ + abs_module_name [shape=point, label="absolute \n module name"]; + + adjust_name -> abs_module_name; + if_name_resolution -> abs_module_name [label="False"]; + + abs_module_name -> return; + } + + /* XXX until I decide how I want to handle the inputs. */ + start [shape=point]; + {module_name; globals; locals; fromlist; level} -> start; + start-> if_name_resolution; +} Added: sandbox/trunk/import_in_py/import_diagram.svg ============================================================================== --- (empty file) +++ sandbox/trunk/import_in_py/import_diagram.svg Tue Apr 10 19:44:33 2007 @@ -0,0 +1,137 @@ + + + + + +Import +cluster_input + +Input + +cluster_output + +Output + +cluster_import_locking + +Import Lock Held + +cluster_name_resolution + +Make name absolute + +module_name + +module_name + +start + + +module_name->start + + + +globals + +globals + +globals->start + + + +locals + +locals + +locals->start + + + +fromlist + +fromlist + +fromlist->start + + + +level + +level + +level->start + + + +return + +return + +ImportError + +ImportError + +if_name_resolution + +level != 0 and + '__name__' + +pkg_level_adjust + +level - 1 + if '__path__' + else level + +if_name_resolution->pkg_level_adjust + + +True + +abs_module_name + + +if_name_resolution->abs_module_name + + +False + +test_depth + +Depth < level + +pkg_level_adjust->test_depth + + + +test_depth->ImportError + + +True + +adjust_name + +Adjust name + +test_depth->adjust_name + + +False + +adjust_name->abs_module_name + + + +abs_module_name->return + + + +start->if_name_resolution + + + + + From python-checkins at python.org Tue Apr 10 20:38:00 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 10 Apr 2007 20:38:00 +0200 (CEST) Subject: [Python-checkins] r54735 - peps/trunk/pep-3116.txt Message-ID: <20070410183800.B71C21E400D@bag.python.org> Author: guido.van.rossum Date: Tue Apr 10 20:37:53 2007 New Revision: 54735 Modified: peps/trunk/pep-3116.txt Log: seek() returns an int everywhere. Modified: peps/trunk/pep-3116.txt ============================================================================== --- peps/trunk/pep-3116.txt (original) +++ peps/trunk/pep-3116.txt Tue Apr 10 20:37:53 2007 @@ -82,7 +82,7 @@ Returns number of bytes written, which may be ``< len(b)``. - ``.seek(pos: int, whence: int = 0) -> None`` + ``.seek(pos: int, whence: int = 0) -> int`` ``.tell() -> int`` @@ -283,7 +283,7 @@ The only supported use for the cookie is with .seek() with whence set to 0 (i.e. absolute seek). - ``.seek(pos: object, whence: int = 0) -> None`` + ``.seek(pos: object, whence: int = 0) -> int`` Seek to position ``pos``. If ``pos`` is non-zero, it must be a cookie returned from ``.tell()`` and ``whence`` must be zero. From python-checkins at python.org Tue Apr 10 20:55:04 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 10 Apr 2007 20:55:04 +0200 (CEST) Subject: [Python-checkins] r54736 - peps/trunk/pep-3000.txt Message-ID: <20070410185504.6C7B81E4011@bag.python.org> Author: guido.van.rossum Date: Tue Apr 10 20:55:02 2007 New Revision: 54736 Modified: peps/trunk/pep-3000.txt Log: Note that stdlib changes are starting after 3.0a1 is released. Modified: peps/trunk/pep-3000.txt ============================================================================== --- peps/trunk/pep-3000.txt (original) +++ peps/trunk/pep-3000.txt Tue Apr 10 20:55:02 2007 @@ -56,6 +56,9 @@ submitted by the end of April 2007 (allowing time for discussion and implementation after the initial submission). +Note: standard library development is expected to ramp up after 3.0a1 +is released; it is exempt from the April 2007 PEP deadline. + I expect that there will be parallel Python 2.x and 3.x releases for some time; the Python 2.x releases will continue for a longer time than the traditional 2.x.y bugfix releases. Typically, we stop From python-checkins at python.org Tue Apr 10 22:58:54 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 10 Apr 2007 22:58:54 +0200 (CEST) Subject: [Python-checkins] r54739 - peps/trunk/pep-3116.txt Message-ID: <20070410205854.5A4A01E400D@bag.python.org> Author: guido.van.rossum Date: Tue Apr 10 22:58:53 2007 New Revision: 54739 Modified: peps/trunk/pep-3116.txt Log: Like seek(), truncate() always returns the new current position. All write() methods return the number of bytes/characters written (for buffered and text files, this is always the lenth of the input). Modified: peps/trunk/pep-3116.txt ============================================================================== --- peps/trunk/pep-3116.txt (original) +++ peps/trunk/pep-3116.txt Tue Apr 10 22:58:53 2007 @@ -86,7 +86,7 @@ ``.tell() -> int`` - ``.truncate(n: int = None) -> None`` + ``.truncate(n: int = None) -> int`` ``.close() -> None`` @@ -162,17 +162,17 @@ ``.readinto(b: bytes) -> int`` - ``.write(b: bytes) -> None`` + ``.write(b: bytes) -> int`` Write ``b`` bytes to the buffer. The bytes are not guaranteed to be written to the Raw I/O object immediately; they may be - buffered. + buffered. Returns ``len(b)``. ``.seek(pos: int, whence: int = 0) -> int`` ``.tell() -> int`` - ``.truncate(pos: int = None) -> None`` + ``.truncate(pos: int = None) -> int`` ``.flush() -> None`` @@ -275,7 +275,7 @@ ``.read(n: int = -1) -> str`` - ``.write(s: str) -> None`` + ``.write(s: str) -> int`` ``.tell() -> object`` @@ -288,7 +288,7 @@ Seek to position ``pos``. If ``pos`` is non-zero, it must be a cookie returned from ``.tell()`` and ``whence`` must be zero. - ``.truncate(pos: object = None) -> None`` + ``.truncate(pos: object = None) -> int`` Like ``BufferedIOBase.truncate()``, except that ``pos`` (if not ``None``) must be a cookie previously returned by ``.tell()``. From python-checkins at python.org Tue Apr 10 23:39:42 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 10 Apr 2007 23:39:42 +0200 (CEST) Subject: [Python-checkins] r54741 - in python/trunk/Doc: lib/libamoeba.tex lib/libfm.tex lib/libposixfile.tex lib/libsun.tex lib/libunittest.tex mac/libframework.tex Message-ID: <20070410213942.22AB91E400D@bag.python.org> Author: georg.brandl Date: Tue Apr 10 23:39:38 2007 New Revision: 54741 Modified: python/trunk/Doc/lib/libamoeba.tex python/trunk/Doc/lib/libfm.tex python/trunk/Doc/lib/libposixfile.tex python/trunk/Doc/lib/libsun.tex python/trunk/Doc/lib/libunittest.tex python/trunk/Doc/mac/libframework.tex Log: Repair a duplicate label and some obsolete uses of \setindexsubitem. Modified: python/trunk/Doc/lib/libamoeba.tex ============================================================================== --- python/trunk/Doc/lib/libamoeba.tex (original) +++ python/trunk/Doc/lib/libamoeba.tex Tue Apr 10 23:39:38 2007 @@ -89,25 +89,24 @@ % The following methods are defined for capability objects. -\setindexsubitem{(capability method)} -\begin{funcdesc}{dir_list}{} +\begin{methoddesc}[capability]{dir_list}{} Returns a list of the names of the entries in an Amoeba directory. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{b_read}{offset, maxsize} +\begin{methoddesc}[capability]{b_read}{offset, maxsize} Reads (at most) \var{maxsize} bytes from a bullet file at offset \var{offset.} The data is returned as a string. EOF is reported as an empty string. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{b_size}{} +\begin{methoddesc}[capability]{b_size}{} Returns the size of a bullet file. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{dir_append}{} +\begin{methoddesc}[capability]{dir_append}{} \funcline{dir_delete}{} \funcline{dir_lookup}{} \funcline{dir_replace}{} @@ -116,17 +115,17 @@ functions, but with a path relative to the capability. (For paths beginning with a slash the capability is ignored, since this is the defined semantics for Amoeba.) -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{std_info}{} +\begin{methoddesc}[capability]{std_info}{} Returns the standard info string of the object. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{tod_gettime}{} +\begin{methoddesc}[capability]{tod_gettime}{} Returns the time (in seconds since the Epoch, in UCT, as for \POSIX) from a time server. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{tod_settime}{t} +\begin{methoddesc}[capability]{tod_settime}{t} Sets the time kept by a time server. -\end{funcdesc} +\end{methoddesc} Modified: python/trunk/Doc/lib/libfm.tex ============================================================================== --- python/trunk/Doc/lib/libfm.tex (original) +++ python/trunk/Doc/lib/libfm.tex Tue Apr 10 23:39:38 2007 @@ -55,40 +55,39 @@ Font handle objects support the following operations: -\setindexsubitem{(font handle method)} -\begin{funcdesc}{scalefont}{factor} +\begin{methoddesc}[font handle]{scalefont}{factor} Returns a handle for a scaled version of this font. Calls \code{fmscalefont(\var{fh}, \var{factor})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{setfont}{} +\begin{methoddesc}[font handle]{setfont}{} Makes this font the current font. Note: the effect is undone silently when the font handle object is deleted. Calls \code{fmsetfont(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getfontname}{} +\begin{methoddesc}[font handle]{getfontname}{} Returns this font's name. Calls \code{fmgetfontname(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getcomment}{} +\begin{methoddesc}[font handle]{getcomment}{} Returns the comment string associated with this font. Raises an exception if there is none. Calls \code{fmgetcomment(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getfontinfo}{} +\begin{methoddesc}[font handle]{getfontinfo}{} Returns a tuple giving some pertinent data about this font. This is an interface to \code{fmgetfontinfo()}. The returned tuple contains the following numbers: \code{(}\var{printermatched}, \var{fixed_width}, \var{xorig}, \var{yorig}, \var{xsize}, \var{ysize}, \var{height}, \var{nglyphs}\code{)}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getstrwidth}{string} +\begin{methoddesc}[font handle]{getstrwidth}{string} Returns the width, in pixels, of \var{string} when drawn in this font. Calls \code{fmgetstrwidth(\var{fh}, \var{string})}. -\end{funcdesc} +\end{methoddesc} Modified: python/trunk/Doc/lib/libposixfile.tex ============================================================================== --- python/trunk/Doc/lib/libposixfile.tex (original) +++ python/trunk/Doc/lib/libposixfile.tex Tue Apr 10 23:39:38 2007 @@ -62,8 +62,7 @@ The posixfile object defines the following additional methods: -\setindexsubitem{(posixfile method)} -\begin{funcdesc}{lock}{fmt, \optional{len\optional{, start\optional{, whence}}}} +\begin{methoddesc}[posixfile]{lock}{fmt, \optional{len\optional{, start\optional{, whence}}}} Lock the specified section of the file that the file object is referring to. The format is explained below in a table. The \var{len} argument specifies the length of the @@ -74,9 +73,9 @@ \constant{SEEK_CUR} or \constant{SEEK_END}. The default is \constant{SEEK_SET}. For more information about the arguments refer to the \manpage{fcntl}{2} manual page on your system. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{flags}{\optional{flags}} +\begin{methoddesc}[posixfile]{flags}{\optional{flags}} Set the specified flags for the file that the file object is referring to. The new flags are ORed with the old flags, unless specified otherwise. The format is explained below in a table. Without @@ -84,25 +83,25 @@ a string indicating the current flags is returned (this is the same as the \samp{?} modifier). For more information about the flags refer to the \manpage{fcntl}{2} manual page on your system. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{dup}{} +\begin{methoddesc}[posixfile]{dup}{} Duplicate the file object and the underlying file pointer and file descriptor. The resulting object behaves as if it were newly opened. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{dup2}{fd} +\begin{methoddesc}[posixfile]{dup2}{fd} Duplicate the file object and the underlying file pointer and file descriptor. The new object will have the given file descriptor. Otherwise the resulting object behaves as if it were newly opened. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{file}{} +\begin{methoddesc}[posixfile]{file}{} Return the standard file object that the posixfile object is based on. This is sometimes necessary for functions that insist on a standard file object. -\end{funcdesc} +\end{methoddesc} All methods raise \exception{IOError} when the request fails. Modified: python/trunk/Doc/lib/libsun.tex ============================================================================== --- python/trunk/Doc/lib/libsun.tex (original) +++ python/trunk/Doc/lib/libsun.tex Tue Apr 10 23:39:38 2007 @@ -3,3 +3,5 @@ The modules described in this chapter provide interfaces to features that are unique to SunOS 5 (also known as Solaris version 2). + +\localmoduletable Modified: python/trunk/Doc/lib/libunittest.tex ============================================================================== --- python/trunk/Doc/lib/libunittest.tex (original) +++ python/trunk/Doc/lib/libunittest.tex Tue Apr 10 23:39:38 2007 @@ -91,7 +91,7 @@ \end{seealso} -\subsection{Basic example \label{minimal-example}} +\subsection{Basic example \label{unittest-minimal-example}} The \module{unittest} module provides a rich set of tools for constructing and running tests. This section demonstrates that a Modified: python/trunk/Doc/mac/libframework.tex ============================================================================== --- python/trunk/Doc/mac/libframework.tex (original) +++ python/trunk/Doc/mac/libframework.tex Tue Apr 10 23:39:38 2007 @@ -189,8 +189,6 @@ Window objects have the following methods, among others: -\setindexsubitem{(Window method)} - \begin{methoddesc}[Window]{open}{} Override this method to open a window. Store the MacOS window-id in \member{self.wid} and call the \method{do_postopen()} method to From python-checkins at python.org Wed Apr 11 03:09:34 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 11 Apr 2007 03:09:34 +0200 (CEST) Subject: [Python-checkins] r54743 - peps/trunk/pep-3116.txt Message-ID: <20070411010934.8E6001E400F@bag.python.org> Author: guido.van.rossum Date: Wed Apr 11 03:09:33 2007 New Revision: 54743 Modified: peps/trunk/pep-3116.txt Log: Add newline arg to open(). Modified: peps/trunk/pep-3116.txt ============================================================================== --- peps/trunk/pep-3116.txt (original) +++ peps/trunk/pep-3116.txt Wed Apr 11 03:09:33 2007 @@ -413,11 +413,13 @@ The ``open()`` built-in function is specified by the following pseudo-code:: - def open(filename, mode="r", buffering=None, *, encoding=None): - assert isinstance(filename, str) + def open(filename, mode="r", buffering=None, *, + encoding=None, newline=None): + assert isinstance(filename, (str, int)) assert isinstance(mode, str) assert buffering is None or isinstance(buffering, int) assert encoding is None or isinstance(encoding, str) + assert newline in (None, "\n", "\r\n") modes = set(mode) if modes - set("arwb+t") or len(mode) > len(modes): raise ValueError("invalid mode: %r" % mode) @@ -434,7 +436,9 @@ if not (reading or writing or appending): raise ValueError("must have exactly one of read/write/append mode") if binary and encoding is not None: - raise ValueError("binary modes doesn't take an encoding") + raise ValueError("binary modes doesn't take an encoding arg") + if binary and newline is not None: + raise ValueError("binary modes doesn't take a newline arg") # XXX Need to spec the signature for FileIO() raw = FileIO(filename, mode) if buffering is None: @@ -456,9 +460,7 @@ if binary: return buffer assert text - # XXX Need to do something about universal newlines? - textio = TextIOWrapper(buffer) - return textio + return TextIOWrapper(buffer, encoding, newline) Copyright From python-checkins at python.org Wed Apr 11 15:39:02 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 11 Apr 2007 15:39:02 +0200 (CEST) Subject: [Python-checkins] r54746 - in python/trunk: Doc/lib/libcurses.tex Doc/whatsnew/whatsnew26.tex Lib/test/test_curses.py Misc/ACKS Modules/_cursesmodule.c Message-ID: <20070411133902.5A8F31E400F@bag.python.org> Author: andrew.kuchling Date: Wed Apr 11 15:39:00 2007 New Revision: 54746 Modified: python/trunk/Doc/lib/libcurses.tex python/trunk/Doc/whatsnew/whatsnew26.tex python/trunk/Lib/test/test_curses.py python/trunk/Misc/ACKS python/trunk/Modules/_cursesmodule.c Log: Add window.chgat() method, submitted via e-mail by Fabian Kreutz Modified: python/trunk/Doc/lib/libcurses.tex ============================================================================== --- python/trunk/Doc/lib/libcurses.tex (original) +++ python/trunk/Doc/lib/libcurses.tex Wed Apr 11 15:39:00 2007 @@ -646,6 +646,16 @@ corner characters are always used by this function. \end{methoddesc} +\begin{methoddesc}[window]{chgat}{\optional{y, x, } \optional{num,} attr} +Sets the attributes of \var{num} characters at the current cursor +position, or at position \code{(\var{y}, \var{x})} if supplied. If no +value of \var{num} is given or \var{num} = -1, the attribute will +be set on all the characters to the end of the line. +This function does not move the cursor. The changed line +will be touched using the \method{touchline} method so that the +contents will be redisplayed by the next window refresh. +\end{methoddesc} + \begin{methoddesc}[window]{clear}{} Like \method{erase()}, but also causes the whole window to be repainted upon next call to \method{refresh()}. Modified: python/trunk/Doc/whatsnew/whatsnew26.tex ============================================================================== --- python/trunk/Doc/whatsnew/whatsnew26.tex (original) +++ python/trunk/Doc/whatsnew/whatsnew26.tex Wed Apr 11 15:39:00 2007 @@ -135,6 +135,18 @@ (Contributed by Raymond Hettinger.) +\item New method in the \module{curses} module: +for a window, \method{chgat()} changes the display characters for a +certain number of characters on a single line. + +\begin{verbatim} +# Boldface text starting at y=0,x=21 +# and affecting the rest of the line. +stdscr.chgat(0,21, curses.A_BOLD) +\end{verbatim} + +(Contributed by Fabian Kreutz.) + \item New function in the \module{heapq} module: \function{merge(iter1, iter2, ...)} takes any number of iterables that return data Modified: python/trunk/Lib/test/test_curses.py ============================================================================== --- python/trunk/Lib/test/test_curses.py (original) +++ python/trunk/Lib/test/test_curses.py Wed Apr 11 15:39:00 2007 @@ -129,6 +129,12 @@ stdscr.touchline(5,5,0) stdscr.vline('a', 3) stdscr.vline('a', 3, curses.A_STANDOUT) + stdscr.chgat(5, 2, 3, curses.A_BLINK) + stdscr.chgat(3, curses.A_BOLD) + stdscr.chgat(5, 8, curses.A_UNDERLINE) + stdscr.chgat(curses.A_BLINK) + stdscr.refresh() + stdscr.vline(1,1, 'a', 3) stdscr.vline(1,1, 'a', 3, curses.A_STANDOUT) Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Wed Apr 11 15:39:00 2007 @@ -367,6 +367,7 @@ Joseph Koshy Bob Kras Holger Krekel +Fabian Kreutz Hannu Krosing Andrew Kuchling Vladimir Kushnir Modified: python/trunk/Modules/_cursesmodule.c ============================================================================== --- python/trunk/Modules/_cursesmodule.c (original) +++ python/trunk/Modules/_cursesmodule.c Wed Apr 11 15:39:00 2007 @@ -39,15 +39,15 @@ a given function, add it and send a patch. Here's a list of currently unsupported functions: - addchnstr addchstr chgat color_set define_key + addchnstr addchstr color_set define_key del_curterm delscreen dupwin inchnstr inchstr innstr keyok - mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr - mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat + mcprint mvaddchnstr mvaddchstr mvcur mvinchnstr + mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwinchnstr mvwinchstr mvwinnstr newterm restartterm ripoffline scr_dump scr_init scr_restore scr_set scrl set_curterm set_term setterm tgetent tgetflag tgetnum tgetstr tgoto timeout tputs - vidattr vidputs waddchnstr waddchstr wchgat + vidattr vidputs waddchnstr waddchstr wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl Low-priority: @@ -620,6 +620,56 @@ } #endif +/* chgat, added by Fabian Kreutz */ + +static PyObject * +PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args) +{ + int rtn; + int x, y; + int num = -1; + short color; + attr_t attr = A_NORMAL; + int use_xy = FALSE; + + switch (PyTuple_Size(args)) { + case 1: + if (!PyArg_ParseTuple(args,"l;attr", &attr)) + return NULL; + break; + case 2: + if (!PyArg_ParseTuple(args,"il;n,attr", &num, &attr)) + return NULL; + break; + case 3: + if (!PyArg_ParseTuple(args,"iil;int,int,attr", &y, &x, &attr)) + return NULL; + use_xy = TRUE; + break; + case 4: + if (!PyArg_ParseTuple(args,"iiil;int,int,n,attr", &y, &x, &num, &attr)) + return NULL; + use_xy = TRUE; + break; + default: + PyErr_SetString(PyExc_TypeError, "chgat requires 1 to 4 arguments"); + return NULL; + } + + color = (short)((attr >> 8) & 0xff); + attr = attr - (color << 8); + + if (use_xy == TRUE) { + rtn = mvwchgat(self->win,y,x,num,attr,color,NULL); + touchline(self->win,y,1); + } else { + getyx(self->win,y,x); + rtn = wchgat(self->win,num,attr,color,NULL); + touchline(self->win,y,1); + } + return PyCursesCheckERR(rtn, "chgat"); +} + static PyObject * PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args) @@ -1428,6 +1478,7 @@ {"attron", (PyCFunction)PyCursesWindow_wattron, METH_VARARGS}, {"attrset", (PyCFunction)PyCursesWindow_wattrset, METH_VARARGS}, {"bkgd", (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS}, + {"chgat", (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS}, {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS}, {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS}, {"box", (PyCFunction)PyCursesWindow_Box, METH_VARARGS}, From python-checkins at python.org Wed Apr 11 15:42:26 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 11 Apr 2007 15:42:26 +0200 (CEST) Subject: [Python-checkins] r54747 - python/trunk/Modules/_cursesmodule.c Message-ID: <20070411134226.02E311E4002@bag.python.org> Author: andrew.kuchling Date: Wed Apr 11 15:42:25 2007 New Revision: 54747 Modified: python/trunk/Modules/_cursesmodule.c Log: Point readers at the patch submission instructions Modified: python/trunk/Modules/_cursesmodule.c ============================================================================== --- python/trunk/Modules/_cursesmodule.c (original) +++ python/trunk/Modules/_cursesmodule.c Wed Apr 11 15:42:25 2007 @@ -35,9 +35,12 @@ /* -A number of SysV or ncurses functions don't have wrappers yet; if you need -a given function, add it and send a patch. Here's a list of currently -unsupported functions: +A number of SysV or ncurses functions don't have wrappers yet; if you +need a given function, add it and send a patch. See +http://www.python.org/dev/patches/ for instructions on how to submit +patches to Python. + +Here's a list of currently unsupported functions: addchnstr addchstr color_set define_key del_curterm delscreen dupwin inchnstr inchstr innstr keyok From python-checkins at python.org Wed Apr 11 15:47:13 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 11 Apr 2007 15:47:13 +0200 (CEST) Subject: [Python-checkins] r54748 - python/trunk/Doc/lib/libcurses.tex Message-ID: <20070411134713.9836C1E4002@bag.python.org> Author: andrew.kuchling Date: Wed Apr 11 15:47:13 2007 New Revision: 54748 Modified: python/trunk/Doc/lib/libcurses.tex Log: Describe undocumented third argument to touchline() Modified: python/trunk/Doc/lib/libcurses.tex ============================================================================== --- python/trunk/Doc/lib/libcurses.tex (original) +++ python/trunk/Doc/lib/libcurses.tex Wed Apr 11 15:47:13 2007 @@ -1024,9 +1024,11 @@ input at the end of that time. \end{methoddesc} -\begin{methoddesc}[window]{touchline}{start, count} +\begin{methoddesc}[window]{touchline}{start, count\optional{, changed}} Pretend \var{count} lines have been changed, starting with line -\var{start}. +\var{start}. If \var{changed} is supplied, it specifies +whether the affected lines are marked as +having been changed (\var{changed}=1) or unchanged (\var{changed}=0). \end{methoddesc} \begin{methoddesc}[window]{touchwin}{} From buildbot at python.org Wed Apr 11 15:47:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:32 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20070411134732.5D6721E4002@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2130 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:47:33 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:33 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20070411134733.02A921E4012@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/861 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:47:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:35 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian trunk Message-ID: <20070411134735.524071E4002@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/747 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:47:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:35 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20070411134735.C113E1E4011@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1947 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:47:39 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:39 +0000 Subject: [Python-checkins] buildbot failure in x86 mvlgcc trunk Message-ID: <20070411134739.322A81E4011@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/454 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:47:57 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:47:57 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k trunk Message-ID: <20070411134757.353F31E4002@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/201 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Wed Apr 11 15:47:59 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 11 Apr 2007 15:47:59 +0200 (CEST) Subject: [Python-checkins] r54749 - python/branches/release25-maint/Doc/lib/libcurses.tex Message-ID: <20070411134759.4F6EC1E4011@bag.python.org> Author: andrew.kuchling Date: Wed Apr 11 15:47:58 2007 New Revision: 54749 Modified: python/branches/release25-maint/Doc/lib/libcurses.tex Log: Describe undocumented third argument to touchline() Modified: python/branches/release25-maint/Doc/lib/libcurses.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libcurses.tex (original) +++ python/branches/release25-maint/Doc/lib/libcurses.tex Wed Apr 11 15:47:58 2007 @@ -1014,9 +1014,11 @@ input at the end of that time. \end{methoddesc} -\begin{methoddesc}[window]{touchline}{start, count} +\begin{methoddesc}[window]{touchline}{start, count\optional{, changed}} Pretend \var{count} lines have been changed, starting with line -\var{start}. +\var{start}. If \var{changed} is supplied, it specifies +whether the affected lines are marked as +having been changed (\var{changed}=1) or unchanged (\var{changed}=0). \end{methoddesc} \begin{methoddesc}[window]{touchwin}{} From buildbot at python.org Wed Apr 11 15:48:05 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:48:05 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20070411134805.853511E4010@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/1934 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:48:07 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:48:07 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20070411134807.EC3471E4012@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/1942 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:49:05 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:49:05 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20070411134905.63FEF1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1615 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 15:53:47 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 13:53:47 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk trunk Message-ID: <20070411135347.EA66B1E400D@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/574 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,georg.brandl BUILD FAILED: failed svn sincerely, -The Buildbot From kristjan at ccpgames.com Wed Apr 11 15:15:29 2007 From: kristjan at ccpgames.com (=?iso-8859-1?Q?Kristj=E1n_Valur_J=F3nsson?=) Date: Wed, 11 Apr 2007 13:15:29 +0000 Subject: [Python-checkins] svn dead? Message-ID: <4E9372E6B2234D4F859320D896059A9508BF48EBAF@exchis.ccp.ad.local> The SVN repository hasn't answered http requests since this morning. Anyone know what is up with that? Kristj?n -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070411/7674304d/attachment.html From barry at python.org Wed Apr 11 16:34:28 2007 From: barry at python.org (Barry Warsaw) Date: Wed, 11 Apr 2007 10:34:28 -0400 Subject: [Python-checkins] svn dead? In-Reply-To: <4E9372E6B2234D4F859320D896059A9508BF48EBAF@exchis.ccp.ad.local> References: <4E9372E6B2234D4F859320D896059A9508BF48EBAF@exchis.ccp.ad.local> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 11, 2007, at 9:15 AM, Kristj?n Valur J?nsson wrote: > The SVN repository hasn?t answered http requests since this > morning. Anyone know what is up with that? Known breakage. We're working on it. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRhzx9HEjvBPtnXfVAQJwEQQApPQumTtLJPhlRU9a44dOuRI9DFGMQePD 6Hbsux0HcKvcLpR5QQlsUrKEAyGOt2qDm1YpoWM3uwSN68JnnlAc0iiYUQe1s8/U pRBy18eIhd9mGR2F2k9ZdDX0tqDapyVlc5bDb2jAaWSMwMO0AAUXyz4gtIP7thDW b9vZ18YXnvQ= =9riM -----END PGP SIGNATURE----- From barry at python.org Wed Apr 11 17:10:52 2007 From: barry at python.org (Barry Warsaw) Date: Wed, 11 Apr 2007 11:10:52 -0400 Subject: [Python-checkins] svn dead? In-Reply-To: References: <4E9372E6B2234D4F859320D896059A9508BF48EBAF@exchis.ccp.ad.local> Message-ID: <022AFF34-4BAE-4B26-BA3E-9823D9253B94@python.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 11, 2007, at 10:34 AM, Barry Warsaw wrote: > On Apr 11, 2007, at 9:15 AM, Kristj?n Valur J?nsson wrote: >> The SVN repository hasn?t answered http requests since this >> morning. Anyone know what is up with that? > Known breakage. We're working on it. svn.python.org is back online now (both http and https). I'll take this opportunity to mention that we've ordered a new ssl cert for our expired one on https. It hasn't arrived yet, but should within a few days. I'll make another announcement when the new cert is installed. Cheers, - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRhz6fXEjvBPtnXfVAQJKYAQAhtF4kA/5HeEvSZhktR3zAHkCZMjDcs1M sPeaAOOF55Pej0HagUi6haYcxoGeFOiGYq0pVzhu2FnuuUIi5LIOumn65w1s7xci z14OhYquTOMTyY2leyZdIj8eywg9ZMtKPXHS5spCm912/9gyuqYI6X9pkPakSRZ/ 0kD1/DmVvhE= =h93N -----END PGP SIGNATURE----- From python-checkins at python.org Wed Apr 11 17:27:07 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 11 Apr 2007 17:27:07 +0200 (CEST) Subject: [Python-checkins] r54751 - sandbox/trunk/2to3/fixes/util.py Message-ID: <20070411152707.CD3A31E4002@bag.python.org> Author: collin.winter Date: Wed Apr 11 17:27:03 2007 New Revision: 54751 Modified: sandbox/trunk/2to3/fixes/util.py Log: Add a KeywordArg() macro. Modified: sandbox/trunk/2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/fixes/util.py Wed Apr 11 17:27:03 2007 @@ -15,6 +15,10 @@ ### Common node-construction "macros" ########################################################### +def KeywordArg(keyword, value): + return Node(syms.argument, + [keyword, Leaf(token.EQUAL, '='), value]) + def LParen(): return Leaf(token.LPAR, "(") From python-checkins at python.org Wed Apr 11 17:57:49 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 11 Apr 2007 17:57:49 +0200 (CEST) Subject: [Python-checkins] r54752 - in sandbox/trunk/2to3: pytree.py tests/test_pytree.py Message-ID: <20070411155749.123E41E4016@bag.python.org> Author: collin.winter Date: Wed Apr 11 17:57:45 2007 New Revision: 54752 Modified: sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py Log: Add append_child(), insert_child() and set_child() methods to pytree.Node to simplify child-manipulating code. Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Wed Apr 11 17:57:45 2007 @@ -209,6 +209,25 @@ if not self.children: return "" return self.children[0].get_prefix() + + def set_child(self, i, child): + """Equivalent to 'node.children[i] = child'. This method also sets the + child's parent attribute appropriately.""" + child.parent = self + self.children[i].parent = None + self.children[i] = child + + def insert_child(self, i, child): + """Equivalent to 'node.children.insert(i, child)'. This method also + sets the child's parent attribute appropriately.""" + child.parent = self + self.children.insert(i, child) + + def append_child(self, child): + """Equivalent to 'node.children.append(child)'. This method also + sets the child's parent attribute appropriately.""" + child.parent = self + self.children.append(child) class Leaf(Base): Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Wed Apr 11 17:57:45 2007 @@ -209,6 +209,59 @@ l1 = pytree.Leaf(100, "foo") l1.remove() self.assertEqual(l1.parent, None) + + def testNodeSetChild(self): + l1 = pytree.Leaf(100, "foo") + n1 = pytree.Node(1000, [l1]) + + l2 = pytree.Leaf(100, "bar") + n1.set_child(0, l2) + self.assertEqual(l1.parent, None) + self.assertEqual(l2.parent, n1) + self.assertEqual(n1.children, [l2]) + + n2 = pytree.Node(1000, [l1]) + n2.set_child(0, n1) + self.assertEqual(l1.parent, None) + self.assertEqual(n1.parent, n2) + self.assertEqual(n2.parent, None) + self.assertEqual(n2.children, [n1]) + + self.assertRaises(IndexError, n1.set_child, 4, l2) + # I don't care what it raises, so long as it's an exception + self.assertRaises(Exception, n1.set_child, 0, list) + + def testNodeInsertChild(self): + l1 = pytree.Leaf(100, "foo") + n1 = pytree.Node(1000, [l1]) + + l2 = pytree.Leaf(100, "bar") + n1.insert_child(0, l2) + self.assertEqual(l2.parent, n1) + self.assertEqual(n1.children, [l2, l1]) + + l3 = pytree.Leaf(100, "abc") + n1.insert_child(2, l3) + self.assertEqual(n1.children, [l2, l1, l3]) + + # I don't care what it raises, so long as it's an exception + self.assertRaises(Exception, n1.insert_child, 0, list) + + def testNodeAppendChild(self): + n1 = pytree.Node(1000, []) + + l1 = pytree.Leaf(100, "foo") + n1.append_child(l1) + self.assertEqual(l1.parent, n1) + self.assertEqual(n1.children, [l1]) + + l2 = pytree.Leaf(100, "bar") + n1.append_child(l2) + self.assertEqual(l2.parent, n1) + self.assertEqual(n1.children, [l1, l2]) + + # I don't care what it raises, so long as it's an exception + self.assertRaises(Exception, n1.append_child, list) class TestPatterns(support.TestCase): From python-checkins at python.org Wed Apr 11 17:59:19 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 11 Apr 2007 17:59:19 +0200 (CEST) Subject: [Python-checkins] r54753 - sandbox/trunk/2to3/tests/test_pytree.py Message-ID: <20070411155919.C28851E4002@bag.python.org> Author: collin.winter Date: Wed Apr 11 17:59:15 2007 New Revision: 54753 Modified: sandbox/trunk/2to3/tests/test_pytree.py Log: Strengthen two assertions. Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Wed Apr 11 17:59:15 2007 @@ -185,7 +185,7 @@ n2 = pytree.Node(1000, [n1]) self.assertEqual(n1.remove(), 0) - self.failIf(n1 in n2.children) + self.assertEqual(n2.children, []) self.assertEqual(l1.parent, n1) self.assertEqual(n1.parent, None) self.assertEqual(n2.parent, None) @@ -194,7 +194,7 @@ self.assertEqual(l2.remove(), 1) self.assertEqual(l1.remove(), 0) - self.failIf(l1 in n1.children) + self.assertEqual(n1.children, []) self.assertEqual(l1.parent, None) self.assertEqual(n1.parent, None) self.assertEqual(n2.parent, None) From python-checkins at python.org Wed Apr 11 19:16:25 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Apr 2007 19:16:25 +0200 (CEST) Subject: [Python-checkins] r54757 - python/trunk/Objects/exceptions.c python/trunk/Objects/longobject.c Message-ID: <20070411171625.EC97F1E4004@bag.python.org> Author: georg.brandl Date: Wed Apr 11 19:16:24 2007 New Revision: 54757 Modified: python/trunk/Objects/exceptions.c python/trunk/Objects/longobject.c Log: Add some missing NULL checks which trigger crashes on low-memory conditions. Found by Victor Stinner. Will backport when 2.5 branch is unfrozen. Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Wed Apr 11 19:16:24 2007 @@ -33,6 +33,8 @@ PyBaseExceptionObject *self; self = (PyBaseExceptionObject *)type->tp_alloc(type, 0); + if (!self) + return NULL; /* the dict is created on the fly in PyObject_GenericSetAttr */ self->message = self->dict = NULL; Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Wed Apr 11 19:16:24 2007 @@ -1739,6 +1739,8 @@ a->ob_digit[size_a-1] < b->ob_digit[size_b-1])) { /* |a| < |b|. */ *pdiv = _PyLong_New(0); + if (*pdiv == NULL) + return -1; Py_INCREF(a); *prem = (PyLongObject *) a; return 0; @@ -1749,6 +1751,10 @@ if (z == NULL) return -1; *prem = (PyLongObject *) PyLong_FromLong((long)rem); + if (*prem == NULL) { + Py_DECREF(z); + return -1; + } } else { z = x_divrem(a, b, prem); @@ -3204,6 +3210,8 @@ { if (PyInt_Check(*pw)) { *pw = PyLong_FromLong(PyInt_AS_LONG(*pw)); + if (*pw == NULL) + return -1; Py_INCREF(*pv); return 0; } From buildbot at python.org Wed Apr 11 19:54:10 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 17:54:10 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070411175411.03F241E4010@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1948 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Apr 11 19:57:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 17:57:32 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20070411175732.A929F1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1616 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From barry at python.org Wed Apr 11 20:05:17 2007 From: barry at python.org (Barry Warsaw) Date: Wed, 11 Apr 2007 14:05:17 -0400 Subject: [Python-checkins] svn.python.org In-Reply-To: <022AFF34-4BAE-4B26-BA3E-9823D9253B94@python.org> References: <4E9372E6B2234D4F859320D896059A9508BF48EBAF@exchis.ccp.ad.local> <022AFF34-4BAE-4B26-BA3E-9823D9253B94@python.org> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 11, 2007, at 11:10 AM, Barry Warsaw wrote: > I'll take this opportunity to mention that we've ordered a new ssl > cert for our expired one on https. It hasn't arrived yet, but > should within a few days. I'll make another announcement when the > new cert is installed. The new certificate has been installed. It's good until 2010. Please let me know if you have any problems with it. Cheers, - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRh0jXnEjvBPtnXfVAQKuQwP/QZr/mP6bppUDw4Lz1CoKeWlICTSk0Qg/ g+RdFJFXgpwEwWUPRc8w6Cg7yxQZkpaWzoI1+wQRf10G6sw0JUWzN6A2wgBc0lNy 7W2sFFghjQ55gFqoYIGDs3dhLlKcNHhyhTWPFKTw5cnQ41GV9fVLXVtuMqGzeylg dFGUcXqazdU= =jv2x -----END PGP SIGNATURE----- From buildbot at python.org Wed Apr 11 20:13:55 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Apr 2007 18:13:55 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070411181355.EA5131E401E@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/1935 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 2 tests failed: test_pty test_socketserver ====================================================================== FAIL: test_basic (test.test_pty.PtyTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_pty.py", line 76, in test_basic normalize_output(s1)) AssertionError: 'I wish to buy a fish license.\n' != '' sincerely, -The Buildbot From python-checkins at python.org Wed Apr 11 20:41:02 2007 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Apr 2007 20:41:02 +0200 (CEST) Subject: [Python-checkins] r54760 - in python/trunk: Lib/test/test_slice.py Misc/NEWS Objects/sliceobject.c Message-ID: <20070411184102.BA6CB1E4002@bag.python.org> Author: raymond.hettinger Date: Wed Apr 11 20:40:58 2007 New Revision: 54760 Modified: python/trunk/Lib/test/test_slice.py python/trunk/Misc/NEWS python/trunk/Objects/sliceobject.c Log: SF 1191699: Make slices picklable Modified: python/trunk/Lib/test/test_slice.py ============================================================================== --- python/trunk/Lib/test/test_slice.py (original) +++ python/trunk/Lib/test/test_slice.py Wed Apr 11 20:40:58 2007 @@ -2,6 +2,7 @@ import unittest from test import test_support +from cPickle import loads, dumps import sys @@ -102,6 +103,13 @@ x[1:2] = 42 self.assertEquals(tmp, [(1, 2, 42)]) + def test_pickle(self): + s = slice(10, 20, 3) + for protocol in (0,1,2): + t = loads(dumps(s, protocol)) + self.assertEqual(s, t) + self.assertEqual(s.indices(15), t.indices(15)) + self.assertNotEqual(id(s), id(t)) def test_main(): test_support.run_unittest(SliceTest) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Apr 11 20:40:58 2007 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Request #1191699: Slices can now be pickled. + - Patch #1682205: a TypeError while unpacking an iterable is no longer masked by a generic one with the message "unpack non-sequence". Modified: python/trunk/Objects/sliceobject.c ============================================================================== --- python/trunk/Objects/sliceobject.c (original) +++ python/trunk/Objects/sliceobject.c Wed Apr 11 20:40:58 2007 @@ -274,9 +274,19 @@ S. Out of bounds indices are clipped in a manner consistent with the\n\ handling of normal slices."); +static PyObject * +slice_reduce(PySliceObject* self) +{ + return Py_BuildValue("O(OOO)", self->ob_type, self->start, self->stop, self->step); +} + +PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); + static PyMethodDef slice_methods[] = { {"indices", (PyCFunction)slice_indices, METH_O, slice_indices_doc}, + {"__reduce__", (PyCFunction)slice_reduce, + METH_NOARGS, reduce_doc}, {NULL, NULL} }; From python-checkins at python.org Wed Apr 11 21:25:14 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Apr 2007 21:25:14 +0200 (CEST) Subject: [Python-checkins] r54762 - python/trunk/Lib/cgitb.py Message-ID: <20070411192514.3C9721E4003@bag.python.org> Author: georg.brandl Date: Wed Apr 11 21:25:11 2007 New Revision: 54762 Modified: python/trunk/Lib/cgitb.py Log: Exceptions are no longer old-style instances. Fix accordingly. Modified: python/trunk/Lib/cgitb.py ============================================================================== --- python/trunk/Lib/cgitb.py (original) +++ python/trunk/Lib/cgitb.py Wed Apr 11 21:25:11 2007 @@ -167,7 +167,7 @@ exception = ['

%s: %s' % (strong(pydoc.html.escape(str(etype))), pydoc.html.escape(str(evalue)))] - if type(evalue) is types.InstanceType: + if isinstance(evalue, BaseException): for name in dir(evalue): if name[:1] == '_': continue value = pydoc.html.repr(getattr(evalue, name)) @@ -239,7 +239,7 @@ frames.append('\n%s\n' % '\n'.join(rows)) exception = ['%s: %s' % (str(etype), str(evalue))] - if type(evalue) is types.InstanceType: + if isinstance(evalue, BaseException): for name in dir(evalue): value = pydoc.text.repr(getattr(evalue, name)) exception.append('\n%s%s = %s' % (" "*4, name, value)) From python-checkins at python.org Thu Apr 12 01:28:45 2007 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Apr 2007 01:28:45 +0200 (CEST) Subject: [Python-checkins] r54763 - in python/trunk/Doc: api/init.tex inst/inst.tex lib/libposixpath.tex mac/using.tex Message-ID: <20070411232845.D721A1E4002@bag.python.org> Author: georg.brandl Date: Thu Apr 12 01:28:44 2007 New Revision: 54763 Modified: python/trunk/Doc/api/init.tex python/trunk/Doc/inst/inst.tex python/trunk/Doc/lib/libposixpath.tex python/trunk/Doc/mac/using.tex Log: Repair missing spaces after \UNIX. Modified: python/trunk/Doc/api/init.tex ============================================================================== --- python/trunk/Doc/api/init.tex (original) +++ python/trunk/Doc/api/init.tex Thu Apr 12 01:28:44 2007 @@ -245,7 +245,7 @@ program name (set by \cfunction{Py_SetProgramName()} above) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter - character. The delimiter character is \character{:} on \UNIX and Mac OS X, + character. The delimiter character is \character{:} on \UNIX{} and Mac OS X, \character{;} on Windows. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as the list Modified: python/trunk/Doc/inst/inst.tex ============================================================================== --- python/trunk/Doc/inst/inst.tex (original) +++ python/trunk/Doc/inst/inst.tex Thu Apr 12 01:28:44 2007 @@ -296,7 +296,7 @@ \filevar{prefix} and \filevar{exec-prefix} stand for the directories that Python is installed to, and where it finds its libraries at run-time. They are always the same under Windows, and very -often the same under \UNIX and Mac OS X. You can find out what your Python +often the same under \UNIX{} and Mac OS X. You can find out what your Python installation uses for \filevar{prefix} and \filevar{exec-prefix} by running Python in interactive mode and typing a few simple commands. Under \UNIX, just type \code{python} at the shell prompt. Under Modified: python/trunk/Doc/lib/libposixpath.tex ============================================================================== --- python/trunk/Doc/lib/libposixpath.tex (original) +++ python/trunk/Doc/lib/libposixpath.tex Thu Apr 12 01:28:44 2007 @@ -58,7 +58,7 @@ \end{funcdesc} \begin{funcdesc}{expanduser}{path} -On \UNIX and Windows, return the argument with an initial component of +On \UNIX{} and Windows, return the argument with an initial component of \samp{\~} or \samp{\~\var{user}} replaced by that \var{user}'s home directory. On \UNIX, an initial \samp{\~} is replaced by the environment variable Modified: python/trunk/Doc/mac/using.tex ============================================================================== --- python/trunk/Doc/mac/using.tex (original) +++ python/trunk/Doc/mac/using.tex Thu Apr 12 01:28:44 2007 @@ -2,7 +2,7 @@ \sectionauthor{Bob Savage}{bobsavage at mac.com} Python on a Macintosh running Mac OS X is in principle very similar to -Python on any other \UNIX platform, but there are a number of additional +Python on any other \UNIX{} platform, but there are a number of additional features such as the IDE and the Package Manager that are worth pointing out. Python on Mac OS 9 or earlier can be quite different from Python on From python-checkins at python.org Thu Apr 12 04:06:33 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 04:06:33 +0200 (CEST) Subject: [Python-checkins] r54764 - sandbox/trunk/pep0/pep0.py Message-ID: <20070412020633.114131E4003@bag.python.org> Author: brett.cannon Date: Thu Apr 12 04:06:30 2007 New Revision: 54764 Modified: sandbox/trunk/pep0/pep0.py Log: Allow for specifying a single PEP file (for testing purposes). Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Thu Apr 12 04:06:30 2007 @@ -139,13 +139,15 @@ from sys import argv, stdout if not argv[1:]: - directory = '.' + path = '.' else: - directory = argv[1] - peps = consume_headers(directory) + path = argv[1] + if os.path.isdir(path): + peps = consume_headers(directory) + else: + peps = [consume_pep(path)] - output = stdout for pep in peps: - write_pep(pep, output) + write_pep(pep, stdout) #meta, info, accepted, open_, done, empty, dead = sort_peps(peps) From python-checkins at python.org Thu Apr 12 04:07:03 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 04:07:03 +0200 (CEST) Subject: [Python-checkins] r54765 - sandbox/trunk/pep0/test_pep0.py Message-ID: <20070412020703.AD9671E4003@bag.python.org> Author: brett.cannon Date: Thu Apr 12 04:07:02 2007 New Revision: 54765 Modified: sandbox/trunk/pep0/test_pep0.py Log: Strengthen author parsing. Currently leads to a failure. Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Thu Apr 12 04:07:02 2007 @@ -36,22 +36,18 @@ # Name , # email (name), # Name. - author = "Guido van Rossum" - str_rep = "%s " % author - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) - str_rep += ',' - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) - str_rep = "email (%s)" % author - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) - str_rep += ',' - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) - str_rep = author - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) - str_rep += ',' - self.failUnlessEqual(pep0.handle_author(str_rep), [author]) authors = ["Guido van Rossum", "Brett Cannon"] - str_rep = ', '.join(authors) - self.failUnlessEqual(pep0.handle_author(str_rep), authors) + formats = ["%s ", "email (%s)", "%s"] + for format in formats: + rep = format % authors[0] + expect = authors[0:1] + self.failUnlessEqual(pep0.handle_author(rep), expect) + rep += ',' + self.failUnlessEqual(pep0.handle_author(rep), expect) + rep += format % authors[1] + self.failUnlessEqual(pep0.handle_author(rep), authors) + rep += ',' + self.failUnlessEqual(pep0.handle_author(rep), authors) class ParseMetaDataTests(unittest.TestCase): From python-checkins at python.org Thu Apr 12 04:50:48 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 04:50:48 +0200 (CEST) Subject: [Python-checkins] r54766 - sandbox/trunk/2to3/HACKING sandbox/trunk/2to3/README Message-ID: <20070412025048.B80D41E400D@bag.python.org> Author: collin.winter Date: Thu Apr 12 04:50:44 2007 New Revision: 54766 Modified: sandbox/trunk/2to3/HACKING sandbox/trunk/2to3/README Log: Add a TODO section to HACKING (and a pointer to it from README). Modified: sandbox/trunk/2to3/HACKING ============================================================================== --- sandbox/trunk/2to3/HACKING (original) +++ sandbox/trunk/2to3/HACKING Thu Apr 12 04:50:44 2007 @@ -6,3 +6,26 @@ * If your fixer works by changing a node's children list or a leaf's value, be sure to call the node/leaf's changed() method. This to be sure refactor.py will recognize that the tree has changed. + + + +TODO + + Simple: + ####### + + * Refactor common code out of fixes/fix_*.py into fixes.util (ongoing). + + + Complex: + ######## + + * Replace tuple usage in patterns and node.children with lists (95% + done). Simplify fixers accordingly (mostly done, I think). + + * Come up with a scheme to hide the details of suite indentation (some + kind of custom pytree node for suites, probably). This will + automatically reindent all code with spaces, tied into a refactor.py + flag that allows you to specify the indent level. + + * Remove the need to explicitly assign a node's parent attribute. Modified: sandbox/trunk/2to3/README ============================================================================== --- sandbox/trunk/2to3/README (original) +++ sandbox/trunk/2to3/README Thu Apr 12 04:50:44 2007 @@ -150,6 +150,13 @@ it while at Google to suit the needs of this refactoring tool. +Development +=========== + +The HACKING file has a list of TODOs -- some simple, some complex -- that +would make good introductions for anyone new to 2to3. + + Licensing ========= From python-checkins at python.org Thu Apr 12 04:54:30 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 04:54:30 +0200 (CEST) Subject: [Python-checkins] r54767 - sandbox/trunk/2to3/README Message-ID: <20070412025430.835231E4015@bag.python.org> Author: collin.winter Date: Thu Apr 12 04:54:30 2007 New Revision: 54767 Modified: sandbox/trunk/2to3/README Log: Update licensing section. Modified: sandbox/trunk/2to3/README ============================================================================== --- sandbox/trunk/2to3/README (original) +++ sandbox/trunk/2to3/README Thu Apr 12 04:54:30 2007 @@ -162,8 +162,16 @@ The original pgen2 module is copyrighted by Elemental Security. All new code I wrote specifically for this tool is copyrighted by Google. -New code by others (notably Collin Winter) is copyrighted by the -respective authors. All code (whether by me or by others) is licensed -to the PSF under a contributor agreement. +New code by others is copyrighted by the respective authors. All code +(whether by me or by others) is licensed to the PSF under a contributor +agreement. --Guido van Rossum + + +All code I wrote specifically for this tool before 9 April 2007 is +copyrighted by me. All new code I wrote specifically for this tool after +9 April 2007 is copyrighted by Google. Regardless, my contributions are +licensed to the PSF under a contributor agreement. + +--Collin Winter From python-checkins at python.org Thu Apr 12 04:59:27 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 04:59:27 +0200 (CEST) Subject: [Python-checkins] r54768 - sandbox/trunk/2to3/fixes/fix_dict.py Message-ID: <20070412025927.9348E1E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 04:59:25 2007 New Revision: 54768 Modified: sandbox/trunk/2to3/fixes/fix_dict.py Log: Reindent to four spaces, not Google's two :) Modified: sandbox/trunk/2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/fixes/fix_dict.py Thu Apr 12 04:59:25 2007 @@ -29,65 +29,64 @@ from fixes.util import Name, Call, LParen, RParen class FixDict(basefix.BaseFix): - - PATTERN = """ - power< head=any+ + PATTERN = """ + power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues') > trailer< '(' ')' > tail=any* - > - """ - - def transform(self, node): - results = self.match(node) - head = results["head"] - method = results["method"][0].value # Extract method name - tail = results["tail"] - syms = self.syms - isiter = method.startswith("iter") - if isiter: - method = method[4:] - assert method in ("keys", "items", "values"), repr(method) - head = [n.clone() for n in head] - tail = [n.clone() for n in tail] - special = not tail and self.in_special_context(node, isiter) - args = head + [pytree.Node(syms.trailer, - [pytree.Leaf(token.DOT, '.'), - Name(method)]), - pytree.Node(syms.trailer, [LParen(), RParen()])] - new = pytree.Node(syms.power, args) - if not special: - new.set_prefix("") - new = Call(Name(isiter and "iter" or "list"), [new]) - if tail: - new = pytree.Node(syms.power, [new] + tail) - new.set_prefix(node.get_prefix()) - return new - - P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" - p1 = patcomp.PatternCompiler().compile_pattern(P1) - - P2 = """for_stmt< 'for' any 'in' node=any ':' any* > - | list_for< 'for' any 'in' node=any any* > - | gen_for< 'for' any 'in' node=any any* > - """ - p2 = patcomp.PatternCompiler().compile_pattern(P2) + > + """ - def in_special_context(self, node, isiter): - if node.parent is None: - return False - results = {} - if (node.parent.parent is not None and - self.p1.match(node.parent.parent, results) and - results["node"] is node): - if isiter: - # iter(d.iterkeys()) -> iter(d.keys()), etc. - return results["func"].value in ("iter", "list", "sorted") - else: - # list(d.keys()) -> list(d.keys()), etc. - return results["func"].value in ("list", "sorted") - if not isiter: - return False - # for ... in d.iterkeys() -> for ... in d.keys(), etc. - return self.p2.match(node.parent, results) and results["node"] is node + def transform(self, node): + results = self.match(node) + head = results["head"] + method = results["method"][0].value # Extract method name + tail = results["tail"] + syms = self.syms + isiter = method.startswith("iter") + if isiter: + method = method[4:] + assert method in ("keys", "items", "values"), repr(method) + head = [n.clone() for n in head] + tail = [n.clone() for n in tail] + special = not tail and self.in_special_context(node, isiter) + args = head + [pytree.Node(syms.trailer, + [pytree.Leaf(token.DOT, '.'), + Name(method)]), + pytree.Node(syms.trailer, [LParen(), RParen()])] + new = pytree.Node(syms.power, args) + if not special: + new.set_prefix("") + new = Call(Name(isiter and "iter" or "list"), [new]) + if tail: + new = pytree.Node(syms.power, [new] + tail) + new.set_prefix(node.get_prefix()) + return new + + P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" + p1 = patcomp.PatternCompiler().compile_pattern(P1) + + P2 = """for_stmt< 'for' any 'in' node=any ':' any* > + | list_for< 'for' any 'in' node=any any* > + | gen_for< 'for' any 'in' node=any any* > + """ + p2 = patcomp.PatternCompiler().compile_pattern(P2) + + def in_special_context(self, node, isiter): + if node.parent is None: + return False + results = {} + if (node.parent.parent is not None and + self.p1.match(node.parent.parent, results) and + results["node"] is node): + if isiter: + # iter(d.iterkeys()) -> iter(d.keys()), etc. + return results["func"].value in ("iter", "list", "sorted") + else: + # list(d.keys()) -> list(d.keys()), etc. + return results["func"].value in ("list", "sorted") + if not isiter: + return False + # for ... in d.iterkeys() -> for ... in d.keys(), etc. + return self.p2.match(node.parent, results) and results["node"] is node From python-checkins at python.org Thu Apr 12 05:02:12 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 05:02:12 +0200 (CEST) Subject: [Python-checkins] r54769 - sandbox/trunk/2to3/fixes/fix_except.py Message-ID: <20070412030212.028641E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 05:02:04 2007 New Revision: 54769 Modified: sandbox/trunk/2to3/fixes/fix_except.py Log: Refactor to use the Name() macro. Modified: sandbox/trunk/2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/fixes/fix_except.py Thu Apr 12 05:02:04 2007 @@ -33,10 +33,6 @@ if n.children[0].value == 'except': yield (n, nodes[i+2]) -### Common across all transforms -as_leaf = pytree.Leaf(token.NAME, "as") -as_leaf.set_prefix(" ") - class FixExcept(basefix.BaseFix): PATTERN = """ @@ -55,7 +51,8 @@ for except_clause, e_suite in find_excepts(try_cleanup): if len(except_clause.children) == 4: (E, comma, N) = except_clause.children[1:4] - comma.replace(as_leaf.clone()) + comma.replace(Name("as", prefix=" ")) + if N.type != token.NAME: # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=" ") From python-checkins at python.org Thu Apr 12 05:30:27 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 05:30:27 +0200 (CEST) Subject: [Python-checkins] r54770 - sandbox/trunk/2to3/fixes/fix_raw_input.py Message-ID: <20070412033027.E49B91E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 05:30:26 2007 New Revision: 54770 Modified: sandbox/trunk/2to3/fixes/fix_raw_input.py Log: Reindent, reformat for readability. Also, remove an unneeded import. Modified: sandbox/trunk/2to3/fixes/fix_raw_input.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_raw_input.py (original) +++ sandbox/trunk/2to3/fixes/fix_raw_input.py Thu Apr 12 05:30:26 2007 @@ -3,23 +3,19 @@ # Local imports import pytree -from pgen2 import token from fixes import basefix from fixes.util import Name class FixRawInput(basefix.BaseFix): PATTERN = """ - power< - 'raw_input' - args=trailer< '(' [any] ')' > - > - """ + power< 'raw_input' args=trailer< '(' [any] ')' > > + """ def transform(self, node): results = self.match(node) args = results["args"] - new = pytree.Node(self.syms.power, - [Name("input"), args.clone()]) + + new = pytree.Node(self.syms.power, [Name("input"), args.clone()]) new.set_prefix(node.get_prefix()) return new From python-checkins at python.org Thu Apr 12 05:34:43 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 05:34:43 +0200 (CEST) Subject: [Python-checkins] r54771 - sandbox/trunk/2to3/fixes/fix_repr.py Message-ID: <20070412033443.42AA51E4010@bag.python.org> Author: collin.winter Date: Thu Apr 12 05:34:39 2007 New Revision: 54771 Modified: sandbox/trunk/2to3/fixes/fix_repr.py Log: Reindent, reformat for readability. Also, remove an unneeded import. Modified: sandbox/trunk/2to3/fixes/fix_repr.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_repr.py (original) +++ sandbox/trunk/2to3/fixes/fix_repr.py Thu Apr 12 05:34:39 2007 @@ -5,7 +5,6 @@ # Local imports import pytree -from pgen2 import token from fixes import basefix from fixes.util import Call, Name @@ -13,15 +12,16 @@ class FixRepr(basefix.BaseFix): PATTERN = """ - atom < '`' expr=any '`' > - """ + atom < '`' expr=any '`' > + """ def transform(self, node): results = self.match(node) assert results expr = results["expr"].clone() + if expr.type == self.syms.testlist1: - expr = self.parenthesize(expr) + expr = self.parenthesize(expr) new = Call(Name("repr"), [expr]) new.set_prefix(node.get_prefix()) return new From python-checkins at python.org Thu Apr 12 06:10:04 2007 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 12 Apr 2007 06:10:04 +0200 (CEST) Subject: [Python-checkins] r54772 - in python/trunk: Doc/lib/libstdtypes.tex Doc/lib/libstring.tex Lib/string.py Lib/test/string_tests.py Misc/NEWS Objects/stringobject.c Message-ID: <20070412041004.2B4291E4002@bag.python.org> Author: raymond.hettinger Date: Thu Apr 12 06:10:00 2007 New Revision: 54772 Modified: python/trunk/Doc/lib/libstdtypes.tex python/trunk/Doc/lib/libstring.tex python/trunk/Lib/string.py python/trunk/Lib/test/string_tests.py python/trunk/Misc/NEWS python/trunk/Objects/stringobject.c Log: SF 1193128: Let str.translate(None) be an identity transformation Modified: python/trunk/Doc/lib/libstdtypes.tex ============================================================================== --- python/trunk/Doc/lib/libstdtypes.tex (original) +++ python/trunk/Doc/lib/libstdtypes.tex Thu Apr 12 06:10:00 2007 @@ -878,6 +878,13 @@ You can use the \function{maketrans()} helper function in the \refmodule{string} module to create a translation table. +For string objects, set the \var{table} argument to \code{None} +for translations that only delete characters: +\begin{verbatim} + >>> 'read this short text'.translate(None, 'aeiou') + 'rd ths shrt txt' +\end{verbatim} +\versionadded[Support for a \code{None} \var{table} argument]{2.6} For Unicode objects, the \method{translate()} method does not accept the optional \var{deletechars} argument. Instead, it Modified: python/trunk/Doc/lib/libstring.tex ============================================================================== --- python/trunk/Doc/lib/libstring.tex (original) +++ python/trunk/Doc/lib/libstring.tex Thu Apr 12 06:10:00 2007 @@ -419,7 +419,8 @@ Delete all characters from \var{s} that are in \var{deletechars} (if present), and then translate the characters using \var{table}, which must be a 256-character string giving the translation for each - character value, indexed by its ordinal. + character value, indexed by its ordinal. If \var{table} is \code{None}, + then only the character deletion step is performed. \end{funcdesc} \begin{funcdesc}{upper}{s} Modified: python/trunk/Lib/string.py ============================================================================== --- python/trunk/Lib/string.py (original) +++ python/trunk/Lib/string.py Thu Apr 12 06:10:00 2007 @@ -487,7 +487,7 @@ deletions argument is not allowed for Unicode strings. """ - if deletions: + if deletions or table is None: return s.translate(table, deletions) else: # Add s[:0] so that if s is Unicode and table is an 8-bit string, Modified: python/trunk/Lib/test/string_tests.py ============================================================================== --- python/trunk/Lib/test/string_tests.py (original) +++ python/trunk/Lib/test/string_tests.py Thu Apr 12 06:10:00 2007 @@ -1096,6 +1096,9 @@ self.checkequal('Abc', 'abc', 'translate', table) self.checkequal('xyz', 'xyz', 'translate', table) self.checkequal('yz', 'xyz', 'translate', table, 'x') + self.checkequal('yx', 'zyzzx', 'translate', None, 'z') + self.checkequal('zyzzx', 'zyzzx', 'translate', None, '') + self.checkequal('zyzzx', 'zyzzx', 'translate', None) self.checkraises(ValueError, 'xyz', 'translate', 'too short', 'strip') self.checkraises(ValueError, 'xyz', 'translate', 'too short') Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Apr 12 06:10:00 2007 @@ -14,6 +14,10 @@ - Request #1191699: Slices can now be pickled. +- Request #1193128: str.translate() now allows a None argument for + translations that only remove characters without re-mapping the + remaining characters. + - Patch #1682205: a TypeError while unpacking an iterable is no longer masked by a generic one with the message "unpack non-sequence". Modified: python/trunk/Objects/stringobject.c ============================================================================== --- python/trunk/Objects/stringobject.c (original) +++ python/trunk/Objects/stringobject.c Thu Apr 12 06:10:00 2007 @@ -2344,10 +2344,10 @@ string_translate(PyStringObject *self, PyObject *args) { register char *input, *output; - register const char *table; + const char *table; register Py_ssize_t i, c, changed = 0; PyObject *input_obj = (PyObject*)self; - const char *table1, *output_start, *del_table=NULL; + const char *output_start, *del_table=NULL; Py_ssize_t inlen, tablen, dellen = 0; PyObject *result; int trans_table[256]; @@ -2358,9 +2358,13 @@ return NULL; if (PyString_Check(tableobj)) { - table1 = PyString_AS_STRING(tableobj); + table = PyString_AS_STRING(tableobj); tablen = PyString_GET_SIZE(tableobj); } + else if (tableobj == Py_None) { + table = NULL; + tablen = 256; + } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(tableobj)) { /* Unicode .translate() does not support the deletechars @@ -2374,7 +2378,7 @@ return PyUnicode_Translate((PyObject *)self, tableobj, NULL); } #endif - else if (PyObject_AsCharBuffer(tableobj, &table1, &tablen)) + else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) return NULL; if (tablen != 256) { @@ -2403,7 +2407,6 @@ dellen = 0; } - table = table1; inlen = PyString_GET_SIZE(input_obj); result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) @@ -2411,7 +2414,7 @@ output_start = output = PyString_AsString(result); input = PyString_AS_STRING(input_obj); - if (dellen == 0) { + if (dellen == 0 && table != NULL) { /* If no deletions are required, use faster code */ for (i = inlen; --i >= 0; ) { c = Py_CHARMASK(*input++); @@ -2425,8 +2428,13 @@ return input_obj; } - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); + if (table == NULL) { + for (i = 0; i < 256; i++) + trans_table[i] = Py_CHARMASK(i); + } else { + for (i = 0; i < 256; i++) + trans_table[i] = Py_CHARMASK(table[i]); + } for (i = 0; i < dellen; i++) trans_table[(int) Py_CHARMASK(del_table[i])] = -1; From python-checkins at python.org Thu Apr 12 06:16:34 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 06:16:34 +0200 (CEST) Subject: [Python-checkins] r54773 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Message-ID: <20070412041634.08A541E4002@bag.python.org> Author: brett.cannon Date: Thu Apr 12 06:16:33 2007 New Revision: 54773 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Log: Fix author parsing (really need to have a consistent way of listing authors). Also updated TODO list of what is left to do. Minor bug in running pep0.py with a directory argument also fixed. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Thu Apr 12 06:16:33 2007 @@ -1,20 +1,43 @@ -In script: +Current discrepencies +--------------------- + * Author issues + Missing an author - - 207 - - 208 - - 209 - - 218 - - 228 - - 234 - - 238 - - 246 - - 251 - - 263 - - 312 - 314 + How to handle suffixes (Jr., etc.)? -* Read PEPs as UTF-8, not ASCII. + - 160 + - 205 +* Type/status issues: + - 160: missing F + - 206: missing W + - 216: missing R + - 220: missing D + - 226: missing F + - 247: missing F + - 248: missing F + - 249: missing F + - 251: missing F + - 269: added D + - 272: missing F + - 283: missing F + - 286: added A + - 320: missing F + - 344: added A + - 353: used F, expected A + - 356: missing F + - 364: added A + - 3102: used A, expected F + - 3104: used A, expected F + - 3107: used A, expected F + - 3104: used A +* Title are too long (use ellipsis?): + - 311 + - 3001 + + +Functionality to add +-------------------- + * Output static text for PEP 0. + Store Owners list in a data structure. - Support nicknames for PEP listing (e.g., "Guido van Rossum" -> @@ -28,11 +51,14 @@ - Would allow for easy validation that metadata is correct in PEPs. * Output PEP 0 with numerical PEP index. * Output PEP 0 with special sections. +* Make sure that it is easy to identify which PEP triggered an error. + -For PEPs: +To clean up PEPs +---------------- * Define (and enforce) consistency in Author field. * Empty PEPs are not in any way identified within the PEPs themselves. - + Get ride of section and just consider rejected? + + Get rid of section and just consider rejected? - No longer accept empty PEPs, right? * Meta-PEPs are not noted as such within the PEPs. + Add a "Meta" option for "Type"? Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Thu Apr 12 06:16:33 2007 @@ -1,6 +1,7 @@ """Auto-generate PEP 0 (PEP index). """ from __future__ import with_statement import os +import re def consume_headers(directory='.'): """Pull out metadata for every PEP in the specified directory and return @@ -61,15 +62,20 @@ def handle_author(data): """Return a list of author names.""" - if '<' in data: - author, email = data.split('<', 1) - elif '(' in data: - email, author = data.split('(', 1) - author = author[:author.index(')')] - else: - author = data - return [author_name.strip() for author_name in author.split(',') if - author_name] + angled = r'(?P.+?) <.+?>' + paren = r'.+? \((?P.+?)\)' + simple = r'(?P[^,]+)' + authors = [] + for regex in (angled, paren, simple): + # Watch out for commas separating multiple names. + regex += '(,\s+)?' + for match in re.finditer(regex, data): + authors.append(match.group('author')) + else: + # If authors were found then stop searching. + if authors: + break + return authors def handle_csv(data): """Handle the Post-History.""" @@ -143,7 +149,7 @@ else: path = argv[1] if os.path.isdir(path): - peps = consume_headers(directory) + peps = consume_headers(path) else: peps = [consume_pep(path)] Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Thu Apr 12 06:16:33 2007 @@ -41,12 +41,14 @@ for format in formats: rep = format % authors[0] expect = authors[0:1] - self.failUnlessEqual(pep0.handle_author(rep), expect) - rep += ',' + got = pep0.handle_author(rep) + self.failUnlessEqual(got, expect, + "%r failed; %r != %r" % (rep, got, expect)) + rep += ', ' self.failUnlessEqual(pep0.handle_author(rep), expect) rep += format % authors[1] self.failUnlessEqual(pep0.handle_author(rep), authors) - rep += ',' + rep += ', ' self.failUnlessEqual(pep0.handle_author(rep), authors) From buildbot at python.org Thu Apr 12 06:33:31 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Apr 2007 04:33:31 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070412043332.1D76F1E4002@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2134 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib2net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Apr 12 07:34:30 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:34:30 +0200 (CEST) Subject: [Python-checkins] r54775 - sandbox/trunk/2to3/fixes/util.py Message-ID: <20070412053430.9073E1E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:34:30 2007 New Revision: 54775 Modified: sandbox/trunk/2to3/fixes/util.py Log: Add reversed() for 2.3-compat. Modified: sandbox/trunk/2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/fixes/util.py Thu Apr 12 07:34:30 2007 @@ -117,6 +117,12 @@ set = set except NameError: from sets import Set as set + +try: + reversed = reversed +except NameError: + def reversed(l): + return l[::-1] ########################################################### ### The following functions are to find bindings in a suite From python-checkins at python.org Thu Apr 12 07:35:32 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:35:32 +0200 (CEST) Subject: [Python-checkins] r54776 - sandbox/trunk/2to3/fixes/fix_except.py Message-ID: <20070412053532.9D9111E4004@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:35:31 2007 New Revision: 54776 Modified: sandbox/trunk/2to3/fixes/fix_except.py Log: Refactoring/cleanup to use the new Node.insert_child() method. Modified: sandbox/trunk/2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/fixes/fix_except.py Thu Apr 12 07:35:31 2007 @@ -25,7 +25,7 @@ import pytree from pgen2 import token from fixes import basefix -from fixes.util import Assign, Attr, Name, is_tuple, is_list +from fixes.util import Assign, Attr, Name, is_tuple, is_list, reversed def find_excepts(nodes): for i, n in enumerate(nodes): @@ -76,9 +76,10 @@ else: assign = Assign(target, new_N) - assign.parent = e_suite - suite_stmts = suite_stmts[:i] + [assign] + suite_stmts - e_suite.children = suite_stmts + #XXX(cwinter) stopgap until children becomes a smart list + for child in reversed(suite_stmts[:i]): + e_suite.insert_child(0, child) + e_suite.insert_child(i, assign) children = [c.clone() for c in node.children[:3]] + try_cleanup return pytree.Node(node.type, children) From python-checkins at python.org Thu Apr 12 07:44:54 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:44:54 +0200 (CEST) Subject: [Python-checkins] r54778 - sandbox/trunk/2to3/fixes/fix_exec.py Message-ID: <20070412054454.6CF191E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:44:54 2007 New Revision: 54778 Modified: sandbox/trunk/2to3/fixes/fix_exec.py Log: Remove an unneeded import from fix_exec. Modified: sandbox/trunk/2to3/fixes/fix_exec.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_exec.py (original) +++ sandbox/trunk/2to3/fixes/fix_exec.py Thu Apr 12 07:44:54 2007 @@ -11,7 +11,6 @@ # Local imports import pytree -from pgen2 import token from fixes import basefix from fixes.util import Comma, Name, Call From python-checkins at python.org Thu Apr 12 07:46:36 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:46:36 +0200 (CEST) Subject: [Python-checkins] r54779 - sandbox/trunk/2to3/fixes/fix_input.py Message-ID: <20070412054636.177201E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:46:34 2007 New Revision: 54779 Modified: sandbox/trunk/2to3/fixes/fix_input.py Log: Remove unneeded imports from fix_input. Modified: sandbox/trunk/2to3/fixes/fix_input.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_input.py (original) +++ sandbox/trunk/2to3/fixes/fix_input.py Thu Apr 12 07:46:34 2007 @@ -2,9 +2,6 @@ # Author: Andre Roberge # Local imports -import pytree -import patcomp -from pgen2 import token from fixes import basefix from fixes.util import Call, Name From python-checkins at python.org Thu Apr 12 07:48:11 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:48:11 +0200 (CEST) Subject: [Python-checkins] r54780 - sandbox/trunk/2to3/fixes/fix_intern.py Message-ID: <20070412054811.B10741E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:48:10 2007 New Revision: 54780 Modified: sandbox/trunk/2to3/fixes/fix_intern.py Log: Remove an unneeded import from fix_intern. Modified: sandbox/trunk/2to3/fixes/fix_intern.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_intern.py (original) +++ sandbox/trunk/2to3/fixes/fix_intern.py Thu Apr 12 07:48:10 2007 @@ -7,7 +7,6 @@ # Local imports import pytree -from pgen2 import token from fixes import basefix from fixes.util import Name, Attr From python-checkins at python.org Thu Apr 12 07:55:09 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 07:55:09 +0200 (CEST) Subject: [Python-checkins] r54781 - sandbox/trunk/2to3/fixes/fix_long.py sandbox/trunk/2to3/fixes/fix_nonzero.py sandbox/trunk/2to3/fixes/fix_numliterals.py sandbox/trunk/2to3/fixes/fix_repr.py sandbox/trunk/2to3/fixes/fix_sysexcinfo.py Message-ID: <20070412055509.325191E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 07:55:08 2007 New Revision: 54781 Modified: sandbox/trunk/2to3/fixes/fix_long.py sandbox/trunk/2to3/fixes/fix_nonzero.py sandbox/trunk/2to3/fixes/fix_numliterals.py sandbox/trunk/2to3/fixes/fix_repr.py sandbox/trunk/2to3/fixes/fix_sysexcinfo.py Log: Remove unneeded imports from a number of fixers. Modified: sandbox/trunk/2to3/fixes/fix_long.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_long.py (original) +++ sandbox/trunk/2to3/fixes/fix_long.py Thu Apr 12 07:55:08 2007 @@ -8,7 +8,6 @@ # Local imports import pytree -from pgen2 import token from fixes import basefix from fixes.util import Name, Number Modified: sandbox/trunk/2to3/fixes/fix_nonzero.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_nonzero.py (original) +++ sandbox/trunk/2to3/fixes/fix_nonzero.py Thu Apr 12 07:55:08 2007 @@ -2,8 +2,6 @@ # Author: Collin Winter # Local imports -import pytree -from pgen2 import token from fixes import basefix from fixes.util import Name, syms Modified: sandbox/trunk/2to3/fixes/fix_numliterals.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_numliterals.py (original) +++ sandbox/trunk/2to3/fixes/fix_numliterals.py Thu Apr 12 07:55:08 2007 @@ -5,7 +5,6 @@ # Licensed to PSF under a Contributor Agreement. # Local imports -import pytree from pgen2 import token from fixes import basefix from fixes.util import Number, set Modified: sandbox/trunk/2to3/fixes/fix_repr.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_repr.py (original) +++ sandbox/trunk/2to3/fixes/fix_repr.py Thu Apr 12 07:55:08 2007 @@ -4,7 +4,6 @@ """Fixer that transforms `xyzzy` into repr(xyzzy).""" # Local imports -import pytree from fixes import basefix from fixes.util import Call, Name Modified: sandbox/trunk/2to3/fixes/fix_sysexcinfo.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_sysexcinfo.py (original) +++ sandbox/trunk/2to3/fixes/fix_sysexcinfo.py Thu Apr 12 07:55:08 2007 @@ -2,7 +2,6 @@ # Author: Collin Winter # Local imports -from pgen2 import token from pytree import Leaf from fixes import basefix From python-checkins at python.org Thu Apr 12 08:03:33 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 08:03:33 +0200 (CEST) Subject: [Python-checkins] r54782 - sandbox/trunk/2to3/fixes/fix_tuple_params.py Message-ID: <20070412060333.0C3251E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 08:03:32 2007 New Revision: 54782 Modified: sandbox/trunk/2to3/fixes/fix_tuple_params.py Log: Cleanup to reflect that node.children is now a list. Modified: sandbox/trunk/2to3/fixes/fix_tuple_params.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_tuple_params.py (original) +++ sandbox/trunk/2to3/fixes/fix_tuple_params.py Thu Apr 12 08:03:32 2007 @@ -88,11 +88,9 @@ new_lines[0].set_prefix(indent) after = start + 1 - children = list(suite[0].children) - children[after:after] = new_lines + suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): - children[i].set_prefix(indent) - suite[0].children = tuple(children) + suite[0].children[i].set_prefix(indent) suite[0].changed() def transform_lambda(self, node): From python-checkins at python.org Thu Apr 12 08:05:37 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 08:05:37 +0200 (CEST) Subject: [Python-checkins] r54783 - sandbox/trunk/2to3/fixes/fix_except.py sandbox/trunk/2to3/fixes/fix_tuple_params.py Message-ID: <20070412060537.B44631E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 08:05:37 2007 New Revision: 54783 Modified: sandbox/trunk/2to3/fixes/fix_except.py sandbox/trunk/2to3/fixes/fix_tuple_params.py Log: Add a bunch of TODO points. Modified: sandbox/trunk/2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/fixes/fix_except.py Thu Apr 12 08:05:37 2007 @@ -64,6 +64,7 @@ # Insert "old_N = new_N" as the first statement in # the except body. This loop skips leading whitespace # and indents + #TODO(cwinter) suite-cleanup suite_stmts = e_suite.children for i, stmt in enumerate(suite_stmts): if isinstance(stmt, pytree.Node): @@ -76,10 +77,11 @@ else: assign = Assign(target, new_N) - #XXX(cwinter) stopgap until children becomes a smart list + #TODO(cwinter) stopgap until children becomes a smart list for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) + #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup return pytree.Node(node.type, children) Modified: sandbox/trunk/2to3/fixes/fix_tuple_params.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_tuple_params.py (original) +++ sandbox/trunk/2to3/fixes/fix_tuple_params.py Thu Apr 12 08:05:37 2007 @@ -43,6 +43,7 @@ suite = results["suite"] args = results["args"] # This crap is so "def foo(...): x = 5; y = 7" is handled correctly. + # TODO(cwinter): suite-cleanup if suite[0].children[1].type == token.INDENT: start = 2 indent = suite[0].children[1].value @@ -78,9 +79,11 @@ return node # This isn't strictly necessary, but it plays nicely with other fixers. + # TODO(cwinter) get rid of this when children becomes a smart list for line in new_lines: line.parent = suite[0] + # TODO(cwinter) suite-cleanup after = start if start == 0: new_lines[0].set_prefix(" ") From python-checkins at python.org Thu Apr 12 09:01:21 2007 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Apr 2007 09:01:21 +0200 (CEST) Subject: [Python-checkins] r54784 - python/trunk/Lib/Bastion.py python/trunk/Lib/rexec.py Message-ID: <20070412070121.BE5461E4002@bag.python.org> Author: georg.brandl Date: Thu Apr 12 09:01:19 2007 New Revision: 54784 Modified: python/trunk/Lib/Bastion.py python/trunk/Lib/rexec.py Log: Patch #1698951: clarify deprecation message in rexec and Bastion Modified: python/trunk/Lib/Bastion.py ============================================================================== --- python/trunk/Lib/Bastion.py (original) +++ python/trunk/Lib/Bastion.py Thu Apr 12 09:01:19 2007 @@ -97,7 +97,7 @@ """ - raise RuntimeError, "This code is not secure in Python 2.2 and 2.3" + raise RuntimeError, "This code is not secure in Python 2.2 and later" # Note: we define *two* ad-hoc functions here, get1 and get2. # Both are intended to be called in the same way: get(name). Modified: python/trunk/Lib/rexec.py ============================================================================== --- python/trunk/Lib/rexec.py (original) +++ python/trunk/Lib/rexec.py Thu Apr 12 09:01:19 2007 @@ -181,7 +181,7 @@ """ - raise RuntimeError, "This code is not secure in Python 2.2 and 2.3" + raise RuntimeError, "This code is not secure in Python 2.2 and later" ihooks._Verbose.__init__(self, verbose) # XXX There's a circular reference here: From buildbot at python.org Thu Apr 12 09:09:01 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Apr 2007 07:09:01 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070412070901.738D51E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/370 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Apr 12 10:46:58 2007 From: python-checkins at python.org (ziga.seilnacht) Date: Thu, 12 Apr 2007 10:46:58 +0200 (CEST) Subject: [Python-checkins] r54785 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070412084658.2E87E1E4008@bag.python.org> Author: ziga.seilnacht Date: Thu Apr 12 10:46:51 2007 New Revision: 54785 Modified: python/trunk/Lib/test/test_urllib.py Log: Patch #1695862: remove the cleanup code, now that Windows buildbots are green again. Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Thu Apr 12 10:46:51 2007 @@ -27,7 +27,6 @@ def setUp(self): """Setup of a temp file to use for testing""" self.text = "test_urllib: %s\n" % self.__class__.__name__ - test_support.unlink(test_support.TESTFN) FILE = file(test_support.TESTFN, 'wb') try: FILE.write(self.text) @@ -196,7 +195,6 @@ def test_copy(self): # Test that setting the filename argument works. second_temp = "%s.2" % test_support.TESTFN - test_support.unlink(second_temp) self.registerFileForCleanUp(second_temp) result = urllib.urlretrieve(self.constructLocalFileUrl( test_support.TESTFN), second_temp) @@ -221,7 +219,6 @@ self.assertEqual(count, count_holder[0]) count_holder[0] = count_holder[0] + 1 second_temp = "%s.2" % test_support.TESTFN - test_support.unlink(second_temp) self.registerFileForCleanUp(second_temp) urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), second_temp, hooktester) @@ -547,20 +544,6 @@ def test_main(): - # cleanup old test dir on Windows buildbots - old_test_path = test_support.TESTFN + ".2" - if os.path.isdir(old_test_path): - for root, dirs, files in os.walk(old_test_path, topdown=False): - for name in files: - os.remove(os.path.join(root, name)) - for name in dirs: - dirname = os.path.join(root, name) - if not os.path.islink(dirname): - os.rmdir(dirname) - else: - os.remove(dirname) - os.rmdir(old_test_path) - test_support.run_unittest( urlopen_FileTests, urlopen_HttpTests, From buildbot at python.org Thu Apr 12 11:15:15 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Apr 2007 09:15:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070412091515.EE60A1E4003@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/207 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ziga.seilnacht Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_profile sincerely, -The Buildbot From buildbot at python.org Thu Apr 12 11:40:16 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Apr 2007 09:40:16 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070412094016.A91B01E4011@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/580 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ziga.seilnacht Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_ctypes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Apr 12 12:35:03 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 12 Apr 2007 12:35:03 +0200 (CEST) Subject: [Python-checkins] r54786 - in python/trunk: Lib/encodings/utf_8_sig.py Lib/test/test_codecs.py Misc/NEWS Message-ID: <20070412103503.5964A1E4010@bag.python.org> Author: walter.doerwald Date: Thu Apr 12 12:35:00 2007 New Revision: 54786 Modified: python/trunk/Lib/encodings/utf_8_sig.py python/trunk/Lib/test/test_codecs.py python/trunk/Misc/NEWS Log: Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the first chunk fed to the decoder started with a BOM, but was longer than 3 bytes. Modified: python/trunk/Lib/encodings/utf_8_sig.py ============================================================================== --- python/trunk/Lib/encodings/utf_8_sig.py (original) +++ python/trunk/Lib/encodings/utf_8_sig.py Thu Apr 12 12:35:00 2007 @@ -44,14 +44,19 @@ self.first = True def _buffer_decode(self, input, errors, final): - if self.first and codecs.BOM_UTF8.startswith(input): # might be a BOM + if self.first: if len(input) < 3: - # not enough data to decide if this really is a BOM - # => try again on the next call - return (u"", 0) - (output, consumed) = codecs.utf_8_decode(input[3:], errors, final) - self.first = False - return (output, consumed+3) + if codecs.BOM_UTF8.startswith(input): + # not enough data to decide if this really is a BOM + # => try again on the next call + return (u"", 0) + else: + self.first = None + else: + self.first = None + if input[:3] == codecs.BOM_UTF8: + (output, consumed) = codecs.utf_8_decode(input[3:], errors, final) + return (output, consumed+3) return codecs.utf_8_decode(input, errors, final) def reset(self): Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Thu Apr 12 12:35:00 2007 @@ -429,6 +429,11 @@ # SF bug #1601501: check that the codec works with a buffer unicode("\xef\xbb\xbf", "utf-8-sig") + def test_bom(self): + d = codecs.getincrementaldecoder("utf-8-sig")() + s = u"spam" + self.assertEqual(d.decode(s.encode("utf-8-sig")), s) + class EscapeDecodeTest(unittest.TestCase): def test_empty(self): self.assertEquals(codecs.escape_decode(""), ("", 0)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Apr 12 12:35:00 2007 @@ -591,6 +591,8 @@ - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092). +- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the + first chunk fed to the decoder started with a BOM, but was longer than 3 bytes. Extension Modules ----------------- From buildbot at python.org Thu Apr 12 12:41:14 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Apr 2007 10:41:14 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070412104114.D96FC1E4011@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/372 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Apr 12 18:09:36 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 18:09:36 +0200 (CEST) Subject: [Python-checkins] r54789 - sandbox/trunk/2to3/tests/pytree_idempotency.py Message-ID: <20070412160936.824171E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 18:09:31 2007 New Revision: 54789 Modified: sandbox/trunk/2to3/tests/pytree_idempotency.py Log: Import tests.support so the path gets fixed up. Modified: sandbox/trunk/2to3/tests/pytree_idempotency.py ============================================================================== --- sandbox/trunk/2to3/tests/pytree_idempotency.py (original) +++ sandbox/trunk/2to3/tests/pytree_idempotency.py Thu Apr 12 18:09:31 2007 @@ -6,16 +6,19 @@ __author__ = "Guido van Rossum " +# Support imports (need to be imported first) +import support + # Python imports import os import sys import logging +# Local imports +import pytree import pgen2 from pgen2 import driver -import pytree - logging.basicConfig() def main(): From python-checkins at python.org Thu Apr 12 18:11:33 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 12 Apr 2007 18:11:33 +0200 (CEST) Subject: [Python-checkins] r54790 - sandbox/trunk/2to3/tests/pytree_idempotency.py Message-ID: <20070412161133.3D8A51E4002@bag.python.org> Author: collin.winter Date: Thu Apr 12 18:11:32 2007 New Revision: 54790 Modified: sandbox/trunk/2to3/tests/pytree_idempotency.py Log: Indentation fix. Modified: sandbox/trunk/2to3/tests/pytree_idempotency.py ============================================================================== --- sandbox/trunk/2to3/tests/pytree_idempotency.py (original) +++ sandbox/trunk/2to3/tests/pytree_idempotency.py Thu Apr 12 18:11:32 2007 @@ -28,9 +28,9 @@ fn = "example.py" tree = dr.parse_file(fn, debug=True) if not diff(fn, tree): - print "No diffs." + print "No diffs." if not sys.argv[1:]: - return # Pass a dummy argument to run the complete test suite below + return # Pass a dummy argument to run the complete test suite below problems = [] From python-checkins at python.org Thu Apr 12 23:29:31 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 23:29:31 +0200 (CEST) Subject: [Python-checkins] r54791 - sandbox/trunk/pep0/test_pep0.py Message-ID: <20070412212931.BAF761E4002@bag.python.org> Author: brett.cannon Date: Thu Apr 12 23:29:29 2007 New Revision: 54791 Modified: sandbox/trunk/pep0/test_pep0.py Log: Refactor author parsing test. Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Thu Apr 12 23:29:29 2007 @@ -32,24 +32,22 @@ (got, data, string_rep)) def test_handle_author(self): - # Handle the various ways authors can be specified: - # Name , - # email (name), - # Name. - authors = ["Guido van Rossum", "Brett Cannon"] + # Handle the various ways authors can be specified. + # Test needs to validate not just how the author's name can be written + # but also variations in people's names (e.g., 'van', 'Jr.', etc.). + authors = ["Guido van Rossum", "Brett Cannon", ] formats = ["%s ", "email (%s)", "%s"] for format in formats: - rep = format % authors[0] - expect = authors[0:1] - got = pep0.handle_author(rep) - self.failUnlessEqual(got, expect, - "%r failed; %r != %r" % (rep, got, expect)) - rep += ', ' - self.failUnlessEqual(pep0.handle_author(rep), expect) - rep += format % authors[1] - self.failUnlessEqual(pep0.handle_author(rep), authors) - rep += ', ' - self.failUnlessEqual(pep0.handle_author(rep), authors) + for author_count in range(len(authors)): + rep = ', '.join(format % author + for author in authors[:author_count+1]) + expect = authors[:author_count+1] + got = pep0.handle_author(rep) + self.failUnlessEqual(got, expect) + # Test with a trailing comma. + rep += ',' + got = pep0.handle_author(rep) + self.failUnlessEqual(got, expect) class ParseMetaDataTests(unittest.TestCase): From python-checkins at python.org Thu Apr 12 23:29:52 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 23:29:52 +0200 (CEST) Subject: [Python-checkins] r54792 - sandbox/trunk/pep0/TODO Message-ID: <20070412212952.7D63E1E4002@bag.python.org> Author: brett.cannon Date: Thu Apr 12 23:29:50 2007 New Revision: 54792 Modified: sandbox/trunk/pep0/TODO Log: Make sure that PEPs are read as UTF-8. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Thu Apr 12 23:29:50 2007 @@ -38,6 +38,7 @@ Functionality to add -------------------- +* Read PEPs as UTF-8. * Output static text for PEP 0. + Store Owners list in a data structure. - Support nicknames for PEP listing (e.g., "Guido van Rossum" -> From python-checkins at python.org Thu Apr 12 23:31:25 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 23:31:25 +0200 (CEST) Subject: [Python-checkins] r54793 - sandbox/trunk/pep0/test_pep0.py Message-ID: <20070412213125.693201E4003@bag.python.org> Author: brett.cannon Date: Thu Apr 12 23:31:24 2007 New Revision: 54793 Modified: sandbox/trunk/pep0/test_pep0.py Log: Add two more names two author test that can cause trouble. Author test now fails. Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Thu Apr 12 23:31:24 2007 @@ -35,7 +35,8 @@ # Handle the various ways authors can be specified. # Test needs to validate not just how the author's name can be written # but also variations in people's names (e.g., 'van', 'Jr.', etc.). - authors = ["Guido van Rossum", "Brett Cannon", ] + authors = ["Guido van Rossum", "Brett Cannon", "Fred L. Drake, Jr.", + "Aahz"] formats = ["%s ", "email (%s)", "%s"] for format in formats: for author_count in range(len(authors)): From python-checkins at python.org Thu Apr 12 23:38:14 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 23:38:14 +0200 (CEST) Subject: [Python-checkins] r54794 - sandbox/trunk/pep0/pep0.py Message-ID: <20070412213814.E53A11E4002@bag.python.org> Author: brett.cannon Date: Thu Apr 12 23:38:09 2007 New Revision: 54794 Modified: sandbox/trunk/pep0/pep0.py Log: Fix handling of names that end in 'Jr.' and such. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Thu Apr 12 23:38:09 2007 @@ -70,7 +70,15 @@ # Watch out for commas separating multiple names. regex += '(,\s+)?' for match in re.finditer(regex, data): - authors.append(match.group('author')) + author = match.group('author') + # Watch out for suffixes like 'Jr.' when they are comma-separated + # from the name and thus cause issues when *all* names are only + # separated by commas. + author = match.group('author') + if not author.partition(' ')[1] and author.endswith('.'): + prev_author = authors.pop() + author = ', '.join([prev_author, author]) + authors.append(author) else: # If authors were found then stop searching. if authors: From python-checkins at python.org Thu Apr 12 23:59:42 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Apr 2007 23:59:42 +0200 (CEST) Subject: [Python-checkins] r54795 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Message-ID: <20070412215942.8B2891E4008@bag.python.org> Author: brett.cannon Date: Thu Apr 12 23:59:40 2007 New Revision: 54795 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Log: Fix the finding of a person's last name. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Thu Apr 12 23:59:40 2007 @@ -1,12 +1,7 @@ Current discrepencies --------------------- +Compatibility with PEP numerical index only (no static text). -* Author issues - + Missing an author - - 314 - + How to handle suffixes (Jr., etc.)? - - 160 - - 205 * Type/status issues: - 160: missing F - 206: missing W @@ -30,10 +25,20 @@ - 3104: used A, expected F - 3107: used A, expected F - 3104: used A -* Title are too long (use ellipsis?): + +* Titles are too long (use ellipsis?): - 311 - 3001 +* Blank lines between spaces in count: + - 42/100 + - 160/200 + - Will be more than currently in index: + + 364/666 + + 666/754 + + 754/3000 + + 3002/3099 + Functionality to add -------------------- Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Thu Apr 12 23:59:40 2007 @@ -94,6 +94,27 @@ 'Post-History': handle_csv, } +def last_name(full_name): + """Find the last name of a full name. + + If no last name (e.g, 'Aahz') then return the full name. If there is a + leading, lowercase portion to the last name (e.g., 'van' or 'von') then + include it. If there is a suffix (e.g., 'Jr.') that is appended through a + comma, then drop the suffix. + + """ + no_suffix = full_name.partition(',')[0] + name_parts = no_suffix.split() + part_count = len(name_parts) + if part_count == 1 or part_count == 2: + return name_parts[-1] + else: + assert part_count > 2 + if name_parts[-2].islower(): + return ' '.join(name_parts[-2:]) + else: + return name_parts[-1] + def sort_peps(peps): """Sort PEPs into meta, informational, accepted, open, finished, empty, and essentially dead.""" @@ -133,18 +154,7 @@ number = str(pep['PEP']).rjust(4) title = pep['Title'] authors_list = [] - for author in pep['Author']: - name_parts = author.split() - last_name = name_parts.pop() - try: - last_name_leader = name_parts.pop() - except IndexError: - pass - else: - if last_name_leader[0].islower(): - last_name = '%s %s' % (last_name_leader, last_name) - authors_list.append(last_name) - authors = ', '.join(authors_list) + authors = ', '.join(last_name(author) for author in pep['Author']) output.write(" %s%s %s %s %s\n" % (type_abbr, status_abbr, number, title.ljust(44), authors)) Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Thu Apr 12 23:59:40 2007 @@ -1,7 +1,8 @@ from __future__ import with_statement +import pep0 + import unittest from test import test_support -import pep0 from contextlib import contextmanager import os @@ -142,34 +143,19 @@ self.failUnless('Post-History' in metadata) self.failUnlessEqual(metadata['Post-History'], dates) - def test_utf8(self): - # Need to handle text as UTF-8. - # XXX - pass - - -class PepSortTests(unittest.TestCase): - - def test_meta(self): - pass - - def test_info(self): - pass - - def test_accepted(self): - pass - - def test_open(self): - pass - - def test_finished(self): - pass - def test_empty(self): - pass +class OutputTests(unittest.TestCase): - def test_dead(self): - pass + def test_author_last_name(self): + # Test that last names are discovered properly. + test_names = [("Brett Cannon", "Cannon"), + ("Guido van Rossum", "van Rossum"), + ("Fred L. Drake, Jr.", "Drake"), + ("Aahz", "Aahz"), + ] + for full_name, expect in test_names: + got = pep0.last_name(full_name) + self.failUnlessEqual(got, expect) def test_main(): @@ -177,6 +163,7 @@ HandlerTests, ParseMetaDataTests, ConsumePepTests, + OutputTests, ) From python-checkins at python.org Fri Apr 13 00:08:54 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 13 Apr 2007 00:08:54 +0200 (CEST) Subject: [Python-checkins] r54796 - sandbox/trunk/pep0/TODO Message-ID: <20070412220854.2121C1E4002@bag.python.org> Author: brett.cannon Date: Fri Apr 13 00:08:50 2007 New Revision: 54796 Modified: sandbox/trunk/pep0/TODO Log: Clean up todo list. Separate out from discrepencies things that are from how the index has been handled and are definitely not the script's fault. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Fri Apr 13 00:08:50 2007 @@ -2,7 +2,7 @@ --------------------- Compatibility with PEP numerical index only (no static text). -* Type/status issues: +* Type/status issues (might be inconsistencies between index and PEP): - 160: missing F - 206: missing W - 216: missing R @@ -26,24 +26,12 @@ - 3107: used A, expected F - 3104: used A -* Titles are too long (use ellipsis?): - - 311 - - 3001 - -* Blank lines between spaces in count: - - 42/100 - - 160/200 - - Will be more than currently in index: - + 364/666 - + 666/754 - + 754/3000 - + 3002/3099 - Functionality to add -------------------- * Read PEPs as UTF-8. + * Output static text for PEP 0. + Store Owners list in a data structure. - Support nicknames for PEP listing (e.g., "Guido van Rossum" -> @@ -55,20 +43,49 @@ maintained and considered up-to-date? + Store Key in data structure for easy mapping? - Would allow for easy validation that metadata is correct in PEPs. + * Output PEP 0 with numerical PEP index. + * Output PEP 0 with special sections. + * Make sure that it is easy to identify which PEP triggered an error. + + Has all expected fields. + + Values in fields correct. + + Formatting correct. + - Plaintext. + - reST. -To clean up PEPs +Inconsistencies ---------------- -* Define (and enforce) consistency in Author field. +* Author field + + Three different formats for author (two include an email address). + + Best to settle on a single format. + - Author names separated by commas. + - Maintain email addresses only in PEP index so as to always have + up-to-date address in a single location. + +* Counting gap in numerical index and a newline. + + 42/100, 160/200. + + No other spaces in the count are used (e.g., 666/754). + + Have no spaces, always have a space? + + Should jumps in thousands digit have more than a single newline? + +* Titles that are longer than allowed. + + 311, 3001. + + Use custom titles to fit. + + Possible solutions. + - Use ellipsis to shorten name for index? + - Just deal with some being longer than expected? + * Empty PEPs are not in any way identified within the PEPs themselves. + Get rid of section and just consider rejected? - No longer accept empty PEPs, right? + * Meta-PEPs are not noted as such within the PEPs. + Add a "Meta" option for "Type"? -* Fix inconsistent usage of Status field. - + Some PEPs just say "Standard"; missing "Track". -* Informational, meta, and process PEPs inconsistently have status listed in - index. + +* Status field. + + Not all PEPs use consistent names (e.g., some just say "Standard" instead + of "Standard Track"). + + Status of PEPs not consistently listed in index. From python-checkins at python.org Fri Apr 13 06:16:21 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 13 Apr 2007 06:16:21 +0200 (CEST) Subject: [Python-checkins] r54803 - sandbox/trunk/pep0/pep0.py Message-ID: <20070413041621.2EC601E4005@bag.python.org> Author: brett.cannon Date: Fri Apr 13 06:16:15 2007 New Revision: 54803 Modified: sandbox/trunk/pep0/pep0.py Log: Do not suppress status output if the PEP is a process or informational PEP. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Fri Apr 13 06:16:15 2007 @@ -147,7 +147,7 @@ """Write PEP info to 'output'.""" type_abbr = pep['Type'][0].upper() status = pep['Status'] - if status == 'Draft' or type_abbr in ('I', 'P'): + if status == 'Draft': status_abbr = ' ' else: status_abbr = status[0].upper() From python-checkins at python.org Fri Apr 13 06:17:15 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 13 Apr 2007 06:17:15 +0200 (CEST) Subject: [Python-checkins] r54804 - sandbox/trunk/pep0/TODO Message-ID: <20070413041715.84CB71E4002@bag.python.org> Author: brett.cannon Date: Fri Apr 13 06:17:12 2007 New Revision: 54804 Modified: sandbox/trunk/pep0/TODO Log: Reorganize TODO inconsistencies. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Fri Apr 13 06:17:12 2007 @@ -1,30 +1,10 @@ -Current discrepencies ---------------------- -Compatibility with PEP numerical index only (no static text). - -* Type/status issues (might be inconsistencies between index and PEP): - - 160: missing F - - 206: missing W - - 216: missing R - - 220: missing D - - 226: missing F - - 247: missing F - - 248: missing F - - 249: missing F - - 251: missing F - - 269: added D - - 272: missing F - - 283: missing F - - 286: added A - - 320: missing F - - 344: added A - - 353: used F, expected A - - 356: missing F - - 364: added A - - 3102: used A, expected F - - 3104: used A, expected F - - 3107: used A, expected F - - 3104: used A +Current discrepencies/bugs +-------------------------- + +* Be able to import authors.py . + - Probably as simple as declaring encoding. + - Otherwise prepend 'u' to every string. + Functionality to add @@ -51,6 +31,9 @@ * Make sure that it is easy to identify which PEP triggered an error. + Has all expected fields. + Values in fields correct. + - Type + - Status + - All authors declared in authors.py. + Formatting correct. - Plaintext. - reST. @@ -58,34 +41,38 @@ Inconsistencies ---------------- -* Author field - + Three different formats for author (two include an email address). - + Best to settle on a single format. - - Author names separated by commas. - - Maintain email addresses only in PEP index so as to always have - up-to-date address in a single location. - -* Counting gap in numerical index and a newline. - + 42/100, 160/200. - + No other spaces in the count are used (e.g., 666/754). - + Have no spaces, always have a space? - + Should jumps in thousands digit have more than a single newline? - -* Titles that are longer than allowed. - + 311, 3001. - + Use custom titles to fit. - + Possible solutions. - - Use ellipsis to shorten name for index? - - Just deal with some being longer than expected? - -* Empty PEPs are not in any way identified within the PEPs themselves. - + Get rid of section and just consider rejected? - - No longer accept empty PEPs, right? - -* Meta-PEPs are not noted as such within the PEPs. - + Add a "Meta" option for "Type"? - -* Status field. - + Not all PEPs use consistent names (e.g., some just say "Standard" instead - of "Standard Track"). - + Status of PEPs not consistently listed in index. +* Within PEPs: + + + Author field + - Three different formats for author (two include an email address). + - Best to settle on a single format. + * Author names separated by commas. + * Maintain email addresses only in PEP index so as to always have + up-to-date address in a single location. + + + Type field + - Meta-PEPs are not delineated as such. + + + Status field. + - Not all PEPs use consistent names (e.g., some just say "Standard" instead + of "Standard Track"). + - Empty PEPs are not specified as such. + +* In the index: + + * Counting gap in numerical index and a newline. + + 42/100, 160/200. + + No other spaces in the count are used (e.g., 666/754). + + Have no spaces, always have a space? + + Should jumps in thousands digit have more than a single newline? + + * Titles that are longer than allowed. + + 311, 3001. + + Use custom titles to fit. + + Possible solutions. + - Use ellipsis to shorten name for index? + - Just deal with some being longer than expected? + + * Type/Status field. + + Informational PEPs inconsistenty leave out Status. + From python-checkins at python.org Fri Apr 13 18:12:05 2007 From: python-checkins at python.org (barry.warsaw) Date: Fri, 13 Apr 2007 18:12:05 +0200 (CEST) Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py Message-ID: <20070413161205.4BA581E4002@bag.python.org> Author: barry.warsaw Date: Fri Apr 13 18:12:02 2007 New Revision: 54805 Modified: python/branches/release25-maint/Lib/test/test_pty.py Log: Add code to read from master_fd in the parent, breaking when we get an OSError (EIO can occur on Linux) or there's no more data to read. Without this, test_pty.py can hang on the waitpid() because the child is blocking on the stdout write. This will definitely happen on Mac OS X and could potentially happen on other platforms. See the comment for details. Modified: python/branches/release25-maint/Lib/test/test_pty.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_pty.py (original) +++ python/branches/release25-maint/Lib/test/test_pty.py Fri Apr 13 18:12:02 2007 @@ -115,6 +115,24 @@ os._exit(4) else: debug("Waiting for child (%d) to finish."%pid) + # In verbose mode, we have to consume the debug output from the child or + # the child will block, causing this test to hang in the parent's + # waitpid() call. The child blocks after a platform-dependent amount of + # data is written to its fd. On Linux 2.6, it's 4000 bytes and the child + # won't block, but on OS X even the small writes in the child above will + # block it. Also on Linux, the read() will throw an OSError (input/output + # error) when it tries to read past the end of the buffer but the child's + # already exited, so catch and discard those exceptions. It's not worth + # checking for EIO. + while True: + try: + data = os.read(master_fd, 80) + except OSError: + break + if not data: + break + sys.stdout.write(data.replace('\r\n', '\n')) + ##line = os.read(master_fd, 80) ##lines = line.replace('\r\n', '\n').split('\n') ##if False and lines != ['In child, calling os.setsid()', From python at rcn.com Fri Apr 13 18:43:13 2007 From: python at rcn.com (Raymond Hettinger) Date: Fri, 13 Apr 2007 12:43:13 -0400 (EDT) Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py Message-ID: <20070413124313.BFJ16741@ms09.lnh.mail.rcn.net> I thought the 25 maint branch was closed until a few days after the release-candidate goes final. If it is open, let me know, I've got more fixes to apply. Raymond From barry at python.org Fri Apr 13 18:54:33 2007 From: barry at python.org (Barry Warsaw) Date: Fri, 13 Apr 2007 12:54:33 -0400 Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py In-Reply-To: <20070413124313.BFJ16741@ms09.lnh.mail.rcn.net> References: <20070413124313.BFJ16741@ms09.lnh.mail.rcn.net> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 13, 2007, at 12:43 PM, Raymond Hettinger wrote: > I thought the 25 maint branch was closed until a few days after the > release-candidate goes final. If it is open, let me know, I've got > more fixes to apply. I don't know, maybe it is. This one's extremely low risk as it only affects certain platforms when test_pty is run verbosely. But if it ain't cool, I'll back it out and re-apply after 2.5.1 final. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRh+1ynEjvBPtnXfVAQIZJQQAkMPMe4G9LyPUp9Tt2OmmIvIfdQiat/yS FeGvknxgQRITRZK7ByVZPp/FX6of65oPYkyprnBdxAfE36TYKt9nVzdYSQ1YIOOM RQaFczCuj/u07vnvSvBngoVUuGFW9MbAvtGT7nMwoFBZXPUjC5Q1hGXlo2/0jZg3 q85tNLXJ4d8= =Ywzx -----END PGP SIGNATURE----- From python-checkins at python.org Fri Apr 13 20:47:16 2007 From: python-checkins at python.org (barry.warsaw) Date: Fri, 13 Apr 2007 20:47:16 +0200 (CEST) Subject: [Python-checkins] r54807 - python/trunk/Lib/test/test_pty.py Message-ID: <20070413184716.C81AA1E4003@bag.python.org> Author: barry.warsaw Date: Fri Apr 13 20:47:14 2007 New Revision: 54807 Modified: python/trunk/Lib/test/test_pty.py Log: Port r54805 from python25-maint branch: Add code to read from master_fd in the parent, breaking when we get an OSError (EIO can occur on Linux) or there's no more data to read. Without this, test_pty.py can hang on the waitpid() because the child is blocking on the stdout write. This will definitely happen on Mac OS X and could potentially happen on other platforms. See the comment for details. Modified: python/trunk/Lib/test/test_pty.py ============================================================================== --- python/trunk/Lib/test/test_pty.py (original) +++ python/trunk/Lib/test/test_pty.py Fri Apr 13 20:47:14 2007 @@ -1,5 +1,6 @@ import pty import os +import sys import signal from test.test_support import verbose, TestSkipped, run_unittest import unittest @@ -120,6 +121,25 @@ os._exit(4) else: debug("Waiting for child (%d) to finish." % pid) + # In verbose mode, we have to consume the debug output from the + # child or the child will block, causing this test to hang in the + # parent's waitpid() call. The child blocks after a + # platform-dependent amount of data is written to its fd. On + # Linux 2.6, it's 4000 bytes and the child won't block, but on OS + # X even the small writes in the child above will block it. Also + # on Linux, the read() will throw an OSError (input/output error) + # when it tries to read past the end of the buffer but the child's + # already exited, so catch and discard those exceptions. It's not + # worth checking for EIO. + while True: + try: + data = os.read(master_fd, 80) + except OSError: + break + if not data: + break + sys.stdout.write(data.replace('\r\n', '\n')) + ##line = os.read(master_fd, 80) ##lines = line.replace('\r\n', '\n').split('\n') ##if False and lines != ['In child, calling os.setsid()', From martin at v.loewis.de Fri Apr 13 22:58:57 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Fri, 13 Apr 2007 22:58:57 +0200 Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py In-Reply-To: References: <20070413124313.BFJ16741@ms09.lnh.mail.rcn.net> Message-ID: <461FEF11.4020100@v.loewis.de> > I don't know, maybe it is. This one's extremely low risk as it only > affects certain platforms when test_pty is run verbosely. But if it > ain't cool, I'll back it out and re-apply after 2.5.1 final. Please back it out. If there are changes to the branch, we would have to create another release candidate (IMO). Regards, Martin From python at rcn.com Fri Apr 13 23:34:47 2007 From: python at rcn.com (Raymond Hettinger) Date: Fri, 13 Apr 2007 17:34:47 -0400 (EDT) Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py Message-ID: <20070413173447.BFK12886@ms09.lnh.mail.rcn.net> [MvL] > Please back it out. If there are changes to the branch, we would have > to create another release candidate (IMO). I believe Anthony had already tagged a branch. Barry's checkin was on the trunk so it may be automatically excluded from the final release. If so, then the only issue would be if the rc bad and we had to build a new one off of the trunk.. Raymond From martin at v.loewis.de Fri Apr 13 23:49:21 2007 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Fri, 13 Apr 2007 23:49:21 +0200 Subject: [Python-checkins] r54805 - python/branches/release25-maint/Lib/test/test_pty.py In-Reply-To: <20070413173447.BFK12886@ms09.lnh.mail.rcn.net> References: <20070413173447.BFK12886@ms09.lnh.mail.rcn.net> Message-ID: <461FFAE1.9090409@v.loewis.de> Raymond Hettinger schrieb: > [MvL] >> Please back it out. If there are changes to the branch, we would >> have to create another release candidate (IMO). > > I believe Anthony had already tagged a branch. Barry's checkin was > on the trunk so it may be automatically excluded from the final > release. If so, then the only issue would be if the rc bad and we had > to build a new one off of the trunk.. Barry's checkin was *not* on the trunk, but on the 2.5 branch: r54805 | barry.warsaw | 2007-04-13 18:12:02 +0200 (Fri, 13 Apr 2007) | 6 lines Changed paths: M /python/branches/release25-maint/Lib/test/test_pty.py Anthony did not recently create another branch, AFAICT: the last one was the release25-maint branch. Instead, he created a tag "r251c1". This tag will *not* be used to create the final 2.5.1 release. Instead, the final 2.5.1 release will be made out of the release25-maint branch. Hope this clears it up (and hoping this is all correct). Regards, Martin From python-checkins at python.org Sat Apr 14 00:02:51 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 14 Apr 2007 00:02:51 +0200 (CEST) Subject: [Python-checkins] r54809 - sandbox/trunk/2to3/HACKING Message-ID: <20070413220251.700AE1E4003@bag.python.org> Author: collin.winter Date: Sat Apr 14 00:02:47 2007 New Revision: 54809 Modified: sandbox/trunk/2to3/HACKING Log: Add a section on more complicated modifications to 2to3. Modified: sandbox/trunk/2to3/HACKING ============================================================================== --- sandbox/trunk/2to3/HACKING (original) +++ sandbox/trunk/2to3/HACKING Sat Apr 14 00:02:47 2007 @@ -9,6 +9,22 @@ +Putting 2to3 to work somewhere else: + + * By default, 2to3 uses a merger of Python 2.x and Python 3's grammars. + If you want to support a different grammar, just replace the + Grammar.txt file with Grammar/Grammar from your chosen Python version. + + * The real heart of 2to3 is the concrete syntax tree parser in pgen2; this + chunk of the system is suitable for a wide range of applications that + require CST transformation. All that's required is to rip off the fixer + layer and replace it with something else that walks the tree. One + application would be a tool to check/enforce style guidelines; this + could leverage 90% of the existing infrastructure with primarily + cosmetic changes (e.g., fixes/fix_*.py -> styles/style_*.py). + + + TODO Simple: From python-checkins at python.org Sat Apr 14 00:03:38 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 14 Apr 2007 00:03:38 +0200 (CEST) Subject: [Python-checkins] r54810 - in sandbox/trunk/2to3: pytree.py tests/test_pytree.py Message-ID: <20070413220338.B352D1E4003@bag.python.org> Author: collin.winter Date: Sat Apr 14 00:03:36 2007 New Revision: 54810 Modified: sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py Log: Add a get_next_sibling() method to pytree.Base. Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Sat Apr 14 00:03:36 2007 @@ -142,6 +142,21 @@ del self.parent.children[i] self.parent = None return i + + def get_next_sibling(self): + """Return the node immediately following the invocant in their + parent's children list. If the invocant does not have a next + sibling, return None.""" + if self.parent is None: + return None + + # Can't use index(); we need to test by identity + for i, sibling in enumerate(self.parent.children): + if sibling is self: + try: + return self.parent.children[i+1] + except IndexError: + return None class Node(Base): Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Sat Apr 14 00:03:36 2007 @@ -262,6 +262,24 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.append_child, list) + + def testNodeNextSibling(self): + n1 = pytree.Node(1000, []) + n2 = pytree.Node(1000, []) + p1 = pytree.Node(1000, [n1, n2]) + + self.failUnless(n1.get_next_sibling() is n2) + self.assertEqual(n2.get_next_sibling(), None) + self.assertEqual(p1.get_next_sibling(), None) + + def testLeafNextSibling(self): + l1 = pytree.Leaf(100, "a") + l2 = pytree.Leaf(100, "b") + p1 = pytree.Node(1000, [l1, l2]) + + self.failUnless(l1.get_next_sibling() is l2) + self.assertEqual(l2.get_next_sibling(), None) + self.assertEqual(p1.get_next_sibling(), None) class TestPatterns(support.TestCase): From python-checkins at python.org Sat Apr 14 00:05:53 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 14 Apr 2007 00:05:53 +0200 (CEST) Subject: [Python-checkins] r54811 - in sandbox/trunk/2to3: pytree.py tests/test_pytree.py Message-ID: <20070413220553.8F4161E4012@bag.python.org> Author: collin.winter Date: Sat Apr 14 00:05:51 2007 New Revision: 54811 Modified: sandbox/trunk/2to3/pytree.py sandbox/trunk/2to3/tests/test_pytree.py Log: Add a get_suffix() method to pytree.Base. Modified: sandbox/trunk/2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/pytree.py (original) +++ sandbox/trunk/2to3/pytree.py Sat Apr 14 00:05:51 2007 @@ -142,7 +142,7 @@ del self.parent.children[i] self.parent = None return i - + def get_next_sibling(self): """Return the node immediately following the invocant in their parent's children list. If the invocant does not have a next @@ -157,6 +157,14 @@ return self.parent.children[i+1] except IndexError: return None + + def get_suffix(self): + """Return the string immediately following the invocant node. This + is effectively equivalent to node.get_next_sibling().get_prefix()""" + next_sib = self.get_next_sibling() + if next_sib is None: + return "" + return next_sib.get_prefix() class Node(Base): Modified: sandbox/trunk/2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/tests/test_pytree.py Sat Apr 14 00:05:51 2007 @@ -99,6 +99,22 @@ self.assertEqual(n1.get_prefix(), " ") self.assertEqual(l1.get_prefix(), " ") + def testGetSuffix(self): + l1 = pytree.Leaf(100, "foo", prefix="a") + l2 = pytree.Leaf(100, "bar", prefix="b") + n1 = pytree.Node(1000, [l1, l2]) + + self.assertEqual(l1.get_suffix(), l2.get_prefix()) + self.assertEqual(l2.get_suffix(), "") + self.assertEqual(n1.get_suffix(), "") + + l3 = pytree.Leaf(100, "bar", prefix="c") + n2 = pytree.Node(1000, [n1, l3]) + + self.assertEqual(n1.get_suffix(), l3.get_prefix()) + self.assertEqual(l3.get_suffix(), "") + self.assertEqual(n2.get_suffix(), "") + def testNodeEq(self): n1 = pytree.Node(1000, ()) n2 = pytree.Node(1000, [], context=(" ", (1, 0))) From python-checkins at python.org Sat Apr 14 00:07:33 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 14 Apr 2007 00:07:33 +0200 (CEST) Subject: [Python-checkins] r54812 - in python/trunk: Objects/frameobject.c Python/ceval.c Message-ID: <20070413220733.F005F1E4016@bag.python.org> Author: kristjan.jonsson Date: Sat Apr 14 00:07:33 2007 New Revision: 54812 Modified: python/trunk/Objects/frameobject.c python/trunk/Python/ceval.c Log: Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127 Modified: python/trunk/Objects/frameobject.c ============================================================================== --- python/trunk/Objects/frameobject.c (original) +++ python/trunk/Objects/frameobject.c Sat Apr 14 00:07:33 2007 @@ -68,7 +68,7 @@ int new_lineno = 0; /* The new value of f_lineno */ int new_lasti = 0; /* The new value of f_lasti */ int new_iblock = 0; /* The new value of f_iblock */ - char *code = NULL; /* The bytecode for the frame... */ + unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ @@ -85,7 +85,7 @@ int blockstack[CO_MAXBLOCKS]; /* Walking the 'finally' blocks */ int in_finally[CO_MAXBLOCKS]; /* (ditto) */ int blockstack_top = 0; /* (ditto) */ - int setup_op = 0; /* (ditto) */ + unsigned char setup_op = 0; /* (ditto) */ /* f_lineno must be an integer. */ if (!PyInt_Check(p_new_lineno)) { Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Sat Apr 14 00:07:33 2007 @@ -662,7 +662,7 @@ #define STACKADJ(n) { (void)(BASIC_STACKADJ(n), \ lltrace && prtrace(TOP(), "stackadj")); \ assert(STACK_LEVEL() <= co->co_stacksize); } -#define EXT_POP(STACK_POINTER) (lltrace && prtrace(*(STACK_POINTER), "ext_pop"), *--(STACK_POINTER)) +#define EXT_POP(STACK_POINTER) (lltrace && prtrace((STACK_POINTER)[-1], "ext_pop"), *--(STACK_POINTER)) #else #define PUSH(v) BASIC_PUSH(v) #define POP() BASIC_POP() From python-checkins at python.org Sat Apr 14 00:10:01 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 14 Apr 2007 00:10:01 +0200 (CEST) Subject: [Python-checkins] r54813 - in python/branches/release25-maint: Objects/frameobject.c Python/ceval.c Message-ID: <20070413221001.58AC31E4005@bag.python.org> Author: kristjan.jonsson Date: Sat Apr 14 00:09:59 2007 New Revision: 54813 Modified: python/branches/release25-maint/Objects/frameobject.c python/branches/release25-maint/Python/ceval.c Log: Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127 Modified: python/branches/release25-maint/Objects/frameobject.c ============================================================================== --- python/branches/release25-maint/Objects/frameobject.c (original) +++ python/branches/release25-maint/Objects/frameobject.c Sat Apr 14 00:09:59 2007 @@ -68,7 +68,7 @@ int new_lineno = 0; /* The new value of f_lineno */ int new_lasti = 0; /* The new value of f_lasti */ int new_iblock = 0; /* The new value of f_iblock */ - char *code = NULL; /* The bytecode for the frame... */ + unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ @@ -85,7 +85,7 @@ int blockstack[CO_MAXBLOCKS]; /* Walking the 'finally' blocks */ int in_finally[CO_MAXBLOCKS]; /* (ditto) */ int blockstack_top = 0; /* (ditto) */ - int setup_op = 0; /* (ditto) */ + unsigned char setup_op = 0; /* (ditto) */ /* f_lineno must be an integer. */ if (!PyInt_Check(p_new_lineno)) { Modified: python/branches/release25-maint/Python/ceval.c ============================================================================== --- python/branches/release25-maint/Python/ceval.c (original) +++ python/branches/release25-maint/Python/ceval.c Sat Apr 14 00:09:59 2007 @@ -662,7 +662,7 @@ #define STACKADJ(n) { (void)(BASIC_STACKADJ(n), \ lltrace && prtrace(TOP(), "stackadj")); \ assert(STACK_LEVEL() <= co->co_stacksize); } -#define EXT_POP(STACK_POINTER) (lltrace && prtrace(*(STACK_POINTER), "ext_pop"), *--(STACK_POINTER)) +#define EXT_POP(STACK_POINTER) (lltrace && prtrace((STACK_POINTER)[-1], "ext_pop"), *--(STACK_POINTER)) #else #define PUSH(v) BASIC_PUSH(v) #define POP() BASIC_POP() From python-checkins at python.org Sat Apr 14 00:20:17 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 14 Apr 2007 00:20:17 +0200 (CEST) Subject: [Python-checkins] r54814 - python/trunk/PC/getpathp.c Message-ID: <20070413222017.31E551E4004@bag.python.org> Author: kristjan.jonsson Date: Sat Apr 14 00:20:13 2007 New Revision: 54814 Modified: python/trunk/PC/getpathp.c Log: Fix potential crash in path manipulation on windows Modified: python/trunk/PC/getpathp.c ============================================================================== --- python/trunk/PC/getpathp.c (original) +++ python/trunk/PC/getpathp.c Sat Apr 14 00:20:13 2007 @@ -650,7 +650,7 @@ start of the path in question - even if this is one character before the start of the buffer */ - while (*look != DELIM && look >= module_search_path) + while (look >= module_search_path && *look != DELIM) look--; nchars = lookEnd-look; strncpy(lookBuf, look+1, nchars); From python-checkins at python.org Sat Apr 14 00:21:07 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 14 Apr 2007 00:21:07 +0200 (CEST) Subject: [Python-checkins] r54815 - python/branches/release25-maint/PC/getpathp.c Message-ID: <20070413222107.EC5C11E4003@bag.python.org> Author: kristjan.jonsson Date: Sat Apr 14 00:21:07 2007 New Revision: 54815 Modified: python/branches/release25-maint/PC/getpathp.c Log: Fix potential crash in path manipulation on windows Modified: python/branches/release25-maint/PC/getpathp.c ============================================================================== --- python/branches/release25-maint/PC/getpathp.c (original) +++ python/branches/release25-maint/PC/getpathp.c Sat Apr 14 00:21:07 2007 @@ -650,7 +650,7 @@ start of the path in question - even if this is one character before the start of the buffer */ - while (*look != DELIM && look >= module_search_path) + while (look >= module_search_path && *look != DELIM) look--; nchars = lookEnd-look; strncpy(lookBuf, look+1, nchars); From python-checkins at python.org Sat Apr 14 01:22:07 2007 From: python-checkins at python.org (trent.mick) Date: Sat, 14 Apr 2007 01:22:07 +0200 (CEST) Subject: [Python-checkins] r54816 - python/trunk/PC/VC6/pcbuild.dsw Message-ID: <20070413232207.9FAA61E4003@bag.python.org> Author: trent.mick Date: Sat Apr 14 01:22:05 2007 New Revision: 54816 Modified: python/trunk/PC/VC6/pcbuild.dsw Log: Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore' is built before '_ctypes' is attempted. Will backport to 2.5 once it is unfrozen for 2.5.1. Modified: python/trunk/PC/VC6/pcbuild.dsw ============================================================================== --- python/trunk/PC/VC6/pcbuild.dsw (original) +++ python/trunk/PC/VC6/pcbuild.dsw Sat Apr 14 01:22:05 2007 @@ -26,6 +26,9 @@ Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency }}} ############################################################################### From buildbot at python.org Sat Apr 14 02:04:00 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Apr 2007 00:04:00 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20070414000400.D5A721E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1625 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Apr 14 02:21:17 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:21:17 +0200 (CEST) Subject: [Python-checkins] r54817 - sandbox/trunk/pep0/authors.py Message-ID: <20070414002117.ED32E1E4008@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:21:16 2007 New Revision: 54817 Added: sandbox/trunk/pep0/authors.py (contents, props changed) Log: Create a module to store author/email info along with nicknames. Added: sandbox/trunk/pep0/authors.py ============================================================================== --- (empty file) +++ sandbox/trunk/pep0/authors.py Sat Apr 14 02:21:16 2007 @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +email_addresses = { + 'Aahz' : 'aahz at pobox.com', + 'James C. Ahlstrom' : 'jim at interet.com', + 'Jim Althoff' : 'james_althoff at i2.com', + 'Kevin Altis' : 'altis at semi-retired.com', + 'David Ascher' : 'davida at activestate.com', + 'Peter Astrand' : 'astrand at lysator.liu.se', + 'Carl Banks' : 'pythondev at aerojockey.com', + 'Paul Barrett' : 'barrett at stsci.edu', + 'Facundo Batista' : 'facundo at taniquetil.com.ar', + 'Anthony Baxter' : 'anthony at interlink.com.au', + 'Thomas Bellman' : 'bellman+pep-divmod at lysator.liu.se', + 'Steven Bethard' : 'steven.bethard at gmail.com', + 'Georg Brandl' : 'g.brandl at gmx.net', + 'Brett Cannon' : 'brett at python.org', + 'Josiah Carlson' : 'jcarlson at uci.edu', + 'W Isaac Carroll' : 'icarroll at pobox.com', + 'Nick Coghlan' : 'ncoghlan at gmail.com', + 'Dave Cole' : 'djc at object-craft.com.au', + 'Christopher Craig' : 'python-pep at ccraig.org', + 'Laura Creighton' : 'lac at strakt.com', + 'Walter D?rwald' : '', + 'Fred L. Drake, Jr.' : 'fdrake at acm.org', + 'Michael P. Dubner' : 'dubnerm at mindless.com', + 'Paul F. Dubois' : 'paul at pfdubois.com', + 'Phillip J. Eby' : 'pje at telecommunity.com', + 'Micah Elliott' : 'mde at tracos.org', + 'Jeff Epler' : 'jepler at unpythonic.net', + 'David Eppstein' : 'eppstein at ics.uci.edu', + 'Clark C. Evans' : 'cce at clarkevans.com', + 'Greg Ewing' : 'greg at cosc.canterbury.ac.nz', + 'Martijn Faassen' : 'faassen at infrae.com', + 'Ben Finney' : 'ben+python at benfinney.id.au', + 'Fr?d?ric B. Giacometti' : 'fred at arakne.com', + 'Scott Gilbert' : 'xscottg at yahoo.com', + 'David Goodger' : 'goodger at python.org', + 'Grant Griffin' : 'g2 at iowegian.com', + 'Mark Hammond' : 'mhammond at skippinet.com.au', + 'Peter Harris' : 'scav at blueyonder.co.uk', + 'Thomas Heller' : 'theller at python.net', + 'Magnus Lie Hetland' : 'magnus at hetland.org', + 'Raymond D. Hettinger' : 'python at rcn.com', + 'Neil Hodgson' : 'neilh at scintilla.org', + 'Michael Hudson' : 'mwh at python.net', + 'Jeremy Hylton' : 'jeremy at zope.com', + 'Jack Jansen' : 'jack at cwi.nl', + 'Jim Jewett' : 'jimjjewett at users.sourceforge.net', + 'Richard Jones' : 'richard at mechanicalcat.net', + 'Stepan Koltsov' : 'yozh at mx1.ru', + 'A.M. Kuchling' : 'amk at amk.ca', + 'Marc-Andre Lemburg' : 'mal at lemburg.com', + 'Gregory Lielens' : 'gregory.lielens at fft.be', + 'Bj?rn Lindqvist' : 'bjourne at gmail.com', + 'Martin von L?wis' : 'loewis at informatik.hu-berlin.de', + 'Tony Lownds' : 'tony at pagedna.com', + 'Alex Martelli' : 'aleax at aleax.it', + 'Andrew McClelland' : 'eternalsquire at comcast.net', + 'Gordon McMillan' : 'gmcm at hypernet.com', + 'Andrew McNamara' : 'andrewm at object-craft.com.au', + 'Trent Mick' : 'trentm at activestate.com', + 'Mike Meyer' : 'mwm at mired.org', + 'Skip Montanaro' : 'skip at pobox.com', + 'Paul Moore' : 'gustav at morpheus.demon.co.uk', + 'Ben North' : 'ben at redfrontdoor.org', + 'Neal Norwitz' : 'nnorwitz at gmail.com', + 'Travis Oliphant' : 'oliphant at ee.byu.edu', + 'Jason Orendorff' : 'jason.orendorff at gmail.com', + 'Samuele Pedroni' : 'pedronis at python.org', + 'Michel Pelletier' : 'michel at users.sourceforge.net', + 'Tim Peters' : 'tim at zope.com', + 'Jason Petrone' : 'jp at demonseed.net', + 'Paul Prescod' : 'paul at prescod.net', + 'Terry Reedy' : 'tjreedy at udel.edu', + 'Sean Reifschneider' : 'jafo-pep at tummy.com', + 'Christian R. Reis' : 'kiko at async.com.br', + 'Jonathan Riehl' : 'jriehl at spaceship.com', + 'Andr? Roberge' : 'andre.roberge at gmail.com', + 'Guido van Rossum' : 'guido at python.org', + 'Just van Rossum' : 'just at letterror.com', + 'Vinay Sajip' : 'vinay_sajip at red-dove.com', + 'Neil Schemenauer' : 'nas at arctrix.com', + 'Peter Schneider-Kamp' : 'nowonder at nowonder.de', + 'Jiwon Seo' : 'seojiwon at gmail.com', + 'Kevin D. Smith' : 'Kevin.Smith at theMorgue.org', + 'Greg Stein' : 'gstein at lyra.org', + 'Daniel Stutzbach' : 'daniel.stutzbach at gmail.com', + 'Roman Suzi' : 'rnd at onego.ru', + 'Talin' : 'talin at acm.org', + 'Steven Taschuk' : 'staschuk at telusplanet.net', + 'Oren Tirosh' : 'oren at hishome.net', + 'Mike Verdone' : 'mike.verdone at gmail.com', + 'Gregory R. Warnes' : 'warnes at users.sourceforge.net', + 'Barry Warsaw' : 'barry at python.org', + 'Terence Way' : 'terry at wayforward.net', + 'Cliff Wells' : 'LogiplexSoftware at earthlink.net', + 'Greg Wilson' : 'gvwilson at ddj.com', + 'Collin Winter' : 'collinw at gmail.com', + 'Thomas Wouters' : 'thomas at python.org', + 'Ka-Ping Yee' : 'ping at zesty.ca', + 'Moshe Zadka' : 'moshez at zadka.site.co.il', + 'Huaiyu Zhu' : 'hzhu at users.sourceforge.net', +} + +nicknames = { + 'Guido van Rossum' : 'GvR', + 'Just van Rossum' : 'JvR', +} From python-checkins at python.org Sat Apr 14 02:30:07 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:30:07 +0200 (CEST) Subject: [Python-checkins] r54818 - peps/trunk/pep-0207.txt Message-ID: <20070414003007.B94441E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:30:06 2007 New Revision: 54818 Modified: peps/trunk/pep-0207.txt Log: Fix a typo in the PEP title. Modified: peps/trunk/pep-0207.txt ============================================================================== --- peps/trunk/pep-0207.txt (original) +++ peps/trunk/pep-0207.txt Sat Apr 14 02:30:06 2007 @@ -1,5 +1,5 @@ PEP: 207 -Title: Rich Comparisions +Title: Rich Comparisons Version: $Revision$ Last-Modified: $Date$ Author: guido at python.org (Guido van Rossum), DavidA at ActiveState.com (David Ascher) From python-checkins at python.org Sat Apr 14 02:31:27 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:31:27 +0200 (CEST) Subject: [Python-checkins] r54819 - peps/trunk/pep-3118.txt Message-ID: <20070414003127.37C791E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:31:26 2007 New Revision: 54819 Modified: peps/trunk/pep-3118.txt Log: Make Author field's name be consistent with other names (it's not plural). Modified: peps/trunk/pep-3118.txt ============================================================================== --- peps/trunk/pep-3118.txt (original) +++ peps/trunk/pep-3118.txt Sat Apr 14 02:31:26 2007 @@ -2,7 +2,7 @@ Title: Revising the buffer protocol Version: $Revision$ Last-Modified: $Date$ -Authors: Travis Oliphant , Carl Banks +Author: Travis Oliphant , Carl Banks Status: Draft Type: Standards Track Content-Type: text/x-rst From python-checkins at python.org Sat Apr 14 02:33:00 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:33:00 +0200 (CEST) Subject: [Python-checkins] r54820 - sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Message-ID: <20070414003300.1E5011E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:32:58 2007 New Revision: 54820 Modified: sandbox/trunk/pep0/pep0.py sandbox/trunk/pep0/test_pep0.py Log: Add support for author nicknames. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sat Apr 14 02:32:58 2007 @@ -1,5 +1,6 @@ """Auto-generate PEP 0 (PEP index). """ from __future__ import with_statement +import authors import os import re @@ -65,7 +66,7 @@ angled = r'(?P.+?) <.+?>' paren = r'.+? \((?P.+?)\)' simple = r'(?P[^,]+)' - authors = [] + author_list = [] for regex in (angled, paren, simple): # Watch out for commas separating multiple names. regex += '(,\s+)?' @@ -76,14 +77,15 @@ # separated by commas. author = match.group('author') if not author.partition(' ')[1] and author.endswith('.'): - prev_author = authors.pop() + prev_author = author_list.pop() author = ', '.join([prev_author, author]) - authors.append(author) + author_list.append(author) else: - # If authors were found then stop searching. - if authors: + # If authors were found then stop searching as only expect one + # style of author citation. + if author_list: break - return authors + return author_list def handle_csv(data): """Handle the Post-History.""" @@ -94,8 +96,8 @@ 'Post-History': handle_csv, } -def last_name(full_name): - """Find the last name of a full name. +def last_name(full_name, nicknames={}): + """Find the last name (or nickname) of a full name. If no last name (e.g, 'Aahz') then return the full name. If there is a leading, lowercase portion to the last name (e.g., 'van' or 'von') then @@ -103,6 +105,9 @@ comma, then drop the suffix. """ + nickname = nicknames.get(full_name) + if nickname: + return nickname no_suffix = full_name.partition(',')[0] name_parts = no_suffix.split() part_count = len(name_parts) @@ -154,9 +159,11 @@ number = str(pep['PEP']).rjust(4) title = pep['Title'] authors_list = [] - authors = ', '.join(last_name(author) for author in pep['Author']) + author_string = ', '.join(last_name(author, authors.nicknames) + for author in pep['Author']) output.write(" %s%s %s %s %s\n" % - (type_abbr, status_abbr, number, title.ljust(44), authors)) + (type_abbr, status_abbr, number, title.ljust(44), + author_string)) if __name__ == '__main__': Modified: sandbox/trunk/pep0/test_pep0.py ============================================================================== --- sandbox/trunk/pep0/test_pep0.py (original) +++ sandbox/trunk/pep0/test_pep0.py Sat Apr 14 02:32:58 2007 @@ -157,6 +157,17 @@ got = pep0.last_name(full_name) self.failUnlessEqual(got, expect) + def test_author_nickname(self): + # Make sure nicknames are returned instead of last names when a + # nickname is available. + full_name = 'Guido van Rossum' + nickname = 'GvR' + last_name = 'van Rossum' + got = pep0.last_name(full_name, {full_name:nickname}) + self.failUnlessEqual(got, nickname) + got = pep0.last_name(full_name, {'asdf':nickname}) + self.failUnlessEqual(got, last_name) + def test_main(): test_support.run_unittest( From python-checkins at python.org Sat Apr 14 02:34:43 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:34:43 +0200 (CEST) Subject: [Python-checkins] r54821 - sandbox/trunk/pep0/TODO Message-ID: <20070414003443.63C561E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:34:42 2007 New Revision: 54821 Modified: sandbox/trunk/pep0/TODO Log: Update TODO that authors index has been implemented. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Sat Apr 14 02:34:42 2007 @@ -1,26 +1,9 @@ -Current discrepencies/bugs --------------------------- - -* Be able to import authors.py . - - Probably as simple as declaring encoding. - - Otherwise prepend 'u' to every string. - - - Functionality to add -------------------- * Read PEPs as UTF-8. * Output static text for PEP 0. - + Store Owners list in a data structure. - - Support nicknames for PEP listing (e.g., "Guido van Rossum" -> - "GvR"). - - Care about making sure that email addresses are up-to-date between - PEPs and PEP 0? - - Worth keeping emails in both PEP 0 and individual PEPs, or just make - PEP 0 master and leave out of PEPs so that single place can be - maintained and considered up-to-date? + Store Key in data structure for easy mapping? - Would allow for easy validation that metadata is correct in PEPs. @@ -39,8 +22,8 @@ - reST. -Inconsistencies ----------------- +Inconsistencies/Things To Improve +--------------------------------- * Within PEPs: + Author field From python-checkins at python.org Sat Apr 14 02:49:05 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:49:05 +0200 (CEST) Subject: [Python-checkins] r54822 - sandbox/trunk/pep0/pep0.py Message-ID: <20070414004905.6B00D1E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:48:59 2007 New Revision: 54822 Modified: sandbox/trunk/pep0/pep0.py Log: Output key information. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sat Apr 14 02:48:59 2007 @@ -4,6 +4,9 @@ import os import re +type_values = ("Standards Track", "Informational", "Process") +status_values = ("Accepted", "Rejected", "Withdrawn", "Deferred", "Final") + def consume_headers(directory='.'): """Pull out metadata for every PEP in the specified directory and return them in a list sorted by PEP name.""" @@ -178,7 +181,28 @@ else: peps = [consume_pep(path)] + + #XXX meta, info, accepted, open_, done, empty, dead = sort_peps(peps) + for pep in peps: write_pep(pep, stdout) - #meta, info, accepted, open_, done, empty, dead = sort_peps(peps) + print + print + print "Key" + print + for type_ in type_values: + print " %s - %s PEP" % (type_[0], type_) + print + for status in status_values: + print " %s - %s proposal" % (status[0], status) + + print + print + print "Owners" + print + # XXX list by last name, sort (take into account van/von and Jr.), list + # nickname, and + # output with email. Need to know longest one for both fields to make sure + # list header is long enough and proper padding between name and email is + # done. From python-checkins at python.org Sat Apr 14 02:58:04 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 02:58:04 +0200 (CEST) Subject: [Python-checkins] r54823 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Message-ID: <20070414005804.0C45F1E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 02:58:00 2007 New Revision: 54823 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Log: Clarify what is left to do. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Sat Apr 14 02:58:00 2007 @@ -4,12 +4,21 @@ * Read PEPs as UTF-8. * Output static text for PEP 0. - + Store Key in data structure for easy mapping? - - Would allow for easy validation that metadata is correct in PEPs. - -* Output PEP 0 with numerical PEP index. + + Header. + + Footer. + + References. + + Column titles for numerical index. + + Author/email list. + - names + - emails + - Column headers. + * Underline to length of author name or just column header like in + rest of doc? * Output PEP 0 with special sections. + + Sort PEPs. + + Column headers. + + Section info. * Make sure that it is easy to identify which PEP triggered an error. + Has all expected fields. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sat Apr 14 02:58:00 2007 @@ -201,8 +201,9 @@ print print "Owners" print - # XXX list by last name, sort (take into account van/von and Jr.), list - # nickname, and - # output with email. Need to know longest one for both fields to make sure - # list header is long enough and proper padding between name and email is - # done. + # XXX + # * get "last, first I." of each name. + # * add nickname. + # * find longest name. + # * column headers. + # * name/email with a two-space separation between longest name and email. From buildbot at python.org Sat Apr 14 02:58:25 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Apr 2007 00:58:25 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070414005826.36B021E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/244 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: kristjan.jonsson Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket sincerely, -The Buildbot From python-checkins at python.org Sat Apr 14 03:03:33 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Apr 2007 03:03:33 +0200 (CEST) Subject: [Python-checkins] r54824 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Message-ID: <20070414010333.EA7821E4003@bag.python.org> Author: brett.cannon Date: Sat Apr 14 03:03:29 2007 New Revision: 54824 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Log: Add in static text to file (but not to output). Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Sat Apr 14 03:03:29 2007 @@ -6,6 +6,7 @@ * Output static text for PEP 0. + Header. + Footer. + + Introduction. + References. + Column titles for numerical index. + Author/email list. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sat Apr 14 03:03:29 2007 @@ -4,6 +4,50 @@ import os import re +# Don't start on a new line to make easier to read as that would cause output to +# start on a blank line. +header = """PEP: 0 +Title: Index of Python Enhancement Proposals (PEPs) +Version: $Revision$ +Last-Modified: $Date$ +Author: David Goodger , + Barry A. Warsaw +Status: Active +Type: Informational +Created: 13-Jul-2000 +""" + +intro = """ + The PEP contains the index of all Python Enhancement Proposals, + known as PEPs. PEP numbers are assigned by the PEP Editor, and + once assigned are never changed. The SVN history[1] of the PEP + texts represent their historical record. + + The BDFL maintains his own Pronouncements page[2] at + http://www.python.org/doc/essays/pepparade.html which contains his + musings on the various outstanding PEPs. +""" + +references = """ + [1] View PEP history online + http://svn.python.org/projects/peps/trunk/ + + [2] The Benevolent Dictator For Life's Parade of PEPs + http://www.python.org/doc/essays/pepparade.html +""" + +footer = """ + +Local Variables: +mode: indented-text +indent-tabs-mode: nil +sentence-end-double-space: t +fill-column: 70 +coding: utf-8 +End: +""" + + type_values = ("Standards Track", "Informational", "Process") status_values = ("Accepted", "Rejected", "Withdrawn", "Deferred", "Final") From python-checkins at python.org Sat Apr 14 07:25:58 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 14 Apr 2007 07:25:58 +0200 (CEST) Subject: [Python-checkins] r54825 - in python/trunk: Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20070414052558.078C41E4003@bag.python.org> Author: neal.norwitz Date: Sat Apr 14 07:25:50 2007 New Revision: 54825 Modified: python/trunk/Lib/test/test_descr.py python/trunk/Misc/NEWS python/trunk/Objects/typeobject.c Log: When __slots__ are set to a unicode string, make it work the same as setting a plain string, ie don't expand to single letter identifiers. Modified: python/trunk/Lib/test/test_descr.py ============================================================================== --- python/trunk/Lib/test/test_descr.py (original) +++ python/trunk/Lib/test/test_descr.py Sat Apr 14 07:25:50 2007 @@ -1225,13 +1225,29 @@ raise TestFailed, "[''] slots not caught" class C(object): __slots__ = ["a", "a_b", "_a", "A0123456789Z"] + # XXX(nnorwitz): was there supposed to be something tested + # from the class above? + + # Test a single string is not expanded as a sequence. + class C(object): + __slots__ = "abc" + c = C() + c.abc = 5 + vereq(c.abc, 5) # Test unicode slot names try: - unichr + unicode except NameError: pass else: + # Test a single unicode string is not expanded as a sequence. + class C(object): + __slots__ = unicode("abc") + c = C() + c.abc = 5 + vereq(c.abc, 5) + # _unicode_to_string used to modify slots in certain circumstances slots = (unicode("foo"), unicode("bar")) class C(object): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Apr 14 07:25:50 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- When __slots__ are set to a unicode string, make it work the same as + setting a plain string, ie don't expand to single letter identifiers. + - Request #1191699: Slices can now be pickled. - Request #1193128: str.translate() now allows a None argument for Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Sat Apr 14 07:25:50 2007 @@ -1816,7 +1816,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyString_Check(slots)) + if (PyString_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); From buildbot at python.org Sat Apr 14 07:41:58 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Apr 2007 05:41:58 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070414054158.B24441E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/378 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings failed slave lost sincerely, -The Buildbot From stackless-checkins-bounces at stackless.com Sat Apr 14 15:06:00 2007 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Sat, 14 Apr 2007 15:06:00 +0200 Subject: [Python-checkins] Your message to Stackless-checkins awaits moderator approval Message-ID: Your mail to 'Stackless-checkins' with the subject r54826 - in stackless/branches/release25-maint: Demo/parser/unparse.py Doc/README Doc/api/abstract.tex Doc/api/concrete.tex Doc/api/exceptions.tex Doc/api/memory.tex Doc/api/newtypes.tex Doc/api/utilities.tex Doc/commontex/boilerplate.tex Doc/commontex/license.tex Doc/dist/dist.tex Doc/ext/newtypes.tex Doc/ext/shoddy.c Doc/inst/inst.tex Doc/lib/emailgenerator.tex Doc/lib/libasyncore.tex Doc/lib/libbase64.tex Doc/lib/libbsddb.tex Doc/lib/libbz2.tex Doc/lib/libcollections.tex Doc/lib/libcommands.tex Doc/lib/libcsv.tex Doc/lib/libctypes.tex Doc/lib/libdbhash.tex Doc/lib/libfnmatch.tex Doc/lib/libfuncs.tex Doc/lib/libfunctools.tex Doc/lib/libgetopt.tex Doc/lib/libgettext.tex Doc/lib/libheapq.tex Doc/lib/libimageop.tex Doc/lib/libitertools.tex Doc/lib/liblocale.tex Doc/lib/liblogging.tex Doc/lib/libmailbox.tex Doc/lib/libmmap.tex Doc/lib/libmsilib.tex Doc/lib/libos.tex Doc/lib/libpickle.tex Doc/lib/libpopen2.tex Doc/lib/libprofile.tex Doc/lib/librandom.tex Doc/lib/libshu! til.tex Doc/lib/libsimplexmlrpc.tex Doc/lib/libsmtplib.tex Doc/lib/libsocket.tex Doc/lib/libsqlite3.tex Doc/lib/libstdtypes.tex Doc/lib/libstring.tex Doc/lib/libstruct.tex Doc/lib/libsubprocess.tex Doc/lib/libtarfile.tex Doc/lib/libtempfile.tex Doc/lib/libthreading.tex Doc/lib/libtimeit.tex Doc/lib/libunittest.tex Doc/lib/liburlparse.tex Doc/lib/libwsgiref.tex Doc/lib/tkinter.tex Doc/mac/toolbox.tex Doc/ref/ref1.tex Doc/ref/ref3.tex Doc/ref/ref5.tex Doc/ref/ref6.tex Doc/ref/ref7.tex Doc/tools/py2texi.el Doc/tut/tut.tex Doc/whatsnew/whatsnew25.tex Include/Python-ast.h Include/abstract.h Include/dictobject.h Include/patchlevel.h Include/pystate.h Include/setobject.h LICENSE Lib/CGIHTTPServer.py Lib/Queue.py Lib/SimpleHTTPServer.py Lib/SocketServer.py Lib/StringIO.py Lib/_strptime.py Lib/bisect.py Lib/bsddb/dbobj.py Lib/bsddb/test/test_1413192.py Lib/bsddb/test/test_dbobj.py Lib/codecs.py Lib/compiler/pycodegen.py Lib/compiler/transformer.py Lib/ctypes Lib/ctypes/__init__.py L! ib/ctypes/test/test_callbacks.py Lib/ctypes/test/test_functions.py Lib/ctypes/test/test_loading.py Lib/ctypes/test/test_memfunctions.py Lib/ctypes/test/test_structures.py Lib/ctypes/util.py Lib/decimal.py Lib/difflib.py Lib/distutils/__init__.py Lib/distutils/command/bdist_rpm.py Lib/distutils/command/build_ext.py Lib/distut Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 909930 bytes with a limit of 500 KB Either the message will get posted to the list, or you will receive notification of the moderator's decision. If you would like to cancel this posting, please visit the following URL: http://www.stackless.com/mailman/confirm/stackless-checkins/793022e0e2f4ffef76427874acc8923d75b2d392 From python-checkins at python.org Sun Apr 15 03:35:34 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 15 Apr 2007 03:35:34 +0200 (CEST) Subject: [Python-checkins] r54828 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Message-ID: <20070415013534.60D551E4008@bag.python.org> Author: brett.cannon Date: Sun Apr 15 03:35:29 2007 New Revision: 54828 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Log: Flesh out output of static text. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Sun Apr 15 03:35:29 2007 @@ -4,11 +4,6 @@ * Read PEPs as UTF-8. * Output static text for PEP 0. - + Header. - + Footer. - + Introduction. - + References. - + Column titles for numerical index. + Author/email list. - names - emails @@ -16,9 +11,8 @@ * Underline to length of author name or just column header like in rest of doc? -* Output PEP 0 with special sections. - + Sort PEPs. - + Column headers. +* Index by Category. + + Sort PEPs and output + Section info. * Make sure that it is easy to identify which PEP triggered an error. Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sun Apr 15 03:35:29 2007 @@ -36,16 +36,14 @@ http://www.python.org/doc/essays/pepparade.html """ -footer = """ - +footer = """ Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 coding: utf-8 -End: -""" +End:""" type_values = ("Standards Track", "Informational", "Process") @@ -212,6 +210,13 @@ (type_abbr, status_abbr, number, title.ljust(44), author_string)) +def write_column_headers(output): + """Output the column headers for the PEP indices.""" + output.write('%s %s %s\n' % ("num".rjust(8), "title".ljust(44), "owner")) + output.write('%s %s %s\n' % ((len("num")*'-').rjust(8), + (len("title")*'-').ljust(44), len("owner")*'-')) + + if __name__ == '__main__': from sys import argv, stdout @@ -225,12 +230,27 @@ else: peps = [consume_pep(path)] - + print header + print + print "Introduction" + print intro + print + print "Index by Category" + print + write_column_headers(stdout) #XXX meta, info, accepted, open_, done, empty, dead = sort_peps(peps) - + print ' XXX' + print + print + print "Numerical Index" + print + write_column_headers(stdout) + prev_pep = 0 for pep in peps: + if pep['PEP'] - prev_pep > 1: + print write_pep(pep, stdout) - + prev_pep = pep['PEP'] print print print "Key" @@ -251,3 +271,10 @@ # * find longest name. # * column headers. # * name/email with a two-space separation between longest name and email. + print ' XXX' + print + print + print "References" + print + print references + print footer From python-checkins at python.org Sun Apr 15 04:08:40 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 15 Apr 2007 04:08:40 +0200 (CEST) Subject: [Python-checkins] r54829 - peps/trunk/pep-0314.txt Message-ID: <20070415020840.4C3191E4003@bag.python.org> Author: brett.cannon Date: Sun Apr 15 04:08:39 2007 New Revision: 54829 Modified: peps/trunk/pep-0314.txt Log: Make author listing consistent. Modified: peps/trunk/pep-0314.txt ============================================================================== --- peps/trunk/pep-0314.txt (original) +++ peps/trunk/pep-0314.txt Sun Apr 15 04:08:39 2007 @@ -2,7 +2,7 @@ Title: Metadata for Python Software Packages v1.1 Version: $Revision$ Last-Modified: $Date$ -Author: A.M. Kuchling , Richard Jones +Author: A.M. Kuchling, Richard Jones Status: Final Type: Standards Track Content-type: text/plain From python-checkins at python.org Sun Apr 15 04:10:31 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 15 Apr 2007 04:10:31 +0200 (CEST) Subject: [Python-checkins] r54830 - peps/trunk/pep-0160.txt peps/trunk/pep-0205.txt peps/trunk/pep-0207.txt peps/trunk/pep-0214.txt peps/trunk/pep-0229.txt peps/trunk/pep-0231.txt peps/trunk/pep-3101.txt peps/trunk/pep-3102.txt peps/trunk/pep-3105.txt peps/trunk/pep-3106.txt peps/trunk/pep-3115.txt Message-ID: <20070415021031.B92121E4003@bag.python.org> Author: brett.cannon Date: Sun Apr 15 04:10:27 2007 New Revision: 54830 Modified: peps/trunk/pep-0160.txt peps/trunk/pep-0205.txt peps/trunk/pep-0207.txt peps/trunk/pep-0214.txt peps/trunk/pep-0229.txt peps/trunk/pep-0231.txt peps/trunk/pep-3101.txt peps/trunk/pep-3102.txt peps/trunk/pep-3105.txt peps/trunk/pep-3106.txt peps/trunk/pep-3115.txt Log: Make Type field values consistent across all PEPs. Modified: peps/trunk/pep-0160.txt ============================================================================== --- peps/trunk/pep-0160.txt (original) +++ peps/trunk/pep-0160.txt Sun Apr 15 04:10:27 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Fred L. Drake, Jr. -Status: Finished +Status: Final Type: Informational Created: 25-Jul-2000 Python-Version: 1.6 Modified: peps/trunk/pep-0205.txt ============================================================================== --- peps/trunk/pep-0205.txt (original) +++ peps/trunk/pep-0205.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Fred L. Drake, Jr. Python-Version: 2.1 -Status: Incomplete +Status: Final Type: Standards Track Post-History: 11-Jan-2001 Modified: peps/trunk/pep-0207.txt ============================================================================== --- peps/trunk/pep-0207.txt (original) +++ peps/trunk/pep-0207.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: guido at python.org (Guido van Rossum), DavidA at ActiveState.com (David Ascher) Python-Version: 2.1 -Type: Standards +Type: Standards Track Status: Final Modified: peps/trunk/pep-0214.txt ============================================================================== --- peps/trunk/pep-0214.txt (original) +++ peps/trunk/pep-0214.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: barry at python.org (Barry A. Warsaw) Python-Version: 2.0 -Type: Standards +Type: Standards Track Status: Final Created: 24-Jul-2000 Post-History: 16-Aug-2000 Modified: peps/trunk/pep-0229.txt ============================================================================== --- peps/trunk/pep-0229.txt (original) +++ peps/trunk/pep-0229.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: A.M. Kuchling Status: Final -Type: Standards +Type: Standards Track Created: 16-Nov-2000 Post-History: Modified: peps/trunk/pep-0231.txt ============================================================================== --- peps/trunk/pep-0231.txt (original) +++ peps/trunk/pep-0231.txt Sun Apr 15 04:10:27 2007 @@ -5,7 +5,7 @@ Author: barry at python.org (Barry A. Warsaw) Python-Version: 2.1 Status: Rejected -Type: Standards +Type: Standards Track Created: 30-Nov-2000 Post-History: Modified: peps/trunk/pep-3101.txt ============================================================================== --- peps/trunk/pep-3101.txt (original) +++ peps/trunk/pep-3101.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Talin Status: Draft -Type: Standards +Type: Standards Track Content-Type: text/plain Created: 16-Apr-2006 Python-Version: 3.0 Modified: peps/trunk/pep-3102.txt ============================================================================== --- peps/trunk/pep-3102.txt (original) +++ peps/trunk/pep-3102.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Talin Status: Accepted -Type: Standards +Type: Standards Track Content-Type: text/plain Created: 22-Apr-2006 Python-Version: 3.0 Modified: peps/trunk/pep-3105.txt ============================================================================== --- peps/trunk/pep-3105.txt (original) +++ peps/trunk/pep-3105.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Georg Brandl Status: Final -Type: Standards +Type: Standards Track Content-Type: text/x-rst Created: 19-Nov-2006 Python-Version: 3.0 Modified: peps/trunk/pep-3106.txt ============================================================================== --- peps/trunk/pep-3106.txt (original) +++ peps/trunk/pep-3106.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Guido van Rossum Status: Accepted -Type: Standards +Type: Standards Track Content-Type: text/x-rst Created: 19-Dec-2006 Post-History: Modified: peps/trunk/pep-3115.txt ============================================================================== --- peps/trunk/pep-3115.txt (original) +++ peps/trunk/pep-3115.txt Sun Apr 15 04:10:27 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Talin Status: Accepted -Type: Standards +Type: Standards Track Content-Type: text/plain Created: 07-Mar-2007 Python-Version: 3.0 From python-checkins at python.org Sun Apr 15 04:15:05 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 15 Apr 2007 04:15:05 +0200 (CEST) Subject: [Python-checkins] r54831 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Message-ID: <20070415021505.C322B1E4003@bag.python.org> Author: brett.cannon Date: Sun Apr 15 04:15:01 2007 New Revision: 54831 Modified: sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py Log: Get the index to output by category. Modified: sandbox/trunk/pep0/TODO ============================================================================== --- sandbox/trunk/pep0/TODO (original) +++ sandbox/trunk/pep0/TODO Sun Apr 15 04:15:01 2007 @@ -3,23 +3,15 @@ * Read PEPs as UTF-8. -* Output static text for PEP 0. - + Author/email list. - - names - - emails - - Column headers. - * Underline to length of author name or just column header like in - rest of doc? - -* Index by Category. - + Sort PEPs and output - + Section info. +* Author/email list. + + names + + emails + + Column headers. + - Underline to length of author name or just column header like in + rest of doc? * Make sure that it is easy to identify which PEP triggered an error. - + Has all expected fields. + Values in fields correct. - - Type - - Status - All authors declared in authors.py. + Formatting correct. - Plaintext. @@ -41,8 +33,6 @@ - Meta-PEPs are not delineated as such. + Status field. - - Not all PEPs use consistent names (e.g., some just say "Standard" instead - of "Standard Track"). - Empty PEPs are not specified as such. * In the index: @@ -61,5 +51,7 @@ - Just deal with some being longer than expected? * Type/Status field. - + Informational PEPs inconsistenty leave out Status. + + Active and Draft status is not listed in index. + - Conflicts with Accepted and Deferred initials, respectively. + - Worth using other letters? Modified: sandbox/trunk/pep0/pep0.py ============================================================================== --- sandbox/trunk/pep0/pep0.py (original) +++ sandbox/trunk/pep0/pep0.py Sun Apr 15 04:15:01 2007 @@ -47,7 +47,9 @@ type_values = ("Standards Track", "Informational", "Process") -status_values = ("Accepted", "Rejected", "Withdrawn", "Deferred", "Final") +# Active and Draft are not listed in the index. +status_values = ("Accepted", "Rejected", "Withdrawn", "Deferred", "Final", + "Active", "Draft") def consume_headers(directory='.'): """Pull out metadata for every PEP in the specified directory and return @@ -74,6 +76,19 @@ except Exception: print "In", pep_file raise + if not 'PEP' in pep_info: + raise ValueError("PEP at file %s lacks a PEP number" % path) + if not 'Author' in pep_info: + raise ValueError("PEP %s is missing the Author field" % + pep_info['PEP']) + if len(pep_info['Author']) < 1: + raise ValueError("PEP %s is lacking authors" % pep_info['PEP']) + if pep_info['Type'] not in type_values: + raise ValueError("%s is an invalid Type value for PEP %s" % + (pep_info['Type'], pep_info['PEP'])) + if pep_info['Status'] not in status_values: + raise ValueError("%s is an invalid Status value for PEP %s" % + (pep_info['Status'], pep_info['PEP'])) return pep_info def parse_metadata(pep_info, line, previous_type=None): @@ -176,28 +191,28 @@ empty = [] dead = [] for pep in peps: - # XXX not all meta PEPs are process PEPs. - if pep['Type'] == 'Process': + # Order of 'if' statement important. Key Status values take precedence + # over Type value, and vice-versa. + if pep['Status'] == 'Draft': + open_.append(pep) + elif pep['Status'] in ('Rejected', 'Withdrawn', 'Deferred', + 'Incomplete'): + dead.append(pep) + elif pep['Type'] == 'Process': meta.append(pep) elif pep['Type'] == 'Informational': info.append(pep) elif pep['Status'] == 'Accepted': accepted.append(pep) - elif pep['Status'] == 'Draft': - open_.append(pep) elif pep['Status'] == 'Final': finished.append(pep) - # XXX empty - elif pep['Status'] in ('Rejected', 'Withdrawn', 'Deferred', - 'Incomplete'): - dead.append(pep) - return meta, info, accepted, open_, finished, empty, dead + return meta, info, accepted, open_, finished, empty, dead def write_pep(pep, output): """Write PEP info to 'output'.""" type_abbr = pep['Type'][0].upper() status = pep['Status'] - if status == 'Draft': + if status in ('Draft', 'Active'): status_abbr = ' ' else: status_abbr = status[0].upper() @@ -238,11 +253,45 @@ print "Index by Category" print write_column_headers(stdout) - #XXX meta, info, accepted, open_, done, empty, dead = sort_peps(peps) - print ' XXX' + meta, info, accepted, open_, done, empty, dead = sort_peps(peps) + print + print " Meta-PEPs (PEPs about PEPs or Processs)" + print + for pep in meta: + write_pep(pep, stdout) + print + print " Other Informational PEPs" + print + for pep in info: + write_pep(pep, stdout) + print + print " Accepted PEPs (accepted; may not be implemented yet)" + print + for pep in accepted: + write_pep(pep, stdout) + print + print " Open PEPs (under consideration)" + print + for pep in open_: + write_pep(pep, stdout) + print + print " Finished PEPs (done, implemented in code repository)" + print + for pep in done: + write_pep(pep, stdout) + print + print " Empty PEPs (or containing only abstract)" + print + for pep in empty: + write_pep(pep, stdout) + print + print " Deferred, Abandoned, Withdrawn, and Rejected PEPs" + print + for pep in dead: + write_pep(pep, stdout) print print - print "Numerical Index" + print " Numerical Index" print write_column_headers(stdout) prev_pep = 0 From python-checkins at python.org Sun Apr 15 05:21:50 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 15 Apr 2007 05:21:50 +0200 (CEST) Subject: [Python-checkins] r54832 - in sandbox/trunk/pep0: authors.py pep0 pep0.py pep0/__init__.py pep0/authors.py pep0/output.py pep0/parse.py pep0/pep.py pep0/statictext.py test_pep0.py Message-ID: <20070415032150.E65671E4005@bag.python.org> Author: brett.cannon Date: Sun Apr 15 05:21:46 2007 New Revision: 54832 Added: sandbox/trunk/pep0/pep0/ sandbox/trunk/pep0/pep0/__init__.py (contents, props changed) sandbox/trunk/pep0/pep0/authors.py (contents, props changed) sandbox/trunk/pep0/pep0/output.py (contents, props changed) sandbox/trunk/pep0/pep0/parse.py (contents, props changed) sandbox/trunk/pep0/pep0/pep.py (contents, props changed) sandbox/trunk/pep0/pep0/statictext.py (contents, props changed) Removed: sandbox/trunk/pep0/authors.py sandbox/trunk/pep0/pep0.py Modified: sandbox/trunk/pep0/test_pep0.py Log: Start to refactor code into a package to make discrete steps in creating index more obvious and easier to handle. Still need to break out metadata parsing and validation into separate steps. Also need to rework output. See docstring in pep0.__init__ for discrete steps that are planned. Tests are now totally broken and need to be regrouped based on new package structure. But code can still be run (using ``-m pep0 ``). Deleted: /sandbox/trunk/pep0/authors.py ============================================================================== --- /sandbox/trunk/pep0/authors.py Sun Apr 15 05:21:46 2007 +++ (empty file) @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -email_addresses = { - 'Aahz' : 'aahz at pobox.com', - 'James C. Ahlstrom' : 'jim at interet.com', - 'Jim Althoff' : 'james_althoff at i2.com', - 'Kevin Altis' : 'altis at semi-retired.com', - 'David Ascher' : 'davida at activestate.com', - 'Peter Astrand' : 'astrand at lysator.liu.se', - 'Carl Banks' : 'pythondev at aerojockey.com', - 'Paul Barrett' : 'barrett at stsci.edu', - 'Facundo Batista' : 'facundo at taniquetil.com.ar', - 'Anthony Baxter' : 'anthony at interlink.com.au', - 'Thomas Bellman' : 'bellman+pep-divmod at lysator.liu.se', - 'Steven Bethard' : 'steven.bethard at gmail.com', - 'Georg Brandl' : 'g.brandl at gmx.net', - 'Brett Cannon' : 'brett at python.org', - 'Josiah Carlson' : 'jcarlson at uci.edu', - 'W Isaac Carroll' : 'icarroll at pobox.com', - 'Nick Coghlan' : 'ncoghlan at gmail.com', - 'Dave Cole' : 'djc at object-craft.com.au', - 'Christopher Craig' : 'python-pep at ccraig.org', - 'Laura Creighton' : 'lac at strakt.com', - 'Walter D?rwald' : '', - 'Fred L. Drake, Jr.' : 'fdrake at acm.org', - 'Michael P. Dubner' : 'dubnerm at mindless.com', - 'Paul F. Dubois' : 'paul at pfdubois.com', - 'Phillip J. Eby' : 'pje at telecommunity.com', - 'Micah Elliott' : 'mde at tracos.org', - 'Jeff Epler' : 'jepler at unpythonic.net', - 'David Eppstein' : 'eppstein at ics.uci.edu', - 'Clark C. Evans' : 'cce at clarkevans.com', - 'Greg Ewing' : 'greg at cosc.canterbury.ac.nz', - 'Martijn Faassen' : 'faassen at infrae.com', - 'Ben Finney' : 'ben+python at benfinney.id.au', - 'Fr?d?ric B. Giacometti' : 'fred at arakne.com', - 'Scott Gilbert' : 'xscottg at yahoo.com', - 'David Goodger' : 'goodger at python.org', - 'Grant Griffin' : 'g2 at iowegian.com', - 'Mark Hammond' : 'mhammond at skippinet.com.au', - 'Peter Harris' : 'scav at blueyonder.co.uk', - 'Thomas Heller' : 'theller at python.net', - 'Magnus Lie Hetland' : 'magnus at hetland.org', - 'Raymond D. Hettinger' : 'python at rcn.com', - 'Neil Hodgson' : 'neilh at scintilla.org', - 'Michael Hudson' : 'mwh at python.net', - 'Jeremy Hylton' : 'jeremy at zope.com', - 'Jack Jansen' : 'jack at cwi.nl', - 'Jim Jewett' : 'jimjjewett at users.sourceforge.net', - 'Richard Jones' : 'richard at mechanicalcat.net', - 'Stepan Koltsov' : 'yozh at mx1.ru', - 'A.M. Kuchling' : 'amk at amk.ca', - 'Marc-Andre Lemburg' : 'mal at lemburg.com', - 'Gregory Lielens' : 'gregory.lielens at fft.be', - 'Bj?rn Lindqvist' : 'bjourne at gmail.com', - 'Martin von L?wis' : 'loewis at informatik.hu-berlin.de', - 'Tony Lownds' : 'tony at pagedna.com', - 'Alex Martelli' : 'aleax at aleax.it', - 'Andrew McClelland' : 'eternalsquire at comcast.net', - 'Gordon McMillan' : 'gmcm at hypernet.com', - 'Andrew McNamara' : 'andrewm at object-craft.com.au', - 'Trent Mick' : 'trentm at activestate.com', - 'Mike Meyer' : 'mwm at mired.org', - 'Skip Montanaro' : 'skip at pobox.com', - 'Paul Moore' : 'gustav at morpheus.demon.co.uk', - 'Ben North' : 'ben at redfrontdoor.org', - 'Neal Norwitz' : 'nnorwitz at gmail.com', - 'Travis Oliphant' : 'oliphant at ee.byu.edu', - 'Jason Orendorff' : 'jason.orendorff at gmail.com', - 'Samuele Pedroni' : 'pedronis at python.org', - 'Michel Pelletier' : 'michel at users.sourceforge.net', - 'Tim Peters' : 'tim at zope.com', - 'Jason Petrone' : 'jp at demonseed.net', - 'Paul Prescod' : 'paul at prescod.net', - 'Terry Reedy' : 'tjreedy at udel.edu', - 'Sean Reifschneider' : 'jafo-pep at tummy.com', - 'Christian R. Reis' : 'kiko at async.com.br', - 'Jonathan Riehl' : 'jriehl at spaceship.com', - 'Andr? Roberge' : 'andre.roberge at gmail.com', - 'Guido van Rossum' : 'guido at python.org', - 'Just van Rossum' : 'just at letterror.com', - 'Vinay Sajip' : 'vinay_sajip at red-dove.com', - 'Neil Schemenauer' : 'nas at arctrix.com', - 'Peter Schneider-Kamp' : 'nowonder at nowonder.de', - 'Jiwon Seo' : 'seojiwon at gmail.com', - 'Kevin D. Smith' : 'Kevin.Smith at theMorgue.org', - 'Greg Stein' : 'gstein at lyra.org', - 'Daniel Stutzbach' : 'daniel.stutzbach at gmail.com', - 'Roman Suzi' : 'rnd at onego.ru', - 'Talin' : 'talin at acm.org', - 'Steven Taschuk' : 'staschuk at telusplanet.net', - 'Oren Tirosh' : 'oren at hishome.net', - 'Mike Verdone' : 'mike.verdone at gmail.com', - 'Gregory R. Warnes' : 'warnes at users.sourceforge.net', - 'Barry Warsaw' : 'barry at python.org', - 'Terence Way' : 'terry at wayforward.net', - 'Cliff Wells' : 'LogiplexSoftware at earthlink.net', - 'Greg Wilson' : 'gvwilson at ddj.com', - 'Collin Winter' : 'collinw at gmail.com', - 'Thomas Wouters' : 'thomas at python.org', - 'Ka-Ping Yee' : 'ping at zesty.ca', - 'Moshe Zadka' : 'moshez at zadka.site.co.il', - 'Huaiyu Zhu' : 'hzhu at users.sourceforge.net', -} - -nicknames = { - 'Guido van Rossum' : 'GvR', - 'Just van Rossum' : 'JvR', -} Deleted: /sandbox/trunk/pep0/pep0.py ============================================================================== --- /sandbox/trunk/pep0/pep0.py Sun Apr 15 05:21:46 2007 +++ (empty file) @@ -1,329 +0,0 @@ -"""Auto-generate PEP 0 (PEP index). """ -from __future__ import with_statement -import authors -import os -import re - -# Don't start on a new line to make easier to read as that would cause output to -# start on a blank line. -header = """PEP: 0 -Title: Index of Python Enhancement Proposals (PEPs) -Version: $Revision$ -Last-Modified: $Date$ -Author: David Goodger , - Barry A. Warsaw -Status: Active -Type: Informational -Created: 13-Jul-2000 -""" - -intro = """ - The PEP contains the index of all Python Enhancement Proposals, - known as PEPs. PEP numbers are assigned by the PEP Editor, and - once assigned are never changed. The SVN history[1] of the PEP - texts represent their historical record. - - The BDFL maintains his own Pronouncements page[2] at - http://www.python.org/doc/essays/pepparade.html which contains his - musings on the various outstanding PEPs. -""" - -references = """ - [1] View PEP history online - http://svn.python.org/projects/peps/trunk/ - - [2] The Benevolent Dictator For Life's Parade of PEPs - http://www.python.org/doc/essays/pepparade.html -""" - -footer = """ -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End:""" - - -type_values = ("Standards Track", "Informational", "Process") -# Active and Draft are not listed in the index. -status_values = ("Accepted", "Rejected", "Withdrawn", "Deferred", "Final", - "Active", "Draft") - -def consume_headers(directory='.'): - """Pull out metadata for every PEP in the specified directory and return - them in a list sorted by PEP name.""" - peps = [] - for file_name in os.listdir(directory): - if file_name.startswith('pep-') and file_name.endswith('.txt'): - peps.append(consume_pep(os.path.join(directory, file_name))) - peps.sort(key=lambda pep: pep['PEP']) - return peps - -def consume_pep(path): - """Consume the specified file as a PEP to get its metadata.""" - pep_info = {} - with open(path, 'rU') as pep_file: - try: - for line in pep_file: - if line == '\n': - break - elif line[1].isspace(): - type_ = parse_metadata(pep_info, line, type_) - else: - type_ = parse_metadata(pep_info, line) - except Exception: - print "In", pep_file - raise - if not 'PEP' in pep_info: - raise ValueError("PEP at file %s lacks a PEP number" % path) - if not 'Author' in pep_info: - raise ValueError("PEP %s is missing the Author field" % - pep_info['PEP']) - if len(pep_info['Author']) < 1: - raise ValueError("PEP %s is lacking authors" % pep_info['PEP']) - if pep_info['Type'] not in type_values: - raise ValueError("%s is an invalid Type value for PEP %s" % - (pep_info['Type'], pep_info['PEP'])) - if pep_info['Status'] not in status_values: - raise ValueError("%s is an invalid Status value for PEP %s" % - (pep_info['Status'], pep_info['PEP'])) - return pep_info - -def parse_metadata(pep_info, line, previous_type=None): - """Parse the given line for PEP metadata, adding on to existing metadata if - previous_type is specified, returning the last type of metadata handled.""" - if previous_type: - type_ = previous_type - data = line - else: - type_, data = line.split(':', 1) - type_ = type_.strip() - data = data.strip() - handler = handlers.get(type_, handle_generic) - result = handler(data) - if previous_type: - previous_data = pep_info[type_] - if not isinstance(previous_data, list): - previous_data = [previous_data] - pep_info[type_] = previous_data - previous_data.extend(result) - else: - pep_info[type_] = result - return type_ - -def handle_generic(data): - """Default handler for PEP metadata.""" - return data - -def handle_pep_num(data): - """Return the integer for the PEP number.""" - return int(data) - -def handle_author(data): - """Return a list of author names.""" - angled = r'(?P.+?) <.+?>' - paren = r'.+? \((?P.+?)\)' - simple = r'(?P[^,]+)' - author_list = [] - for regex in (angled, paren, simple): - # Watch out for commas separating multiple names. - regex += '(,\s+)?' - for match in re.finditer(regex, data): - author = match.group('author') - # Watch out for suffixes like 'Jr.' when they are comma-separated - # from the name and thus cause issues when *all* names are only - # separated by commas. - author = match.group('author') - if not author.partition(' ')[1] and author.endswith('.'): - prev_author = author_list.pop() - author = ', '.join([prev_author, author]) - author_list.append(author) - else: - # If authors were found then stop searching as only expect one - # style of author citation. - if author_list: - break - return author_list - -def handle_csv(data): - """Handle the Post-History.""" - return [value.strip() for value in data.split(',') if value] - -handlers = {'Author': handle_author, - 'PEP': handle_pep_num, - 'Post-History': handle_csv, - } - -def last_name(full_name, nicknames={}): - """Find the last name (or nickname) of a full name. - - If no last name (e.g, 'Aahz') then return the full name. If there is a - leading, lowercase portion to the last name (e.g., 'van' or 'von') then - include it. If there is a suffix (e.g., 'Jr.') that is appended through a - comma, then drop the suffix. - - """ - nickname = nicknames.get(full_name) - if nickname: - return nickname - no_suffix = full_name.partition(',')[0] - name_parts = no_suffix.split() - part_count = len(name_parts) - if part_count == 1 or part_count == 2: - return name_parts[-1] - else: - assert part_count > 2 - if name_parts[-2].islower(): - return ' '.join(name_parts[-2:]) - else: - return name_parts[-1] - -def sort_peps(peps): - """Sort PEPs into meta, informational, accepted, open, finished, empty, - and essentially dead.""" - meta = [] - info = [] - accepted = [] - open_ = [] - finished = [] - empty = [] - dead = [] - for pep in peps: - # Order of 'if' statement important. Key Status values take precedence - # over Type value, and vice-versa. - if pep['Status'] == 'Draft': - open_.append(pep) - elif pep['Status'] in ('Rejected', 'Withdrawn', 'Deferred', - 'Incomplete'): - dead.append(pep) - elif pep['Type'] == 'Process': - meta.append(pep) - elif pep['Type'] == 'Informational': - info.append(pep) - elif pep['Status'] == 'Accepted': - accepted.append(pep) - elif pep['Status'] == 'Final': - finished.append(pep) - return meta, info, accepted, open_, finished, empty, dead - -def write_pep(pep, output): - """Write PEP info to 'output'.""" - type_abbr = pep['Type'][0].upper() - status = pep['Status'] - if status in ('Draft', 'Active'): - status_abbr = ' ' - else: - status_abbr = status[0].upper() - number = str(pep['PEP']).rjust(4) - title = pep['Title'] - authors_list = [] - author_string = ', '.join(last_name(author, authors.nicknames) - for author in pep['Author']) - output.write(" %s%s %s %s %s\n" % - (type_abbr, status_abbr, number, title.ljust(44), - author_string)) - -def write_column_headers(output): - """Output the column headers for the PEP indices.""" - output.write('%s %s %s\n' % ("num".rjust(8), "title".ljust(44), "owner")) - output.write('%s %s %s\n' % ((len("num")*'-').rjust(8), - (len("title")*'-').ljust(44), len("owner")*'-')) - - - -if __name__ == '__main__': - from sys import argv, stdout - - if not argv[1:]: - path = '.' - else: - path = argv[1] - if os.path.isdir(path): - peps = consume_headers(path) - else: - peps = [consume_pep(path)] - - print header - print - print "Introduction" - print intro - print - print "Index by Category" - print - write_column_headers(stdout) - meta, info, accepted, open_, done