From buildbot at python.org Sun Feb 1 00:07:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 Jan 2009 23:07:56 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090131230756.323A81E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/150 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 00:17:14 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 Jan 2009 23:17:14 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.x Message-ID: <20090131231714.424541E400C@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.x/builds/195 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_epoll make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 00:24:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 Jan 2009 23:24:52 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090131232452.7A5C91E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/208 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_posix ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 00:43:25 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 1 Feb 2009 00:43:25 +0100 (CET) Subject: [Python-checkins] r69157 - python/trunk/Python/compile.c Message-ID: <20090131234325.58BEE1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Feb 1 00:43:25 2009 New Revision: 69157 Log: add explanatory comment Modified: python/trunk/Python/compile.c Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sun Feb 1 00:43:25 2009 @@ -3769,6 +3769,8 @@ return NULL; while (PyDict_Next(dict, &pos, &k, &v)) { i = PyInt_AS_LONG(v); + /* The keys of the dictionary are tuples. (see compiler_add_o) + The object we want is always first, though. */ k = PyTuple_GET_ITEM(k, 0); Py_INCREF(k); assert((i - offset) < size); From buildbot at python.org Sun Feb 1 00:45:07 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 Jan 2009 23:45:07 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.6 Message-ID: <20090131234507.9B95F1E4002@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%202.6/builds/84 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 00:47:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 Jan 2009 23:47:20 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090131234720.3DDF41E4002@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%20gentoo%20trunk/builds/1782 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: david.goodger,gregory.p.smith BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 00:54:38 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 1 Feb 2009 00:54:38 +0100 (CET) Subject: [Python-checkins] r69158 - python/trunk/Python/compile.c Message-ID: <20090131235438.47A951E4002@bag.python.org> Author: benjamin.peterson Date: Sun Feb 1 00:54:38 2009 New Revision: 69158 Log: more flags which only work for function blocks Modified: python/trunk/Python/compile.c Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sun Feb 1 00:54:38 2009 @@ -3794,13 +3794,11 @@ flags |= CO_NESTED; if (ste->ste_generator) flags |= CO_GENERATOR; + if (ste->ste_varargs) + flags |= CO_VARARGS; + if (ste->ste_varkeywords) + flags |= CO_VARKEYWORDS; } - if (ste->ste_varargs) - flags |= CO_VARARGS; - if (ste->ste_varkeywords) - flags |= CO_VARKEYWORDS; - if (ste->ste_generator) - flags |= CO_GENERATOR; /* (Only) inherit compilerflags in PyCF_MASK */ flags |= (c->c_flags->cf_flags & PyCF_MASK); From python-checkins at python.org Sun Feb 1 01:16:01 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:16:01 +0100 (CET) Subject: [Python-checkins] r69159 - python/trunk/Doc/library/binascii.rst Message-ID: <20090201001601.BF31C1E4002@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:16:01 2009 New Revision: 69159 Log: Update doc wording as suggested in issue4903. Modified: python/trunk/Doc/library/binascii.rst Modified: python/trunk/Doc/library/binascii.rst ============================================================================== --- python/trunk/Doc/library/binascii.rst (original) +++ python/trunk/Doc/library/binascii.rst Sun Feb 1 01:16:01 2009 @@ -120,17 +120,17 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] + The return value is in the range [-2**31, 2**31-1] regardless of platform. In the past the value would be signed on some platforms and unsigned on others. Use & 0xffffffff on the value if you want it to match 3.0 behavior. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From python-checkins at python.org Sun Feb 1 01:19:42 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:19:42 +0100 (CET) Subject: [Python-checkins] r69160 - python/branches/release26-maint/Doc/library/binascii.rst Message-ID: <20090201001942.699281E4002@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:19:42 2009 New Revision: 69160 Log: #documentation update for issue4903 - svn merge -c68535 http://svn.python.org/projects/python/trunk svn merge -c69159 http://svn.python.org/projects/python/trunk Modified: python/branches/release26-maint/Doc/library/binascii.rst Modified: python/branches/release26-maint/Doc/library/binascii.rst ============================================================================== --- python/branches/release26-maint/Doc/library/binascii.rst (original) +++ python/branches/release26-maint/Doc/library/binascii.rst Sun Feb 1 01:19:42 2009 @@ -120,17 +120,17 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] + The return value is in the range [-2**31, 2**31-1] regardless of platform. In the past the value would be signed on some platforms and unsigned on others. Use & 0xffffffff on the value if you want it to match 3.0 behavior. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From python-checkins at python.org Sun Feb 1 01:24:21 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:24:21 +0100 (CET) Subject: [Python-checkins] r69161 - python/trunk/Doc/library/zlib.rst Message-ID: <20090201002421.3FFC21E4002@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:24:21 2009 New Revision: 69161 Log: wording for for issue4903. Modified: python/trunk/Doc/library/zlib.rst Modified: python/trunk/Doc/library/zlib.rst ============================================================================== --- python/trunk/Doc/library/zlib.rst (original) +++ python/trunk/Doc/library/zlib.rst Sun Feb 1 01:24:21 2009 @@ -48,16 +48,16 @@ To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] - regardless of platform. In older versions the value would be + The return value is in the range [-2**31, 2**31-1] + regardless of platform. In older versions the value is signed on some platforms and unsigned on others. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. @@ -98,16 +98,16 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] + The return value is in the range [-2**31, 2**31-1] regardless of platform. In older versions the value would be signed on some platforms and unsigned on others. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From python-checkins at python.org Sun Feb 1 01:25:16 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:25:16 +0100 (CET) Subject: [Python-checkins] r69162 - python/branches/release26-maint/Doc/library/zlib.rst Message-ID: <20090201002516.EFA771E400C@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:25:16 2009 New Revision: 69162 Log: merge 69161 wording update. Modified: python/branches/release26-maint/Doc/library/zlib.rst Modified: python/branches/release26-maint/Doc/library/zlib.rst ============================================================================== --- python/branches/release26-maint/Doc/library/zlib.rst (original) +++ python/branches/release26-maint/Doc/library/zlib.rst Sun Feb 1 01:25:16 2009 @@ -48,16 +48,16 @@ To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] - regardless of platform. In older versions the value would be + The return value is in the range [-2**31, 2**31-1] + regardless of platform. In older versions the value is signed on some platforms and unsigned on others. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. @@ -98,16 +98,16 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 2.6 - The return value will always be in the range [-2**31, 2**31-1] + The return value is in the range [-2**31, 2**31-1] regardless of platform. In older versions the value would be signed on some platforms and unsigned on others. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From buildbot at python.org Sun Feb 1 01:27:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 00:27:43 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: <20090201002743.943321E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.0/builds/84 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_codecs test_io test_traceback ====================================================================== ERROR: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_codecs.py", line 1344, in test_basics encodedresult += encoder.encode(c) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_decoder_state (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_codecs.py", line 1429, in test_decoder_state self.check_state_handling_decode(encoding, u, u.encode(encoding)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_codecs.py", line 30, in check_state_handling_decode part1 = d.decode(s[:i]) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: testBasicIO (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 939, in testBasicIO self.assertEquals(f.write("abc"), 3) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1496, in write b = encoder.encode(s) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: testEncodingErrorsReading (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 774, in testEncodingErrorsReading self.assertRaises(UnicodeError, t.read) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1730, in read decoder.decode(self.buffer.read(), final=True)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: testEncodingErrorsWriting (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 792, in testEncodingErrorsWriting self.assertRaises(UnicodeError, t.write, "\xff") File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1496, in write b = encoder.encode(s) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: testNewlinesInput (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 900, in testNewlinesInput self.assertEquals(txt.readlines(), expected) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 538, in readlines return list(self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1746, in __next__ line = self.readline() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1819, in readline while self._read_chunk(): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: testNewlinesOutput (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 925, in testNewlinesOutput txt.write(data) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1496, in write b = encoder.encode(s) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_issue1395_1 (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 1161, in test_issue1395_1 c = txt.read(1) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1739, in read eof = not self._read_chunk() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_2 (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 1173, in test_issue1395_2 c = txt.read(4) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1739, in read eof = not self._read_chunk() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_3 (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 1183, in test_issue1395_3 reads = txt.read(4) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1739, in read eof = not self._read_chunk() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_4 (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 1194, in test_issue1395_4 reads = txt.read(4) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1739, in read eof = not self._read_chunk() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_5 (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_io.py", line 1202, in test_issue1395_5 reads = txt.read(4) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1739, in read eof = not self._read_chunk() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1567, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1301, in decode output = self.decoder.decode(input, final=final) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_encoded_file (test.test_traceback.SyntaxTracebackCases) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_traceback.py", line 145, in test_encoded_file do_test("", "foo", "ascii", 3) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_traceback.py", line 117, in do_test """.format(firstlines, message)) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 1496, in write b = encoder.encode(s) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\encodings\ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 01:29:45 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:29:45 +0100 (CET) Subject: [Python-checkins] r69163 - in python/branches/release30-maint/Doc/library: binascii.rst zlib.rst Message-ID: <20090201002945.470361E4002@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:29:45 2009 New Revision: 69163 Log: wording update for issue4903 Modified: python/branches/release30-maint/Doc/library/binascii.rst python/branches/release30-maint/Doc/library/zlib.rst Modified: python/branches/release30-maint/Doc/library/binascii.rst ============================================================================== --- python/branches/release30-maint/Doc/library/binascii.rst (original) +++ python/branches/release30-maint/Doc/library/binascii.rst Sun Feb 1 01:29:45 2009 @@ -120,11 +120,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. Modified: python/branches/release30-maint/Doc/library/zlib.rst ============================================================================== --- python/branches/release30-maint/Doc/library/zlib.rst (original) +++ python/branches/release30-maint/Doc/library/zlib.rst Sun Feb 1 01:29:45 2009 @@ -48,11 +48,11 @@ To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. @@ -93,11 +93,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From buildbot at python.org Sun Feb 1 01:29:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 00:29:56 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20090201002956.8A3C21E4002@bag.python.org> The Buildbot has detected a new failure of x86 osx.5 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.0/builds/95 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_calendar test_email test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 01:30:50 2009 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 1 Feb 2009 01:30:50 +0100 (CET) Subject: [Python-checkins] r69164 - in python/branches/py3k/Doc/library: binascii.rst zlib.rst Message-ID: <20090201003050.4D3CA1E4002@bag.python.org> Author: gregory.p.smith Date: Sun Feb 1 01:30:50 2009 New Revision: 69164 Log: documentation wording fix for issue4903 Modified: python/branches/py3k/Doc/library/binascii.rst python/branches/py3k/Doc/library/zlib.rst Modified: python/branches/py3k/Doc/library/binascii.rst ============================================================================== --- python/branches/py3k/Doc/library/binascii.rst (original) +++ python/branches/py3k/Doc/library/binascii.rst Sun Feb 1 01:30:50 2009 @@ -120,11 +120,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. Modified: python/branches/py3k/Doc/library/zlib.rst ============================================================================== --- python/branches/py3k/Doc/library/zlib.rst (original) +++ python/branches/py3k/Doc/library/zlib.rst Sun Feb 1 01:30:50 2009 @@ -48,11 +48,11 @@ To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. @@ -93,11 +93,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. From python-checkins at python.org Sun Feb 1 01:37:13 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 01:37:13 +0100 (CET) Subject: [Python-checkins] r69165 - in python/branches/py3k/Lib/importlib: NOTES test/builtin/test_loader.py Message-ID: <20090201003713.8FB701E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 01:37:13 2009 New Revision: 69165 Log: Move built-in loader tests to importlib.test.abc.LoaderTests. Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/builtin/test_loader.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 01:37:13 2009 @@ -1,9 +1,8 @@ to do ///// -* Use test.loader_tests +* Use test.abc.LoaderTests - + builtin + frozen + extension + source Modified: python/branches/py3k/Lib/importlib/test/builtin/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/builtin/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/builtin/test_loader.py Sun Feb 1 01:37:13 2009 @@ -1,5 +1,6 @@ import importlib from importlib import machinery +from .. import abc from .. import support import sys @@ -7,7 +8,7 @@ import unittest -class LoaderTests(unittest.TestCase): +class LoaderTests(abc.LoaderTests): """Test load_module() for built-in modules.""" @@ -26,13 +27,32 @@ load_module = staticmethod(lambda name: machinery.BuiltinImporter.load_module(name)) - def test_load_module(self): + def test_module(self): # Common case. with support.uncache(self.name): module = self.load_module(self.name) self.verify(module) - def test_nonexistent(self): + def test_package(self): + # Built-in modules cannot be a package. + pass + + def test_lacking_parent(self): + # Built-in modules cannot be a package. + pass + + def test_state_after_failure(self): + # Not way to force an imoprt failure. + pass + + def test_module_reuse(self): + # Test that the same module is used in a reload. + with support.uncache(self.name): + module1 = self.load_module(self.name) + module2 = self.load_module(self.name) + self.assert_(module1 is module2) + + def test_unloadable(self): name = 'dssdsdfff' assert name not in sys.builtin_module_names self.assertRaises(ImportError, self.load_module, name) From python-checkins at python.org Sun Feb 1 01:49:41 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 01:49:41 +0100 (CET) Subject: [Python-checkins] r69166 - in python/branches/py3k/Lib/importlib: NOTES test/extension/test_loader.py Message-ID: <20090201004941.9BF541E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 01:49:41 2009 New Revision: 69166 Log: Move extension module loader tests over to importlib.test.abc.LoaderTests. Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/extension/test_loader.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 01:49:41 2009 @@ -4,7 +4,6 @@ * Use test.abc.LoaderTests + frozen - + extension + source * Reorganize support code. Modified: python/branches/py3k/Lib/importlib/test/extension/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/extension/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/extension/test_loader.py Sun Feb 1 01:49:41 2009 @@ -1,12 +1,13 @@ import importlib from . import test_path_hook +from .. import abc from .. import support import sys import unittest -class LoaderTests(unittest.TestCase): +class LoaderTests(abc.LoaderTests): """Test load_module() for extension modules.""" @@ -16,7 +17,7 @@ False) return loader.load_module(fullname) - def test_success(self): + def test_module(self): with support.uncache(test_path_hook.NAME): module = self.load_module(test_path_hook.NAME) for attr, value in [('__name__', test_path_hook.NAME), @@ -24,7 +25,25 @@ self.assertEqual(getattr(module, attr), value) self.assert_(test_path_hook.NAME in sys.modules) - def test_failure(self): + def test_package(self): + # Extensions are not found in packages. + pass + + def test_lacking_parent(self): + # Extensions are not found in packages. + pass + + def test_module_reuse(self): + with support.uncache(test_path_hook.NAME): + module1 = self.load_module(test_path_hook.NAME) + module2 = self.load_module(test_path_hook.NAME) + self.assert_(module1 is module2) + + def test_state_after_failure(self): + # No easy way to trigger a failure after a successful import. + pass + + def test_unloadable(self): self.assertRaises(ImportError, self.load_module, 'asdfjkl;') From buildbot at python.org Sun Feb 1 02:27:22 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 01:27:22 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20090201012723.055571E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/90 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,david.goodger,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 02:34:14 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 02:34:14 +0100 (CET) Subject: [Python-checkins] r69167 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py test/frozen/test_loader.py Message-ID: <20090201013414.2FEB41E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 02:34:13 2009 New Revision: 69167 Log: Fix importlib.machinery.FrozenImporter.load_module() to set __package__ properly. Discovered by also moving the loader tests over to importlib.test.abc.LoaderTests. Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/_bootstrap.py python/branches/py3k/Lib/importlib/test/frozen/test_loader.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 02:34:13 2009 @@ -3,7 +3,6 @@ * Use test.abc.LoaderTests - + frozen + source * Reorganize support code. Modified: python/branches/py3k/Lib/importlib/_bootstrap.py ============================================================================== --- python/branches/py3k/Lib/importlib/_bootstrap.py (original) +++ python/branches/py3k/Lib/importlib/_bootstrap.py Sun Feb 1 02:34:13 2009 @@ -137,7 +137,12 @@ """Load a frozen module.""" if cls.find_module(fullname) is None: raise ImportError("{0} is not a frozen module".format(fullname)) - return imp.init_frozen(fullname) + module = imp.init_frozen(fullname) + if hasattr(module, '__path__'): + module.__package__ = module.__name__ + elif '.' in module.__name__: + module.__package__ = module.__name__.rsplit('.', 1)[0] + return module class ChainedImporter(object): Modified: python/branches/py3k/Lib/importlib/test/frozen/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/frozen/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/frozen/test_loader.py Sun Feb 1 02:34:13 2009 @@ -1,26 +1,59 @@ from importlib import machinery -from ..builtin import test_loader +from .. import abc +from .. import support -class LoaderTests(test_loader.LoaderTests): +class LoaderTests(abc.LoaderTests): - name = '__phello__' - load_module = staticmethod(lambda name: - machinery.FrozenImporter.load_module(name)) - verification = {'__name__': '__phello__', '__file__': '', - '__package__': None, '__path__': ['__phello__']} - - -class SubmoduleLoaderTests(LoaderTests): - - name = '__phello__.spam' - verification = {'__name__': '__phello__.spam', '__file__': '', - '__package__': None} + def test_module(self): + with support.uncache('__hello__'): + module = machinery.FrozenImporter.load_module('__hello__') + check = {'__name__': '__hello__', '__file__': '', + '__package__': None} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def test_package(self): + with support.uncache('__phello__'): + module = machinery.FrozenImporter.load_module('__phello__') + check = {'__name__': '__phello__', '__file__': '', + '__package__': '__phello__', '__path__': ['__phello__']} + for attr, value in check.items(): + attr_value = getattr(module, attr) + self.assertEqual(attr_value, value, + "for __phello__.%s, %r != %r" % + (attr, attr_value, value)) + + def test_lacking_parent(self): + with support.uncache('__phello__', '__phello__.spam'): + module = machinery.FrozenImporter.load_module('__phello__.spam') + check = {'__name__': '__phello__.spam', '__file__': '', + '__package__': '__phello__'} + for attr, value in check.items(): + attr_value = getattr(module, attr) + self.assertEqual(attr_value, value, + "for __phello__.spam.%s, %r != %r" % + (attr, attr_value, value)) + + def test_module_reuse(self): + with support.uncache('__hello__'): + module1 = machinery.FrozenImporter.load_module('__hello__') + module2 = machinery.FrozenImporter.load_module('__hello__') + self.assert_(module1 is module2) + + def test_state_after_failure(self): + # No way to trigger an error in a frozen module. + pass + + def test_unloadable(self): + assert machinery.FrozenImporter.find_module('_not_real') is None + self.assertRaises(ImportError, machinery.FrozenImporter.load_module, + '_not_real') def test_main(): from test.support import run_unittest - run_unittest(LoaderTests, SubmoduleLoaderTests) + run_unittest(LoaderTests) if __name__ == '__main__': From python-checkins at python.org Sun Feb 1 03:05:11 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 03:05:11 +0100 (CET) Subject: [Python-checkins] r69168 - in python/branches/py3k/Lib/importlib: NOTES test/source/test_loader.py test/source/test_reload.py Message-ID: <20090201020511.9C9541E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 03:05:11 2009 New Revision: 69168 Log: Move source loader tests (including reload tests) over to importlib.test.abc.LoaderTests. Removed: python/branches/py3k/Lib/importlib/test/source/test_reload.py Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/source/test_loader.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 03:05:11 2009 @@ -1,10 +1,6 @@ to do ///// -* Use test.abc.LoaderTests - - + source - * Reorganize support code. + Separate general support code and importer-specific (e.g. source) support Modified: python/branches/py3k/Lib/importlib/test/source/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_loader.py Sun Feb 1 03:05:11 2009 @@ -1,4 +1,5 @@ import importlib +from .. import abc from .. import support import imp @@ -16,11 +17,80 @@ """ # [basic] - def test_basic(self): + def test_module(self): with support.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) - loader.load_module('_temp') + module = loader.load_module('_temp') self.assert_('_temp' in sys.modules) + check = {'__name__': '_temp', '__file__': mapping['_temp'], + '__package__': None} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def test_package(self): + with support.create_modules('_pkg.__init__') as mapping: + loader = importlib._PyFileLoader('_pkg', mapping['_pkg.__init__'], + True) + module = loader.load_module('_pkg') + self.assert_('_pkg' in sys.modules) + check = {'__name__': '_pkg', '__file__': mapping['_pkg.__init__'], + '__path__': [os.path.dirname(mapping['_pkg.__init__'])], + '__package__': '_pkg'} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + + def test_lacking_parent(self): + with support.create_modules('_pkg.__init__', '_pkg.mod')as mapping: + loader = importlib._PyFileLoader('_pkg.mod', mapping['_pkg.mod'], + False) + module = loader.load_module('_pkg.mod') + self.assert_('_pkg.mod' in sys.modules) + check = {'__name__': '_pkg.mod', '__file__': mapping['_pkg.mod'], + '__package__': '_pkg'} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def fake_mtime(self, fxn): + """Fake mtime to always be higher than expected.""" + return lambda name: fxn(name) + 1 + + def test_module_reuse(self): + with support.create_modules('_temp') as mapping: + loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) + module = loader.load_module('_temp') + module_id = id(module) + module_dict_id = id(module.__dict__) + with open(mapping['_temp'], 'w') as file: + file.write("testing_var = 42\n") + # For filesystems where the mtime is only to a second granularity, + # everything that has happened above can be too fast; + # force an mtime on the source that is guaranteed to be different + # than the original mtime. + loader.source_mtime = self.fake_mtime(loader.source_mtime) + module = loader.load_module('_temp') + self.assert_('testing_var' in module.__dict__, + "'testing_var' not in " + "{0}".format(list(module.__dict__.keys()))) + self.assertEqual(module, sys.modules['_temp']) + self.assertEqual(id(module), module_id) + self.assertEqual(id(module.__dict__), module_dict_id) + + def test_state_after_failure(self): + # A failed reload should leave the original module intact. + attributes = ('__file__', '__path__', '__package__') + value = '' + name = '_temp' + with support.create_modules(name) as mapping: + orig_module = imp.new_module(name) + for attr in attributes: + setattr(orig_module, attr, value) + with open(mapping[name], 'w') as file: + file.write('+++ bad syntax +++') + loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) + self.assertRaises(SyntaxError, loader.load_module, name) + for attr in attributes: + self.assertEqual(getattr(orig_module, attr), value) # [syntax error] def test_bad_syntax(self): Deleted: python/branches/py3k/Lib/importlib/test/source/test_reload.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_reload.py Sun Feb 1 03:05:11 2009 +++ (empty file) @@ -1,71 +0,0 @@ -"""Test reload support. - -Reload support requires two things. One is that if module is loaded that -already exists in sys.modules then it is reused. And two, if a reload fails the -pre-existing module is left in a sane state. - -""" -import imp -import sys -import types -import unittest -import importlib -from .. import support - - -class ReloadTests(unittest.TestCase): - - name = '_temp' - - def load_module(self, mapping): - return importlib._PyFileLoader(self.name, mapping[self.name], False) - - def fake_mtime(self, fxn): - """Fake mtime to always be higher than expected.""" - return lambda name: fxn(name) + 1 - - def test_module_reuse(self): - with support.create_modules(self.name) as mapping: - loader = self.load_module(mapping) - module = loader.load_module(self.name) - module_id = id(module) - module_dict_id = id(module.__dict__) - with open(mapping[self.name], 'w') as file: - file.write("testing_var = 42\n") - # For filesystems where the mtime is only to a second granularity, - # everything that has happened above can be too fast; - # force an mtime on the source that is guaranteed to be different - # than the original mtime. - loader.source_mtime = self.fake_mtime(loader.source_mtime) - module = loader.load_module(self.name) - self.assert_('testing_var' in module.__dict__, - "'testing_var' not in " - "{0}".format(list(module.__dict__.keys()))) - self.assertEqual(module, sys.modules[self.name]) - self.assertEqual(id(module), module_id) - self.assertEqual(id(module.__dict__), module_dict_id) - - def test_bad_reload(self): - # A failed reload should leave the original module intact. - attributes = ('__file__', '__path__', '__package__') - value = '' - with support.create_modules(self.name) as mapping: - orig_module = imp.new_module(self.name) - for attr in attributes: - setattr(orig_module, attr, value) - with open(mapping[self.name], 'w') as file: - file.write('+++ bad syntax +++') - loader = self.load_module(mapping) - self.assertRaises(SyntaxError, loader.load_module, self.name) - for attr in attributes: - self.assertEqual(getattr(orig_module, attr), value) - - - -def test_main(): - from test.support import run_unittest - run_unittest(ReloadTests) - - -if __name__ == '__main__': - test_main() From python-checkins at python.org Sun Feb 1 03:56:16 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 1 Feb 2009 03:56:16 +0100 (CET) Subject: [Python-checkins] r69169 - python/trunk/Lib/test/test_tcl.py Message-ID: <20090201025616.AEAC51E4002@bag.python.org> Author: guilherme.polo Date: Sun Feb 1 03:56:16 2009 New Revision: 69169 Log: Restore Tkinter.Tk._loadtk so this test doesn't fail for problems related to ttk. Modified: python/trunk/Lib/test/test_tcl.py Modified: python/trunk/Lib/test/test_tcl.py ============================================================================== --- python/trunk/Lib/test/test_tcl.py (original) +++ python/trunk/Lib/test/test_tcl.py Sun Feb 1 03:56:16 2009 @@ -4,9 +4,15 @@ import os import _tkinter from test import test_support -from Tkinter import Tcl +from Tkinter import Tk, Tcl from _tkinter import TclError +# Restore Tkinter.Tk._loadtk that may have been overridden by ttk. +# If this is not done then this test may fail for reasons related +# to ttk only (like failing to load the tile package). +from ttk import __loadtk__ +Tk._loadtk = __loadtk__ + class TkinterTest(unittest.TestCase): From buildbot at python.org Sun Feb 1 04:08:25 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 03:08:25 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20090201030825.3475C1E4002@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%20gentoo%20trunk/builds/4568 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith,guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Killed sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 04:08:31 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 04:08:31 +0100 (CET) Subject: [Python-checkins] r69170 - in python/branches/py3k/Lib/importlib: NOTES test/source/test_case_sensitivity.py test/source/test_finder.py test/source/test_loader.py test/source/test_path_hook.py test/source/test_source_encoding.py test/source/util.py test/support.py Message-ID: <20090201030831.B8C701E400C@bag.python.org> Author: brett.cannon Date: Sun Feb 1 04:08:31 2009 New Revision: 69170 Log: Split out support code that is specific to source tests out of importlib.test.support to importlib.test.source.util. Added: python/branches/py3k/Lib/importlib/test/source/util.py Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py python/branches/py3k/Lib/importlib/test/source/test_finder.py python/branches/py3k/Lib/importlib/test/source/test_loader.py python/branches/py3k/Lib/importlib/test/source/test_path_hook.py python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py python/branches/py3k/Lib/importlib/test/support.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 04:08:31 2009 @@ -3,9 +3,6 @@ * Reorganize support code. - + Separate general support code and importer-specific (e.g. source) support - code. - - Create support modules for each subdirectory (as needed). + Add a file loader mock that returns monotonically increasing mtime. - Use in source/test_reload. - Use in source/test_load_module_mixed. Modified: python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py Sun Feb 1 04:08:31 2009 @@ -1,6 +1,7 @@ """Test case-sensitivity (PEP 235).""" import importlib from .. import support +from . import util as source_util import os import sys from test import support as test_support @@ -25,7 +26,8 @@ """Look for a module with matching and non-matching sensitivity.""" sensitive_pkg = 'sensitive.{0}'.format(self.name) insensitive_pkg = 'insensitive.{0}'.format(self.name.lower()) - with support.create_modules(insensitive_pkg, sensitive_pkg) as mapping: + context = source_util.create_modules(insensitive_pkg, sensitive_pkg) + with context as mapping: sensitive_path = os.path.join(mapping['.root'], 'sensitive') insensitive_path = os.path.join(mapping['.root'], 'insensitive') return self.find(sensitive_path), self.find(insensitive_path) Modified: python/branches/py3k/Lib/importlib/test/source/test_finder.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_finder.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_finder.py Sun Feb 1 04:08:31 2009 @@ -1,6 +1,7 @@ import importlib from .. import abc from .. import support +from . import util as source_util import os import py_compile import unittest @@ -45,7 +46,7 @@ """ if create is None: create = {test} - with support.create_modules(*create) as mapping: + with source_util.create_modules(*create) as mapping: if compile_: for name in compile_: py_compile.compile(mapping[name]) @@ -76,14 +77,14 @@ # [sub module] def test_module_in_package(self): - with support.create_modules('pkg.__init__', 'pkg.sub') as mapping: + with source_util.create_modules('pkg.__init__', 'pkg.sub') as mapping: pkg_dir = os.path.dirname(mapping['pkg.__init__']) loader = self.import_(pkg_dir, 'pkg.sub') self.assert_(hasattr(loader, 'load_module')) # [sub package] def test_package_in_package(self): - context = support.create_modules('pkg.__init__', 'pkg.sub.__init__') + context = source_util.create_modules('pkg.__init__', 'pkg.sub.__init__') with context as mapping: pkg_dir = os.path.dirname(mapping['pkg.__init__']) loader = self.import_(pkg_dir, 'pkg.sub') @@ -91,7 +92,7 @@ # [sub empty] def test_empty_sub_directory(self): - context = support.create_modules('pkg.__init__', 'pkg.sub.__init__') + context = source_util.create_modules('pkg.__init__', 'pkg.sub.__init__') with warnings.catch_warnings(): warnings.simplefilter("error", ImportWarning) with context as mapping: @@ -109,7 +110,7 @@ def test_failure(self): - with support.create_modules('blah') as mapping: + with source_util.create_modules('blah') as mapping: nothing = self.import_(mapping['.root'], 'sdfsadsadf') self.assert_(nothing is None) Modified: python/branches/py3k/Lib/importlib/test/source/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_loader.py Sun Feb 1 04:08:31 2009 @@ -1,6 +1,7 @@ import importlib from .. import abc from .. import support +from . import util as source_util import imp import os @@ -18,7 +19,7 @@ # [basic] def test_module(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) module = loader.load_module('_temp') self.assert_('_temp' in sys.modules) @@ -28,7 +29,7 @@ self.assertEqual(getattr(module, attr), value) def test_package(self): - with support.create_modules('_pkg.__init__') as mapping: + with source_util.create_modules('_pkg.__init__') as mapping: loader = importlib._PyFileLoader('_pkg', mapping['_pkg.__init__'], True) module = loader.load_module('_pkg') @@ -41,7 +42,7 @@ def test_lacking_parent(self): - with support.create_modules('_pkg.__init__', '_pkg.mod')as mapping: + with source_util.create_modules('_pkg.__init__', '_pkg.mod')as mapping: loader = importlib._PyFileLoader('_pkg.mod', mapping['_pkg.mod'], False) module = loader.load_module('_pkg.mod') @@ -56,7 +57,7 @@ return lambda name: fxn(name) + 1 def test_module_reuse(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) module = loader.load_module('_temp') module_id = id(module) @@ -81,7 +82,7 @@ attributes = ('__file__', '__path__', '__package__') value = '' name = '_temp' - with support.create_modules(name) as mapping: + with source_util.create_modules(name) as mapping: orig_module = imp.new_module(name) for attr in attributes: setattr(orig_module, attr, value) @@ -94,7 +95,7 @@ # [syntax error] def test_bad_syntax(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: with open(mapping['_temp'], 'w') as file: file.write('=') loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) @@ -109,12 +110,12 @@ def tearDown(self): sys.dont_write_bytecode = False - @support.writes_bytecode + @source_util.writes_bytecode def run_test(self, assertion): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) loader.load_module('_temp') - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) assertion(bytecode_path) def test_bytecode_written(self): @@ -137,10 +138,10 @@ # [bad magic] def test_bad_magic(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) os.unlink(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as file: file.seek(0) file.write(b'\x00\x00\x00\x00') @@ -164,7 +165,7 @@ def run_test(self, test, *create, pkg=False): create += (test,) - with support.create_modules(*create) as mapping: + with source_util.create_modules(*create) as mapping: for name in create: py_compile.compile(mapping[name]) if pkg: @@ -217,11 +218,11 @@ self.assert_(module_name in sys.modules) # [bad magic] - @support.writes_bytecode + @source_util.writes_bytecode def test_bad_magic(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as bytecode_file: bytecode_file.seek(0) bytecode_file.write(b'\x00\x00\x00\x00') @@ -230,12 +231,12 @@ self.assertEqual(bytecode_file.read(4), imp.get_magic()) # [bad timestamp] - @support.writes_bytecode + @source_util.writes_bytecode def test_bad_bytecode(self): zeros = b'\x00\x00\x00\x00' - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as bytecode_file: bytecode_file.seek(4) bytecode_file.write(zeros) @@ -248,8 +249,8 @@ # [bad marshal] def test_bad_marshal(self): - with support.create_modules('_temp') as mapping: - bytecode_path = support.bytecode_path(mapping['_temp']) + with source_util.create_modules('_temp') as mapping: + bytecode_path = source_util.bytecode_path(mapping['_temp']) source_mtime = os.path.getmtime(mapping['_temp']) source_timestamp = importlib._w_long(source_mtime) with open(bytecode_path, 'wb') as bytecode_file: Modified: python/branches/py3k/Lib/importlib/test/source/test_path_hook.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_path_hook.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_path_hook.py Sun Feb 1 04:08:31 2009 @@ -1,5 +1,5 @@ import importlib -from .. import support +from . import util import unittest @@ -9,7 +9,7 @@ def test_success(self): # XXX Only work on existing directories? - with support.create_modules('dummy') as mapping: + with util.create_modules('dummy') as mapping: self.assert_(hasattr(importlib.FileImporter(mapping['.root']), 'find_module')) Modified: python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py Sun Feb 1 04:08:31 2009 @@ -1,5 +1,6 @@ import importlib from .. import support +from . import util as source_util import codecs import re @@ -32,7 +33,7 @@ module_name = '_temp' def run_test(self, source): - with support.create_modules(self.module_name) as mapping: + with source_util.create_modules(self.module_name) as mapping: with open(mapping[self.module_name], 'wb')as file: file.write(source) loader = importlib._PyFileLoader(self.module_name, @@ -93,7 +94,7 @@ module_name = '_temp' source_lines = [b"a = 42", b"b = -13", b''] source = line_ending.join(source_lines) - with support.create_modules(module_name) as mapping: + with source_util.create_modules(module_name) as mapping: with open(mapping[module_name], 'wb') as file: file.write(source) loader = importlib._PyFileLoader(module_name, mapping[module_name], Added: python/branches/py3k/Lib/importlib/test/source/util.py ============================================================================== --- (empty file) +++ python/branches/py3k/Lib/importlib/test/source/util.py Sun Feb 1 04:08:31 2009 @@ -0,0 +1,88 @@ +from .. import support as util +import contextlib +import imp +import os +import os.path +import sys +import tempfile +from test import support as support + + +def writes_bytecode(fxn): + """Decorator that returns the function if writing bytecode is enabled, else + a stub function that accepts anything and simply returns None.""" + if sys.dont_write_bytecode: + return lambda *args, **kwargs: None + else: + return fxn + + +def bytecode_path(source_path): + for suffix, _, type_ in imp.get_suffixes(): + if type_ == imp.PY_COMPILED: + bc_suffix = suffix + break + else: + raise ValueError("no bytecode suffix is defined") + return os.path.splitext(source_path)[0] + bc_suffix + + + at contextlib.contextmanager +def create_modules(*names): + """Temporarily create each named module with an attribute (named 'attr') + that contains the name passed into the context manager that caused the + creation of the module. + + All files are created in a temporary directory specified by + tempfile.gettempdir(). This directory is inserted at the beginning of + sys.path. When the context manager exits all created files (source and + bytecode) are explicitly deleted. + + No magic is performed when creating packages! This means that if you create + a module within a package you must also create the package's __init__ as + well. + + """ + source = 'attr = {0!r}' + created_paths = [] + mapping = {} + try: + temp_dir = tempfile.gettempdir() + mapping['.root'] = temp_dir + import_names = set() + for name in names: + if not name.endswith('__init__'): + import_name = name + else: + import_name = name[:-len('.__init__')] + import_names.add(import_name) + if import_name in sys.modules: + del sys.modules[import_name] + name_parts = name.split('.') + file_path = temp_dir + for directory in name_parts[:-1]: + file_path = os.path.join(file_path, directory) + if not os.path.exists(file_path): + os.mkdir(file_path) + created_paths.append(file_path) + file_path = os.path.join(file_path, name_parts[-1] + '.py') + with open(file_path, 'w') as file: + file.write(source.format(name)) + created_paths.append(file_path) + mapping[name] = file_path + uncache_manager = util.uncache(*import_names) + uncache_manager.__enter__() + state_manager = util.import_state(path=[temp_dir]) + state_manager.__enter__() + yield mapping + finally: + state_manager.__exit__(None, None, None) + uncache_manager.__exit__(None, None, None) + # Reverse the order for path removal to unroll directory creation. + for path in reversed(created_paths): + if file_path.endswith('.py'): + support.unlink(path) + support.unlink(path + 'c') + support.unlink(path + 'o') + else: + os.rmdir(path) Modified: python/branches/py3k/Lib/importlib/test/support.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/support.py (original) +++ python/branches/py3k/Lib/importlib/test/support.py Sun Feb 1 04:08:31 2009 @@ -6,7 +6,6 @@ import os.path from test.support import unlink import sys -from tempfile import gettempdir using___import__ = False @@ -28,14 +27,6 @@ update_wrapper(inner, fxn) return inner -def writes_bytecode(fxn): - """Decorator that returns the function if writing bytecode is enabled, else - a stub function that accepts anything and simply returns None.""" - if sys.dont_write_bytecode: - return lambda *args, **kwargs: None - else: - return fxn - def case_insensitive_tests(class_): """Class decorator that nullifies tests that require a case-insensitive @@ -102,67 +93,6 @@ setattr(sys, attr, value) - at contextmanager -def create_modules(*names): - """Temporarily create each named module with an attribute (named 'attr') - that contains the name passed into the context manager that caused the - creation of the module. - - All files are created in a temporary directory specified by - tempfile.gettempdir(). This directory is inserted at the beginning of - sys.path. When the context manager exits all created files (source and - bytecode) are explicitly deleted. - - No magic is performed when creating packages! This means that if you create - a module within a package you must also create the package's __init__ as - well. - - """ - source = 'attr = {0!r}' - created_paths = [] - mapping = {} - try: - temp_dir = gettempdir() - mapping['.root'] = temp_dir - import_names = set() - for name in names: - if not name.endswith('__init__'): - import_name = name - else: - import_name = name[:-len('.__init__')] - import_names.add(import_name) - if import_name in sys.modules: - del sys.modules[import_name] - name_parts = name.split('.') - file_path = temp_dir - for directory in name_parts[:-1]: - file_path = os.path.join(file_path, directory) - if not os.path.exists(file_path): - os.mkdir(file_path) - created_paths.append(file_path) - file_path = os.path.join(file_path, name_parts[-1] + '.py') - with open(file_path, 'w') as file: - file.write(source.format(name)) - created_paths.append(file_path) - mapping[name] = file_path - uncache_manager = uncache(*import_names) - uncache_manager.__enter__() - state_manager = import_state(path=[temp_dir]) - state_manager.__enter__() - yield mapping - finally: - state_manager.__exit__(None, None, None) - uncache_manager.__exit__(None, None, None) - # Reverse the order for path removal to unroll directory creation. - for path in reversed(created_paths): - if file_path.endswith('.py'): - unlink(path) - unlink(path + 'c') - unlink(path + 'o') - else: - os.rmdir(path) - - class mock_modules: """A mock importer/loader.""" @@ -221,13 +151,3 @@ raise ImportError return importer return hook - - -def bytecode_path(source_path): - for suffix, _, type_ in imp.get_suffixes(): - if type_ == imp.PY_COMPILED: - bc_suffix = suffix - break - else: - raise ValueError("no bytecode suffix is defined") - return os.path.splitext(source_path)[0] + bc_suffix From buildbot at python.org Sun Feb 1 04:33:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 03:33:20 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090201033320.5E6AE1E4002@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%20gentoo%20trunk/builds/1786 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith,guilherme.polo BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 04:47:26 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 03:47:26 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090201034726.7D2E51E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/210 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_posix ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 04:51:54 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 04:51:54 +0100 (CET) Subject: [Python-checkins] r69171 - python/branches/py3k/Lib/importlib/test/__init__.py Message-ID: <20090201035154.BD3E51E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 04:51:54 2009 New Revision: 69171 Log: Do not execute the .pyc/.pyo files as well as the .py files. Modified: python/branches/py3k/Lib/importlib/test/__init__.py Modified: python/branches/py3k/Lib/importlib/test/__init__.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/__init__.py (original) +++ python/branches/py3k/Lib/importlib/test/__init__.py Sun Feb 1 04:51:54 2009 @@ -9,7 +9,8 @@ if name.startswith('.'): continue path = os.path.join(directory, name) - if os.path.isfile(path) and name.startswith('test_'): + if (os.path.isfile(path) and name.startswith('test_') and + name.endswith('.py')): submodule_name = os.path.splitext(name)[0] module_name = "{0}.{1}".format(package, submodule_name) __import__(module_name, level=0) @@ -20,6 +21,8 @@ __import__(package_name, level=0) package_tests = getattr(sys.modules[package_name], 'test_suite')() suite.addTest(package_tests) + else: + continue return suite From python-checkins at python.org Sun Feb 1 05:00:06 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 05:00:06 +0100 (CET) Subject: [Python-checkins] r69172 - in python/branches/py3k/Lib/importlib: NOTES test/builtin/test_finder.py test/builtin/test_loader.py test/extension/test_case_sensitivity.py test/extension/test_loader.py test/frozen/support.py test/frozen/test_loader.py test/import_/test___package__.py test/import_/test_caching.py test/import_/test_fromlist.py test/import_/test_meta_path.py test/import_/test_packages.py test/import_/test_path.py test/import_/test_relative_imports.py test/source/test_case_sensitivity.py test/source/test_finder.py test/source/test_loader.py test/source/test_path_hook.py test/source/test_source_encoding.py test/source/util.py test/support.py test/test_api.py test/util.py Message-ID: <20090201040006.54FF41E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 05:00:05 2009 New Revision: 69172 Log: Rename importlib.test.support to importlib.test.util. Added: python/branches/py3k/Lib/importlib/test/util.py - copied unchanged from r69170, /python/branches/py3k/Lib/importlib/test/support.py Removed: python/branches/py3k/Lib/importlib/test/frozen/support.py python/branches/py3k/Lib/importlib/test/support.py Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/builtin/test_finder.py python/branches/py3k/Lib/importlib/test/builtin/test_loader.py python/branches/py3k/Lib/importlib/test/extension/test_case_sensitivity.py python/branches/py3k/Lib/importlib/test/extension/test_loader.py python/branches/py3k/Lib/importlib/test/frozen/test_loader.py python/branches/py3k/Lib/importlib/test/import_/test___package__.py python/branches/py3k/Lib/importlib/test/import_/test_caching.py python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py python/branches/py3k/Lib/importlib/test/import_/test_packages.py python/branches/py3k/Lib/importlib/test/import_/test_path.py python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py python/branches/py3k/Lib/importlib/test/source/test_finder.py python/branches/py3k/Lib/importlib/test/source/test_loader.py python/branches/py3k/Lib/importlib/test/source/test_path_hook.py python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py python/branches/py3k/Lib/importlib/test/source/util.py python/branches/py3k/Lib/importlib/test/test_api.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 05:00:05 2009 @@ -3,6 +3,10 @@ * Reorganize support code. + + Separate out support code for extensions out of test_support_hook. + + Move util.import_ and utill.mock_modules to import_, importlib_only, + mock_path_hook? + + Add a file loader mock that returns monotonically increasing mtime. - Use in source/test_reload. - Use in source/test_load_module_mixed. Modified: python/branches/py3k/Lib/importlib/test/builtin/test_finder.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/builtin/test_finder.py (original) +++ python/branches/py3k/Lib/importlib/test/builtin/test_finder.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,6 @@ from importlib import machinery from .. import abc -from .. import support +from .. import util import sys import unittest @@ -14,7 +14,7 @@ def test_module(self): # Common case. - with support.uncache(self.name): + with util.uncache(self.name): self.assert_(machinery.BuiltinImporter.find_module(self.name)) def test_package(self): @@ -40,7 +40,7 @@ def test_ignore_path(self): # The value for 'path' should always trigger a failed import. - with support.uncache(self.name): + with util.uncache(self.name): loader = machinery.BuiltinImporter.find_module(self.name, ['pkg']) self.assert_(loader is None) Modified: python/branches/py3k/Lib/importlib/test/builtin/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/builtin/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/builtin/test_loader.py Sun Feb 1 05:00:05 2009 @@ -1,7 +1,7 @@ import importlib from importlib import machinery from .. import abc -from .. import support +from .. import util import sys import types @@ -29,7 +29,7 @@ def test_module(self): # Common case. - with support.uncache(self.name): + with util.uncache(self.name): module = self.load_module(self.name) self.verify(module) @@ -47,7 +47,7 @@ def test_module_reuse(self): # Test that the same module is used in a reload. - with support.uncache(self.name): + with util.uncache(self.name): module1 = self.load_module(self.name) module2 = self.load_module(self.name) self.assert_(module1 is module2) Modified: python/branches/py3k/Lib/importlib/test/extension/test_case_sensitivity.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/extension/test_case_sensitivity.py (original) +++ python/branches/py3k/Lib/importlib/test/extension/test_case_sensitivity.py Sun Feb 1 05:00:05 2009 @@ -1,12 +1,12 @@ import sys -from test import support as test_support +from test import support import unittest import importlib -from .. import support +from .. import util from . import test_path_hook - at support.case_insensitive_tests + at util.case_insensitive_tests class ExtensionModuleCaseSensitivityTest(unittest.TestCase): def find_module(self): @@ -17,13 +17,13 @@ return finder.find_module(bad_name) def test_case_sensitive(self): - with test_support.EnvironmentVarGuard() as env: + with support.EnvironmentVarGuard() as env: env.unset('PYTHONCASEOK') loader = self.find_module() self.assert_(loader is None) def test_case_insensitivity(self): - with test_support.EnvironmentVarGuard() as env: + with support.EnvironmentVarGuard() as env: env.set('PYTHONCASEOK', '1') loader = self.find_module() self.assert_(hasattr(loader, 'load_module')) @@ -32,7 +32,7 @@ def test_main(): - test_support.run_unittest(ExtensionModuleCaseSensitivityTest) + support.run_unittest(ExtensionModuleCaseSensitivityTest) if __name__ == '__main__': Modified: python/branches/py3k/Lib/importlib/test/extension/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/extension/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/extension/test_loader.py Sun Feb 1 05:00:05 2009 @@ -1,7 +1,7 @@ import importlib from . import test_path_hook from .. import abc -from .. import support +from .. import util import sys import unittest @@ -18,7 +18,7 @@ return loader.load_module(fullname) def test_module(self): - with support.uncache(test_path_hook.NAME): + with util.uncache(test_path_hook.NAME): module = self.load_module(test_path_hook.NAME) for attr, value in [('__name__', test_path_hook.NAME), ('__file__', test_path_hook.FILEPATH)]: @@ -34,7 +34,7 @@ pass def test_module_reuse(self): - with support.uncache(test_path_hook.NAME): + with util.uncache(test_path_hook.NAME): module1 = self.load_module(test_path_hook.NAME) module2 = self.load_module(test_path_hook.NAME) self.assert_(module1 is module2) Deleted: python/branches/py3k/Lib/importlib/test/frozen/support.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/frozen/support.py Sun Feb 1 05:00:05 2009 +++ (empty file) @@ -1,24 +0,0 @@ -import sys - - -class Null: - - """Just absorb what is given.""" - - def __getattr__(self): - return lambda *args, **kwargs: None - - -class SilenceStdout: - - """Silence sys.stdout.""" - - def setUp(self): - """Substitute sys.stdout with something that does not print to the - screen thanks to what bytecode is frozen.""" - sys.stdout = Null() - super().setUp() - - def tearDown(self): - sys.stdout = sys.__stdout__ - super().tearDown() Modified: python/branches/py3k/Lib/importlib/test/frozen/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/frozen/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/frozen/test_loader.py Sun Feb 1 05:00:05 2009 @@ -1,12 +1,12 @@ from importlib import machinery from .. import abc -from .. import support +from .. import util class LoaderTests(abc.LoaderTests): def test_module(self): - with support.uncache('__hello__'): + with util.uncache('__hello__'): module = machinery.FrozenImporter.load_module('__hello__') check = {'__name__': '__hello__', '__file__': '', '__package__': None} @@ -14,7 +14,7 @@ self.assertEqual(getattr(module, attr), value) def test_package(self): - with support.uncache('__phello__'): + with util.uncache('__phello__'): module = machinery.FrozenImporter.load_module('__phello__') check = {'__name__': '__phello__', '__file__': '', '__package__': '__phello__', '__path__': ['__phello__']} @@ -25,7 +25,7 @@ (attr, attr_value, value)) def test_lacking_parent(self): - with support.uncache('__phello__', '__phello__.spam'): + with util.uncache('__phello__', '__phello__.spam'): module = machinery.FrozenImporter.load_module('__phello__.spam') check = {'__name__': '__phello__.spam', '__file__': '', '__package__': '__phello__'} @@ -36,7 +36,7 @@ (attr, attr_value, value)) def test_module_reuse(self): - with support.uncache('__hello__'): + with util.uncache('__hello__'): module1 = machinery.FrozenImporter.load_module('__hello__') module2 = machinery.FrozenImporter.load_module('__hello__') self.assert_(module1 is module2) Modified: python/branches/py3k/Lib/importlib/test/import_/test___package__.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test___package__.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test___package__.py Sun Feb 1 05:00:05 2009 @@ -5,7 +5,7 @@ """ import unittest -from .. import support +from .. import util class Using__package__(unittest.TestCase): @@ -34,19 +34,19 @@ def test_using___package__(self): # [__package__] - with support.mock_modules('pkg.__init__', 'pkg.fake') as importer: - with support.import_state(meta_path=[importer]): - support.import_('pkg.fake') - module = support.import_('', globals={'__package__': 'pkg.fake'}, + with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: + with util.import_state(meta_path=[importer]): + util.import_('pkg.fake') + module = util.import_('', globals={'__package__': 'pkg.fake'}, fromlist=['attr'], level=2) self.assertEquals(module.__name__, 'pkg') def test_using___name__(self): # [__name__] - with support.mock_modules('pkg.__init__', 'pkg.fake') as importer: - with support.import_state(meta_path=[importer]): - support.import_('pkg.fake') - module = support.import_('', + with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: + with util.import_state(meta_path=[importer]): + util.import_('pkg.fake') + module = util.import_('', globals={'__name__': 'pkg.fake', '__path__': []}, fromlist=['attr'], level=2) @@ -54,12 +54,12 @@ def test_bad__package__(self): globals = {'__package__': ''} - self.assertRaises(SystemError, support.import_,'', globals, {}, + self.assertRaises(SystemError, util.import_,'', globals, {}, ['relimport'], 1) def test_bunk__package__(self): globals = {'__package__': 42} - self.assertRaises(ValueError, support.import_, '', globals, {}, + self.assertRaises(ValueError, util.import_, '', globals, {}, ['relimport'], 1) @@ -77,26 +77,26 @@ # [top-level] def test_top_level(self): - with support.mock_modules('top_level') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('top_level') as mock: + with util.import_state(meta_path=[mock]): del mock['top_level'].__package__ - module = support.import_('top_level') + module = util.import_('top_level') self.assert_(module.__package__ is None) # [package] def test_package(self): - with support.mock_modules('pkg.__init__') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__') as mock: + with util.import_state(meta_path=[mock]): del mock['pkg'].__package__ - module = support.import_('pkg') + module = util.import_('pkg') self.assertEqual(module.__package__, 'pkg') # [submodule] def test_submodule(self): - with support.mock_modules('pkg.__init__', 'pkg.mod') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__', 'pkg.mod') as mock: + with util.import_state(meta_path=[mock]): del mock['pkg.mod'].__package__ - pkg = support.import_('pkg.mod') + pkg = util.import_('pkg.mod') module = getattr(pkg, 'mod') self.assertEqual(module.__package__, 'pkg') Modified: python/branches/py3k/Lib/importlib/test/import_/test_caching.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_caching.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_caching.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,5 @@ """Test that sys.modules is used properly by import.""" -from ..support import import_, mock_modules, importlib_only, import_state - +from .. import util import sys from types import MethodType import unittest @@ -24,11 +23,11 @@ # [use cache] module_to_use = "some module found!" sys.modules['some_module'] = module_to_use - module = import_('some_module') + module = util.import_('some_module') self.assertEqual(id(module_to_use), id(module)) def create_mock(self, *names, return_=None): - mock = mock_modules(*names) + mock = util.mock_modules(*names) original_load = mock.load_module def load_module(self, fullname): original_load(fullname) @@ -38,31 +37,31 @@ # __import__ inconsistent between loaders and built-in import when it comes # to when to use the module in sys.modules and when not to. - @importlib_only + @util.importlib_only def test_using_cache_after_loader(self): # [from cache on return] with self.create_mock('module') as mock: - with import_state(meta_path=[mock]): - module = import_('module') + with util.import_state(meta_path=[mock]): + module = util.import_('module') self.assertEquals(id(module), id(sys.modules['module'])) # See test_using_cache_after_loader() for reasoning. - @importlib_only + @util.importlib_only def test_using_cache_for_assigning_to_attribute(self): # [from cache to attribute] with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module') + with util.import_state(meta_path=[importer]): + module = util.import_('pkg.module') self.assert_(hasattr(module, 'module')) self.assert_(id(module.module), id(sys.modules['pkg.module'])) # See test_using_cache_after_loader() for reasoning. - @importlib_only + @util.importlib_only def test_using_cache_for_fromlist(self): # [from cache for fromlist] with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist=['module']) + with util.import_state(meta_path=[importer]): + module = util.import_('pkg', fromlist=['module']) self.assert_(hasattr(module, 'module')) self.assertEquals(id(module.module), id(sys.modules['pkg.module'])) Modified: python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,5 @@ """Test that the semantics relating to the 'fromlist' argument are correct.""" -from ..support import import_, mock_modules, import_state - +from .. import util import unittest class ReturnValue(unittest.TestCase): @@ -16,16 +15,16 @@ def test_return_from_import(self): # [import return] - with mock_modules('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module') + with util.mock_modules('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('pkg.module') self.assertEquals(module.__name__, 'pkg') def test_return_from_from_import(self): # [from return] - with mock_modules('pkg.__init__', 'pkg.module')as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module', fromlist=['attr']) + with util.mock_modules('pkg.__init__', 'pkg.module')as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('pkg.module', fromlist=['attr']) self.assertEquals(module.__name__, 'pkg.module') @@ -48,59 +47,59 @@ def test_object(self): # [object case] - with mock_modules('module') as importer: - with import_state(meta_path=[importer]): - module = import_('module', fromlist=['attr']) + with util.mock_modules('module') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('module', fromlist=['attr']) self.assertEquals(module.__name__, 'module') def test_unexistent_object(self): # [bad object] - with mock_modules('module') as importer: - with import_state(meta_path=[importer]): - module = import_('module', fromlist=['non_existent']) + with util.mock_modules('module') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('module', fromlist=['non_existent']) self.assertEquals(module.__name__, 'module') self.assert_(not hasattr(module, 'non_existent')) def test_module_from_package(self): # [module] - with mock_modules('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist=['module']) + with util.mock_modules('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('pkg', fromlist=['module']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEquals(module.module.__name__, 'pkg.module') def test_no_module_from_package(self): # [no module] - with mock_modules('pkg.__init__') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist='non_existent') + with util.mock_modules('pkg.__init__') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('pkg', fromlist='non_existent') self.assertEquals(module.__name__, 'pkg') self.assert_(not hasattr(module, 'non_existent')) def test_empty_string(self): - with mock_modules('pkg.__init__', 'pkg.mod') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.mod', fromlist=['']) + with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: + with util.import_state(meta_path=[importer]): + module = util.import_('pkg.mod', fromlist=['']) self.assertEquals(module.__name__, 'pkg.mod') def test_using_star(self): # [using *] - with mock_modules('pkg.__init__', 'pkg.module') as mock: - with import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__', 'pkg.module') as mock: + with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module'] - module = import_('pkg', fromlist=['*']) + module = util.import_('pkg', fromlist=['*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEqual(module.module.__name__, 'pkg.module') def test_star_with_others(self): # [using * with others] - context = mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2') + context = util.mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2') with context as mock: - with import_state(meta_path=[mock]): + with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module1'] - module = import_('pkg', fromlist=['module2', '*']) + module = util.import_('pkg', fromlist=['module2', '*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module1')) self.assert_(hasattr(module, 'module2')) Modified: python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py Sun Feb 1 05:00:05 2009 @@ -1,5 +1,4 @@ -from ..support import import_state, mock_modules, import_ - +from .. import util from contextlib import nested from types import MethodType import unittest @@ -16,24 +15,25 @@ def test_first_called(self): # [first called] mod = 'top_level' - first = mock_modules(mod) - second = mock_modules(mod) - with nested(mock_modules(mod), mock_modules(mod)) as (first, second): + first = util.mock_modules(mod) + second = util.mock_modules(mod) + context = nested(util.mock_modules(mod), util.mock_modules(mod)) + with context as (first, second): first.modules[mod] = 42 second.modules[mod] = -13 - with import_state(meta_path=[first, second]): - self.assertEquals(import_(mod), 42) + with util.import_state(meta_path=[first, second]): + self.assertEquals(util.import_(mod), 42) def test_continuing(self): # [continuing] mod_name = 'for_real' - first = mock_modules('nonexistent') - second = mock_modules(mod_name) + first = util.mock_modules('nonexistent') + second = util.mock_modules(mod_name) with nested(first, second): first.find_module = lambda self, fullname, path=None: None second.modules[mod_name] = 42 - with import_state(meta_path=[first, second]): - self.assertEquals(import_(mod_name), 42) + with util.import_state(meta_path=[first, second]): + self.assertEquals(util.import_(mod_name), 42) class CallSignature(unittest.TestCase): @@ -54,11 +54,11 @@ # [no path] mod_name = 'top_level' assert '.' not in mod_name - with mock_modules(mod_name) as importer: + with util.mock_modules(mod_name) as importer: log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) - with import_state(meta_path=[importer]): - import_(mod_name) + with util.import_state(meta_path=[importer]): + util.import_(mod_name) assert len(log) == 1 args = log[0][0] kwargs = log[0][1] @@ -74,12 +74,12 @@ mod_name = pkg_name + '.module' path = [42] assert '.' in mod_name - with mock_modules(pkg_name+'.__init__', mod_name) as importer: + with util.mock_modules(pkg_name+'.__init__', mod_name) as importer: importer.modules[pkg_name].__path__ = path log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) - with import_state(meta_path=[importer]): - import_(mod_name) + with util.import_state(meta_path=[importer]): + util.import_(mod_name) assert len(log) == 2 args = log[1][0] kwargs = log[1][1] Modified: python/branches/py3k/Lib/importlib/test/import_/test_packages.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_packages.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_packages.py Sun Feb 1 05:00:05 2009 @@ -1,7 +1,7 @@ +from .. import util import sys import unittest import importlib -from .. import support class ParentModuleTests(unittest.TestCase): @@ -9,15 +9,15 @@ """Importing a submodule should import the parent modules.""" def test_import_parent(self): - with support.mock_modules('pkg.__init__', 'pkg.module') as mock: - with support.import_state(meta_path=[mock]): - module = support.import_('pkg.module') + with util.mock_modules('pkg.__init__', 'pkg.module') as mock: + with util.import_state(meta_path=[mock]): + module = util.import_('pkg.module') self.assert_('pkg' in sys.modules) def test_bad_parent(self): - with support.mock_modules('pkg.module') as mock: - with support.import_state(meta_path=[mock]): - self.assertRaises(ImportError, support.import_, 'pkg.module') + with util.mock_modules('pkg.module') as mock: + with util.import_state(meta_path=[mock]): + self.assertRaises(ImportError, util.import_, 'pkg.module') def test_main(): Modified: python/branches/py3k/Lib/importlib/test/import_/test_path.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_path.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_path.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,4 @@ -from ..support import (mock_modules, import_state, import_, mock_path_hook, - importlib_only, uncache) - +from .. import util from contextlib import nested from imp import new_module import sys @@ -32,7 +30,7 @@ def order_test(self, to_import, entry, search_path, path=[]): # [order] log = [] - class LogFindModule(mock_modules): + class LogFindModule(util.mock_modules): def find_module(self, fullname): log.append(self) return super().find_module(fullname) @@ -42,12 +40,12 @@ hitter = LogFindModule(to_import) with nested(misser, hitter): cache = dict(zip(search_path, (misser, hitter))) - with import_state(path=path, path_importer_cache=cache): - import_(to_import) + with util.import_state(path=path, path_importer_cache=cache): + util.import_(to_import) self.assertEquals(log[0], misser) self.assertEquals(log[1], hitter) - @importlib_only # __import__ uses PyDict_GetItem(), bypassing log. + @util.importlib_only # __import__ uses PyDict_GetItem(), bypassing log. def cache_use_test(self, to_import, entry, path=[]): # [cache check], [cache use] log = [] @@ -56,11 +54,11 @@ log.append(item) return super(LoggingDict, self).__getitem__(item) - with mock_modules(to_import) as importer: + with util.mock_modules(to_import) as importer: cache = LoggingDict() cache[entry] = importer - with import_state(path=[entry], path_importer_cache=cache): - module = import_(to_import, fromlist=['a']) + with util.import_state(path=[entry], path_importer_cache=cache): + module = util.import_(to_import, fromlist=['a']) self.assert_(module is importer[to_import]) self.assertEquals(len(cache), 1) self.assertEquals([entry], log) @@ -71,11 +69,11 @@ def logging_hook(entry): log.append(entry) raise ImportError - with mock_modules(to_import) as importer: - hitter = mock_path_hook(entry, importer=importer) + with util.mock_modules(to_import) as importer: + hitter = util.mock_path_hook(entry, importer=importer) path_hooks = [logging_hook, logging_hook, hitter] - with import_state(path_hooks=path_hooks, path=path): - import_(to_import) + with util.import_state(path_hooks=path_hooks, path=path): + util.import_(to_import) self.assertEquals(sys.path_importer_cache[entry], importer) self.assertEquals(len(log), 2) @@ -90,7 +88,7 @@ raise ImportError try: - import_(to_import) + util.import_(to_import) except ImportError: pass @@ -113,7 +111,7 @@ def test_path_argument(self): name = 'total junk' - with uncache(name): + with util.uncache(name): self.path_argument_test(name) @@ -122,13 +120,13 @@ """Tests for __path__.""" def run_test(self, test, entry, path, *args): - with mock_modules('pkg.__init__') as importer: + with util.mock_modules('pkg.__init__') as importer: importer['pkg'].__path__ = path importer.load_module('pkg') test('pkg.hit', entry, *args) - @importlib_only # XXX Unknown reason why this fails. + @util.importlib_only # XXX Unknown reason why this fails. def test_order(self): self.run_test(self.order_test, 'second', ('first', 'second'), ['first', 'second']) @@ -146,7 +144,7 @@ module.__path__ = ['random __path__'] name = 'pkg.whatever' sys.modules['pkg'] = module - with uncache('pkg', name): + with util.uncache('pkg', name): self.path_argument_test(name) Modified: python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py Sun Feb 1 05:00:05 2009 @@ -1,7 +1,5 @@ """Test relative imports (PEP 328).""" - -from ..support import uncache, import_, mock_modules, import_state - +from .. import util import sys import unittest @@ -65,10 +63,10 @@ uncache_names.append(name) else: uncache_names.append(name[:-len('.__init__')]) - with mock_modules(*create) as importer: - with import_state(meta_path=[importer]): + with util.mock_modules(*create) as importer: + with util.import_state(meta_path=[importer]): for global_ in globals_: - with uncache(*uncache_names): + with util.uncache(*uncache_names): callback(global_) @@ -77,8 +75,8 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['mod2'], level=1) + util.import_('pkg') # For __import__(). + module = util.import_('', global_, fromlist=['mod2'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'mod2')) self.assertEqual(module.mod2.attr, 'pkg.mod2') @@ -89,8 +87,8 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('mod2', global_, fromlist=['attr'], level=1) + util.import_('pkg') # For __import__(). + module = util.import_('mod2', global_, fromlist=['attr'], level=1) self.assertEqual(module.__name__, 'pkg.mod2') self.assertEqual(module.attr, 'pkg.mod2') self.relative_import_test(create, globals_, callback) @@ -101,8 +99,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['module'], + util.import_('pkg') # For __import__(). + module = util.import_('', global_, fromlist=['module'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) @@ -114,8 +112,8 @@ create = 'pkg.__init__', 'pkg.module' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['attr'], level=1) + util.import_('pkg') # For __import__(). + module = util.import_('', global_, fromlist=['attr'], level=1) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -126,7 +124,7 @@ globals_ = ({'__package__': 'pkg.subpkg1'}, {'__name__': 'pkg.subpkg1', '__path__': ['blah']}) def callback(global_): - module = import_('', global_, fromlist=['subpkg2'], level=2) + module = util.import_('', global_, fromlist=['subpkg2'], level=2) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'subpkg2')) self.assertEqual(module.subpkg2.attr, 'pkg.subpkg2.__init__') @@ -141,8 +139,8 @@ {'__name__': 'pkg.pkg1.pkg2.pkg3.pkg4.pkg5', '__path__': ['blah']}) def callback(global_): - import_(globals_[0]['__package__']) - module = import_('', global_, fromlist=['attr'], level=6) + util.import_(globals_[0]['__package__']) + module = util.import_('', global_, fromlist=['attr'], level=6) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -152,8 +150,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - import_('pkg') - self.assertRaises(ValueError, import_, '', global_, + util.import_('pkg') + self.assertRaises(ValueError, util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) @@ -162,14 +160,14 @@ create = ['top_level', 'pkg.__init__', 'pkg.module'] globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - import_('pkg') - self.assertRaises(ValueError, import_, '', global_, + util.import_('pkg') + self.assertRaises(ValueError, util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) def test_empty_name_w_level_0(self): # [empty name] - self.assertRaises(ValueError, import_, '') + self.assertRaises(ValueError, util.import_, '') def test_import_from_different_package(self): # Test importing from a different package than the caller. @@ -183,8 +181,9 @@ '__runpy_pkg__.uncle.cousin.nephew'] globals_ = {'__package__': '__runpy_pkg__.__runpy_pkg__'} def callback(global_): - import_('__runpy_pkg__.__runpy_pkg__') - module = import_('uncle.cousin', globals_, {}, fromlist=['nephew'], + util.import_('__runpy_pkg__.__runpy_pkg__') + module = util.import_('uncle.cousin', globals_, {}, + fromlist=['nephew'], level=2) self.assertEqual(module.__name__, '__runpy_pkg__.uncle.cousin') self.relative_import_test(create, globals_, callback) Modified: python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_case_sensitivity.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,6 @@ """Test case-sensitivity (PEP 235).""" import importlib -from .. import support +from .. import util from . import util as source_util import os import sys @@ -8,7 +8,7 @@ import unittest - at support.case_insensitive_tests + at util.case_insensitive_tests class CaseSensitivityTest(unittest.TestCase): """PEP 235 dictates that on case-preserving, case-insensitive file systems Modified: python/branches/py3k/Lib/importlib/test/source/test_finder.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_finder.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_finder.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,5 @@ import importlib from .. import abc -from .. import support from . import util as source_util import os import py_compile Modified: python/branches/py3k/Lib/importlib/test/source/test_loader.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_loader.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_loader.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,5 @@ import importlib from .. import abc -from .. import support from . import util as source_util import imp Modified: python/branches/py3k/Lib/importlib/test/source/test_path_hook.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_path_hook.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_path_hook.py Sun Feb 1 05:00:05 2009 @@ -1,5 +1,5 @@ import importlib -from . import util +from . import util as source_util import unittest @@ -9,7 +9,7 @@ def test_success(self): # XXX Only work on existing directories? - with util.create_modules('dummy') as mapping: + with source_util.create_modules('dummy') as mapping: self.assert_(hasattr(importlib.FileImporter(mapping['.root']), 'find_module')) Modified: python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py (original) +++ python/branches/py3k/Lib/importlib/test/source/test_source_encoding.py Sun Feb 1 05:00:05 2009 @@ -1,5 +1,4 @@ import importlib -from .. import support from . import util as source_util import codecs Modified: python/branches/py3k/Lib/importlib/test/source/util.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/source/util.py (original) +++ python/branches/py3k/Lib/importlib/test/source/util.py Sun Feb 1 05:00:05 2009 @@ -1,11 +1,11 @@ -from .. import support as util +from .. import util import contextlib import imp import os import os.path import sys import tempfile -from test import support as support +from test import support def writes_bytecode(fxn): Deleted: python/branches/py3k/Lib/importlib/test/support.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/support.py Sun Feb 1 05:00:05 2009 +++ (empty file) @@ -1,153 +0,0 @@ -from importlib import Import - -from contextlib import contextmanager -from functools import update_wrapper -import imp -import os.path -from test.support import unlink -import sys - - -using___import__ = False - -def import_(*args, **kwargs): - """Delegate to allow for injecting different implementations of import.""" - if using___import__: - return __import__(*args, **kwargs) - return Import()(*args, **kwargs) - -def importlib_only(fxn): - """Decorator to mark which tests are not supported by the current - implementation of __import__().""" - def inner(*args, **kwargs): - if using___import__: - return - else: - return fxn(*args, **kwargs) - update_wrapper(inner, fxn) - return inner - - -def case_insensitive_tests(class_): - """Class decorator that nullifies tests that require a case-insensitive - file system.""" - if sys.platform not in ('win32', 'darwin', 'cygwin'): - return object() - else: - return class_ - - - at contextmanager -def uncache(*names): - """Uncache a module from sys.modules. - - A basic sanity check is performed to prevent uncaching modules that either - cannot/shouldn't be uncached. - - """ - for name in names: - if name in ('sys', 'marshal', 'imp'): - raise ValueError( - "cannot uncache {0} as it will break _importlib".format(name)) - try: - del sys.modules[name] - except KeyError: - pass - try: - yield - finally: - for name in names: - try: - del sys.modules[name] - except KeyError: - pass - - at contextmanager -def import_state(**kwargs): - """Context manager to manage the various importers and stored state in the - sys module. - - The 'modules' attribute is not supported as the interpreter state stores a - pointer to the dict that the interpreter uses internally; - reassigning to sys.modules does not have the desired effect. - - """ - originals = {} - try: - for attr, default in (('meta_path', []), ('path', []), - ('path_hooks', []), - ('path_importer_cache', {})): - originals[attr] = getattr(sys, attr) - if attr in kwargs: - new_value = kwargs[attr] - del kwargs[attr] - else: - new_value = default - setattr(sys, attr, new_value) - if len(kwargs): - raise ValueError( - 'unrecognized arguments: {0}'.format(kwargs.keys())) - yield - finally: - for attr, value in originals.items(): - setattr(sys, attr, value) - - -class mock_modules: - - """A mock importer/loader.""" - - def __init__(self, *names): - self.modules = {} - for name in names: - if not name.endswith('.__init__'): - import_name = name - else: - import_name = name[:-len('.__init__')] - if '.' not in name: - package = None - elif import_name == name: - package = name.rsplit('.', 1)[0] - else: - package = import_name - module = imp.new_module(import_name) - module.__loader__ = self - module.__file__ = '' - module.__package__ = package - module.attr = name - if import_name != name: - module.__path__ = [''] - self.modules[import_name] = module - - def __getitem__(self, name): - return self.modules[name] - - def find_module(self, fullname, path=None): - if fullname not in self.modules: - return None - else: - return self - - def load_module(self, fullname): - if fullname not in self.modules: - raise ImportError - else: - sys.modules[fullname] = self.modules[fullname] - return self.modules[fullname] - - def __enter__(self): - self._uncache = uncache(*self.modules.keys()) - self._uncache.__enter__() - return self - - def __exit__(self, *exc_info): - self._uncache.__exit__(None, None, None) - - -def mock_path_hook(*entries, importer): - """A mock sys.path_hooks entry.""" - def hook(entry): - if entry not in entries: - raise ImportError - return importer - return hook Modified: python/branches/py3k/Lib/importlib/test/test_api.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/test_api.py (original) +++ python/branches/py3k/Lib/importlib/test/test_api.py Sun Feb 1 05:00:05 2009 @@ -1,6 +1,6 @@ import unittest import importlib -from . import support +from . import util class ImportModuleTests(unittest.TestCase): @@ -9,8 +9,8 @@ def test_module_import(self): # Test importing a top-level module. - with support.mock_modules('top_level') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('top_level') as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module('top_level') self.assertEqual(module.__name__, 'top_level') @@ -19,8 +19,8 @@ pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with support.mock_modules(pkg_long_name, name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(name) self.assertEqual(module.__name__, name) @@ -31,8 +31,8 @@ module_name = 'mod' absolute_name = '{0}.{1}'.format(pkg_name, module_name) relative_name = '.{0}'.format(module_name) - with support.mock_modules(pkg_long_name, absolute_name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, absolute_name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(relative_name, pkg_name) self.assertEqual(module.__name__, absolute_name) @@ -42,8 +42,8 @@ pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with support.mock_modules(pkg_long_name, name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(name, pkg_name) self.assertEqual(module.__name__, name) From buildbot at python.org Sun Feb 1 05:22:08 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 04:22:08 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090201042208.5BDF41E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/156 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 05:28:04 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 05:28:04 +0100 (CET) Subject: [Python-checkins] r69173 - in python/branches/py3k/Lib/importlib: NOTES test/import_/test___package__.py test/import_/test_caching.py test/import_/test_fromlist.py test/import_/test_meta_path.py test/import_/test_packages.py test/import_/test_path.py test/import_/test_relative_imports.py test/import_/util.py test/util.py Message-ID: <20090201042804.A91511E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 05:28:04 2009 New Revision: 69173 Log: Move import semantic util code to importlib.test.import_.util. Added: python/branches/py3k/Lib/importlib/test/import_/util.py Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/test/import_/test___package__.py python/branches/py3k/Lib/importlib/test/import_/test_caching.py python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py python/branches/py3k/Lib/importlib/test/import_/test_packages.py python/branches/py3k/Lib/importlib/test/import_/test_path.py python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py python/branches/py3k/Lib/importlib/test/util.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 05:28:04 2009 @@ -3,10 +3,6 @@ * Reorganize support code. - + Separate out support code for extensions out of test_support_hook. - + Move util.import_ and utill.mock_modules to import_, importlib_only, - mock_path_hook? - + Add a file loader mock that returns monotonically increasing mtime. - Use in source/test_reload. - Use in source/test_load_module_mixed. Modified: python/branches/py3k/Lib/importlib/test/import_/test___package__.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test___package__.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test___package__.py Sun Feb 1 05:28:04 2009 @@ -6,6 +6,7 @@ """ import unittest from .. import util +from . import util as import_util class Using__package__(unittest.TestCase): @@ -36,8 +37,8 @@ # [__package__] with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: with util.import_state(meta_path=[importer]): - util.import_('pkg.fake') - module = util.import_('', globals={'__package__': 'pkg.fake'}, + import_util.import_('pkg.fake') + module = import_util.import_('', globals={'__package__': 'pkg.fake'}, fromlist=['attr'], level=2) self.assertEquals(module.__name__, 'pkg') @@ -45,8 +46,8 @@ # [__name__] with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: with util.import_state(meta_path=[importer]): - util.import_('pkg.fake') - module = util.import_('', + import_util.import_('pkg.fake') + module = import_util.import_('', globals={'__name__': 'pkg.fake', '__path__': []}, fromlist=['attr'], level=2) @@ -54,12 +55,12 @@ def test_bad__package__(self): globals = {'__package__': ''} - self.assertRaises(SystemError, util.import_,'', globals, {}, + self.assertRaises(SystemError, import_util.import_,'', globals, {}, ['relimport'], 1) def test_bunk__package__(self): globals = {'__package__': 42} - self.assertRaises(ValueError, util.import_, '', globals, {}, + self.assertRaises(ValueError, import_util.import_, '', globals, {}, ['relimport'], 1) @@ -80,7 +81,7 @@ with util.mock_modules('top_level') as mock: with util.import_state(meta_path=[mock]): del mock['top_level'].__package__ - module = util.import_('top_level') + module = import_util.import_('top_level') self.assert_(module.__package__ is None) # [package] @@ -88,7 +89,7 @@ with util.mock_modules('pkg.__init__') as mock: with util.import_state(meta_path=[mock]): del mock['pkg'].__package__ - module = util.import_('pkg') + module = import_util.import_('pkg') self.assertEqual(module.__package__, 'pkg') # [submodule] @@ -96,7 +97,7 @@ with util.mock_modules('pkg.__init__', 'pkg.mod') as mock: with util.import_state(meta_path=[mock]): del mock['pkg.mod'].__package__ - pkg = util.import_('pkg.mod') + pkg = import_util.import_('pkg.mod') module = getattr(pkg, 'mod') self.assertEqual(module.__package__, 'pkg') Modified: python/branches/py3k/Lib/importlib/test/import_/test_caching.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_caching.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_caching.py Sun Feb 1 05:28:04 2009 @@ -1,5 +1,6 @@ """Test that sys.modules is used properly by import.""" from .. import util +from . import util as import_util import sys from types import MethodType import unittest @@ -23,7 +24,7 @@ # [use cache] module_to_use = "some module found!" sys.modules['some_module'] = module_to_use - module = util.import_('some_module') + module = import_util.import_('some_module') self.assertEqual(id(module_to_use), id(module)) def create_mock(self, *names, return_=None): @@ -37,31 +38,31 @@ # __import__ inconsistent between loaders and built-in import when it comes # to when to use the module in sys.modules and when not to. - @util.importlib_only + @import_util.importlib_only def test_using_cache_after_loader(self): # [from cache on return] with self.create_mock('module') as mock: with util.import_state(meta_path=[mock]): - module = util.import_('module') + module = import_util.import_('module') self.assertEquals(id(module), id(sys.modules['module'])) # See test_using_cache_after_loader() for reasoning. - @util.importlib_only + @import_util.importlib_only def test_using_cache_for_assigning_to_attribute(self): # [from cache to attribute] with self.create_mock('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg.module') + module = import_util.import_('pkg.module') self.assert_(hasattr(module, 'module')) self.assert_(id(module.module), id(sys.modules['pkg.module'])) # See test_using_cache_after_loader() for reasoning. - @util.importlib_only + @import_util.importlib_only def test_using_cache_for_fromlist(self): # [from cache for fromlist] with self.create_mock('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg', fromlist=['module']) + module = import_util.import_('pkg', fromlist=['module']) self.assert_(hasattr(module, 'module')) self.assertEquals(id(module.module), id(sys.modules['pkg.module'])) Modified: python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_fromlist.py Sun Feb 1 05:28:04 2009 @@ -1,5 +1,6 @@ """Test that the semantics relating to the 'fromlist' argument are correct.""" from .. import util +from . import util as import_util import unittest class ReturnValue(unittest.TestCase): @@ -17,14 +18,14 @@ # [import return] with util.mock_modules('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg.module') + module = import_util.import_('pkg.module') self.assertEquals(module.__name__, 'pkg') def test_return_from_from_import(self): # [from return] with util.mock_modules('pkg.__init__', 'pkg.module')as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg.module', fromlist=['attr']) + module = import_util.import_('pkg.module', fromlist=['attr']) self.assertEquals(module.__name__, 'pkg.module') @@ -49,14 +50,14 @@ # [object case] with util.mock_modules('module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('module', fromlist=['attr']) + module = import_util.import_('module', fromlist=['attr']) self.assertEquals(module.__name__, 'module') def test_unexistent_object(self): # [bad object] with util.mock_modules('module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('module', fromlist=['non_existent']) + module = import_util.import_('module', fromlist=['non_existent']) self.assertEquals(module.__name__, 'module') self.assert_(not hasattr(module, 'non_existent')) @@ -64,7 +65,7 @@ # [module] with util.mock_modules('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg', fromlist=['module']) + module = import_util.import_('pkg', fromlist=['module']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEquals(module.module.__name__, 'pkg.module') @@ -73,14 +74,14 @@ # [no module] with util.mock_modules('pkg.__init__') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg', fromlist='non_existent') + module = import_util.import_('pkg', fromlist='non_existent') self.assertEquals(module.__name__, 'pkg') self.assert_(not hasattr(module, 'non_existent')) def test_empty_string(self): with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: with util.import_state(meta_path=[importer]): - module = util.import_('pkg.mod', fromlist=['']) + module = import_util.import_('pkg.mod', fromlist=['']) self.assertEquals(module.__name__, 'pkg.mod') def test_using_star(self): @@ -88,7 +89,7 @@ with util.mock_modules('pkg.__init__', 'pkg.module') as mock: with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module'] - module = util.import_('pkg', fromlist=['*']) + module = import_util.import_('pkg', fromlist=['*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEqual(module.module.__name__, 'pkg.module') @@ -99,7 +100,7 @@ with context as mock: with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module1'] - module = util.import_('pkg', fromlist=['module2', '*']) + module = import_util.import_('pkg', fromlist=['module2', '*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module1')) self.assert_(hasattr(module, 'module2')) Modified: python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py Sun Feb 1 05:28:04 2009 @@ -1,4 +1,5 @@ from .. import util +from . import util as import_util from contextlib import nested from types import MethodType import unittest @@ -22,7 +23,7 @@ first.modules[mod] = 42 second.modules[mod] = -13 with util.import_state(meta_path=[first, second]): - self.assertEquals(util.import_(mod), 42) + self.assertEquals(import_util.import_(mod), 42) def test_continuing(self): # [continuing] @@ -33,7 +34,7 @@ first.find_module = lambda self, fullname, path=None: None second.modules[mod_name] = 42 with util.import_state(meta_path=[first, second]): - self.assertEquals(util.import_(mod_name), 42) + self.assertEquals(import_util.import_(mod_name), 42) class CallSignature(unittest.TestCase): @@ -58,7 +59,7 @@ log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) with util.import_state(meta_path=[importer]): - util.import_(mod_name) + import_util.import_(mod_name) assert len(log) == 1 args = log[0][0] kwargs = log[0][1] @@ -79,7 +80,7 @@ log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) with util.import_state(meta_path=[importer]): - util.import_(mod_name) + import_util.import_(mod_name) assert len(log) == 2 args = log[1][0] kwargs = log[1][1] Modified: python/branches/py3k/Lib/importlib/test/import_/test_packages.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_packages.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_packages.py Sun Feb 1 05:28:04 2009 @@ -1,4 +1,5 @@ from .. import util +from . import util as import_util import sys import unittest import importlib @@ -11,13 +12,14 @@ def test_import_parent(self): with util.mock_modules('pkg.__init__', 'pkg.module') as mock: with util.import_state(meta_path=[mock]): - module = util.import_('pkg.module') + module = import_util.import_('pkg.module') self.assert_('pkg' in sys.modules) def test_bad_parent(self): with util.mock_modules('pkg.module') as mock: with util.import_state(meta_path=[mock]): - self.assertRaises(ImportError, util.import_, 'pkg.module') + self.assertRaises(ImportError, + import_util.import_, 'pkg.module') def test_main(): Modified: python/branches/py3k/Lib/importlib/test/import_/test_path.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_path.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_path.py Sun Feb 1 05:28:04 2009 @@ -1,4 +1,5 @@ from .. import util +from . import util as import_util from contextlib import nested from imp import new_module import sys @@ -41,11 +42,11 @@ with nested(misser, hitter): cache = dict(zip(search_path, (misser, hitter))) with util.import_state(path=path, path_importer_cache=cache): - util.import_(to_import) + import_util.import_(to_import) self.assertEquals(log[0], misser) self.assertEquals(log[1], hitter) - @util.importlib_only # __import__ uses PyDict_GetItem(), bypassing log. + @import_util.importlib_only # __import__ uses PyDict_GetItem(), bypassing log. def cache_use_test(self, to_import, entry, path=[]): # [cache check], [cache use] log = [] @@ -58,7 +59,7 @@ cache = LoggingDict() cache[entry] = importer with util.import_state(path=[entry], path_importer_cache=cache): - module = util.import_(to_import, fromlist=['a']) + module = import_util.import_(to_import, fromlist=['a']) self.assert_(module is importer[to_import]) self.assertEquals(len(cache), 1) self.assertEquals([entry], log) @@ -70,10 +71,10 @@ log.append(entry) raise ImportError with util.mock_modules(to_import) as importer: - hitter = util.mock_path_hook(entry, importer=importer) + hitter = import_util.mock_path_hook(entry, importer=importer) path_hooks = [logging_hook, logging_hook, hitter] with util.import_state(path_hooks=path_hooks, path=path): - util.import_(to_import) + import_util.import_(to_import) self.assertEquals(sys.path_importer_cache[entry], importer) self.assertEquals(len(log), 2) @@ -88,7 +89,7 @@ raise ImportError try: - util.import_(to_import) + import_util.import_(to_import) except ImportError: pass @@ -126,7 +127,7 @@ test('pkg.hit', entry, *args) - @util.importlib_only # XXX Unknown reason why this fails. + @import_util.importlib_only # XXX Unknown reason why this fails. def test_order(self): self.run_test(self.order_test, 'second', ('first', 'second'), ['first', 'second']) Modified: python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_relative_imports.py Sun Feb 1 05:28:04 2009 @@ -1,5 +1,6 @@ """Test relative imports (PEP 328).""" from .. import util +from . import util as import_util import sys import unittest @@ -75,8 +76,8 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - util.import_('pkg') # For __import__(). - module = util.import_('', global_, fromlist=['mod2'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['mod2'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'mod2')) self.assertEqual(module.mod2.attr, 'pkg.mod2') @@ -87,8 +88,9 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - util.import_('pkg') # For __import__(). - module = util.import_('mod2', global_, fromlist=['attr'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('mod2', global_, fromlist=['attr'], + level=1) self.assertEqual(module.__name__, 'pkg.mod2') self.assertEqual(module.attr, 'pkg.mod2') self.relative_import_test(create, globals_, callback) @@ -99,8 +101,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - util.import_('pkg') # For __import__(). - module = util.import_('', global_, fromlist=['module'], + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['module'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) @@ -112,8 +114,8 @@ create = 'pkg.__init__', 'pkg.module' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - util.import_('pkg') # For __import__(). - module = util.import_('', global_, fromlist=['attr'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['attr'], level=1) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -124,7 +126,8 @@ globals_ = ({'__package__': 'pkg.subpkg1'}, {'__name__': 'pkg.subpkg1', '__path__': ['blah']}) def callback(global_): - module = util.import_('', global_, fromlist=['subpkg2'], level=2) + module = import_util.import_('', global_, fromlist=['subpkg2'], + level=2) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'subpkg2')) self.assertEqual(module.subpkg2.attr, 'pkg.subpkg2.__init__') @@ -139,8 +142,8 @@ {'__name__': 'pkg.pkg1.pkg2.pkg3.pkg4.pkg5', '__path__': ['blah']}) def callback(global_): - util.import_(globals_[0]['__package__']) - module = util.import_('', global_, fromlist=['attr'], level=6) + import_util.import_(globals_[0]['__package__']) + module = import_util.import_('', global_, fromlist=['attr'], level=6) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -150,8 +153,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - util.import_('pkg') - self.assertRaises(ValueError, util.import_, '', global_, + import_util.import_('pkg') + self.assertRaises(ValueError, import_util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) @@ -160,14 +163,14 @@ create = ['top_level', 'pkg.__init__', 'pkg.module'] globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - util.import_('pkg') - self.assertRaises(ValueError, util.import_, '', global_, + import_util.import_('pkg') + self.assertRaises(ValueError, import_util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) def test_empty_name_w_level_0(self): # [empty name] - self.assertRaises(ValueError, util.import_, '') + self.assertRaises(ValueError, import_util.import_, '') def test_import_from_different_package(self): # Test importing from a different package than the caller. @@ -181,8 +184,8 @@ '__runpy_pkg__.uncle.cousin.nephew'] globals_ = {'__package__': '__runpy_pkg__.__runpy_pkg__'} def callback(global_): - util.import_('__runpy_pkg__.__runpy_pkg__') - module = util.import_('uncle.cousin', globals_, {}, + import_util.import_('__runpy_pkg__.__runpy_pkg__') + module = import_util.import_('uncle.cousin', globals_, {}, fromlist=['nephew'], level=2) self.assertEqual(module.__name__, '__runpy_pkg__.uncle.cousin') Added: python/branches/py3k/Lib/importlib/test/import_/util.py ============================================================================== --- (empty file) +++ python/branches/py3k/Lib/importlib/test/import_/util.py Sun Feb 1 05:28:04 2009 @@ -0,0 +1,33 @@ +import functools +import importlib + + +using___import__ = False + + +def import_(*args, **kwargs): + """Delegate to allow for injecting different implementations of import.""" + if using___import__: + return __import__(*args, **kwargs) + return importlib.Import()(*args, **kwargs) + + +def importlib_only(fxn): + """Decorator to mark which tests are not supported by the current + implementation of __import__().""" + def inner(*args, **kwargs): + if using___import__: + return + else: + return fxn(*args, **kwargs) + functools.update_wrapper(inner, fxn) + return inner + + +def mock_path_hook(*entries, importer): + """A mock sys.path_hooks entry.""" + def hook(entry): + if entry not in entries: + raise ImportError + return importer + return hook Modified: python/branches/py3k/Lib/importlib/test/util.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/util.py (original) +++ python/branches/py3k/Lib/importlib/test/util.py Sun Feb 1 05:28:04 2009 @@ -1,33 +1,10 @@ -from importlib import Import - from contextlib import contextmanager -from functools import update_wrapper import imp import os.path from test.support import unlink import sys -using___import__ = False - -def import_(*args, **kwargs): - """Delegate to allow for injecting different implementations of import.""" - if using___import__: - return __import__(*args, **kwargs) - return Import()(*args, **kwargs) - -def importlib_only(fxn): - """Decorator to mark which tests are not supported by the current - implementation of __import__().""" - def inner(*args, **kwargs): - if using___import__: - return - else: - return fxn(*args, **kwargs) - update_wrapper(inner, fxn) - return inner - - def case_insensitive_tests(class_): """Class decorator that nullifies tests that require a case-insensitive file system.""" @@ -142,12 +119,3 @@ def __exit__(self, *exc_info): self._uncache.__exit__(None, None, None) - - -def mock_path_hook(*entries, importer): - """A mock sys.path_hooks entry.""" - def hook(entry): - if entry not in entries: - raise ImportError - return importer - return hook From python-checkins at python.org Sun Feb 1 06:04:08 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 06:04:08 +0100 (CET) Subject: [Python-checkins] r69174 - python/branches/py3k/Lib/importlib/NOTES Message-ID: <20090201050408.1B9131E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 06:04:06 2009 New Revision: 69174 Log: Remove an outdated todo item from importlib. Modified: python/branches/py3k/Lib/importlib/NOTES Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 06:04:06 2009 @@ -1,12 +1,6 @@ to do ///// -* Reorganize support code. - - + Add a file loader mock that returns monotonically increasing mtime. - - Use in source/test_reload. - - Use in source/test_load_module_mixed. - * API simplification? + read_source -> get_data/source_path From python-checkins at python.org Sun Feb 1 06:12:58 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 1 Feb 2009 06:12:58 +0100 (CET) Subject: [Python-checkins] r69175 - sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Message-ID: <20090201051258.9AFCB1E4002@bag.python.org> Author: raymond.hettinger Date: Sun Feb 1 06:12:58 2009 New Revision: 69175 Log: First draft of timing bench. Added: sandbox/trunk/dbm_sqlite/alt/time_sqlite.py (contents, props changed) Added: sandbox/trunk/dbm_sqlite/alt/time_sqlite.py ============================================================================== --- (empty file) +++ sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Sun Feb 1 06:12:58 2009 @@ -0,0 +1,102 @@ +''' Testbench and timing routines to figure-out the fastest schema for shelves. + +With unique index or primary key or no index. + Insertion speed (do we pay a high price for reindexing on every commit) + Individual Lookup speed (regular value, masked key, uncommitted key) + Speed of replacing vs inserting. + + Speed of: + 'select *' + 'select * order by key' + 'select * order by rowid' + + Do 'select key', 'select *', and 'select value' all produce the same order? + +Delayed commits: + How much insertion speed is gained by n-period commits + How much does that slow-down searches + Should iterators force a commit before iterating + +Do 'select key', 'select *', and 'select value' all produce the same order? + +Same tests, but first fragment the snot out of the db. + +What about deletions and fragmentation? +Cost and effects of vacuuming. +BLOB vs TEXT + +''' + +from random import * +from string import ascii_letters +import sqlite3 +import os +from time import clock + +MAKE_shelf = ('''\ + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key TEXT NOT NULL, value TEXT NOT NULL); +''', 'UNINDEXED') +MAKE_shelf_PRIMARY = ('''\ + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key PRIMARY KEY, value TEXT NOT NULL); +''', 'PRIMARY') +MAKE_shelf_UNIQUE = ('''\ + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key TEXT NOT NULL, value TEXT NOT NULL); + CREATE UNIQUE INDEX IF NOT EXISTS keyndx ON shelf (key); +''', 'UNIQ') + +SELECTORS = [ + 'SELECT * FROM shelf', + 'SELECT * FROM shelf ORDER BY key', + 'SELECT * FROM shelf ORDER BY rowid', + 'SELECT key FROM shelf', + 'SELECT value FROM shelf', + 'SELECT key, value FROM shelf', +] + +def populate(n=100, m=5): + items = [] + for i in range(n): + key = bytes(''.join(choice(ascii_letters) for j in range(m)), 'utf-8') + val = bytes(''.join(choice(ascii_letters) for j in range(m)), 'utf-8') + items += [(key, val)] + if len(set(k for k,v in items)) != n: + return populate(n, m) + return items + +def setup(BUILDER, items=None): + filename = 'tmpshl' + try: + os.remove(filename) + except OSError: + pass + conn = sqlite3.connect(filename) + conn.text_factory = bytes + conn.executescript(BUILDER) + if items: + UPDATE_ITEMS = 'REPLACE INTO shelf (key, value) VALUES (?, ?)' + conn.executemany(UPDATE_ITEMS, items) + conn.commit() + return conn + +def timeit(conn, stmt, n=20): + conn.execute(stmt) # precompile + start = clock() + for i in range(n): + conn.execute(stmt).fetchall() + return '%.2f' % (clock() - start) + + +seed('xyzpdqbingo') +items = populate(2000) +for stmt in SELECTORS: + print(stmt) + for builder, name in [MAKE_shelf, MAKE_shelf_PRIMARY, MAKE_shelf_UNIQUE]: + conn = setup(builder, items) + print(sorted(timeit(conn, stmt, n=100) for i in range(6)), name) + print() + + + From buildbot at python.org Sun Feb 1 06:28:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 05:28:52 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.x Message-ID: <20090201052852.524EB1E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.x/builds/228 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 06:33:17 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 06:33:17 +0100 (CET) Subject: [Python-checkins] r69176 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py Message-ID: <20090201053317.58B5F1E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 06:33:17 2009 New Revision: 69176 Log: Expose source_path and bytecode_path on _PyFileLoader. Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/_bootstrap.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 06:33:17 2009 @@ -3,8 +3,7 @@ * API simplification? - + read_source -> get_data/source_path - + read_bytecode -> get_data/bytecode_path + + Use *_path() along with get_data + write_bytecode -> complete set of bytes for bytecode instead of individual arguments. Modified: python/branches/py3k/Lib/importlib/_bootstrap.py ============================================================================== --- python/branches/py3k/Lib/importlib/_bootstrap.py (original) +++ python/branches/py3k/Lib/importlib/_bootstrap.py Sun Feb 1 06:33:17 2009 @@ -341,13 +341,15 @@ else: return None - def _source_path(self): + @check_name + def source_path(self, fullname): """Return the path to an existing source file for the module, or None if one cannot be found.""" # Not a property so that it is easy to override. return self._find_path(imp.PY_SOURCE) - def _bytecode_path(self): + @check_name + def bytecode_path(self, fullname): """Return the path to a bytecode file, or None if one does not exist.""" # Not a property for easy overriding. @@ -357,8 +359,9 @@ @get_module def load_module(self, module): """Load a Python source or bytecode module.""" - source_path = self._source_path() - bytecode_path = self._bytecode_path() + name = module.__name__ + source_path = self.source_path(name) + bytecode_path = self.bytecode_path(name) code_object = self.get_code(module.__name__) module.__file__ = source_path if source_path else bytecode_path module.__loader__ = self @@ -376,7 +379,7 @@ def source_mtime(self, name): """Return the modification time of the source for the specified module.""" - source_path = self._source_path() + source_path = self.source_path(name) if not source_path: return None return int(_os.stat(source_path).st_mtime) @@ -389,7 +392,7 @@ laoder cannot handle the specified module. """ - source_path = self._source_path() + source_path = self._source_path(name) if source_path is None: return None import tokenize @@ -407,7 +410,7 @@ The returned path is used by 'compile' for error messages. """ - source_path = self._source_path() + source_path = self.source_path(fullname) if source_path is None: return None with closing(_fileio._FileIO(source_path, 'r')) as bytes_file: @@ -422,7 +425,7 @@ the module. Returns None if there is no bytecode. """ - path = self._bytecode_path() + path = self.bytecode_path(name) if path is None: return None file = _fileio._FileIO(path, 'r') @@ -443,7 +446,7 @@ cannot be handled by the loader. """ - bytecode_path = self._bytecode_path() + bytecode_path = self.bytecode_path(name) if not bytecode_path: bytecode_path = self._base_path + suffix_list(imp.PY_COMPILED)[0] file = _fileio._FileIO(bytecode_path, 'w') From python-checkins at python.org Sun Feb 1 06:43:31 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 06:43:31 +0100 (CET) Subject: [Python-checkins] r69177 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py Message-ID: <20090201054331.662711E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 06:43:31 2009 New Revision: 69177 Log: Ditch read_source() and read_bytecode() and replace with *_path() and get_data(). Modified: python/branches/py3k/Lib/importlib/NOTES python/branches/py3k/Lib/importlib/_bootstrap.py Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 06:43:31 2009 @@ -3,7 +3,6 @@ * API simplification? - + Use *_path() along with get_data + write_bytecode -> complete set of bytes for bytecode instead of individual arguments. Modified: python/branches/py3k/Lib/importlib/_bootstrap.py ============================================================================== --- python/branches/py3k/Lib/importlib/_bootstrap.py (original) +++ python/branches/py3k/Lib/importlib/_bootstrap.py Sun Feb 1 06:43:31 2009 @@ -403,40 +403,6 @@ return open(source_path, encoding=encoding).read() @check_name - def read_source(self, fullname): - """Return the source for the specified module as bytes along with the - path where the source came from. - - The returned path is used by 'compile' for error messages. - - """ - source_path = self.source_path(fullname) - if source_path is None: - return None - with closing(_fileio._FileIO(source_path, 'r')) as bytes_file: - return bytes_file.read(), source_path - - @check_name - def read_bytecode(self, name): - """Return the magic number, timestamp, and the module bytecode for the - module. - - Raises ImportError (just like get_source) if the laoder cannot handle - the module. Returns None if there is no bytecode. - - """ - path = self.bytecode_path(name) - if path is None: - return None - file = _fileio._FileIO(path, 'r') - try: - with closing(file) as bytecode_file: - data = bytecode_file.read() - return data[:4], marshal._r_long(data[4:8]), data[8:] - except AttributeError: - return None - - @check_name def write_bytecode(self, name, magic, timestamp, data): """Write out 'data' for the specified module using the specific timestamp, returning a boolean @@ -462,7 +428,6 @@ else: raise - # XXX Take an optional argument to flag whether to write bytecode? @check_name def get_code(self, name): """Return the code object for the module. @@ -492,9 +457,12 @@ # number is bad? source_timestamp = self.source_mtime(name) # Try to use bytecode if it is available. - bytecode_tuple = self.read_bytecode(name) - if bytecode_tuple: - magic, pyc_timestamp, bytecode = bytecode_tuple + bytecode_path = self.bytecode_path(name) + if bytecode_path: + data = self.get_data(bytecode_path) + magic = data[:4] + pyc_timestamp = marshal._r_long(data[4:8]) + bytecode = data[8:] try: # Verify that the magic number is valid. if imp.get_magic() != magic: @@ -519,7 +487,8 @@ raise ImportError("no source or bytecode available to create code " "object for {0!r}".format(name)) # Use the source. - source, source_path = self.read_source(name) + source_path = self.source_path(name) + source = self.get_data(source_path) # Convert to universal newlines. line_endings = b'\n' for index, c in enumerate(source): From python-checkins at python.org Sun Feb 1 06:55:23 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 06:55:23 +0100 (CET) Subject: [Python-checkins] r69178 - python/branches/py3k/Lib/importlib/NOTES Message-ID: <20090201055523.B631D1E4028@bag.python.org> Author: brett.cannon Date: Sun Feb 1 06:55:23 2009 New Revision: 69178 Log: Update importlib notes. Modified: python/branches/py3k/Lib/importlib/NOTES Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Sun Feb 1 06:55:23 2009 @@ -1,20 +1,10 @@ to do ///// -* API simplification? - - + write_bytecode -> complete set of bytes for bytecode instead of - individual arguments. - * Create meta_path importer for sys.path. -* OPTIMIZE! - - + Write benchmark suite. - + Fast path common cases. - - - Absolute name from sys.path. - - Relative name from sys.path. + + Create hook. + + Rewrite Import to use the hook. * Implement PEP 302 protocol for loaders (should just be a matter of testing). @@ -73,4 +63,13 @@ * SourceFinder * (?) Loader +* Write benchmark suite. + +* OPTIMIZE! + + + Fast path common cases. + + - Absolute name from sys.path. + - Relative name from sys.path. + * Bootstrap importlib as implementation of builtins.__import__ From buildbot at python.org Sun Feb 1 06:56:45 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 05:56:45 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090201055645.E43B81E400C@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/212 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 07:07:57 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 1 Feb 2009 07:07:57 +0100 (CET) Subject: [Python-checkins] r69179 - python/branches/py3k/Lib/importlib/_bootstrap.py Message-ID: <20090201060757.B8FE21E4002@bag.python.org> Author: brett.cannon Date: Sun Feb 1 07:07:57 2009 New Revision: 69179 Log: Simplify write_bytecode for importlib. Modified: python/branches/py3k/Lib/importlib/_bootstrap.py Modified: python/branches/py3k/Lib/importlib/_bootstrap.py ============================================================================== --- python/branches/py3k/Lib/importlib/_bootstrap.py (original) +++ python/branches/py3k/Lib/importlib/_bootstrap.py Sun Feb 1 07:07:57 2009 @@ -403,9 +403,8 @@ return open(source_path, encoding=encoding).read() @check_name - def write_bytecode(self, name, magic, timestamp, data): - """Write out 'data' for the specified module using the specific - timestamp, returning a boolean + def write_bytecode(self, name, data): + """Write out 'data' for the specified module, returning a boolean signifying if the write-out actually occurred. Raises ImportError (just like get_source) if the specified module @@ -418,8 +417,6 @@ file = _fileio._FileIO(bytecode_path, 'w') try: with closing(file) as bytecode_file: - bytecode_file.write(magic) - bytecode_file.write(marshal._w_long(timestamp)) bytecode_file.write(data) return True except IOError as exc: @@ -430,29 +427,7 @@ @check_name def get_code(self, name): - """Return the code object for the module. - - 'self' must implement: - - * read_bytecode(name:str) -> (int, int, bytes) or None - Return the magic number, timestamp, and bytecode for the - module. None is returned if not bytecode is available. - - * source_mtime(name:str) -> int - Return the last modification time for the source of the module. - Returns None if their is no source. - - * read_source(name:str) -> (bytes, str) - Return the source code for the module and the path to use in - the call to 'compile'. Not called if source_mtime returned - None. - - * write_bytecode(name:str, magic:bytes, timestamp:int, data:str) - Write out bytecode for the module with the specified magic - number and timestamp. Not called if sys.dont_write_bytecode is - True. - - """ + """Return the code object for the module.""" # XXX Care enough to make sure this call does not happen if the magic # number is bad? source_timestamp = self.source_mtime(name) @@ -507,8 +482,10 @@ code_object = compile(source, source_path, 'exec', dont_inherit=True) # Generate bytecode and write it out. if not sys.dont_write_bytecode: - data = marshal.dumps(code_object) - self.write_bytecode(name, imp.get_magic(), source_timestamp, data) + data = bytearray(imp.get_magic()) + data.extend(marshal._w_long(source_timestamp)) + data.extend(marshal.dumps(code_object)) + self.write_bytecode(name, data) return code_object def get_data(self, path): From python-checkins at python.org Sun Feb 1 07:14:11 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 1 Feb 2009 07:14:11 +0100 (CET) Subject: [Python-checkins] r69180 - in sandbox/trunk/dbm_sqlite/alt: dbsqlite.py time_sqlite.py Message-ID: <20090201061411.424A21E4002@bag.python.org> Author: raymond.hettinger Date: Sun Feb 1 07:14:11 2009 New Revision: 69180 Log: Timings show PRIMARY KEY eliminated need for separate index and there is no cost to ORDER BY ROWID. Modified: sandbox/trunk/dbm_sqlite/alt/dbsqlite.py sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Modified: sandbox/trunk/dbm_sqlite/alt/dbsqlite.py ============================================================================== --- sandbox/trunk/dbm_sqlite/alt/dbsqlite.py (original) +++ sandbox/trunk/dbm_sqlite/alt/dbsqlite.py Sun Feb 1 07:14:11 2009 @@ -30,8 +30,7 @@ # w -- open existing # r -- readonly - MAKE_SHELF = 'CREATE TABLE IF NOT EXISTS shelf (key TEXT NOT NULL, value TEXT NOT NULL)' - MAKE_INDEX = 'CREATE UNIQUE INDEX IF NOT EXISTS keyndx ON shelf (key)' + MAKE_SHELF = 'CREATE TABLE IF NOT EXISTS shelf (key TEXT PRIMARY KEY, value TEXT NOT NULL)' self.conn = sqlite3.connect(filename) self.conn.text_factory = bytes self.conn.execute(MAKE_SHELF) @@ -108,7 +107,7 @@ class SQLhashKeysView(collections.KeysView, ListRepr): def __iter__(self): - GET_KEYS = 'SELECT key FROM shelf ORDER BY ROWID' # ??? does order by result in diff opcodes + GET_KEYS = 'SELECT key FROM shelf ORDER BY ROWID' return map(itemgetter(0), self._mapping.conn.cursor().execute(GET_KEYS)) class SQLhashValuesView(collections.ValuesView, ListRepr): Modified: sandbox/trunk/dbm_sqlite/alt/time_sqlite.py ============================================================================== --- sandbox/trunk/dbm_sqlite/alt/time_sqlite.py (original) +++ sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Sun Feb 1 07:14:11 2009 @@ -25,6 +25,13 @@ Cost and effects of vacuuming. BLOB vs TEXT +----------------------------------------------------------------- +no diff twixt "select *" and "select k,v" # prefer latter for specificity +no diff twixt "select *" and "select * by rowid" # prefer latter for specificity +no diff for "select *" whether unindexed, primary key, and indexed +? do those results hold after fragmenting +"order by key" is twice as slow as unordered, even with indexing +effect of "primary key" and a unique index is the same ''' from random import * @@ -33,15 +40,15 @@ import os from time import clock -MAKE_shelf = ('''\ +MAKE_shelf = (''' DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; CREATE TABLE IF NOT EXISTS shelf (key TEXT NOT NULL, value TEXT NOT NULL); ''', 'UNINDEXED') -MAKE_shelf_PRIMARY = ('''\ +MAKE_shelf_PRIMARY = (''' DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; CREATE TABLE IF NOT EXISTS shelf (key PRIMARY KEY, value TEXT NOT NULL); ''', 'PRIMARY') -MAKE_shelf_UNIQUE = ('''\ +MAKE_shelf_UNIQUE = (''' DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; CREATE TABLE IF NOT EXISTS shelf (key TEXT NOT NULL, value TEXT NOT NULL); CREATE UNIQUE INDEX IF NOT EXISTS keyndx ON shelf (key); From martin at v.loewis.de Sun Feb 1 07:23:49 2009 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun, 01 Feb 2009 07:23:49 +0100 Subject: [Python-checkins] r69160 - python/branches/release26-maint/Doc/library/binascii.rst In-Reply-To: <20090201001942.699281E4002@bag.python.org> References: <20090201001942.699281E4002@bag.python.org> Message-ID: <49853FF5.4080804@v.loewis.de> gregory.p.smith wrote: > Author: gregory.p.smith > Date: Sun Feb 1 01:19:42 2009 > New Revision: 69160 > > Log: > #documentation update for issue4903 - > svn merge -c68535 http://svn.python.org/projects/python/trunk > svn merge -c69159 http://svn.python.org/projects/python/trunk > > > Modified: > python/branches/release26-maint/Doc/library/binascii.rst Why didn't you use svnmerge.py for that? Regards, Martin From buildbot at python.org Sun Feb 1 07:32:18 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 06:32:18 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.x Message-ID: <20090201063219.0B73E1E4002@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.x/builds/199 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 08:22:44 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 07:22:44 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090201072244.7ADA01E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/214 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_distutils test_posix test_subprocess ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_subprocess.py", line 149, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 08:23:37 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 07:23:37 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.x Message-ID: <20090201072337.4A96D1E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.x/builds/231 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From ncoghlan at gmail.com Sun Feb 1 08:33:58 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 01 Feb 2009 17:33:58 +1000 Subject: [Python-checkins] r69167 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py test/frozen/test_loader.py In-Reply-To: <20090201013414.2FEB41E4002@bag.python.org> References: <20090201013414.2FEB41E4002@bag.python.org> Message-ID: <49855066.60507@gmail.com> brett.cannon wrote: > + elif '.' in module.__name__: > + module.__package__ = module.__name__.rsplit('.', 1)[0] 1. When determining a package name, rpartition is your friend (see the relevant code in runpy.py) 2. It's OK to set __package__ even in a top-level module (just set it to the empty string). That is why rpartition works so well for the application. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From buildbot at python.org Sun Feb 1 09:53:51 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 08:53:51 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20090201085352.1EC741E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1837 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,david.goodger,gregory.p.smith,guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 21, in test01_badpointer dbs = dbshelve.open(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 106, in open d.open(filename, dbname, filetype, flags, mode) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 171, in open self.db.open(*args, **kwargs) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 37, in test03_repr_closed_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test04_repr_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 43, in test04_repr_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test05_double_free_make_key_dbt (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 65, in test05_double_free_make_key_dbt db.DB_CREATE | db.DB_THREAD) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test06_key_with_null_bytes (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 77, in test06_key_with_null_bytes db1.open(self.filename, None, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test07_DB_set_flags_persists (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 101, in test07_DB_set_flags_persists db1.open(self.filename, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') sincerely, -The Buildbot From nnorwitz at gmail.com Sun Feb 1 11:26:34 2009 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 1 Feb 2009 05:26:34 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20090201102634.GA18277@python.psfb.org> More important issues: ---------------------- test_poplib leaked [-203, 0, 0] references, sum=-203 Less important issues: ---------------------- test_asynchat leaked [0, 118, -118] references, sum=0 test_cmd_line leaked [25, -25, 25] references, sum=25 test_smtplib leaked [0, 0, -1] references, sum=-1 test_socketserver leaked [0, 0, 82] references, sum=82 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From brett at python.org Sun Feb 1 11:28:36 2009 From: brett at python.org (Brett Cannon) Date: Sun, 1 Feb 2009 02:28:36 -0800 Subject: [Python-checkins] r69167 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py test/frozen/test_loader.py In-Reply-To: <49855066.60507@gmail.com> References: <20090201013414.2FEB41E4002@bag.python.org> <49855066.60507@gmail.com> Message-ID: On Sat, Jan 31, 2009 at 23:33, Nick Coghlan wrote: > brett.cannon wrote: >> + elif '.' in module.__name__: >> + module.__package__ = module.__name__.rsplit('.', 1)[0] > > 1. When determining a package name, rpartition is your friend (see the > relevant code in runpy.py) > I guess I could, but the semantics are the same. Although I see you hard-coded using rpartition in PEP 366. =) > 2. It's OK to set __package__ even in a top-level module (just set it to > the empty string). That is why rpartition works so well for the application. The PEP doesn't say that, although I guess your ``__name__.rpartition('.')[0]`` line makes that implicit. Could you edit the PEP to mention that the empty string is okay? -Brett From python-checkins at python.org Sun Feb 1 11:28:51 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 11:28:51 +0100 (CET) Subject: [Python-checkins] r69181 - in python/branches/py3k: Lib/test/test_descr.py Lib/test/test_funcattrs.py Lib/test/test_parser.py Modules/_csv.c Modules/_elementtree.c Modules/_localemodule.c Modules/_pickle.c Modules/_tkinter.c Modules/parsermodule.c Modules/pyexpat.c Objects/cellobject.c Objects/descrobject.c Objects/rangeobject.c Objects/setobject.c PC/winreg.c Message-ID: <20090201102851.B10AB1E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 11:28:51 2009 New Revision: 69181 Log: Issue #1717, stage 2: remove uses of tp_compare in Modules and most Objects. Modified: python/branches/py3k/Lib/test/test_descr.py python/branches/py3k/Lib/test/test_funcattrs.py python/branches/py3k/Lib/test/test_parser.py python/branches/py3k/Modules/_csv.c python/branches/py3k/Modules/_elementtree.c python/branches/py3k/Modules/_localemodule.c python/branches/py3k/Modules/_pickle.c python/branches/py3k/Modules/_tkinter.c python/branches/py3k/Modules/parsermodule.c python/branches/py3k/Modules/pyexpat.c python/branches/py3k/Objects/cellobject.c python/branches/py3k/Objects/descrobject.c python/branches/py3k/Objects/rangeobject.c python/branches/py3k/Objects/setobject.c python/branches/py3k/PC/winreg.c Modified: python/branches/py3k/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k/Lib/test/test_descr.py (original) +++ python/branches/py3k/Lib/test/test_descr.py Sun Feb 1 11:28:51 2009 @@ -3885,7 +3885,7 @@ # Testing method-wrapper objects... # did not support any reflection before 2.5 - return # XXX should methods really support __eq__? + # XXX should methods really support __eq__? l = [] self.assertEqual(l.__add__, l.__add__) Modified: python/branches/py3k/Lib/test/test_funcattrs.py ============================================================================== --- python/branches/py3k/Lib/test/test_funcattrs.py (original) +++ python/branches/py3k/Lib/test/test_funcattrs.py Sun Feb 1 11:28:51 2009 @@ -224,10 +224,41 @@ del self.b.__doc__ self.assertEqual(self.b.__doc__, None) +def cell(value): + """Create a cell containing the given value.""" + def f(): + print(a) + a = value + return f.__closure__[0] + +def empty_cell(empty=True): + """Create an empty cell.""" + def f(): + print(a) + # the intent of the following line is simply "if False:"; it's + # spelt this way to avoid the danger that a future optimization + # might simply remove an "if False:" code block. + if not empty: + a = 1729 + return f.__closure__[0] + +class CellTest(unittest.TestCase): + def test_comparison(self): + # These tests are here simply to exercise the comparison code; + # their presence should not be interpreted as providing any + # guarantees about the semantics (or even existence) of cell + # comparisons in future versions of CPython. + self.assert_(cell(2) < cell(3)) + self.assert_(empty_cell() < cell('saturday')) + self.assert_(empty_cell() == empty_cell()) + self.assert_(cell(-36) == cell(-36.0)) + self.assert_(cell(True) > empty_cell()) + + def test_main(): support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, ArbitraryFunctionAttrTest, FunctionDictsTest, - FunctionDocstringTest) + FunctionDocstringTest, CellTest) if __name__ == "__main__": test_main() Modified: python/branches/py3k/Lib/test/test_parser.py ============================================================================== --- python/branches/py3k/Lib/test/test_parser.py (original) +++ python/branches/py3k/Lib/test/test_parser.py Sun Feb 1 11:28:51 2009 @@ -2,6 +2,7 @@ import os import unittest import sys +import operator from test import support # @@ -496,12 +497,81 @@ file=sys.stderr) self.assertRaises(MemoryError, parser.expr, e) +class STObjectTestCase(unittest.TestCase): + """Test operations on ST objects themselves""" + + def test_comparisons(self): + # ST objects should support order and equality comparisons + st1 = parser.expr('2 + 3') + st2 = parser.suite('x = 2; y = x + 3') + st3 = parser.expr('list(x**3 for x in range(20))') + st1_copy = parser.expr('2 + 3') + st2_copy = parser.suite('x = 2; y = x + 3') + st3_copy = parser.expr('list(x**3 for x in range(20))') + + # exercise fast path for object identity + self.assertEquals(st1 == st1, True) + self.assertEquals(st2 == st2, True) + self.assertEquals(st3 == st3, True) + # slow path equality + self.assertEqual(st1, st1_copy) + self.assertEqual(st2, st2_copy) + self.assertEqual(st3, st3_copy) + self.assertEquals(st1 == st2, False) + self.assertEquals(st1 == st3, False) + self.assertEquals(st2 == st3, False) + self.assertEquals(st1 != st1, False) + self.assertEquals(st2 != st2, False) + self.assertEquals(st3 != st3, False) + self.assertEquals(st1 != st1_copy, False) + self.assertEquals(st2 != st2_copy, False) + self.assertEquals(st3 != st3_copy, False) + self.assertEquals(st2 != st1, True) + self.assertEquals(st1 != st3, True) + self.assertEquals(st3 != st2, True) + # we don't particularly care what the ordering is; just that + # it's usable and self-consistent + self.assertEquals(st1 < st2, not (st2 <= st1)) + self.assertEquals(st1 < st3, not (st3 <= st1)) + self.assertEquals(st2 < st3, not (st3 <= st2)) + self.assertEquals(st1 < st2, st2 > st1) + self.assertEquals(st1 < st3, st3 > st1) + self.assertEquals(st2 < st3, st3 > st2) + self.assertEquals(st1 <= st2, st2 >= st1) + self.assertEquals(st3 <= st1, st1 >= st3) + self.assertEquals(st2 <= st3, st3 >= st2) + # transitivity + bottom = min(st1, st2, st3) + top = max(st1, st2, st3) + mid = sorted([st1, st2, st3])[1] + self.assert_(bottom < mid) + self.assert_(bottom < top) + self.assert_(mid < top) + self.assert_(bottom <= mid) + self.assert_(bottom <= top) + self.assert_(mid <= top) + self.assert_(bottom <= bottom) + self.assert_(mid <= mid) + self.assert_(top <= top) + # interaction with other types + self.assertEquals(st1 == 1588.602459, False) + self.assertEquals('spanish armada' != st2, True) + self.assertRaises(TypeError, operator.ge, st3, None) + self.assertRaises(TypeError, operator.le, False, st1) + self.assertRaises(TypeError, operator.lt, st1, 1815) + self.assertRaises(TypeError, operator.gt, b'waterloo', st2) + + + # XXX tests for pickling and unpickling of ST objects should go here + + def test_main(): support.run_unittest( RoundtripLegalSyntaxTestCase, IllegalSyntaxTestCase, CompileTestCase, ParserStackLimitTestCase, + STObjectTestCase, ) Modified: python/branches/py3k/Modules/_csv.c ============================================================================== --- python/branches/py3k/Modules/_csv.c (original) +++ python/branches/py3k/Modules/_csv.c Sun Feb 1 11:28:51 2009 @@ -443,7 +443,7 @@ (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -864,7 +864,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1286,7 +1286,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Modified: python/branches/py3k/Modules/_elementtree.c ============================================================================== --- python/branches/py3k/Modules/_elementtree.c (original) +++ python/branches/py3k/Modules/_elementtree.c Sun Feb 1 11:28:51 2009 @@ -761,7 +761,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { Py_INCREF(item); return item; } @@ -792,7 +792,8 @@ for (i = 0; i < self->extra->length; i++) { ElementObject* item = (ElementObject*) self->extra->children[i]; - if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { + if (Element_CheckExact(item) && (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) { + PyObject* text = element_get_text(item); if (text == Py_None) return PyBytes_FromString(""); @@ -830,7 +831,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { if (PyList_Append(out, item) < 0) { Py_DECREF(out); return NULL; @@ -1102,7 +1103,7 @@ for (i = 0; i < self->extra->length; i++) { if (self->extra->children[i] == element) break; - if (PyObject_Compare(self->extra->children[i], element) == 0) + if (PyObject_RichCompareBool(self->extra->children[i], element, Py_EQ) == 1) break; } Modified: python/branches/py3k/Modules/_localemodule.c ============================================================================== --- python/branches/py3k/Modules/_localemodule.c (original) +++ python/branches/py3k/Modules/_localemodule.c Sun Feb 1 11:28:51 2009 @@ -272,7 +272,9 @@ #ifdef HAVE_WCSXFRM PyDoc_STRVAR(strxfrm__doc__, -"string -> string. Returns a string that behaves for cmp locale-aware."); +"strxfrm(string) -> string.\n\ +\n\ +Return a string that can be used as a key for locale-aware comparisons."); static PyObject* PyLocale_strxfrm(PyObject* self, PyObject* args) Modified: python/branches/py3k/Modules/_pickle.c ============================================================================== --- python/branches/py3k/Modules/_pickle.c (original) +++ python/branches/py3k/Modules/_pickle.c Sun Feb 1 11:28:51 2009 @@ -715,7 +715,7 @@ i = 0; module_name = NULL; while ((j = PyDict_Next(modules_dict, &i, &module_name, &module))) { - if (PyObject_Compare(module_name, main_str) == 0) + if (PyObject_RichCompareBool(module_name, main_str, Py_EQ) == 1) continue; obj = PyObject_GetAttr(module, global_name); Modified: python/branches/py3k/Modules/_tkinter.c ============================================================================== --- python/branches/py3k/Modules/_tkinter.c (original) +++ python/branches/py3k/Modules/_tkinter.c Sun Feb 1 11:28:51 2009 @@ -788,15 +788,59 @@ self->value->typePtr->name, self->value); } -static int -PyTclObject_cmp(PyTclObject *self, PyTclObject *other) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +PyTclObject_richcompare(PyObject *self, PyObject *other, int op) { - int res; - res = strcmp(Tcl_GetString(self->value), - Tcl_GetString(other->value)); - if (res < 0) return -1; - if (res > 0) return 1; - return 0; + int result; + PyObject *v; + + /* neither argument should be NULL, unless something's gone wrong */ + if (self == NULL || other == NULL) { + PyErr_BadInternalCall(); + return NULL; + } + + /* both arguments should be instances of PyTclObject */ + if (!PyTclObject_Check(self) || !PyTclObject_Check(other)) { + v = Py_NotImplemented; + goto finished; + } + + if (self == other) + /* fast path when self and other are identical */ + result = 0; + else + result = strcmp(Tcl_GetString(((PyTclObject *)self)->value), + Tcl_GetString(((PyTclObject *)other)->value)); + /* Convert return value to a Boolean */ + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + finished: + Py_INCREF(v); + return v; } PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type"); @@ -818,45 +862,45 @@ static PyTypeObject PyTclObject_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_tkinter.Tcl_Obj", /*tp_name*/ - sizeof(PyTclObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ + sizeof(PyTclObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ /* methods */ - (destructor)PyTclObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - (cmpfunc)PyTclObject_cmp, /*tp_compare*/ + (destructor)PyTclObject_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - (reprfunc)PyTclObject_str, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - PyTclObject_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + (reprfunc)PyTclObject_str, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + PyTclObject_richcompare, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + PyTclObject_getsetlist, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ }; static Tcl_Obj* Modified: python/branches/py3k/Modules/parsermodule.c ============================================================================== --- python/branches/py3k/Modules/parsermodule.c (original) +++ python/branches/py3k/Modules/parsermodule.c Sun Feb 1 11:28:51 2009 @@ -169,7 +169,7 @@ static void parser_free(PyST_Object *st); -static int parser_compare(PyST_Object *left, PyST_Object *right); +static PyObject* parser_richcompare(PyObject *left, PyObject *right, int op); static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *); static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *); static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *); @@ -203,7 +203,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)parser_compare, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -223,7 +223,7 @@ "Intermediate representation of a Python parse tree.", 0, /* tp_traverse */ 0, /* tp_clear */ - 0, /* tp_richcompare */ + parser_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ @@ -231,6 +231,9 @@ }; /* PyST_Type */ +/* PyST_Type isn't subclassable, so just check ob_type */ +#define PyST_Object_Check(v) ((v)->ob_type == &PyST_Type) + static int parser_compare_nodes(node *left, node *right) { @@ -260,26 +263,69 @@ return (0); } - -/* int parser_compare(PyST_Object* left, PyST_Object* right) +/* parser_richcompare(PyObject* left, PyObject* right, int op) * * Comparison function used by the Python operators ==, !=, <, >, <=, >= * This really just wraps a call to parser_compare_nodes() with some easy * checks and protection code. * */ -static int -parser_compare(PyST_Object *left, PyST_Object *right) + +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +parser_richcompare(PyObject *left, PyObject *right, int op) { - if (left == right) - return (0); + int result; + PyObject *v; - if ((left == 0) || (right == 0)) - return (-1); + /* neither argument should be NULL, unless something's gone wrong */ + if (left == NULL || right == NULL) { + PyErr_BadInternalCall(); + return NULL; + } - return (parser_compare_nodes(left->st_node, right->st_node)); -} + /* both arguments should be instances of PyST_Object */ + if (!PyST_Object_Check(left) || !PyST_Object_Check(right)) { + v = Py_NotImplemented; + goto finished; + } + if (left == right) + /* if arguments are identical, they're equal */ + result = 0; + else + result = parser_compare_nodes(((PyST_Object *)left)->st_node, + ((PyST_Object *)right)->st_node); + + /* Convert return value to a Boolean */ + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + finished: + Py_INCREF(v); + return v; +} /* parser_newstobject(node* st) * Modified: python/branches/py3k/Modules/pyexpat.c ============================================================================== --- python/branches/py3k/Modules/pyexpat.c (original) +++ python/branches/py3k/Modules/pyexpat.c Sun Feb 1 11:28:51 2009 @@ -1622,7 +1622,7 @@ (printfunc)0, /*tp_print*/ 0, /*tp_getattr*/ (setattrfunc)xmlparse_setattr, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Modified: python/branches/py3k/Objects/cellobject.c ============================================================================== --- python/branches/py3k/Objects/cellobject.c (original) +++ python/branches/py3k/Objects/cellobject.c Sun Feb 1 11:28:51 2009 @@ -51,16 +51,56 @@ PyObject_GC_Del(op); } -static int -cell_compare(PyCellObject *a, PyCellObject *b) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +cell_richcompare(PyObject *a, PyObject *b, int op) { - if (a->ob_ref == NULL) { - if (b->ob_ref == NULL) - return 0; - return -1; - } else if (b->ob_ref == NULL) - return 1; - return PyObject_Compare(a->ob_ref, b->ob_ref); + int result; + PyObject *v; + + /* neither argument should be NULL, unless something's gone wrong */ + assert(a != NULL && b != NULL); + + /* both arguments should be instances of PyCellObject */ + if (!PyCell_Check(a) || !PyCell_Check(b)) { + v = Py_NotImplemented; + Py_INCREF(v); + return v; + } + + /* compare cells by contents; empty cells come before anything else */ + a = ((PyCellObject *)a)->ob_ref; + b = ((PyCellObject *)b)->ob_ref; + if (a != NULL && b != NULL) + return PyObject_RichCompare(a, b, op); + + result = (b == NULL) - (a == NULL); + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + Py_INCREF(v); + return v; } static PyObject * @@ -114,7 +154,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)cell_compare, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)cell_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -129,7 +169,7 @@ 0, /* tp_doc */ (traverseproc)cell_traverse, /* tp_traverse */ (inquiry)cell_clear, /* tp_clear */ - 0, /* tp_richcompare */ + cell_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Modified: python/branches/py3k/Objects/descrobject.c ============================================================================== --- python/branches/py3k/Objects/descrobject.c (original) +++ python/branches/py3k/Objects/descrobject.c Sun Feb 1 11:28:51 2009 @@ -774,12 +774,6 @@ return 0; } -static int -proxy_compare(proxyobject *v, PyObject *w) -{ - return PyObject_Compare(v->dict, w); -} - static PyObject * proxy_richcompare(proxyobject *v, PyObject *w, int op) { @@ -796,7 +790,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)proxy_compare, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ @@ -844,12 +838,17 @@ /* This has no reason to be in this file except that adding new files is a bit of a pain */ +/* forward */ +static PyTypeObject wrappertype; + typedef struct { PyObject_HEAD PyWrapperDescrObject *descr; PyObject *self; } wrapperobject; +#define Wrapper_Check(v) (Py_TYPE(v) == &wrappertype) + static void wrapper_dealloc(wrapperobject *wp) { @@ -861,13 +860,60 @@ Py_TRASHCAN_SAFE_END(wp) } -static int -wrapper_compare(wrapperobject *a, wrapperobject *b) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +wrapper_richcompare(PyObject *a, PyObject *b, int op) { - if (a->descr == b->descr) - return PyObject_Compare(a->self, b->self); - else - return (a->descr < b->descr) ? -1 : 1; + int result; + PyObject *v; + PyWrapperDescrObject *a_descr, *b_descr; + + assert(a != NULL && b != NULL); + + /* both arguments should be wrapperobjects */ + if (!Wrapper_Check(a) || !Wrapper_Check(b)) { + v = Py_NotImplemented; + Py_INCREF(v); + return v; + } + + /* compare by descriptor address; if the descriptors are the same, + compare by the objects they're bound to */ + a_descr = ((wrapperobject *)a)->descr; + b_descr = ((wrapperobject *)b)->descr; + if (a_descr == b_descr) { + a = ((wrapperobject *)a)->self; + b = ((wrapperobject *)b)->self; + return PyObject_RichCompare(a, b, op); + } + + result = a_descr - b_descr; + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + Py_INCREF(v); + return v; } static long @@ -977,7 +1023,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)wrapper_compare, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)wrapper_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -992,7 +1038,7 @@ 0, /* tp_doc */ wrapper_traverse, /* tp_traverse */ 0, /* tp_clear */ - 0, /* tp_richcompare */ + wrapper_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Sun Feb 1 11:28:51 2009 @@ -123,7 +123,7 @@ Algorithm is equal to that of get_len_of_range(), but it operates on PyObjects (which are assumed to be PyLong or PyInt objects). ---------------------------------------------------------------*/ - int cmp_result, cmp_call; + int cmp_result; PyObject *lo, *hi; PyObject *step = NULL; PyObject *diff = NULL; @@ -134,13 +134,12 @@ PyObject *zero = PyLong_FromLong(0); if (zero == NULL) return NULL; - cmp_call = PyObject_Cmp(r->step, zero, &cmp_result); + cmp_result = PyObject_RichCompareBool(r->step, zero, Py_GT); Py_DECREF(zero); - if (cmp_call == -1) + if (cmp_result == -1) return NULL; - assert(cmp_result != 0); - if (cmp_result > 0) { + if (cmp_result == 1) { lo = r->start; hi = r->stop; step = r->step; @@ -154,7 +153,7 @@ } /* if (lo >= hi), return length of 0. */ - if (PyObject_Compare(lo, hi) >= 0) { + if (PyObject_RichCompareBool(lo, hi, Py_GE) == 1) { Py_XDECREF(step); return PyLong_FromLong(0); } Modified: python/branches/py3k/Objects/setobject.c ============================================================================== --- python/branches/py3k/Objects/setobject.c (original) +++ python/branches/py3k/Objects/setobject.c Sun Feb 1 11:28:51 2009 @@ -1824,13 +1824,6 @@ return Py_NotImplemented; } -static int -set_nocmp(PyObject *self, PyObject *other) -{ - PyErr_SetString(PyExc_TypeError, "cannot compare sets using cmp()"); - return -1; -} - static PyObject * set_add(PySetObject *so, PyObject *key) { @@ -2111,7 +2104,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)set_repr, /* tp_repr */ &set_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ @@ -2208,7 +2201,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)set_repr, /* tp_repr */ &frozenset_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ Modified: python/branches/py3k/PC/winreg.c ============================================================================== --- python/branches/py3k/PC/winreg.c (original) +++ python/branches/py3k/PC/winreg.c Sun Feb 1 11:28:51 2009 @@ -326,7 +326,7 @@ "Operations:\n" "__bool__ - Handles with an open object return true, otherwise false.\n" "__int__ - Converting a handle to an integer returns the Win32 handle.\n" -"__cmp__ - Handle objects are compared using the handle value."); +"rich comparison - Handle objects are compared using the handle value."); PyDoc_STRVAR(PyHKEY_Close_doc, @@ -485,7 +485,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - PyHKEY_compareFunc, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ &PyHKEY_NumberMethods, /* tp_as_number */ 0, /* tp_as_sequence */ From python-checkins at python.org Sun Feb 1 11:41:18 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 11:41:18 +0100 (CET) Subject: [Python-checkins] r69182 - in python/branches/release30-maint: Lib/test/test_descr.py Lib/test/test_funcattrs.py Lib/test/test_parser.py Modules/_csv.c Modules/_elementtree.c Modules/_localemodule.c Modules/_pickle.c Modules/_tkinter.c Modules/parsermodule.c Modules/pyexpat.c Objects/cellobject.c Objects/descrobject.c Objects/rangeobject.c Objects/setobject.c PC/winreg.c Message-ID: <20090201104118.B00891E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 11:41:18 2009 New Revision: 69182 Log: Merged revisions 69181 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69181 | mark.dickinson | 2009-02-01 10:28:51 +0000 (Sun, 01 Feb 2009) | 3 lines Issue #1717, stage 2: remove uses of tp_compare in Modules and most Objects. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/test/test_descr.py python/branches/release30-maint/Lib/test/test_funcattrs.py python/branches/release30-maint/Lib/test/test_parser.py python/branches/release30-maint/Modules/_csv.c python/branches/release30-maint/Modules/_elementtree.c python/branches/release30-maint/Modules/_localemodule.c python/branches/release30-maint/Modules/_pickle.c python/branches/release30-maint/Modules/_tkinter.c python/branches/release30-maint/Modules/parsermodule.c python/branches/release30-maint/Modules/pyexpat.c python/branches/release30-maint/Objects/cellobject.c python/branches/release30-maint/Objects/descrobject.c python/branches/release30-maint/Objects/rangeobject.c python/branches/release30-maint/Objects/setobject.c python/branches/release30-maint/PC/winreg.c Modified: python/branches/release30-maint/Lib/test/test_descr.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_descr.py (original) +++ python/branches/release30-maint/Lib/test/test_descr.py Sun Feb 1 11:41:18 2009 @@ -3885,7 +3885,7 @@ # Testing method-wrapper objects... # did not support any reflection before 2.5 - return # XXX should methods really support __eq__? + # XXX should methods really support __eq__? l = [] self.assertEqual(l.__add__, l.__add__) Modified: python/branches/release30-maint/Lib/test/test_funcattrs.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_funcattrs.py (original) +++ python/branches/release30-maint/Lib/test/test_funcattrs.py Sun Feb 1 11:41:18 2009 @@ -224,10 +224,41 @@ del self.b.__doc__ self.assertEqual(self.b.__doc__, None) +def cell(value): + """Create a cell containing the given value.""" + def f(): + print(a) + a = value + return f.__closure__[0] + +def empty_cell(empty=True): + """Create an empty cell.""" + def f(): + print(a) + # the intent of the following line is simply "if False:"; it's + # spelt this way to avoid the danger that a future optimization + # might simply remove an "if False:" code block. + if not empty: + a = 1729 + return f.__closure__[0] + +class CellTest(unittest.TestCase): + def test_comparison(self): + # These tests are here simply to exercise the comparison code; + # their presence should not be interpreted as providing any + # guarantees about the semantics (or even existence) of cell + # comparisons in future versions of CPython. + self.assert_(cell(2) < cell(3)) + self.assert_(empty_cell() < cell('saturday')) + self.assert_(empty_cell() == empty_cell()) + self.assert_(cell(-36) == cell(-36.0)) + self.assert_(cell(True) > empty_cell()) + + def test_main(): support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, ArbitraryFunctionAttrTest, FunctionDictsTest, - FunctionDocstringTest) + FunctionDocstringTest, CellTest) if __name__ == "__main__": test_main() Modified: python/branches/release30-maint/Lib/test/test_parser.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_parser.py (original) +++ python/branches/release30-maint/Lib/test/test_parser.py Sun Feb 1 11:41:18 2009 @@ -2,6 +2,7 @@ import os import unittest import sys +import operator from test import support # @@ -496,12 +497,81 @@ file=sys.stderr) self.assertRaises(MemoryError, parser.expr, e) +class STObjectTestCase(unittest.TestCase): + """Test operations on ST objects themselves""" + + def test_comparisons(self): + # ST objects should support order and equality comparisons + st1 = parser.expr('2 + 3') + st2 = parser.suite('x = 2; y = x + 3') + st3 = parser.expr('list(x**3 for x in range(20))') + st1_copy = parser.expr('2 + 3') + st2_copy = parser.suite('x = 2; y = x + 3') + st3_copy = parser.expr('list(x**3 for x in range(20))') + + # exercise fast path for object identity + self.assertEquals(st1 == st1, True) + self.assertEquals(st2 == st2, True) + self.assertEquals(st3 == st3, True) + # slow path equality + self.assertEqual(st1, st1_copy) + self.assertEqual(st2, st2_copy) + self.assertEqual(st3, st3_copy) + self.assertEquals(st1 == st2, False) + self.assertEquals(st1 == st3, False) + self.assertEquals(st2 == st3, False) + self.assertEquals(st1 != st1, False) + self.assertEquals(st2 != st2, False) + self.assertEquals(st3 != st3, False) + self.assertEquals(st1 != st1_copy, False) + self.assertEquals(st2 != st2_copy, False) + self.assertEquals(st3 != st3_copy, False) + self.assertEquals(st2 != st1, True) + self.assertEquals(st1 != st3, True) + self.assertEquals(st3 != st2, True) + # we don't particularly care what the ordering is; just that + # it's usable and self-consistent + self.assertEquals(st1 < st2, not (st2 <= st1)) + self.assertEquals(st1 < st3, not (st3 <= st1)) + self.assertEquals(st2 < st3, not (st3 <= st2)) + self.assertEquals(st1 < st2, st2 > st1) + self.assertEquals(st1 < st3, st3 > st1) + self.assertEquals(st2 < st3, st3 > st2) + self.assertEquals(st1 <= st2, st2 >= st1) + self.assertEquals(st3 <= st1, st1 >= st3) + self.assertEquals(st2 <= st3, st3 >= st2) + # transitivity + bottom = min(st1, st2, st3) + top = max(st1, st2, st3) + mid = sorted([st1, st2, st3])[1] + self.assert_(bottom < mid) + self.assert_(bottom < top) + self.assert_(mid < top) + self.assert_(bottom <= mid) + self.assert_(bottom <= top) + self.assert_(mid <= top) + self.assert_(bottom <= bottom) + self.assert_(mid <= mid) + self.assert_(top <= top) + # interaction with other types + self.assertEquals(st1 == 1588.602459, False) + self.assertEquals('spanish armada' != st2, True) + self.assertRaises(TypeError, operator.ge, st3, None) + self.assertRaises(TypeError, operator.le, False, st1) + self.assertRaises(TypeError, operator.lt, st1, 1815) + self.assertRaises(TypeError, operator.gt, b'waterloo', st2) + + + # XXX tests for pickling and unpickling of ST objects should go here + + def test_main(): support.run_unittest( RoundtripLegalSyntaxTestCase, IllegalSyntaxTestCase, CompileTestCase, ParserStackLimitTestCase, + STObjectTestCase, ) Modified: python/branches/release30-maint/Modules/_csv.c ============================================================================== --- python/branches/release30-maint/Modules/_csv.c (original) +++ python/branches/release30-maint/Modules/_csv.c Sun Feb 1 11:41:18 2009 @@ -443,7 +443,7 @@ (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -864,7 +864,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -1286,7 +1286,7 @@ (printfunc)0, /*tp_print*/ (getattrfunc)0, /*tp_getattr*/ (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Modified: python/branches/release30-maint/Modules/_elementtree.c ============================================================================== --- python/branches/release30-maint/Modules/_elementtree.c (original) +++ python/branches/release30-maint/Modules/_elementtree.c Sun Feb 1 11:41:18 2009 @@ -761,7 +761,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { Py_INCREF(item); return item; } @@ -792,7 +792,8 @@ for (i = 0; i < self->extra->length; i++) { ElementObject* item = (ElementObject*) self->extra->children[i]; - if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { + if (Element_CheckExact(item) && (PyObject_RichCompareBool(item->tag, tag, Py_EQ) == 1)) { + PyObject* text = element_get_text(item); if (text == Py_None) return PyBytes_FromString(""); @@ -830,7 +831,7 @@ for (i = 0; i < self->extra->length; i++) { PyObject* item = self->extra->children[i]; if (Element_CheckExact(item) && - PyObject_Compare(((ElementObject*)item)->tag, tag) == 0) { + PyObject_RichCompareBool(((ElementObject*)item)->tag, tag, Py_EQ) == 1) { if (PyList_Append(out, item) < 0) { Py_DECREF(out); return NULL; @@ -1102,7 +1103,7 @@ for (i = 0; i < self->extra->length; i++) { if (self->extra->children[i] == element) break; - if (PyObject_Compare(self->extra->children[i], element) == 0) + if (PyObject_RichCompareBool(self->extra->children[i], element, Py_EQ) == 1) break; } Modified: python/branches/release30-maint/Modules/_localemodule.c ============================================================================== --- python/branches/release30-maint/Modules/_localemodule.c (original) +++ python/branches/release30-maint/Modules/_localemodule.c Sun Feb 1 11:41:18 2009 @@ -272,7 +272,9 @@ #ifdef HAVE_WCSXFRM PyDoc_STRVAR(strxfrm__doc__, -"string -> string. Returns a string that behaves for cmp locale-aware."); +"strxfrm(string) -> string.\n\ +\n\ +Return a string that can be used as a key for locale-aware comparisons."); static PyObject* PyLocale_strxfrm(PyObject* self, PyObject* args) Modified: python/branches/release30-maint/Modules/_pickle.c ============================================================================== --- python/branches/release30-maint/Modules/_pickle.c (original) +++ python/branches/release30-maint/Modules/_pickle.c Sun Feb 1 11:41:18 2009 @@ -715,7 +715,7 @@ i = 0; module_name = NULL; while ((j = PyDict_Next(modules_dict, &i, &module_name, &module))) { - if (PyObject_Compare(module_name, main_str) == 0) + if (PyObject_RichCompareBool(module_name, main_str, Py_EQ) == 1) continue; obj = PyObject_GetAttr(module, global_name); Modified: python/branches/release30-maint/Modules/_tkinter.c ============================================================================== --- python/branches/release30-maint/Modules/_tkinter.c (original) +++ python/branches/release30-maint/Modules/_tkinter.c Sun Feb 1 11:41:18 2009 @@ -788,15 +788,59 @@ self->value->typePtr->name, self->value); } -static int -PyTclObject_cmp(PyTclObject *self, PyTclObject *other) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +PyTclObject_richcompare(PyObject *self, PyObject *other, int op) { - int res; - res = strcmp(Tcl_GetString(self->value), - Tcl_GetString(other->value)); - if (res < 0) return -1; - if (res > 0) return 1; - return 0; + int result; + PyObject *v; + + /* neither argument should be NULL, unless something's gone wrong */ + if (self == NULL || other == NULL) { + PyErr_BadInternalCall(); + return NULL; + } + + /* both arguments should be instances of PyTclObject */ + if (!PyTclObject_Check(self) || !PyTclObject_Check(other)) { + v = Py_NotImplemented; + goto finished; + } + + if (self == other) + /* fast path when self and other are identical */ + result = 0; + else + result = strcmp(Tcl_GetString(((PyTclObject *)self)->value), + Tcl_GetString(((PyTclObject *)other)->value)); + /* Convert return value to a Boolean */ + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + finished: + Py_INCREF(v); + return v; } PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type"); @@ -818,45 +862,45 @@ static PyTypeObject PyTclObject_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_tkinter.Tcl_Obj", /*tp_name*/ - sizeof(PyTclObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ + sizeof(PyTclObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ /* methods */ - (destructor)PyTclObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - (cmpfunc)PyTclObject_cmp, /*tp_compare*/ + (destructor)PyTclObject_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - (reprfunc)PyTclObject_str, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - PyTclObject_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + (reprfunc)PyTclObject_str, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + PyTclObject_richcompare, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + PyTclObject_getsetlist, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ }; static Tcl_Obj* Modified: python/branches/release30-maint/Modules/parsermodule.c ============================================================================== --- python/branches/release30-maint/Modules/parsermodule.c (original) +++ python/branches/release30-maint/Modules/parsermodule.c Sun Feb 1 11:41:18 2009 @@ -169,7 +169,7 @@ static void parser_free(PyST_Object *st); -static int parser_compare(PyST_Object *left, PyST_Object *right); +static PyObject* parser_richcompare(PyObject *left, PyObject *right, int op); static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *); static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *); static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *); @@ -203,7 +203,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)parser_compare, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -223,7 +223,7 @@ "Intermediate representation of a Python parse tree.", 0, /* tp_traverse */ 0, /* tp_clear */ - 0, /* tp_richcompare */ + parser_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ @@ -231,6 +231,9 @@ }; /* PyST_Type */ +/* PyST_Type isn't subclassable, so just check ob_type */ +#define PyST_Object_Check(v) ((v)->ob_type == &PyST_Type) + static int parser_compare_nodes(node *left, node *right) { @@ -260,26 +263,69 @@ return (0); } - -/* int parser_compare(PyST_Object* left, PyST_Object* right) +/* parser_richcompare(PyObject* left, PyObject* right, int op) * * Comparison function used by the Python operators ==, !=, <, >, <=, >= * This really just wraps a call to parser_compare_nodes() with some easy * checks and protection code. * */ -static int -parser_compare(PyST_Object *left, PyST_Object *right) + +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +parser_richcompare(PyObject *left, PyObject *right, int op) { - if (left == right) - return (0); + int result; + PyObject *v; - if ((left == 0) || (right == 0)) - return (-1); + /* neither argument should be NULL, unless something's gone wrong */ + if (left == NULL || right == NULL) { + PyErr_BadInternalCall(); + return NULL; + } - return (parser_compare_nodes(left->st_node, right->st_node)); -} + /* both arguments should be instances of PyST_Object */ + if (!PyST_Object_Check(left) || !PyST_Object_Check(right)) { + v = Py_NotImplemented; + goto finished; + } + if (left == right) + /* if arguments are identical, they're equal */ + result = 0; + else + result = parser_compare_nodes(((PyST_Object *)left)->st_node, + ((PyST_Object *)right)->st_node); + + /* Convert return value to a Boolean */ + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + finished: + Py_INCREF(v); + return v; +} /* parser_newstobject(node* st) * Modified: python/branches/release30-maint/Modules/pyexpat.c ============================================================================== --- python/branches/release30-maint/Modules/pyexpat.c (original) +++ python/branches/release30-maint/Modules/pyexpat.c Sun Feb 1 11:41:18 2009 @@ -1622,7 +1622,7 @@ (printfunc)0, /*tp_print*/ 0, /*tp_getattr*/ (setattrfunc)xmlparse_setattr, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ + 0, /*tp_compare*/ (reprfunc)0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ Modified: python/branches/release30-maint/Objects/cellobject.c ============================================================================== --- python/branches/release30-maint/Objects/cellobject.c (original) +++ python/branches/release30-maint/Objects/cellobject.c Sun Feb 1 11:41:18 2009 @@ -51,16 +51,56 @@ PyObject_GC_Del(op); } -static int -cell_compare(PyCellObject *a, PyCellObject *b) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +cell_richcompare(PyObject *a, PyObject *b, int op) { - if (a->ob_ref == NULL) { - if (b->ob_ref == NULL) - return 0; - return -1; - } else if (b->ob_ref == NULL) - return 1; - return PyObject_Compare(a->ob_ref, b->ob_ref); + int result; + PyObject *v; + + /* neither argument should be NULL, unless something's gone wrong */ + assert(a != NULL && b != NULL); + + /* both arguments should be instances of PyCellObject */ + if (!PyCell_Check(a) || !PyCell_Check(b)) { + v = Py_NotImplemented; + Py_INCREF(v); + return v; + } + + /* compare cells by contents; empty cells come before anything else */ + a = ((PyCellObject *)a)->ob_ref; + b = ((PyCellObject *)b)->ob_ref; + if (a != NULL && b != NULL) + return PyObject_RichCompare(a, b, op); + + result = (b == NULL) - (a == NULL); + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + Py_INCREF(v); + return v; } static PyObject * @@ -114,7 +154,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)cell_compare, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)cell_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -129,7 +169,7 @@ 0, /* tp_doc */ (traverseproc)cell_traverse, /* tp_traverse */ (inquiry)cell_clear, /* tp_clear */ - 0, /* tp_richcompare */ + cell_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Modified: python/branches/release30-maint/Objects/descrobject.c ============================================================================== --- python/branches/release30-maint/Objects/descrobject.c (original) +++ python/branches/release30-maint/Objects/descrobject.c Sun Feb 1 11:41:18 2009 @@ -774,12 +774,6 @@ return 0; } -static int -proxy_compare(proxyobject *v, PyObject *w) -{ - return PyObject_Compare(v->dict, w); -} - static PyObject * proxy_richcompare(proxyobject *v, PyObject *w, int op) { @@ -796,7 +790,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)proxy_compare, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ &proxy_as_sequence, /* tp_as_sequence */ @@ -844,12 +838,17 @@ /* This has no reason to be in this file except that adding new files is a bit of a pain */ +/* forward */ +static PyTypeObject wrappertype; + typedef struct { PyObject_HEAD PyWrapperDescrObject *descr; PyObject *self; } wrapperobject; +#define Wrapper_Check(v) (Py_TYPE(v) == &wrappertype) + static void wrapper_dealloc(wrapperobject *wp) { @@ -861,13 +860,60 @@ Py_TRASHCAN_SAFE_END(wp) } -static int -wrapper_compare(wrapperobject *a, wrapperobject *b) +#define TEST_COND(cond) ((cond) ? Py_True : Py_False) + +static PyObject * +wrapper_richcompare(PyObject *a, PyObject *b, int op) { - if (a->descr == b->descr) - return PyObject_Compare(a->self, b->self); - else - return (a->descr < b->descr) ? -1 : 1; + int result; + PyObject *v; + PyWrapperDescrObject *a_descr, *b_descr; + + assert(a != NULL && b != NULL); + + /* both arguments should be wrapperobjects */ + if (!Wrapper_Check(a) || !Wrapper_Check(b)) { + v = Py_NotImplemented; + Py_INCREF(v); + return v; + } + + /* compare by descriptor address; if the descriptors are the same, + compare by the objects they're bound to */ + a_descr = ((wrapperobject *)a)->descr; + b_descr = ((wrapperobject *)b)->descr; + if (a_descr == b_descr) { + a = ((wrapperobject *)a)->self; + b = ((wrapperobject *)b)->self; + return PyObject_RichCompare(a, b, op); + } + + result = a_descr - b_descr; + switch (op) { + case Py_EQ: + v = TEST_COND(result == 0); + break; + case Py_NE: + v = TEST_COND(result != 0); + break; + case Py_LE: + v = TEST_COND(result <= 0); + break; + case Py_GE: + v = TEST_COND(result >= 0); + break; + case Py_LT: + v = TEST_COND(result < 0); + break; + case Py_GT: + v = TEST_COND(result > 0); + break; + default: + PyErr_BadArgument(); + return NULL; + } + Py_INCREF(v); + return v; } static long @@ -977,7 +1023,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - (cmpfunc)wrapper_compare, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)wrapper_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -992,7 +1038,7 @@ 0, /* tp_doc */ wrapper_traverse, /* tp_traverse */ 0, /* tp_clear */ - 0, /* tp_richcompare */ + wrapper_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Modified: python/branches/release30-maint/Objects/rangeobject.c ============================================================================== --- python/branches/release30-maint/Objects/rangeobject.c (original) +++ python/branches/release30-maint/Objects/rangeobject.c Sun Feb 1 11:41:18 2009 @@ -123,7 +123,7 @@ Algorithm is equal to that of get_len_of_range(), but it operates on PyObjects (which are assumed to be PyLong or PyInt objects). ---------------------------------------------------------------*/ - int cmp_result, cmp_call; + int cmp_result; PyObject *lo, *hi; PyObject *step = NULL; PyObject *diff = NULL; @@ -134,13 +134,12 @@ PyObject *zero = PyLong_FromLong(0); if (zero == NULL) return NULL; - cmp_call = PyObject_Cmp(r->step, zero, &cmp_result); + cmp_result = PyObject_RichCompareBool(r->step, zero, Py_GT); Py_DECREF(zero); - if (cmp_call == -1) + if (cmp_result == -1) return NULL; - assert(cmp_result != 0); - if (cmp_result > 0) { + if (cmp_result == 1) { lo = r->start; hi = r->stop; step = r->step; @@ -154,7 +153,7 @@ } /* if (lo >= hi), return length of 0. */ - if (PyObject_Compare(lo, hi) >= 0) { + if (PyObject_RichCompareBool(lo, hi, Py_GE) == 1) { Py_XDECREF(step); return PyLong_FromLong(0); } Modified: python/branches/release30-maint/Objects/setobject.c ============================================================================== --- python/branches/release30-maint/Objects/setobject.c (original) +++ python/branches/release30-maint/Objects/setobject.c Sun Feb 1 11:41:18 2009 @@ -1824,13 +1824,6 @@ return Py_NotImplemented; } -static int -set_nocmp(PyObject *self, PyObject *other) -{ - PyErr_SetString(PyExc_TypeError, "cannot compare sets using cmp()"); - return -1; -} - static PyObject * set_add(PySetObject *so, PyObject *key) { @@ -2111,7 +2104,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)set_repr, /* tp_repr */ &set_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ @@ -2208,7 +2201,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ + 0, /* tp_compare */ (reprfunc)set_repr, /* tp_repr */ &frozenset_as_number, /* tp_as_number */ &set_as_sequence, /* tp_as_sequence */ Modified: python/branches/release30-maint/PC/winreg.c ============================================================================== --- python/branches/release30-maint/PC/winreg.c (original) +++ python/branches/release30-maint/PC/winreg.c Sun Feb 1 11:41:18 2009 @@ -326,7 +326,7 @@ "Operations:\n" "__bool__ - Handles with an open object return true, otherwise false.\n" "__int__ - Converting a handle to an integer returns the Win32 handle.\n" -"__cmp__ - Handle objects are compared using the handle value."); +"rich comparison - Handle objects are compared using the handle value."); PyDoc_STRVAR(PyHKEY_Close_doc, @@ -485,7 +485,7 @@ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ - PyHKEY_compareFunc, /* tp_compare */ + 0, /* tp_compare */ 0, /* tp_repr */ &PyHKEY_NumberMethods, /* tp_as_number */ 0, /* tp_as_sequence */ From python-checkins at python.org Sun Feb 1 11:54:57 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 11:54:57 +0100 (CET) Subject: [Python-checkins] r69183 - in python/branches/py3k-issue1717: Doc/library/binascii.rst Doc/library/zlib.rst Doc/reference/executionmodel.rst Lib/importlib/NOTES Lib/importlib/_bootstrap.py Lib/importlib/test/__init__.py Lib/importlib/test/builtin/test_finder.py Lib/importlib/test/builtin/test_loader.py Lib/importlib/test/extension/test_case_sensitivity.py Lib/importlib/test/extension/test_loader.py Lib/importlib/test/frozen/support.py Lib/importlib/test/frozen/test_loader.py Lib/importlib/test/import_/test___package__.py Lib/importlib/test/import_/test_caching.py Lib/importlib/test/import_/test_fromlist.py Lib/importlib/test/import_/test_meta_path.py Lib/importlib/test/import_/test_packages.py Lib/importlib/test/import_/test_path.py Lib/importlib/test/import_/test_relative_imports.py Lib/importlib/test/import_/util.py Lib/importlib/test/source/test_case_sensitivity.py Lib/importlib/test/source/test_finder.py Lib/importlib/test/source/test_loader.py Lib/importlib/test/source/test_path_hook.py Lib/importlib/test/source/test_reload.py Lib/importlib/test/source/test_source_encoding.py Lib/importlib/test/source/util.py Lib/importlib/test/support.py Lib/importlib/test/test_api.py Lib/importlib/test/util.py Lib/test/test_descr.py Objects/unicodeobject.c Python/makeopcodetargets.py Message-ID: <20090201105457.286E61E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 11:54:55 2009 New Revision: 69183 Log: Merged revisions 69132-69133,69136,69138,69150-69151,69164-69168,69170-69174,69176-69179,69181 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r69132 | benjamin.peterson | 2009-01-31 03:57:19 +0000 (Sat, 31 Jan 2009) | 1 line comprehrensions now have proper scoping #5106 ................ r69133 | mark.dickinson | 2009-01-31 12:12:41 +0000 (Sat, 31 Jan 2009) | 3 lines Make Python/makeopcodetargets runnable with Python 2.3. With any luck, this should solve the 'failed compile' on the x86 gentoo 3.x buildbot. ................ r69136 | benjamin.peterson | 2009-01-31 16:36:08 +0000 (Sat, 31 Jan 2009) | 1 line detabify Objects/unicodeobject.c ................ r69138 | benjamin.peterson | 2009-01-31 16:41:58 +0000 (Sat, 31 Jan 2009) | 8 lines Blocked revisions 69134 via svnmerge ........ r69134 | benjamin.peterson | 2009-01-31 10:29:18 -0600 (Sat, 31 Jan 2009) | 1 line completely detabify unicodeobject.c ........ ................ r69150 | benjamin.peterson | 2009-01-31 22:14:21 +0000 (Sat, 31 Jan 2009) | 1 line fix indentation again ................ r69151 | benjamin.peterson | 2009-01-31 22:17:25 +0000 (Sat, 31 Jan 2009) | 12 lines Blocked revisions 69146,69149 via svnmerge ........ r69146 | benjamin.peterson | 2009-01-31 15:47:42 -0600 (Sat, 31 Jan 2009) | 1 line fix indentation ........ r69149 | benjamin.peterson | 2009-01-31 16:03:19 -0600 (Sat, 31 Jan 2009) | 1 line fix indentation; looks like all I managed to do the first time is make things uglier ........ ................ r69164 | gregory.p.smith | 2009-02-01 00:30:50 +0000 (Sun, 01 Feb 2009) | 2 lines documentation wording fix for issue4903 ................ r69165 | brett.cannon | 2009-02-01 00:37:13 +0000 (Sun, 01 Feb 2009) | 1 line Move built-in loader tests to importlib.test.abc.LoaderTests. ................ r69166 | brett.cannon | 2009-02-01 00:49:41 +0000 (Sun, 01 Feb 2009) | 1 line Move extension module loader tests over to importlib.test.abc.LoaderTests. ................ r69167 | brett.cannon | 2009-02-01 01:34:13 +0000 (Sun, 01 Feb 2009) | 4 lines Fix importlib.machinery.FrozenImporter.load_module() to set __package__ properly. Discovered by also moving the loader tests over to importlib.test.abc.LoaderTests. ................ r69168 | brett.cannon | 2009-02-01 02:05:11 +0000 (Sun, 01 Feb 2009) | 3 lines Move source loader tests (including reload tests) over to importlib.test.abc.LoaderTests. ................ r69170 | brett.cannon | 2009-02-01 03:08:31 +0000 (Sun, 01 Feb 2009) | 3 lines Split out support code that is specific to source tests out of importlib.test.support to importlib.test.source.util. ................ r69171 | brett.cannon | 2009-02-01 03:51:54 +0000 (Sun, 01 Feb 2009) | 2 lines Do not execute the .pyc/.pyo files as well as the .py files. ................ r69172 | brett.cannon | 2009-02-01 04:00:05 +0000 (Sun, 01 Feb 2009) | 2 lines Rename importlib.test.support to importlib.test.util. ................ r69173 | brett.cannon | 2009-02-01 04:28:04 +0000 (Sun, 01 Feb 2009) | 2 lines Move import semantic util code to importlib.test.import_.util. ................ r69174 | brett.cannon | 2009-02-01 05:04:06 +0000 (Sun, 01 Feb 2009) | 1 line Remove an outdated todo item from importlib. ................ r69176 | brett.cannon | 2009-02-01 05:33:17 +0000 (Sun, 01 Feb 2009) | 2 lines Expose source_path and bytecode_path on _PyFileLoader. ................ r69177 | brett.cannon | 2009-02-01 05:43:31 +0000 (Sun, 01 Feb 2009) | 3 lines Ditch read_source() and read_bytecode() and replace with *_path() and get_data(). ................ r69178 | brett.cannon | 2009-02-01 05:55:23 +0000 (Sun, 01 Feb 2009) | 1 line Update importlib notes. ................ r69179 | brett.cannon | 2009-02-01 06:07:57 +0000 (Sun, 01 Feb 2009) | 1 line Simplify write_bytecode for importlib. ................ r69181 | mark.dickinson | 2009-02-01 10:28:51 +0000 (Sun, 01 Feb 2009) | 3 lines Issue #1717, stage 2: remove uses of tp_compare in Modules and most Objects. ................ Added: python/branches/py3k-issue1717/Lib/importlib/test/import_/util.py - copied unchanged from r69181, /python/branches/py3k/Lib/importlib/test/import_/util.py python/branches/py3k-issue1717/Lib/importlib/test/source/util.py - copied unchanged from r69181, /python/branches/py3k/Lib/importlib/test/source/util.py python/branches/py3k-issue1717/Lib/importlib/test/util.py - copied unchanged from r69181, /python/branches/py3k/Lib/importlib/test/util.py Removed: python/branches/py3k-issue1717/Lib/importlib/test/frozen/support.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_reload.py python/branches/py3k-issue1717/Lib/importlib/test/support.py Modified: python/branches/py3k-issue1717/ (props changed) python/branches/py3k-issue1717/Doc/library/binascii.rst python/branches/py3k-issue1717/Doc/library/zlib.rst python/branches/py3k-issue1717/Doc/reference/executionmodel.rst python/branches/py3k-issue1717/Lib/importlib/NOTES python/branches/py3k-issue1717/Lib/importlib/_bootstrap.py python/branches/py3k-issue1717/Lib/importlib/test/__init__.py python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_finder.py python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_loader.py python/branches/py3k-issue1717/Lib/importlib/test/extension/test_case_sensitivity.py python/branches/py3k-issue1717/Lib/importlib/test/extension/test_loader.py python/branches/py3k-issue1717/Lib/importlib/test/frozen/test_loader.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test___package__.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_caching.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_fromlist.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_meta_path.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_packages.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_path.py python/branches/py3k-issue1717/Lib/importlib/test/import_/test_relative_imports.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_case_sensitivity.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_finder.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_loader.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_path_hook.py python/branches/py3k-issue1717/Lib/importlib/test/source/test_source_encoding.py python/branches/py3k-issue1717/Lib/importlib/test/test_api.py python/branches/py3k-issue1717/Lib/test/test_descr.py python/branches/py3k-issue1717/Objects/unicodeobject.c python/branches/py3k-issue1717/Python/makeopcodetargets.py Modified: python/branches/py3k-issue1717/Doc/library/binascii.rst ============================================================================== --- python/branches/py3k-issue1717/Doc/library/binascii.rst (original) +++ python/branches/py3k-issue1717/Doc/library/binascii.rst Sun Feb 1 11:54:55 2009 @@ -120,11 +120,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. Modified: python/branches/py3k-issue1717/Doc/library/zlib.rst ============================================================================== --- python/branches/py3k-issue1717/Doc/library/zlib.rst (original) +++ python/branches/py3k-issue1717/Doc/library/zlib.rst Sun Feb 1 11:54:55 2009 @@ -48,11 +48,11 @@ To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. @@ -93,11 +93,11 @@ To generate the same numeric value across all Python versions and platforms use crc32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the - return value will have the correct 32bit binary representation + return value is the correct 32bit binary representation regardless of sign. .. versionchanged:: 3.0 - The return value will always be unsigned and in the range [0, 2**32-1] + The return value is unsigned and in the range [0, 2**32-1] regardless of platform. Modified: python/branches/py3k-issue1717/Doc/reference/executionmodel.rst ============================================================================== --- python/branches/py3k-issue1717/Doc/reference/executionmodel.rst (original) +++ python/branches/py3k-issue1717/Doc/reference/executionmodel.rst Sun Feb 1 11:54:55 2009 @@ -51,8 +51,8 @@ within the defining one, unless a contained block introduces a different binding for the name. The scope of names defined in a class block is limited to the class block; it does not extend to the code blocks of methods -- this includes -generator expressions since they are implemented using a function scope. This -means that the following will fail:: +comprehensions and generator expressions since they are implemented using a +function scope. This means that the following will fail:: class A: a = 42 Modified: python/branches/py3k-issue1717/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/NOTES (original) +++ python/branches/py3k-issue1717/Lib/importlib/NOTES Sun Feb 1 11:54:55 2009 @@ -1,38 +1,10 @@ to do ///// -* Use test.loader_tests - - + builtin - + frozen - + extension - + source - -* Reorganize support code. - - + Separate general support code and importer-specific (e.g. source) support - code. - - Create support modules for each subdirectory (as needed). - + Add a file loader mock that returns monotonically increasing mtime. - - Use in source/test_reload. - - Use in source/test_load_module_mixed. - -* API simplification? - - + read_source -> get_data/source_path - + read_bytecode -> get_data/bytecode_path - + write_bytecode -> complete set of bytes for bytecode instead of - individual arguments. - * Create meta_path importer for sys.path. -* OPTIMIZE! - - + Write benchmark suite. - + Fast path common cases. - - - Absolute name from sys.path. - - Relative name from sys.path. + + Create hook. + + Rewrite Import to use the hook. * Implement PEP 302 protocol for loaders (should just be a matter of testing). @@ -91,4 +63,13 @@ * SourceFinder * (?) Loader +* Write benchmark suite. + +* OPTIMIZE! + + + Fast path common cases. + + - Absolute name from sys.path. + - Relative name from sys.path. + * Bootstrap importlib as implementation of builtins.__import__ Modified: python/branches/py3k-issue1717/Lib/importlib/_bootstrap.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/_bootstrap.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/_bootstrap.py Sun Feb 1 11:54:55 2009 @@ -137,7 +137,12 @@ """Load a frozen module.""" if cls.find_module(fullname) is None: raise ImportError("{0} is not a frozen module".format(fullname)) - return imp.init_frozen(fullname) + module = imp.init_frozen(fullname) + if hasattr(module, '__path__'): + module.__package__ = module.__name__ + elif '.' in module.__name__: + module.__package__ = module.__name__.rsplit('.', 1)[0] + return module class ChainedImporter(object): @@ -336,13 +341,15 @@ else: return None - def _source_path(self): + @check_name + def source_path(self, fullname): """Return the path to an existing source file for the module, or None if one cannot be found.""" # Not a property so that it is easy to override. return self._find_path(imp.PY_SOURCE) - def _bytecode_path(self): + @check_name + def bytecode_path(self, fullname): """Return the path to a bytecode file, or None if one does not exist.""" # Not a property for easy overriding. @@ -352,8 +359,9 @@ @get_module def load_module(self, module): """Load a Python source or bytecode module.""" - source_path = self._source_path() - bytecode_path = self._bytecode_path() + name = module.__name__ + source_path = self.source_path(name) + bytecode_path = self.bytecode_path(name) code_object = self.get_code(module.__name__) module.__file__ = source_path if source_path else bytecode_path module.__loader__ = self @@ -371,7 +379,7 @@ def source_mtime(self, name): """Return the modification time of the source for the specified module.""" - source_path = self._source_path() + source_path = self.source_path(name) if not source_path: return None return int(_os.stat(source_path).st_mtime) @@ -384,7 +392,7 @@ laoder cannot handle the specified module. """ - source_path = self._source_path() + source_path = self._source_path(name) if source_path is None: return None import tokenize @@ -395,57 +403,20 @@ return open(source_path, encoding=encoding).read() @check_name - def read_source(self, fullname): - """Return the source for the specified module as bytes along with the - path where the source came from. - - The returned path is used by 'compile' for error messages. - - """ - source_path = self._source_path() - if source_path is None: - return None - with closing(_fileio._FileIO(source_path, 'r')) as bytes_file: - return bytes_file.read(), source_path - - @check_name - def read_bytecode(self, name): - """Return the magic number, timestamp, and the module bytecode for the - module. - - Raises ImportError (just like get_source) if the laoder cannot handle - the module. Returns None if there is no bytecode. - - """ - path = self._bytecode_path() - if path is None: - return None - file = _fileio._FileIO(path, 'r') - try: - with closing(file) as bytecode_file: - data = bytecode_file.read() - return data[:4], marshal._r_long(data[4:8]), data[8:] - except AttributeError: - return None - - @check_name - def write_bytecode(self, name, magic, timestamp, data): - """Write out 'data' for the specified module using the specific - timestamp, returning a boolean + def write_bytecode(self, name, data): + """Write out 'data' for the specified module, returning a boolean signifying if the write-out actually occurred. Raises ImportError (just like get_source) if the specified module cannot be handled by the loader. """ - bytecode_path = self._bytecode_path() + bytecode_path = self.bytecode_path(name) if not bytecode_path: bytecode_path = self._base_path + suffix_list(imp.PY_COMPILED)[0] file = _fileio._FileIO(bytecode_path, 'w') try: with closing(file) as bytecode_file: - bytecode_file.write(magic) - bytecode_file.write(marshal._w_long(timestamp)) bytecode_file.write(data) return True except IOError as exc: @@ -454,39 +425,19 @@ else: raise - # XXX Take an optional argument to flag whether to write bytecode? @check_name def get_code(self, name): - """Return the code object for the module. - - 'self' must implement: - - * read_bytecode(name:str) -> (int, int, bytes) or None - Return the magic number, timestamp, and bytecode for the - module. None is returned if not bytecode is available. - - * source_mtime(name:str) -> int - Return the last modification time for the source of the module. - Returns None if their is no source. - - * read_source(name:str) -> (bytes, str) - Return the source code for the module and the path to use in - the call to 'compile'. Not called if source_mtime returned - None. - - * write_bytecode(name:str, magic:bytes, timestamp:int, data:str) - Write out bytecode for the module with the specified magic - number and timestamp. Not called if sys.dont_write_bytecode is - True. - - """ + """Return the code object for the module.""" # XXX Care enough to make sure this call does not happen if the magic # number is bad? source_timestamp = self.source_mtime(name) # Try to use bytecode if it is available. - bytecode_tuple = self.read_bytecode(name) - if bytecode_tuple: - magic, pyc_timestamp, bytecode = bytecode_tuple + bytecode_path = self.bytecode_path(name) + if bytecode_path: + data = self.get_data(bytecode_path) + magic = data[:4] + pyc_timestamp = marshal._r_long(data[4:8]) + bytecode = data[8:] try: # Verify that the magic number is valid. if imp.get_magic() != magic: @@ -511,7 +462,8 @@ raise ImportError("no source or bytecode available to create code " "object for {0!r}".format(name)) # Use the source. - source, source_path = self.read_source(name) + source_path = self.source_path(name) + source = self.get_data(source_path) # Convert to universal newlines. line_endings = b'\n' for index, c in enumerate(source): @@ -530,8 +482,10 @@ code_object = compile(source, source_path, 'exec', dont_inherit=True) # Generate bytecode and write it out. if not sys.dont_write_bytecode: - data = marshal.dumps(code_object) - self.write_bytecode(name, imp.get_magic(), source_timestamp, data) + data = bytearray(imp.get_magic()) + data.extend(marshal._w_long(source_timestamp)) + data.extend(marshal.dumps(code_object)) + self.write_bytecode(name, data) return code_object def get_data(self, path): Modified: python/branches/py3k-issue1717/Lib/importlib/test/__init__.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/__init__.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/__init__.py Sun Feb 1 11:54:55 2009 @@ -9,7 +9,8 @@ if name.startswith('.'): continue path = os.path.join(directory, name) - if os.path.isfile(path) and name.startswith('test_'): + if (os.path.isfile(path) and name.startswith('test_') and + name.endswith('.py')): submodule_name = os.path.splitext(name)[0] module_name = "{0}.{1}".format(package, submodule_name) __import__(module_name, level=0) @@ -20,6 +21,8 @@ __import__(package_name, level=0) package_tests = getattr(sys.modules[package_name], 'test_suite')() suite.addTest(package_tests) + else: + continue return suite Modified: python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_finder.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_finder.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_finder.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,6 @@ from importlib import machinery from .. import abc -from .. import support +from .. import util import sys import unittest @@ -14,7 +14,7 @@ def test_module(self): # Common case. - with support.uncache(self.name): + with util.uncache(self.name): self.assert_(machinery.BuiltinImporter.find_module(self.name)) def test_package(self): @@ -40,7 +40,7 @@ def test_ignore_path(self): # The value for 'path' should always trigger a failed import. - with support.uncache(self.name): + with util.uncache(self.name): loader = machinery.BuiltinImporter.find_module(self.name, ['pkg']) self.assert_(loader is None) Modified: python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_loader.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_loader.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/builtin/test_loader.py Sun Feb 1 11:54:55 2009 @@ -1,13 +1,14 @@ import importlib from importlib import machinery -from .. import support +from .. import abc +from .. import util import sys import types import unittest -class LoaderTests(unittest.TestCase): +class LoaderTests(abc.LoaderTests): """Test load_module() for built-in modules.""" @@ -26,13 +27,32 @@ load_module = staticmethod(lambda name: machinery.BuiltinImporter.load_module(name)) - def test_load_module(self): + def test_module(self): # Common case. - with support.uncache(self.name): + with util.uncache(self.name): module = self.load_module(self.name) self.verify(module) - def test_nonexistent(self): + def test_package(self): + # Built-in modules cannot be a package. + pass + + def test_lacking_parent(self): + # Built-in modules cannot be a package. + pass + + def test_state_after_failure(self): + # Not way to force an imoprt failure. + pass + + def test_module_reuse(self): + # Test that the same module is used in a reload. + with util.uncache(self.name): + module1 = self.load_module(self.name) + module2 = self.load_module(self.name) + self.assert_(module1 is module2) + + def test_unloadable(self): name = 'dssdsdfff' assert name not in sys.builtin_module_names self.assertRaises(ImportError, self.load_module, name) Modified: python/branches/py3k-issue1717/Lib/importlib/test/extension/test_case_sensitivity.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/extension/test_case_sensitivity.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/extension/test_case_sensitivity.py Sun Feb 1 11:54:55 2009 @@ -1,12 +1,12 @@ import sys -from test import support as test_support +from test import support import unittest import importlib -from .. import support +from .. import util from . import test_path_hook - at support.case_insensitive_tests + at util.case_insensitive_tests class ExtensionModuleCaseSensitivityTest(unittest.TestCase): def find_module(self): @@ -17,13 +17,13 @@ return finder.find_module(bad_name) def test_case_sensitive(self): - with test_support.EnvironmentVarGuard() as env: + with support.EnvironmentVarGuard() as env: env.unset('PYTHONCASEOK') loader = self.find_module() self.assert_(loader is None) def test_case_insensitivity(self): - with test_support.EnvironmentVarGuard() as env: + with support.EnvironmentVarGuard() as env: env.set('PYTHONCASEOK', '1') loader = self.find_module() self.assert_(hasattr(loader, 'load_module')) @@ -32,7 +32,7 @@ def test_main(): - test_support.run_unittest(ExtensionModuleCaseSensitivityTest) + support.run_unittest(ExtensionModuleCaseSensitivityTest) if __name__ == '__main__': Modified: python/branches/py3k-issue1717/Lib/importlib/test/extension/test_loader.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/extension/test_loader.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/extension/test_loader.py Sun Feb 1 11:54:55 2009 @@ -1,12 +1,13 @@ import importlib from . import test_path_hook -from .. import support +from .. import abc +from .. import util import sys import unittest -class LoaderTests(unittest.TestCase): +class LoaderTests(abc.LoaderTests): """Test load_module() for extension modules.""" @@ -16,15 +17,33 @@ False) return loader.load_module(fullname) - def test_success(self): - with support.uncache(test_path_hook.NAME): + def test_module(self): + with util.uncache(test_path_hook.NAME): module = self.load_module(test_path_hook.NAME) for attr, value in [('__name__', test_path_hook.NAME), ('__file__', test_path_hook.FILEPATH)]: self.assertEqual(getattr(module, attr), value) self.assert_(test_path_hook.NAME in sys.modules) - def test_failure(self): + def test_package(self): + # Extensions are not found in packages. + pass + + def test_lacking_parent(self): + # Extensions are not found in packages. + pass + + def test_module_reuse(self): + with util.uncache(test_path_hook.NAME): + module1 = self.load_module(test_path_hook.NAME) + module2 = self.load_module(test_path_hook.NAME) + self.assert_(module1 is module2) + + def test_state_after_failure(self): + # No easy way to trigger a failure after a successful import. + pass + + def test_unloadable(self): self.assertRaises(ImportError, self.load_module, 'asdfjkl;') Deleted: python/branches/py3k-issue1717/Lib/importlib/test/frozen/support.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/frozen/support.py Sun Feb 1 11:54:55 2009 +++ (empty file) @@ -1,24 +0,0 @@ -import sys - - -class Null: - - """Just absorb what is given.""" - - def __getattr__(self): - return lambda *args, **kwargs: None - - -class SilenceStdout: - - """Silence sys.stdout.""" - - def setUp(self): - """Substitute sys.stdout with something that does not print to the - screen thanks to what bytecode is frozen.""" - sys.stdout = Null() - super().setUp() - - def tearDown(self): - sys.stdout = sys.__stdout__ - super().tearDown() Modified: python/branches/py3k-issue1717/Lib/importlib/test/frozen/test_loader.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/frozen/test_loader.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/frozen/test_loader.py Sun Feb 1 11:54:55 2009 @@ -1,26 +1,59 @@ from importlib import machinery -from ..builtin import test_loader +from .. import abc +from .. import util -class LoaderTests(test_loader.LoaderTests): +class LoaderTests(abc.LoaderTests): - name = '__phello__' - load_module = staticmethod(lambda name: - machinery.FrozenImporter.load_module(name)) - verification = {'__name__': '__phello__', '__file__': '', - '__package__': None, '__path__': ['__phello__']} - - -class SubmoduleLoaderTests(LoaderTests): - - name = '__phello__.spam' - verification = {'__name__': '__phello__.spam', '__file__': '', - '__package__': None} + def test_module(self): + with util.uncache('__hello__'): + module = machinery.FrozenImporter.load_module('__hello__') + check = {'__name__': '__hello__', '__file__': '', + '__package__': None} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def test_package(self): + with util.uncache('__phello__'): + module = machinery.FrozenImporter.load_module('__phello__') + check = {'__name__': '__phello__', '__file__': '', + '__package__': '__phello__', '__path__': ['__phello__']} + for attr, value in check.items(): + attr_value = getattr(module, attr) + self.assertEqual(attr_value, value, + "for __phello__.%s, %r != %r" % + (attr, attr_value, value)) + + def test_lacking_parent(self): + with util.uncache('__phello__', '__phello__.spam'): + module = machinery.FrozenImporter.load_module('__phello__.spam') + check = {'__name__': '__phello__.spam', '__file__': '', + '__package__': '__phello__'} + for attr, value in check.items(): + attr_value = getattr(module, attr) + self.assertEqual(attr_value, value, + "for __phello__.spam.%s, %r != %r" % + (attr, attr_value, value)) + + def test_module_reuse(self): + with util.uncache('__hello__'): + module1 = machinery.FrozenImporter.load_module('__hello__') + module2 = machinery.FrozenImporter.load_module('__hello__') + self.assert_(module1 is module2) + + def test_state_after_failure(self): + # No way to trigger an error in a frozen module. + pass + + def test_unloadable(self): + assert machinery.FrozenImporter.find_module('_not_real') is None + self.assertRaises(ImportError, machinery.FrozenImporter.load_module, + '_not_real') def test_main(): from test.support import run_unittest - run_unittest(LoaderTests, SubmoduleLoaderTests) + run_unittest(LoaderTests) if __name__ == '__main__': Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test___package__.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test___package__.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test___package__.py Sun Feb 1 11:54:55 2009 @@ -5,7 +5,8 @@ """ import unittest -from .. import support +from .. import util +from . import util as import_util class Using__package__(unittest.TestCase): @@ -34,19 +35,19 @@ def test_using___package__(self): # [__package__] - with support.mock_modules('pkg.__init__', 'pkg.fake') as importer: - with support.import_state(meta_path=[importer]): - support.import_('pkg.fake') - module = support.import_('', globals={'__package__': 'pkg.fake'}, + with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: + with util.import_state(meta_path=[importer]): + import_util.import_('pkg.fake') + module = import_util.import_('', globals={'__package__': 'pkg.fake'}, fromlist=['attr'], level=2) self.assertEquals(module.__name__, 'pkg') def test_using___name__(self): # [__name__] - with support.mock_modules('pkg.__init__', 'pkg.fake') as importer: - with support.import_state(meta_path=[importer]): - support.import_('pkg.fake') - module = support.import_('', + with util.mock_modules('pkg.__init__', 'pkg.fake') as importer: + with util.import_state(meta_path=[importer]): + import_util.import_('pkg.fake') + module = import_util.import_('', globals={'__name__': 'pkg.fake', '__path__': []}, fromlist=['attr'], level=2) @@ -54,12 +55,12 @@ def test_bad__package__(self): globals = {'__package__': ''} - self.assertRaises(SystemError, support.import_,'', globals, {}, + self.assertRaises(SystemError, import_util.import_,'', globals, {}, ['relimport'], 1) def test_bunk__package__(self): globals = {'__package__': 42} - self.assertRaises(ValueError, support.import_, '', globals, {}, + self.assertRaises(ValueError, import_util.import_, '', globals, {}, ['relimport'], 1) @@ -77,26 +78,26 @@ # [top-level] def test_top_level(self): - with support.mock_modules('top_level') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('top_level') as mock: + with util.import_state(meta_path=[mock]): del mock['top_level'].__package__ - module = support.import_('top_level') + module = import_util.import_('top_level') self.assert_(module.__package__ is None) # [package] def test_package(self): - with support.mock_modules('pkg.__init__') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__') as mock: + with util.import_state(meta_path=[mock]): del mock['pkg'].__package__ - module = support.import_('pkg') + module = import_util.import_('pkg') self.assertEqual(module.__package__, 'pkg') # [submodule] def test_submodule(self): - with support.mock_modules('pkg.__init__', 'pkg.mod') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__', 'pkg.mod') as mock: + with util.import_state(meta_path=[mock]): del mock['pkg.mod'].__package__ - pkg = support.import_('pkg.mod') + pkg = import_util.import_('pkg.mod') module = getattr(pkg, 'mod') self.assertEqual(module.__package__, 'pkg') Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_caching.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_caching.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_caching.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,6 @@ """Test that sys.modules is used properly by import.""" -from ..support import import_, mock_modules, importlib_only, import_state - +from .. import util +from . import util as import_util import sys from types import MethodType import unittest @@ -24,11 +24,11 @@ # [use cache] module_to_use = "some module found!" sys.modules['some_module'] = module_to_use - module = import_('some_module') + module = import_util.import_('some_module') self.assertEqual(id(module_to_use), id(module)) def create_mock(self, *names, return_=None): - mock = mock_modules(*names) + mock = util.mock_modules(*names) original_load = mock.load_module def load_module(self, fullname): original_load(fullname) @@ -38,31 +38,31 @@ # __import__ inconsistent between loaders and built-in import when it comes # to when to use the module in sys.modules and when not to. - @importlib_only + @import_util.importlib_only def test_using_cache_after_loader(self): # [from cache on return] with self.create_mock('module') as mock: - with import_state(meta_path=[mock]): - module = import_('module') + with util.import_state(meta_path=[mock]): + module = import_util.import_('module') self.assertEquals(id(module), id(sys.modules['module'])) # See test_using_cache_after_loader() for reasoning. - @importlib_only + @import_util.importlib_only def test_using_cache_for_assigning_to_attribute(self): # [from cache to attribute] with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module') + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg.module') self.assert_(hasattr(module, 'module')) self.assert_(id(module.module), id(sys.modules['pkg.module'])) # See test_using_cache_after_loader() for reasoning. - @importlib_only + @import_util.importlib_only def test_using_cache_for_fromlist(self): # [from cache for fromlist] with self.create_mock('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist=['module']) + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg', fromlist=['module']) self.assert_(hasattr(module, 'module')) self.assertEquals(id(module.module), id(sys.modules['pkg.module'])) Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_fromlist.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_fromlist.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_fromlist.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,6 @@ """Test that the semantics relating to the 'fromlist' argument are correct.""" -from ..support import import_, mock_modules, import_state - +from .. import util +from . import util as import_util import unittest class ReturnValue(unittest.TestCase): @@ -16,16 +16,16 @@ def test_return_from_import(self): # [import return] - with mock_modules('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module') + with util.mock_modules('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg.module') self.assertEquals(module.__name__, 'pkg') def test_return_from_from_import(self): # [from return] - with mock_modules('pkg.__init__', 'pkg.module')as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.module', fromlist=['attr']) + with util.mock_modules('pkg.__init__', 'pkg.module')as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg.module', fromlist=['attr']) self.assertEquals(module.__name__, 'pkg.module') @@ -48,59 +48,59 @@ def test_object(self): # [object case] - with mock_modules('module') as importer: - with import_state(meta_path=[importer]): - module = import_('module', fromlist=['attr']) + with util.mock_modules('module') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('module', fromlist=['attr']) self.assertEquals(module.__name__, 'module') def test_unexistent_object(self): # [bad object] - with mock_modules('module') as importer: - with import_state(meta_path=[importer]): - module = import_('module', fromlist=['non_existent']) + with util.mock_modules('module') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('module', fromlist=['non_existent']) self.assertEquals(module.__name__, 'module') self.assert_(not hasattr(module, 'non_existent')) def test_module_from_package(self): # [module] - with mock_modules('pkg.__init__', 'pkg.module') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist=['module']) + with util.mock_modules('pkg.__init__', 'pkg.module') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg', fromlist=['module']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEquals(module.module.__name__, 'pkg.module') def test_no_module_from_package(self): # [no module] - with mock_modules('pkg.__init__') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg', fromlist='non_existent') + with util.mock_modules('pkg.__init__') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg', fromlist='non_existent') self.assertEquals(module.__name__, 'pkg') self.assert_(not hasattr(module, 'non_existent')) def test_empty_string(self): - with mock_modules('pkg.__init__', 'pkg.mod') as importer: - with import_state(meta_path=[importer]): - module = import_('pkg.mod', fromlist=['']) + with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: + with util.import_state(meta_path=[importer]): + module = import_util.import_('pkg.mod', fromlist=['']) self.assertEquals(module.__name__, 'pkg.mod') def test_using_star(self): # [using *] - with mock_modules('pkg.__init__', 'pkg.module') as mock: - with import_state(meta_path=[mock]): + with util.mock_modules('pkg.__init__', 'pkg.module') as mock: + with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module'] - module = import_('pkg', fromlist=['*']) + module = import_util.import_('pkg', fromlist=['*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) self.assertEqual(module.module.__name__, 'pkg.module') def test_star_with_others(self): # [using * with others] - context = mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2') + context = util.mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2') with context as mock: - with import_state(meta_path=[mock]): + with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module1'] - module = import_('pkg', fromlist=['module2', '*']) + module = import_util.import_('pkg', fromlist=['module2', '*']) self.assertEquals(module.__name__, 'pkg') self.assert_(hasattr(module, 'module1')) self.assert_(hasattr(module, 'module2')) Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_meta_path.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_meta_path.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_meta_path.py Sun Feb 1 11:54:55 2009 @@ -1,5 +1,5 @@ -from ..support import import_state, mock_modules, import_ - +from .. import util +from . import util as import_util from contextlib import nested from types import MethodType import unittest @@ -16,24 +16,25 @@ def test_first_called(self): # [first called] mod = 'top_level' - first = mock_modules(mod) - second = mock_modules(mod) - with nested(mock_modules(mod), mock_modules(mod)) as (first, second): + first = util.mock_modules(mod) + second = util.mock_modules(mod) + context = nested(util.mock_modules(mod), util.mock_modules(mod)) + with context as (first, second): first.modules[mod] = 42 second.modules[mod] = -13 - with import_state(meta_path=[first, second]): - self.assertEquals(import_(mod), 42) + with util.import_state(meta_path=[first, second]): + self.assertEquals(import_util.import_(mod), 42) def test_continuing(self): # [continuing] mod_name = 'for_real' - first = mock_modules('nonexistent') - second = mock_modules(mod_name) + first = util.mock_modules('nonexistent') + second = util.mock_modules(mod_name) with nested(first, second): first.find_module = lambda self, fullname, path=None: None second.modules[mod_name] = 42 - with import_state(meta_path=[first, second]): - self.assertEquals(import_(mod_name), 42) + with util.import_state(meta_path=[first, second]): + self.assertEquals(import_util.import_(mod_name), 42) class CallSignature(unittest.TestCase): @@ -54,11 +55,11 @@ # [no path] mod_name = 'top_level' assert '.' not in mod_name - with mock_modules(mod_name) as importer: + with util.mock_modules(mod_name) as importer: log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) - with import_state(meta_path=[importer]): - import_(mod_name) + with util.import_state(meta_path=[importer]): + import_util.import_(mod_name) assert len(log) == 1 args = log[0][0] kwargs = log[0][1] @@ -74,12 +75,12 @@ mod_name = pkg_name + '.module' path = [42] assert '.' in mod_name - with mock_modules(pkg_name+'.__init__', mod_name) as importer: + with util.mock_modules(pkg_name+'.__init__', mod_name) as importer: importer.modules[pkg_name].__path__ = path log, wrapped_call = self.log(importer.find_module) importer.find_module = MethodType(wrapped_call, importer) - with import_state(meta_path=[importer]): - import_(mod_name) + with util.import_state(meta_path=[importer]): + import_util.import_(mod_name) assert len(log) == 2 args = log[1][0] kwargs = log[1][1] Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_packages.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_packages.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_packages.py Sun Feb 1 11:54:55 2009 @@ -1,7 +1,8 @@ +from .. import util +from . import util as import_util import sys import unittest import importlib -from .. import support class ParentModuleTests(unittest.TestCase): @@ -9,15 +10,16 @@ """Importing a submodule should import the parent modules.""" def test_import_parent(self): - with support.mock_modules('pkg.__init__', 'pkg.module') as mock: - with support.import_state(meta_path=[mock]): - module = support.import_('pkg.module') + with util.mock_modules('pkg.__init__', 'pkg.module') as mock: + with util.import_state(meta_path=[mock]): + module = import_util.import_('pkg.module') self.assert_('pkg' in sys.modules) def test_bad_parent(self): - with support.mock_modules('pkg.module') as mock: - with support.import_state(meta_path=[mock]): - self.assertRaises(ImportError, support.import_, 'pkg.module') + with util.mock_modules('pkg.module') as mock: + with util.import_state(meta_path=[mock]): + self.assertRaises(ImportError, + import_util.import_, 'pkg.module') def test_main(): Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_path.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_path.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_path.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,5 @@ -from ..support import (mock_modules, import_state, import_, mock_path_hook, - importlib_only, uncache) - +from .. import util +from . import util as import_util from contextlib import nested from imp import new_module import sys @@ -32,7 +31,7 @@ def order_test(self, to_import, entry, search_path, path=[]): # [order] log = [] - class LogFindModule(mock_modules): + class LogFindModule(util.mock_modules): def find_module(self, fullname): log.append(self) return super().find_module(fullname) @@ -42,12 +41,12 @@ hitter = LogFindModule(to_import) with nested(misser, hitter): cache = dict(zip(search_path, (misser, hitter))) - with import_state(path=path, path_importer_cache=cache): - import_(to_import) + with util.import_state(path=path, path_importer_cache=cache): + import_util.import_(to_import) self.assertEquals(log[0], misser) self.assertEquals(log[1], hitter) - @importlib_only # __import__ uses PyDict_GetItem(), bypassing log. + @import_util.importlib_only # __import__ uses PyDict_GetItem(), bypassing log. def cache_use_test(self, to_import, entry, path=[]): # [cache check], [cache use] log = [] @@ -56,11 +55,11 @@ log.append(item) return super(LoggingDict, self).__getitem__(item) - with mock_modules(to_import) as importer: + with util.mock_modules(to_import) as importer: cache = LoggingDict() cache[entry] = importer - with import_state(path=[entry], path_importer_cache=cache): - module = import_(to_import, fromlist=['a']) + with util.import_state(path=[entry], path_importer_cache=cache): + module = import_util.import_(to_import, fromlist=['a']) self.assert_(module is importer[to_import]) self.assertEquals(len(cache), 1) self.assertEquals([entry], log) @@ -71,11 +70,11 @@ def logging_hook(entry): log.append(entry) raise ImportError - with mock_modules(to_import) as importer: - hitter = mock_path_hook(entry, importer=importer) + with util.mock_modules(to_import) as importer: + hitter = import_util.mock_path_hook(entry, importer=importer) path_hooks = [logging_hook, logging_hook, hitter] - with import_state(path_hooks=path_hooks, path=path): - import_(to_import) + with util.import_state(path_hooks=path_hooks, path=path): + import_util.import_(to_import) self.assertEquals(sys.path_importer_cache[entry], importer) self.assertEquals(len(log), 2) @@ -90,7 +89,7 @@ raise ImportError try: - import_(to_import) + import_util.import_(to_import) except ImportError: pass @@ -113,7 +112,7 @@ def test_path_argument(self): name = 'total junk' - with uncache(name): + with util.uncache(name): self.path_argument_test(name) @@ -122,13 +121,13 @@ """Tests for __path__.""" def run_test(self, test, entry, path, *args): - with mock_modules('pkg.__init__') as importer: + with util.mock_modules('pkg.__init__') as importer: importer['pkg'].__path__ = path importer.load_module('pkg') test('pkg.hit', entry, *args) - @importlib_only # XXX Unknown reason why this fails. + @import_util.importlib_only # XXX Unknown reason why this fails. def test_order(self): self.run_test(self.order_test, 'second', ('first', 'second'), ['first', 'second']) @@ -146,7 +145,7 @@ module.__path__ = ['random __path__'] name = 'pkg.whatever' sys.modules['pkg'] = module - with uncache('pkg', name): + with util.uncache('pkg', name): self.path_argument_test(name) Modified: python/branches/py3k-issue1717/Lib/importlib/test/import_/test_relative_imports.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/import_/test_relative_imports.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/import_/test_relative_imports.py Sun Feb 1 11:54:55 2009 @@ -1,7 +1,6 @@ """Test relative imports (PEP 328).""" - -from ..support import uncache, import_, mock_modules, import_state - +from .. import util +from . import util as import_util import sys import unittest @@ -65,10 +64,10 @@ uncache_names.append(name) else: uncache_names.append(name[:-len('.__init__')]) - with mock_modules(*create) as importer: - with import_state(meta_path=[importer]): + with util.mock_modules(*create) as importer: + with util.import_state(meta_path=[importer]): for global_ in globals_: - with uncache(*uncache_names): + with util.uncache(*uncache_names): callback(global_) @@ -77,8 +76,8 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['mod2'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['mod2'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'mod2')) self.assertEqual(module.mod2.attr, 'pkg.mod2') @@ -89,8 +88,9 @@ create = 'pkg.__init__', 'pkg.mod2' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.mod1'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('mod2', global_, fromlist=['attr'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('mod2', global_, fromlist=['attr'], + level=1) self.assertEqual(module.__name__, 'pkg.mod2') self.assertEqual(module.attr, 'pkg.mod2') self.relative_import_test(create, globals_, callback) @@ -101,8 +101,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['module'], + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['module'], level=1) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'module')) @@ -114,8 +114,8 @@ create = 'pkg.__init__', 'pkg.module' globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - import_('pkg') # For __import__(). - module = import_('', global_, fromlist=['attr'], level=1) + import_util.import_('pkg') # For __import__(). + module = import_util.import_('', global_, fromlist=['attr'], level=1) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -126,7 +126,8 @@ globals_ = ({'__package__': 'pkg.subpkg1'}, {'__name__': 'pkg.subpkg1', '__path__': ['blah']}) def callback(global_): - module = import_('', global_, fromlist=['subpkg2'], level=2) + module = import_util.import_('', global_, fromlist=['subpkg2'], + level=2) self.assertEqual(module.__name__, 'pkg') self.assert_(hasattr(module, 'subpkg2')) self.assertEqual(module.subpkg2.attr, 'pkg.subpkg2.__init__') @@ -141,8 +142,8 @@ {'__name__': 'pkg.pkg1.pkg2.pkg3.pkg4.pkg5', '__path__': ['blah']}) def callback(global_): - import_(globals_[0]['__package__']) - module = import_('', global_, fromlist=['attr'], level=6) + import_util.import_(globals_[0]['__package__']) + module = import_util.import_('', global_, fromlist=['attr'], level=6) self.assertEqual(module.__name__, 'pkg') self.relative_import_test(create, globals_, callback) @@ -152,8 +153,8 @@ globals_ = ({'__package__': 'pkg'}, {'__name__': 'pkg', '__path__': ['blah']}) def callback(global_): - import_('pkg') - self.assertRaises(ValueError, import_, '', global_, + import_util.import_('pkg') + self.assertRaises(ValueError, import_util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) @@ -162,14 +163,14 @@ create = ['top_level', 'pkg.__init__', 'pkg.module'] globals_ = {'__package__': 'pkg'}, {'__name__': 'pkg.module'} def callback(global_): - import_('pkg') - self.assertRaises(ValueError, import_, '', global_, + import_util.import_('pkg') + self.assertRaises(ValueError, import_util.import_, '', global_, fromlist=['top_level'], level=2) self.relative_import_test(create, globals_, callback) def test_empty_name_w_level_0(self): # [empty name] - self.assertRaises(ValueError, import_, '') + self.assertRaises(ValueError, import_util.import_, '') def test_import_from_different_package(self): # Test importing from a different package than the caller. @@ -183,8 +184,9 @@ '__runpy_pkg__.uncle.cousin.nephew'] globals_ = {'__package__': '__runpy_pkg__.__runpy_pkg__'} def callback(global_): - import_('__runpy_pkg__.__runpy_pkg__') - module = import_('uncle.cousin', globals_, {}, fromlist=['nephew'], + import_util.import_('__runpy_pkg__.__runpy_pkg__') + module = import_util.import_('uncle.cousin', globals_, {}, + fromlist=['nephew'], level=2) self.assertEqual(module.__name__, '__runpy_pkg__.uncle.cousin') self.relative_import_test(create, globals_, callback) Modified: python/branches/py3k-issue1717/Lib/importlib/test/source/test_case_sensitivity.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_case_sensitivity.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/source/test_case_sensitivity.py Sun Feb 1 11:54:55 2009 @@ -1,13 +1,14 @@ """Test case-sensitivity (PEP 235).""" import importlib -from .. import support +from .. import util +from . import util as source_util import os import sys from test import support as test_support import unittest - at support.case_insensitive_tests + at util.case_insensitive_tests class CaseSensitivityTest(unittest.TestCase): """PEP 235 dictates that on case-preserving, case-insensitive file systems @@ -25,7 +26,8 @@ """Look for a module with matching and non-matching sensitivity.""" sensitive_pkg = 'sensitive.{0}'.format(self.name) insensitive_pkg = 'insensitive.{0}'.format(self.name.lower()) - with support.create_modules(insensitive_pkg, sensitive_pkg) as mapping: + context = source_util.create_modules(insensitive_pkg, sensitive_pkg) + with context as mapping: sensitive_path = os.path.join(mapping['.root'], 'sensitive') insensitive_path = os.path.join(mapping['.root'], 'insensitive') return self.find(sensitive_path), self.find(insensitive_path) Modified: python/branches/py3k-issue1717/Lib/importlib/test/source/test_finder.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_finder.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/source/test_finder.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,6 @@ import importlib from .. import abc -from .. import support +from . import util as source_util import os import py_compile import unittest @@ -45,7 +45,7 @@ """ if create is None: create = {test} - with support.create_modules(*create) as mapping: + with source_util.create_modules(*create) as mapping: if compile_: for name in compile_: py_compile.compile(mapping[name]) @@ -76,14 +76,14 @@ # [sub module] def test_module_in_package(self): - with support.create_modules('pkg.__init__', 'pkg.sub') as mapping: + with source_util.create_modules('pkg.__init__', 'pkg.sub') as mapping: pkg_dir = os.path.dirname(mapping['pkg.__init__']) loader = self.import_(pkg_dir, 'pkg.sub') self.assert_(hasattr(loader, 'load_module')) # [sub package] def test_package_in_package(self): - context = support.create_modules('pkg.__init__', 'pkg.sub.__init__') + context = source_util.create_modules('pkg.__init__', 'pkg.sub.__init__') with context as mapping: pkg_dir = os.path.dirname(mapping['pkg.__init__']) loader = self.import_(pkg_dir, 'pkg.sub') @@ -91,7 +91,7 @@ # [sub empty] def test_empty_sub_directory(self): - context = support.create_modules('pkg.__init__', 'pkg.sub.__init__') + context = source_util.create_modules('pkg.__init__', 'pkg.sub.__init__') with warnings.catch_warnings(): warnings.simplefilter("error", ImportWarning) with context as mapping: @@ -109,7 +109,7 @@ def test_failure(self): - with support.create_modules('blah') as mapping: + with source_util.create_modules('blah') as mapping: nothing = self.import_(mapping['.root'], 'sdfsadsadf') self.assert_(nothing is None) Modified: python/branches/py3k-issue1717/Lib/importlib/test/source/test_loader.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_loader.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/source/test_loader.py Sun Feb 1 11:54:55 2009 @@ -1,5 +1,6 @@ import importlib -from .. import support +from .. import abc +from . import util as source_util import imp import os @@ -16,15 +17,84 @@ """ # [basic] - def test_basic(self): - with support.create_modules('_temp') as mapping: + def test_module(self): + with source_util.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) - loader.load_module('_temp') + module = loader.load_module('_temp') self.assert_('_temp' in sys.modules) + check = {'__name__': '_temp', '__file__': mapping['_temp'], + '__package__': None} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def test_package(self): + with source_util.create_modules('_pkg.__init__') as mapping: + loader = importlib._PyFileLoader('_pkg', mapping['_pkg.__init__'], + True) + module = loader.load_module('_pkg') + self.assert_('_pkg' in sys.modules) + check = {'__name__': '_pkg', '__file__': mapping['_pkg.__init__'], + '__path__': [os.path.dirname(mapping['_pkg.__init__'])], + '__package__': '_pkg'} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + + def test_lacking_parent(self): + with source_util.create_modules('_pkg.__init__', '_pkg.mod')as mapping: + loader = importlib._PyFileLoader('_pkg.mod', mapping['_pkg.mod'], + False) + module = loader.load_module('_pkg.mod') + self.assert_('_pkg.mod' in sys.modules) + check = {'__name__': '_pkg.mod', '__file__': mapping['_pkg.mod'], + '__package__': '_pkg'} + for attr, value in check.items(): + self.assertEqual(getattr(module, attr), value) + + def fake_mtime(self, fxn): + """Fake mtime to always be higher than expected.""" + return lambda name: fxn(name) + 1 + + def test_module_reuse(self): + with source_util.create_modules('_temp') as mapping: + loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) + module = loader.load_module('_temp') + module_id = id(module) + module_dict_id = id(module.__dict__) + with open(mapping['_temp'], 'w') as file: + file.write("testing_var = 42\n") + # For filesystems where the mtime is only to a second granularity, + # everything that has happened above can be too fast; + # force an mtime on the source that is guaranteed to be different + # than the original mtime. + loader.source_mtime = self.fake_mtime(loader.source_mtime) + module = loader.load_module('_temp') + self.assert_('testing_var' in module.__dict__, + "'testing_var' not in " + "{0}".format(list(module.__dict__.keys()))) + self.assertEqual(module, sys.modules['_temp']) + self.assertEqual(id(module), module_id) + self.assertEqual(id(module.__dict__), module_dict_id) + + def test_state_after_failure(self): + # A failed reload should leave the original module intact. + attributes = ('__file__', '__path__', '__package__') + value = '' + name = '_temp' + with source_util.create_modules(name) as mapping: + orig_module = imp.new_module(name) + for attr in attributes: + setattr(orig_module, attr, value) + with open(mapping[name], 'w') as file: + file.write('+++ bad syntax +++') + loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) + self.assertRaises(SyntaxError, loader.load_module, name) + for attr in attributes: + self.assertEqual(getattr(orig_module, attr), value) # [syntax error] def test_bad_syntax(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: with open(mapping['_temp'], 'w') as file: file.write('=') loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) @@ -39,12 +109,12 @@ def tearDown(self): sys.dont_write_bytecode = False - @support.writes_bytecode + @source_util.writes_bytecode def run_test(self, assertion): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: loader = importlib._PyFileLoader('_temp', mapping['_temp'], False) loader.load_module('_temp') - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) assertion(bytecode_path) def test_bytecode_written(self): @@ -67,10 +137,10 @@ # [bad magic] def test_bad_magic(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) os.unlink(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as file: file.seek(0) file.write(b'\x00\x00\x00\x00') @@ -94,7 +164,7 @@ def run_test(self, test, *create, pkg=False): create += (test,) - with support.create_modules(*create) as mapping: + with source_util.create_modules(*create) as mapping: for name in create: py_compile.compile(mapping[name]) if pkg: @@ -147,11 +217,11 @@ self.assert_(module_name in sys.modules) # [bad magic] - @support.writes_bytecode + @source_util.writes_bytecode def test_bad_magic(self): - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as bytecode_file: bytecode_file.seek(0) bytecode_file.write(b'\x00\x00\x00\x00') @@ -160,12 +230,12 @@ self.assertEqual(bytecode_file.read(4), imp.get_magic()) # [bad timestamp] - @support.writes_bytecode + @source_util.writes_bytecode def test_bad_bytecode(self): zeros = b'\x00\x00\x00\x00' - with support.create_modules('_temp') as mapping: + with source_util.create_modules('_temp') as mapping: py_compile.compile(mapping['_temp']) - bytecode_path = support.bytecode_path(mapping['_temp']) + bytecode_path = source_util.bytecode_path(mapping['_temp']) with open(bytecode_path, 'r+b') as bytecode_file: bytecode_file.seek(4) bytecode_file.write(zeros) @@ -178,8 +248,8 @@ # [bad marshal] def test_bad_marshal(self): - with support.create_modules('_temp') as mapping: - bytecode_path = support.bytecode_path(mapping['_temp']) + with source_util.create_modules('_temp') as mapping: + bytecode_path = source_util.bytecode_path(mapping['_temp']) source_mtime = os.path.getmtime(mapping['_temp']) source_timestamp = importlib._w_long(source_mtime) with open(bytecode_path, 'wb') as bytecode_file: Modified: python/branches/py3k-issue1717/Lib/importlib/test/source/test_path_hook.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_path_hook.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/source/test_path_hook.py Sun Feb 1 11:54:55 2009 @@ -1,5 +1,5 @@ import importlib -from .. import support +from . import util as source_util import unittest @@ -9,7 +9,7 @@ def test_success(self): # XXX Only work on existing directories? - with support.create_modules('dummy') as mapping: + with source_util.create_modules('dummy') as mapping: self.assert_(hasattr(importlib.FileImporter(mapping['.root']), 'find_module')) Deleted: python/branches/py3k-issue1717/Lib/importlib/test/source/test_reload.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_reload.py Sun Feb 1 11:54:55 2009 +++ (empty file) @@ -1,71 +0,0 @@ -"""Test reload support. - -Reload support requires two things. One is that if module is loaded that -already exists in sys.modules then it is reused. And two, if a reload fails the -pre-existing module is left in a sane state. - -""" -import imp -import sys -import types -import unittest -import importlib -from .. import support - - -class ReloadTests(unittest.TestCase): - - name = '_temp' - - def load_module(self, mapping): - return importlib._PyFileLoader(self.name, mapping[self.name], False) - - def fake_mtime(self, fxn): - """Fake mtime to always be higher than expected.""" - return lambda name: fxn(name) + 1 - - def test_module_reuse(self): - with support.create_modules(self.name) as mapping: - loader = self.load_module(mapping) - module = loader.load_module(self.name) - module_id = id(module) - module_dict_id = id(module.__dict__) - with open(mapping[self.name], 'w') as file: - file.write("testing_var = 42\n") - # For filesystems where the mtime is only to a second granularity, - # everything that has happened above can be too fast; - # force an mtime on the source that is guaranteed to be different - # than the original mtime. - loader.source_mtime = self.fake_mtime(loader.source_mtime) - module = loader.load_module(self.name) - self.assert_('testing_var' in module.__dict__, - "'testing_var' not in " - "{0}".format(list(module.__dict__.keys()))) - self.assertEqual(module, sys.modules[self.name]) - self.assertEqual(id(module), module_id) - self.assertEqual(id(module.__dict__), module_dict_id) - - def test_bad_reload(self): - # A failed reload should leave the original module intact. - attributes = ('__file__', '__path__', '__package__') - value = '' - with support.create_modules(self.name) as mapping: - orig_module = imp.new_module(self.name) - for attr in attributes: - setattr(orig_module, attr, value) - with open(mapping[self.name], 'w') as file: - file.write('+++ bad syntax +++') - loader = self.load_module(mapping) - self.assertRaises(SyntaxError, loader.load_module, self.name) - for attr in attributes: - self.assertEqual(getattr(orig_module, attr), value) - - - -def test_main(): - from test.support import run_unittest - run_unittest(ReloadTests) - - -if __name__ == '__main__': - test_main() Modified: python/branches/py3k-issue1717/Lib/importlib/test/source/test_source_encoding.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/source/test_source_encoding.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/source/test_source_encoding.py Sun Feb 1 11:54:55 2009 @@ -1,5 +1,5 @@ import importlib -from .. import support +from . import util as source_util import codecs import re @@ -32,7 +32,7 @@ module_name = '_temp' def run_test(self, source): - with support.create_modules(self.module_name) as mapping: + with source_util.create_modules(self.module_name) as mapping: with open(mapping[self.module_name], 'wb')as file: file.write(source) loader = importlib._PyFileLoader(self.module_name, @@ -93,7 +93,7 @@ module_name = '_temp' source_lines = [b"a = 42", b"b = -13", b''] source = line_ending.join(source_lines) - with support.create_modules(module_name) as mapping: + with source_util.create_modules(module_name) as mapping: with open(mapping[module_name], 'wb') as file: file.write(source) loader = importlib._PyFileLoader(module_name, mapping[module_name], Deleted: python/branches/py3k-issue1717/Lib/importlib/test/support.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/support.py Sun Feb 1 11:54:55 2009 +++ (empty file) @@ -1,233 +0,0 @@ -from importlib import Import - -from contextlib import contextmanager -from functools import update_wrapper -import imp -import os.path -from test.support import unlink -import sys -from tempfile import gettempdir - - -using___import__ = False - -def import_(*args, **kwargs): - """Delegate to allow for injecting different implementations of import.""" - if using___import__: - return __import__(*args, **kwargs) - return Import()(*args, **kwargs) - -def importlib_only(fxn): - """Decorator to mark which tests are not supported by the current - implementation of __import__().""" - def inner(*args, **kwargs): - if using___import__: - return - else: - return fxn(*args, **kwargs) - update_wrapper(inner, fxn) - return inner - -def writes_bytecode(fxn): - """Decorator that returns the function if writing bytecode is enabled, else - a stub function that accepts anything and simply returns None.""" - if sys.dont_write_bytecode: - return lambda *args, **kwargs: None - else: - return fxn - - -def case_insensitive_tests(class_): - """Class decorator that nullifies tests that require a case-insensitive - file system.""" - if sys.platform not in ('win32', 'darwin', 'cygwin'): - return object() - else: - return class_ - - - at contextmanager -def uncache(*names): - """Uncache a module from sys.modules. - - A basic sanity check is performed to prevent uncaching modules that either - cannot/shouldn't be uncached. - - """ - for name in names: - if name in ('sys', 'marshal', 'imp'): - raise ValueError( - "cannot uncache {0} as it will break _importlib".format(name)) - try: - del sys.modules[name] - except KeyError: - pass - try: - yield - finally: - for name in names: - try: - del sys.modules[name] - except KeyError: - pass - - at contextmanager -def import_state(**kwargs): - """Context manager to manage the various importers and stored state in the - sys module. - - The 'modules' attribute is not supported as the interpreter state stores a - pointer to the dict that the interpreter uses internally; - reassigning to sys.modules does not have the desired effect. - - """ - originals = {} - try: - for attr, default in (('meta_path', []), ('path', []), - ('path_hooks', []), - ('path_importer_cache', {})): - originals[attr] = getattr(sys, attr) - if attr in kwargs: - new_value = kwargs[attr] - del kwargs[attr] - else: - new_value = default - setattr(sys, attr, new_value) - if len(kwargs): - raise ValueError( - 'unrecognized arguments: {0}'.format(kwargs.keys())) - yield - finally: - for attr, value in originals.items(): - setattr(sys, attr, value) - - - at contextmanager -def create_modules(*names): - """Temporarily create each named module with an attribute (named 'attr') - that contains the name passed into the context manager that caused the - creation of the module. - - All files are created in a temporary directory specified by - tempfile.gettempdir(). This directory is inserted at the beginning of - sys.path. When the context manager exits all created files (source and - bytecode) are explicitly deleted. - - No magic is performed when creating packages! This means that if you create - a module within a package you must also create the package's __init__ as - well. - - """ - source = 'attr = {0!r}' - created_paths = [] - mapping = {} - try: - temp_dir = gettempdir() - mapping['.root'] = temp_dir - import_names = set() - for name in names: - if not name.endswith('__init__'): - import_name = name - else: - import_name = name[:-len('.__init__')] - import_names.add(import_name) - if import_name in sys.modules: - del sys.modules[import_name] - name_parts = name.split('.') - file_path = temp_dir - for directory in name_parts[:-1]: - file_path = os.path.join(file_path, directory) - if not os.path.exists(file_path): - os.mkdir(file_path) - created_paths.append(file_path) - file_path = os.path.join(file_path, name_parts[-1] + '.py') - with open(file_path, 'w') as file: - file.write(source.format(name)) - created_paths.append(file_path) - mapping[name] = file_path - uncache_manager = uncache(*import_names) - uncache_manager.__enter__() - state_manager = import_state(path=[temp_dir]) - state_manager.__enter__() - yield mapping - finally: - state_manager.__exit__(None, None, None) - uncache_manager.__exit__(None, None, None) - # Reverse the order for path removal to unroll directory creation. - for path in reversed(created_paths): - if file_path.endswith('.py'): - unlink(path) - unlink(path + 'c') - unlink(path + 'o') - else: - os.rmdir(path) - - -class mock_modules: - - """A mock importer/loader.""" - - def __init__(self, *names): - self.modules = {} - for name in names: - if not name.endswith('.__init__'): - import_name = name - else: - import_name = name[:-len('.__init__')] - if '.' not in name: - package = None - elif import_name == name: - package = name.rsplit('.', 1)[0] - else: - package = import_name - module = imp.new_module(import_name) - module.__loader__ = self - module.__file__ = '' - module.__package__ = package - module.attr = name - if import_name != name: - module.__path__ = [''] - self.modules[import_name] = module - - def __getitem__(self, name): - return self.modules[name] - - def find_module(self, fullname, path=None): - if fullname not in self.modules: - return None - else: - return self - - def load_module(self, fullname): - if fullname not in self.modules: - raise ImportError - else: - sys.modules[fullname] = self.modules[fullname] - return self.modules[fullname] - - def __enter__(self): - self._uncache = uncache(*self.modules.keys()) - self._uncache.__enter__() - return self - - def __exit__(self, *exc_info): - self._uncache.__exit__(None, None, None) - - -def mock_path_hook(*entries, importer): - """A mock sys.path_hooks entry.""" - def hook(entry): - if entry not in entries: - raise ImportError - return importer - return hook - - -def bytecode_path(source_path): - for suffix, _, type_ in imp.get_suffixes(): - if type_ == imp.PY_COMPILED: - bc_suffix = suffix - break - else: - raise ValueError("no bytecode suffix is defined") - return os.path.splitext(source_path)[0] + bc_suffix Modified: python/branches/py3k-issue1717/Lib/importlib/test/test_api.py ============================================================================== --- python/branches/py3k-issue1717/Lib/importlib/test/test_api.py (original) +++ python/branches/py3k-issue1717/Lib/importlib/test/test_api.py Sun Feb 1 11:54:55 2009 @@ -1,6 +1,6 @@ import unittest import importlib -from . import support +from . import util class ImportModuleTests(unittest.TestCase): @@ -9,8 +9,8 @@ def test_module_import(self): # Test importing a top-level module. - with support.mock_modules('top_level') as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules('top_level') as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module('top_level') self.assertEqual(module.__name__, 'top_level') @@ -19,8 +19,8 @@ pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with support.mock_modules(pkg_long_name, name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(name) self.assertEqual(module.__name__, name) @@ -31,8 +31,8 @@ module_name = 'mod' absolute_name = '{0}.{1}'.format(pkg_name, module_name) relative_name = '.{0}'.format(module_name) - with support.mock_modules(pkg_long_name, absolute_name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, absolute_name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(relative_name, pkg_name) self.assertEqual(module.__name__, absolute_name) @@ -42,8 +42,8 @@ pkg_name = 'pkg' pkg_long_name = '{0}.__init__'.format(pkg_name) name = '{0}.mod'.format(pkg_name) - with support.mock_modules(pkg_long_name, name) as mock: - with support.import_state(meta_path=[mock]): + with util.mock_modules(pkg_long_name, name) as mock: + with util.import_state(meta_path=[mock]): module = importlib.import_module(name, pkg_name) self.assertEqual(module.__name__, name) Modified: python/branches/py3k-issue1717/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k-issue1717/Lib/test/test_descr.py (original) +++ python/branches/py3k-issue1717/Lib/test/test_descr.py Sun Feb 1 11:54:55 2009 @@ -3885,6 +3885,8 @@ # Testing method-wrapper objects... # did not support any reflection before 2.5 + # XXX should methods really support __eq__? + l = [] self.assertEqual(l.__add__, l.__add__) self.assertEqual(l.__add__, [].__add__) Modified: python/branches/py3k-issue1717/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-issue1717/Objects/unicodeobject.c (original) +++ python/branches/py3k-issue1717/Objects/unicodeobject.c Sun Feb 1 11:54:55 2009 @@ -12,8 +12,8 @@ -------------------------------------------------------------------- The original string type implementation is: - Copyright (c) 1999 by Secret Labs AB - Copyright (c) 1999 by Fredrik Lundh + Copyright (c) 1999 by Secret Labs AB + Copyright (c) 1999 by Fredrik Lundh By obtaining, using, and/or copying this software and/or its associated documentation, you agree that you have read, understood, @@ -125,59 +125,59 @@ /* Fast detection of the most frequent whitespace characters */ const unsigned char _Py_ascii_whitespace[] = { - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* case 0x0009: * HORIZONTAL TABULATION */ /* case 0x000A: * LINE FEED */ /* case 0x000B: * VERTICAL TABULATION */ /* case 0x000C: * FORM FEED */ /* case 0x000D: * CARRIAGE RETURN */ - 0, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* case 0x001C: * FILE SEPARATOR */ /* case 0x001D: * GROUP SEPARATOR */ /* case 0x001E: * RECORD SEPARATOR */ /* case 0x001F: * UNIT SEPARATOR */ - 0, 0, 0, 0, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 1, 1, 1, /* case 0x0020: * SPACE */ - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; /* Same for linebreaks */ static unsigned char ascii_linebreak[] = { - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x000A, * LINE FEED */ /* 0x000D, * CARRIAGE RETURN */ - 0, 0, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x001C, * FILE SEPARATOR */ /* 0x001D, * GROUP SEPARATOR */ /* 0x001E, * RECORD SEPARATOR */ - 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -185,11 +185,11 @@ PyUnicode_GetMax(void) { #ifdef Py_UNICODE_WIDE - return 0x10FFFF; + return 0x10FFFF; #else - /* This is actually an illegal character, so it should - not be passed to unichr. */ - return 0xFFFF; + /* This is actually an illegal character, so it should + not be passed to unichr. */ + return 0xFFFF; #endif } @@ -207,9 +207,9 @@ #define BLOOM(mask, ch) ((mask & (1 << ((ch) & 0x1F)))) -#define BLOOM_LINEBREAK(ch) \ - ((ch) < 128U ? ascii_linebreak[(ch)] : \ - (BLOOM(bloom_linebreak, (ch)) && Py_UNICODE_ISLINEBREAK(ch))) +#define BLOOM_LINEBREAK(ch) \ + ((ch) < 128U ? ascii_linebreak[(ch)] : \ + (BLOOM(bloom_linebreak, (ch)) && Py_UNICODE_ISLINEBREAK(ch))) Py_LOCAL_INLINE(BLOOM_MASK) make_bloom_mask(Py_UNICODE* ptr, Py_ssize_t len) { @@ -236,29 +236,29 @@ return 0; } -#define BLOOM_MEMBER(mask, chr, set, setlen)\ +#define BLOOM_MEMBER(mask, chr, set, setlen) \ BLOOM(mask, chr) && unicode_member(chr, set, setlen) /* --- Unicode Object ----------------------------------------------------- */ static int unicode_resize(register PyUnicodeObject *unicode, - Py_ssize_t length) + Py_ssize_t length) { void *oldstr; /* Shortcut if there's nothing much to do. */ if (unicode->length == length) - goto reset; + goto reset; /* Resizing shared object (unicode_empty or single character objects) in-place is not allowed. Use PyUnicode_Resize() instead ! */ - if (unicode == unicode_empty || - (unicode->length == 1 && - unicode->str[0] < 256U && - unicode_latin1[unicode->str[0]] == unicode)) { + if (unicode == unicode_empty || + (unicode->length == 1 && + unicode->str[0] < 256U && + unicode_latin1[unicode->str[0]] == unicode)) { PyErr_SetString(PyExc_SystemError, "can't resize shared str objects"); return -1; @@ -271,16 +271,16 @@ oldstr = unicode->str; unicode->str = PyObject_REALLOC(unicode->str, - sizeof(Py_UNICODE) * (length + 1)); + sizeof(Py_UNICODE) * (length + 1)); if (!unicode->str) { - unicode->str = (Py_UNICODE *)oldstr; + unicode->str = (Py_UNICODE *)oldstr; PyErr_NoMemory(); return -1; } unicode->str[length] = 0; unicode->length = length; - reset: + reset: /* Reset the object caches */ if (unicode->defenc) { Py_DECREF(unicode->defenc); @@ -296,7 +296,7 @@ relies on that. XXX This allocator could further be enhanced by assuring that the - free list never reduces its size below 1. + free list never reduces its size below 1. */ @@ -321,33 +321,33 @@ unicode = free_list; free_list = *(PyUnicodeObject **)unicode; numfree--; - if (unicode->str) { - /* Keep-Alive optimization: we only upsize the buffer, - never downsize it. */ - if ((unicode->length < length) && + if (unicode->str) { + /* Keep-Alive optimization: we only upsize the buffer, + never downsize it. */ + if ((unicode->length < length) && unicode_resize(unicode, length) < 0) { - PyObject_DEL(unicode->str); - unicode->str = NULL; - } - } + PyObject_DEL(unicode->str); + unicode->str = NULL; + } + } else { - size_t new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); - unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); + size_t new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); + unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); } PyObject_INIT(unicode, &PyUnicode_Type); } else { - size_t new_size; + size_t new_size; unicode = PyObject_New(PyUnicodeObject, &PyUnicode_Type); if (unicode == NULL) return NULL; - new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); - unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); + new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); + unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); } if (!unicode->str) { - PyErr_NoMemory(); - goto onError; + PyErr_NoMemory(); + goto onError; } /* Initialize the first element to guard against cases where * the caller fails before initializing str -- unicode_resize() @@ -364,7 +364,7 @@ unicode->defenc = NULL; return unicode; - onError: + onError: /* XXX UNREF/NEWREF interface should be more symmetrical */ _Py_DEC_REFTOTAL; _Py_ForgetReference((PyObject *)unicode); @@ -376,45 +376,45 @@ void unicode_dealloc(register PyUnicodeObject *unicode) { switch (PyUnicode_CHECK_INTERNED(unicode)) { - case SSTATE_NOT_INTERNED: - break; + case SSTATE_NOT_INTERNED: + break; - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(unicode) = 3; - if (PyDict_DelItem(interned, (PyObject *)unicode) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; + case SSTATE_INTERNED_MORTAL: + /* revive dead object temporarily for DelItem */ + Py_REFCNT(unicode) = 3; + if (PyDict_DelItem(interned, (PyObject *)unicode) != 0) + Py_FatalError( + "deletion of interned string failed"); + break; - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); + case SSTATE_INTERNED_IMMORTAL: + Py_FatalError("Immortal interned string died."); - default: - Py_FatalError("Inconsistent interned string state."); + default: + Py_FatalError("Inconsistent interned string state."); } if (PyUnicode_CheckExact(unicode) && - numfree < PyUnicode_MAXFREELIST) { + numfree < PyUnicode_MAXFREELIST) { /* Keep-Alive optimization */ - if (unicode->length >= KEEPALIVE_SIZE_LIMIT) { - PyObject_DEL(unicode->str); - unicode->str = NULL; - unicode->length = 0; - } - if (unicode->defenc) { - Py_DECREF(unicode->defenc); - unicode->defenc = NULL; - } - /* Add to free list */ + if (unicode->length >= KEEPALIVE_SIZE_LIMIT) { + PyObject_DEL(unicode->str); + unicode->str = NULL; + unicode->length = 0; + } + if (unicode->defenc) { + Py_DECREF(unicode->defenc); + unicode->defenc = NULL; + } + /* Add to free list */ *(PyUnicodeObject **)unicode = free_list; free_list = unicode; numfree++; } else { - PyObject_DEL(unicode->str); - Py_XDECREF(unicode->defenc); - Py_TYPE(unicode)->tp_free((PyObject *)unicode); + PyObject_DEL(unicode->str); + Py_XDECREF(unicode->defenc); + Py_TYPE(unicode)->tp_free((PyObject *)unicode); } } @@ -425,28 +425,28 @@ /* Argument checks */ if (unicode == NULL) { - PyErr_BadInternalCall(); - return -1; + PyErr_BadInternalCall(); + return -1; } v = *unicode; if (v == NULL || !PyUnicode_Check(v) || Py_REFCNT(v) != 1 || length < 0) { - PyErr_BadInternalCall(); - return -1; + PyErr_BadInternalCall(); + return -1; } /* Resizing unicode_empty and single character objects is not possible since these are being shared. We simply return a fresh copy with the same Unicode content. */ if (v->length != length && - (v == unicode_empty || v->length == 1)) { - PyUnicodeObject *w = _PyUnicode_New(length); - if (w == NULL) - return -1; - Py_UNICODE_COPY(w->str, v->str, - length < v->length ? length : v->length); - Py_DECREF(*unicode); - *unicode = w; - return 0; + (v == unicode_empty || v->length == 1)) { + PyUnicodeObject *w = _PyUnicode_New(length); + if (w == NULL) + return -1; + Py_UNICODE_COPY(w->str, v->str, + length < v->length ? length : v->length); + Py_DECREF(*unicode); + *unicode = w; + return 0; } /* Note that we don't have to modify *unicode for unshared Unicode @@ -460,7 +460,7 @@ } PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u, - Py_ssize_t size) + Py_ssize_t size) { PyUnicodeObject *unicode; @@ -468,26 +468,26 @@ some optimizations which share commonly used objects. */ if (u != NULL) { - /* Optimization for empty strings */ - if (size == 0 && unicode_empty != NULL) { - Py_INCREF(unicode_empty); - return (PyObject *)unicode_empty; - } - - /* Single character Unicode objects in the Latin-1 range are - shared when using this constructor */ - if (size == 1 && *u < 256) { - unicode = unicode_latin1[*u]; - if (!unicode) { - unicode = _PyUnicode_New(1); - if (!unicode) - return NULL; - unicode->str[0] = *u; - unicode_latin1[*u] = unicode; - } - Py_INCREF(unicode); - return (PyObject *)unicode; - } + /* Optimization for empty strings */ + if (size == 0 && unicode_empty != NULL) { + Py_INCREF(unicode_empty); + return (PyObject *)unicode_empty; + } + + /* Single character Unicode objects in the Latin-1 range are + shared when using this constructor */ + if (size == 1 && *u < 256) { + unicode = unicode_latin1[*u]; + if (!unicode) { + unicode = _PyUnicode_New(1); + if (!unicode) + return NULL; + unicode->str[0] = *u; + unicode_latin1[*u] = unicode; + } + Py_INCREF(unicode); + return (PyObject *)unicode; + } } unicode = _PyUnicode_New(size); @@ -496,7 +496,7 @@ /* Copy the Unicode data into the new object */ if (u != NULL) - Py_UNICODE_COPY(unicode->str, u, size); + Py_UNICODE_COPY(unicode->str, u, size); return (PyObject *)unicode; } @@ -505,11 +505,11 @@ { PyUnicodeObject *unicode; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyUnicode_FromStringAndSize"); - return NULL; - } + if (size < 0) { + PyErr_SetString(PyExc_SystemError, + "Negative size passed to PyUnicode_FromStringAndSize"); + return NULL; + } /* If the Unicode data is known at construction time, we can apply some optimizations which share commonly used objects. @@ -517,26 +517,26 @@ UTF-8 decoder at the end. */ if (u != NULL) { - /* Optimization for empty strings */ - if (size == 0 && unicode_empty != NULL) { - Py_INCREF(unicode_empty); - return (PyObject *)unicode_empty; - } + /* Optimization for empty strings */ + if (size == 0 && unicode_empty != NULL) { + Py_INCREF(unicode_empty); + return (PyObject *)unicode_empty; + } - /* Single characters are shared when using this constructor. + /* Single characters are shared when using this constructor. Restrict to ASCII, since the input must be UTF-8. */ - if (size == 1 && Py_CHARMASK(*u) < 128) { - unicode = unicode_latin1[Py_CHARMASK(*u)]; - if (!unicode) { - unicode = _PyUnicode_New(1); - if (!unicode) - return NULL; - unicode->str[0] = Py_CHARMASK(*u); - unicode_latin1[Py_CHARMASK(*u)] = unicode; - } - Py_INCREF(unicode); - return (PyObject *)unicode; - } + if (size == 1 && Py_CHARMASK(*u) < 128) { + unicode = unicode_latin1[Py_CHARMASK(*u)]; + if (!unicode) { + unicode = _PyUnicode_New(1); + if (!unicode) + return NULL; + unicode->str[0] = Py_CHARMASK(*u); + unicode_latin1[Py_CHARMASK(*u)] = unicode; + } + Py_INCREF(unicode); + return (PyObject *)unicode; + } return PyUnicode_DecodeUTF8(u, size, NULL); } @@ -562,15 +562,15 @@ #ifdef HAVE_WCHAR_H PyObject *PyUnicode_FromWideChar(register const wchar_t *w, - Py_ssize_t size) + Py_ssize_t size) { PyUnicodeObject *unicode; if (w == NULL) { if (size == 0) return PyUnicode_FromStringAndSize(NULL, 0); - PyErr_BadInternalCall(); - return NULL; + PyErr_BadInternalCall(); + return NULL; } if (size == -1) { @@ -586,11 +586,11 @@ memcpy(unicode->str, w, size * sizeof(wchar_t)); #else { - register Py_UNICODE *u; - register Py_ssize_t i; - u = PyUnicode_AS_UNICODE(unicode); - for (i = size; i > 0; i--) - *u++ = *w++; + register Py_UNICODE *u; + register Py_ssize_t i; + u = PyUnicode_AS_UNICODE(unicode); + for (i = size; i > 0; i--) + *u++ = *w++; } #endif @@ -600,23 +600,23 @@ static void makefmt(char *fmt, int longflag, int size_tflag, int zeropad, int width, int precision, char c) { - *fmt++ = '%'; - if (width) { - if (zeropad) - *fmt++ = '0'; - fmt += sprintf(fmt, "%d", width); - } - if (precision) - fmt += sprintf(fmt, ".%d", precision); - if (longflag) - *fmt++ = 'l'; - else if (size_tflag) { - char *f = PY_FORMAT_SIZE_T; - while (*f) - *fmt++ = *f++; - } - *fmt++ = c; - *fmt = '\0'; + *fmt++ = '%'; + if (width) { + if (zeropad) + *fmt++ = '0'; + fmt += sprintf(fmt, "%d", width); + } + if (precision) + fmt += sprintf(fmt, ".%d", precision); + if (longflag) + *fmt++ = 'l'; + else if (size_tflag) { + char *f = PY_FORMAT_SIZE_T; + while (*f) + *fmt++ = *f++; + } + *fmt++ = c; + *fmt = '\0'; } #define appendstring(string) {for (copy = string;*copy;) *s++ = *copy++;} @@ -624,387 +624,387 @@ PyObject * PyUnicode_FromFormatV(const char *format, va_list vargs) { - va_list count; - Py_ssize_t callcount = 0; - PyObject **callresults = NULL; - PyObject **callresult = NULL; - Py_ssize_t n = 0; - int width = 0; - int precision = 0; - int zeropad; - const char* f; - Py_UNICODE *s; - PyObject *string; - /* used by sprintf */ - char buffer[21]; - /* use abuffer instead of buffer, if we need more space - * (which can happen if there's a format specifier with width). */ - char *abuffer = NULL; - char *realbuffer; - Py_ssize_t abuffersize = 0; - char fmt[60]; /* should be enough for %0width.precisionld */ - const char *copy; + va_list count; + Py_ssize_t callcount = 0; + PyObject **callresults = NULL; + PyObject **callresult = NULL; + Py_ssize_t n = 0; + int width = 0; + int precision = 0; + int zeropad; + const char* f; + Py_UNICODE *s; + PyObject *string; + /* used by sprintf */ + char buffer[21]; + /* use abuffer instead of buffer, if we need more space + * (which can happen if there's a format specifier with width). */ + char *abuffer = NULL; + char *realbuffer; + Py_ssize_t abuffersize = 0; + char fmt[60]; /* should be enough for %0width.precisionld */ + const char *copy; #ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); + Py_MEMCPY(count, vargs, sizeof(va_list)); #else #ifdef __va_copy - __va_copy(count, vargs); + __va_copy(count, vargs); #else - count = vargs; + count = vargs; #endif #endif - /* step 1: count the number of %S/%R/%A format specifications - * (we call PyObject_Str()/PyObject_Repr()/PyObject_ASCII() for - * these objects once during step 3 and put the result in - an array) */ - for (f = format; *f; f++) { - if (*f == '%' && (*(f+1)=='S' || *(f+1)=='R' || *(f+1)=='A')) - ++callcount; - } - /* step 2: allocate memory for the results of - * PyObject_Str()/PyObject_Repr() calls */ - if (callcount) { - callresults = PyObject_Malloc(sizeof(PyObject *)*callcount); - if (!callresults) { - PyErr_NoMemory(); - return NULL; - } - callresult = callresults; - } - /* step 3: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f; - width = 0; - while (ISDIGIT((unsigned)*f)) - width = (width*10) + *f++ - '0'; - while (*++f && *f != '%' && !ISALPHA((unsigned)*f)) - ; - - /* skip the 'l' or 'z' in {%ld, %zd, %lu, %zu} since - * they don't affect the amount of space we reserve. - */ - if ((*f == 'l' || *f == 'z') && - (f[1] == 'd' || f[1] == 'u')) - ++f; - - switch (*f) { - case 'c': - (void)va_arg(count, int); - /* fall through... */ - case '%': - n++; - break; - case 'd': case 'u': case 'i': case 'x': - (void) va_arg(count, int); - /* 20 bytes is enough to hold a 64-bit - integer. Decimal takes the most space. - This isn't enough for octal. - If a width is specified we need more - (which we allocate later). */ - if (width < 20) - width = 20; - n += width; - if (abuffersize < width) - abuffersize = width; - break; - case 's': - { - /* UTF-8 */ - unsigned char*s; - s = va_arg(count, unsigned char*); - while (*s) { - if (*s < 128) { - n++; s++; - } else if (*s < 0xc0) { - /* invalid UTF-8 */ - n++; s++; - } else if (*s < 0xc0) { - n++; - s++; if(!*s)break; - s++; - } else if (*s < 0xe0) { - n++; - s++; if(!*s)break; - s++; if(!*s)break; - s++; - } else { - #ifdef Py_UNICODE_WIDE - n++; - #else - n+=2; - #endif - s++; if(!*s)break; - s++; if(!*s)break; - s++; if(!*s)break; - s++; - } - } - break; - } - case 'U': - { - PyObject *obj = va_arg(count, PyObject *); - assert(obj && PyUnicode_Check(obj)); - n += PyUnicode_GET_SIZE(obj); - break; - } - case 'V': - { - PyObject *obj = va_arg(count, PyObject *); - const char *str = va_arg(count, const char *); - assert(obj || str); - assert(!obj || PyUnicode_Check(obj)); - if (obj) - n += PyUnicode_GET_SIZE(obj); - else - n += strlen(str); - break; - } - case 'S': - { - PyObject *obj = va_arg(count, PyObject *); - PyObject *str; - assert(obj); - str = PyObject_Str(obj); - if (!str) - goto fail; - n += PyUnicode_GET_SIZE(str); - /* Remember the str and switch to the next slot */ - *callresult++ = str; - break; - } - case 'R': - { - PyObject *obj = va_arg(count, PyObject *); - PyObject *repr; - assert(obj); - repr = PyObject_Repr(obj); - if (!repr) - goto fail; - n += PyUnicode_GET_SIZE(repr); - /* Remember the repr and switch to the next slot */ - *callresult++ = repr; - break; - } - case 'A': - { - PyObject *obj = va_arg(count, PyObject *); - PyObject *ascii; - assert(obj); - ascii = PyObject_ASCII(obj); - if (!ascii) - goto fail; - n += PyUnicode_GET_SIZE(ascii); - /* Remember the repr and switch to the next slot */ - *callresult++ = ascii; - break; - } - case 'p': - (void) va_arg(count, int); - /* maximum 64-bit pointer representation: - * 0xffffffffffffffff - * so 19 characters is enough. - * XXX I count 18 -- what's the extra for? - */ - n += 19; - break; - default: - /* if we stumble upon an unknown - formatting code, copy the rest of - the format string to the output - string. (we cannot just skip the - code, since there's no way to know - what's in the argument list) */ - n += strlen(p); - goto expand; - } - } else - n++; - } - expand: - if (abuffersize > 20) { - abuffer = PyObject_Malloc(abuffersize); - if (!abuffer) { - PyErr_NoMemory(); - goto fail; - } - realbuffer = abuffer; - } - else - realbuffer = buffer; - /* step 4: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - we don't have to resize the string. - There can be no errors beyond this point. */ - string = PyUnicode_FromUnicode(NULL, n); - if (!string) - goto fail; - - s = PyUnicode_AS_UNICODE(string); - callresult = callresults; - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - int longflag = 0; - int size_tflag = 0; - zeropad = (*f == '0'); - /* parse the width.precision part */ - width = 0; - while (ISDIGIT((unsigned)*f)) - width = (width*10) + *f++ - '0'; - precision = 0; - if (*f == '.') { - f++; - while (ISDIGIT((unsigned)*f)) - precision = (precision*10) + *f++ - '0'; - } - /* handle the long flag, but only for %ld and %lu. - others can be added when necessary. */ - if (*f == 'l' && (f[1] == 'd' || f[1] == 'u')) { - longflag = 1; - ++f; - } - /* handle the size_t flag. */ - if (*f == 'z' && (f[1] == 'd' || f[1] == 'u')) { - size_tflag = 1; - ++f; - } - - switch (*f) { - case 'c': - *s++ = va_arg(vargs, int); - break; - case 'd': - makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'd'); - if (longflag) - sprintf(realbuffer, fmt, va_arg(vargs, long)); - else if (size_tflag) - sprintf(realbuffer, fmt, va_arg(vargs, Py_ssize_t)); - else - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 'u': - makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'u'); - if (longflag) - sprintf(realbuffer, fmt, va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(realbuffer, fmt, va_arg(vargs, size_t)); - else - sprintf(realbuffer, fmt, va_arg(vargs, unsigned int)); - appendstring(realbuffer); - break; - case 'i': - makefmt(fmt, 0, 0, zeropad, width, precision, 'i'); - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 'x': - makefmt(fmt, 0, 0, zeropad, width, precision, 'x'); - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 's': - { - /* Parameter must be UTF-8 encoded. - In case of encoding errors, use - the replacement character. */ - PyObject *u; - p = va_arg(vargs, char*); - u = PyUnicode_DecodeUTF8(p, strlen(p), - "replace"); - if (!u) - goto fail; - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(u), - PyUnicode_GET_SIZE(u)); - s += PyUnicode_GET_SIZE(u); - Py_DECREF(u); - break; - } - case 'U': - { - PyObject *obj = va_arg(vargs, PyObject *); - Py_ssize_t size = PyUnicode_GET_SIZE(obj); - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); - s += size; - break; - } - case 'V': - { - PyObject *obj = va_arg(vargs, PyObject *); - const char *str = va_arg(vargs, const char *); - if (obj) { - Py_ssize_t size = PyUnicode_GET_SIZE(obj); - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); - s += size; - } else { - appendstring(str); - } - break; - } - case 'S': - case 'R': - { - Py_UNICODE *ucopy; - Py_ssize_t usize; - Py_ssize_t upos; - /* unused, since we already have the result */ - (void) va_arg(vargs, PyObject *); - ucopy = PyUnicode_AS_UNICODE(*callresult); - usize = PyUnicode_GET_SIZE(*callresult); - for (upos = 0; upos forget it */ - Py_DECREF(*callresult); - /* switch to next unicode()/repr() result */ - ++callresult; - break; - } - case 'p': - sprintf(buffer, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (buffer[1] == 'X') - buffer[1] = 'x'; - else if (buffer[1] != 'x') { - memmove(buffer+2, buffer, strlen(buffer)+1); - buffer[0] = '0'; - buffer[1] = 'x'; - } - appendstring(buffer); - break; - case '%': - *s++ = '%'; - break; - default: - appendstring(p); - goto end; - } - } else - *s++ = *f; - } - - end: - if (callresults) - PyObject_Free(callresults); - if (abuffer) - PyObject_Free(abuffer); - PyUnicode_Resize(&string, s - PyUnicode_AS_UNICODE(string)); - return string; - fail: - if (callresults) { - PyObject **callresult2 = callresults; - while (callresult2 < callresult) { - Py_DECREF(*callresult2); - ++callresult2; - } - PyObject_Free(callresults); - } - if (abuffer) - PyObject_Free(abuffer); - return NULL; + /* step 1: count the number of %S/%R/%A format specifications + * (we call PyObject_Str()/PyObject_Repr()/PyObject_ASCII() for + * these objects once during step 3 and put the result in + an array) */ + for (f = format; *f; f++) { + if (*f == '%' && (*(f+1)=='S' || *(f+1)=='R' || *(f+1)=='A')) + ++callcount; + } + /* step 2: allocate memory for the results of + * PyObject_Str()/PyObject_Repr() calls */ + if (callcount) { + callresults = PyObject_Malloc(sizeof(PyObject *)*callcount); + if (!callresults) { + PyErr_NoMemory(); + return NULL; + } + callresult = callresults; + } + /* step 3: figure out how large a buffer we need */ + for (f = format; *f; f++) { + if (*f == '%') { + const char* p = f; + width = 0; + while (ISDIGIT((unsigned)*f)) + width = (width*10) + *f++ - '0'; + while (*++f && *f != '%' && !ISALPHA((unsigned)*f)) + ; + + /* skip the 'l' or 'z' in {%ld, %zd, %lu, %zu} since + * they don't affect the amount of space we reserve. + */ + if ((*f == 'l' || *f == 'z') && + (f[1] == 'd' || f[1] == 'u')) + ++f; + + switch (*f) { + case 'c': + (void)va_arg(count, int); + /* fall through... */ + case '%': + n++; + break; + case 'd': case 'u': case 'i': case 'x': + (void) va_arg(count, int); + /* 20 bytes is enough to hold a 64-bit + integer. Decimal takes the most space. + This isn't enough for octal. + If a width is specified we need more + (which we allocate later). */ + if (width < 20) + width = 20; + n += width; + if (abuffersize < width) + abuffersize = width; + break; + case 's': + { + /* UTF-8 */ + unsigned char*s; + s = va_arg(count, unsigned char*); + while (*s) { + if (*s < 128) { + n++; s++; + } else if (*s < 0xc0) { + /* invalid UTF-8 */ + n++; s++; + } else if (*s < 0xc0) { + n++; + s++; if(!*s)break; + s++; + } else if (*s < 0xe0) { + n++; + s++; if(!*s)break; + s++; if(!*s)break; + s++; + } else { +#ifdef Py_UNICODE_WIDE + n++; +#else + n+=2; +#endif + s++; if(!*s)break; + s++; if(!*s)break; + s++; if(!*s)break; + s++; + } + } + break; + } + case 'U': + { + PyObject *obj = va_arg(count, PyObject *); + assert(obj && PyUnicode_Check(obj)); + n += PyUnicode_GET_SIZE(obj); + break; + } + case 'V': + { + PyObject *obj = va_arg(count, PyObject *); + const char *str = va_arg(count, const char *); + assert(obj || str); + assert(!obj || PyUnicode_Check(obj)); + if (obj) + n += PyUnicode_GET_SIZE(obj); + else + n += strlen(str); + break; + } + case 'S': + { + PyObject *obj = va_arg(count, PyObject *); + PyObject *str; + assert(obj); + str = PyObject_Str(obj); + if (!str) + goto fail; + n += PyUnicode_GET_SIZE(str); + /* Remember the str and switch to the next slot */ + *callresult++ = str; + break; + } + case 'R': + { + PyObject *obj = va_arg(count, PyObject *); + PyObject *repr; + assert(obj); + repr = PyObject_Repr(obj); + if (!repr) + goto fail; + n += PyUnicode_GET_SIZE(repr); + /* Remember the repr and switch to the next slot */ + *callresult++ = repr; + break; + } + case 'A': + { + PyObject *obj = va_arg(count, PyObject *); + PyObject *ascii; + assert(obj); + ascii = PyObject_ASCII(obj); + if (!ascii) + goto fail; + n += PyUnicode_GET_SIZE(ascii); + /* Remember the repr and switch to the next slot */ + *callresult++ = ascii; + break; + } + case 'p': + (void) va_arg(count, int); + /* maximum 64-bit pointer representation: + * 0xffffffffffffffff + * so 19 characters is enough. + * XXX I count 18 -- what's the extra for? + */ + n += 19; + break; + default: + /* if we stumble upon an unknown + formatting code, copy the rest of + the format string to the output + string. (we cannot just skip the + code, since there's no way to know + what's in the argument list) */ + n += strlen(p); + goto expand; + } + } else + n++; + } + expand: + if (abuffersize > 20) { + abuffer = PyObject_Malloc(abuffersize); + if (!abuffer) { + PyErr_NoMemory(); + goto fail; + } + realbuffer = abuffer; + } + else + realbuffer = buffer; + /* step 4: fill the buffer */ + /* Since we've analyzed how much space we need for the worst case, + we don't have to resize the string. + There can be no errors beyond this point. */ + string = PyUnicode_FromUnicode(NULL, n); + if (!string) + goto fail; + + s = PyUnicode_AS_UNICODE(string); + callresult = callresults; + + for (f = format; *f; f++) { + if (*f == '%') { + const char* p = f++; + int longflag = 0; + int size_tflag = 0; + zeropad = (*f == '0'); + /* parse the width.precision part */ + width = 0; + while (ISDIGIT((unsigned)*f)) + width = (width*10) + *f++ - '0'; + precision = 0; + if (*f == '.') { + f++; + while (ISDIGIT((unsigned)*f)) + precision = (precision*10) + *f++ - '0'; + } + /* handle the long flag, but only for %ld and %lu. + others can be added when necessary. */ + if (*f == 'l' && (f[1] == 'd' || f[1] == 'u')) { + longflag = 1; + ++f; + } + /* handle the size_t flag. */ + if (*f == 'z' && (f[1] == 'd' || f[1] == 'u')) { + size_tflag = 1; + ++f; + } + + switch (*f) { + case 'c': + *s++ = va_arg(vargs, int); + break; + case 'd': + makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'd'); + if (longflag) + sprintf(realbuffer, fmt, va_arg(vargs, long)); + else if (size_tflag) + sprintf(realbuffer, fmt, va_arg(vargs, Py_ssize_t)); + else + sprintf(realbuffer, fmt, va_arg(vargs, int)); + appendstring(realbuffer); + break; + case 'u': + makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'u'); + if (longflag) + sprintf(realbuffer, fmt, va_arg(vargs, unsigned long)); + else if (size_tflag) + sprintf(realbuffer, fmt, va_arg(vargs, size_t)); + else + sprintf(realbuffer, fmt, va_arg(vargs, unsigned int)); + appendstring(realbuffer); + break; + case 'i': + makefmt(fmt, 0, 0, zeropad, width, precision, 'i'); + sprintf(realbuffer, fmt, va_arg(vargs, int)); + appendstring(realbuffer); + break; + case 'x': + makefmt(fmt, 0, 0, zeropad, width, precision, 'x'); + sprintf(realbuffer, fmt, va_arg(vargs, int)); + appendstring(realbuffer); + break; + case 's': + { + /* Parameter must be UTF-8 encoded. + In case of encoding errors, use + the replacement character. */ + PyObject *u; + p = va_arg(vargs, char*); + u = PyUnicode_DecodeUTF8(p, strlen(p), + "replace"); + if (!u) + goto fail; + Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(u), + PyUnicode_GET_SIZE(u)); + s += PyUnicode_GET_SIZE(u); + Py_DECREF(u); + break; + } + case 'U': + { + PyObject *obj = va_arg(vargs, PyObject *); + Py_ssize_t size = PyUnicode_GET_SIZE(obj); + Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); + s += size; + break; + } + case 'V': + { + PyObject *obj = va_arg(vargs, PyObject *); + const char *str = va_arg(vargs, const char *); + if (obj) { + Py_ssize_t size = PyUnicode_GET_SIZE(obj); + Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); + s += size; + } else { + appendstring(str); + } + break; + } + case 'S': + case 'R': + { + Py_UNICODE *ucopy; + Py_ssize_t usize; + Py_ssize_t upos; + /* unused, since we already have the result */ + (void) va_arg(vargs, PyObject *); + ucopy = PyUnicode_AS_UNICODE(*callresult); + usize = PyUnicode_GET_SIZE(*callresult); + for (upos = 0; upos forget it */ + Py_DECREF(*callresult); + /* switch to next unicode()/repr() result */ + ++callresult; + break; + } + case 'p': + sprintf(buffer, "%p", va_arg(vargs, void*)); + /* %p is ill-defined: ensure leading 0x. */ + if (buffer[1] == 'X') + buffer[1] = 'x'; + else if (buffer[1] != 'x') { + memmove(buffer+2, buffer, strlen(buffer)+1); + buffer[0] = '0'; + buffer[1] = 'x'; + } + appendstring(buffer); + break; + case '%': + *s++ = '%'; + break; + default: + appendstring(p); + goto end; + } + } else + *s++ = *f; + } + + end: + if (callresults) + PyObject_Free(callresults); + if (abuffer) + PyObject_Free(abuffer); + PyUnicode_Resize(&string, s - PyUnicode_AS_UNICODE(string)); + return string; + fail: + if (callresults) { + PyObject **callresult2 = callresults; + while (callresult2 < callresult) { + Py_DECREF(*callresult2); + ++callresult2; + } + PyObject_Free(callresults); + } + if (abuffer) + PyObject_Free(abuffer); + return NULL; } #undef appendstring @@ -1012,48 +1012,48 @@ PyObject * PyUnicode_FromFormat(const char *format, ...) { - PyObject* ret; - va_list vargs; + PyObject* ret; + va_list vargs; #ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); + va_start(vargs, format); #else - va_start(vargs); + va_start(vargs); #endif - ret = PyUnicode_FromFormatV(format, vargs); - va_end(vargs); - return ret; + ret = PyUnicode_FromFormatV(format, vargs); + va_end(vargs); + return ret; } Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, - wchar_t *w, - Py_ssize_t size) + wchar_t *w, + Py_ssize_t size) { if (unicode == NULL) { - PyErr_BadInternalCall(); - return -1; + PyErr_BadInternalCall(); + return -1; } /* If possible, try to copy the 0-termination as well */ if (size > PyUnicode_GET_SIZE(unicode)) - size = PyUnicode_GET_SIZE(unicode) + 1; + size = PyUnicode_GET_SIZE(unicode) + 1; #ifdef HAVE_USABLE_WCHAR_T memcpy(w, unicode->str, size * sizeof(wchar_t)); #else { - register Py_UNICODE *u; - register Py_ssize_t i; - u = PyUnicode_AS_UNICODE(unicode); - for (i = size; i > 0; i--) - *w++ = *u++; + register Py_UNICODE *u; + register Py_ssize_t i; + u = PyUnicode_AS_UNICODE(unicode); + for (i = size; i > 0; i--) + *w++ = *u++; } #endif if (size > PyUnicode_GET_SIZE(unicode)) return PyUnicode_GET_SIZE(unicode); else - return size; + return size; } #endif @@ -1063,9 +1063,9 @@ Py_UNICODE s[2]; if (ordinal < 0 || ordinal > 0x10ffff) { - PyErr_SetString(PyExc_ValueError, - "chr() arg not in range(0x110000)"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "chr() arg not in range(0x110000)"); + return NULL; } #ifndef Py_UNICODE_WIDE @@ -1084,16 +1084,16 @@ PyObject *PyUnicode_FromObject(register PyObject *obj) { /* XXX Perhaps we should make this API an alias of - PyObject_Str() instead ?! */ + PyObject_Str() instead ?! */ if (PyUnicode_CheckExact(obj)) { - Py_INCREF(obj); - return obj; + Py_INCREF(obj); + return obj; } if (PyUnicode_Check(obj)) { - /* For a Unicode subtype that's not a Unicode object, - return a true Unicode object with the same data. */ - return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj), - PyUnicode_GET_SIZE(obj)); + /* For a Unicode subtype that's not a Unicode object, + return a true Unicode object with the same data. */ + return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj), + PyUnicode_GET_SIZE(obj)); } PyErr_Format(PyExc_TypeError, "Can't convert '%.100s' object to str implicitly", @@ -1102,23 +1102,23 @@ } PyObject *PyUnicode_FromEncodedObject(register PyObject *obj, - const char *encoding, - const char *errors) + const char *encoding, + const char *errors) { const char *s = NULL; Py_ssize_t len; PyObject *v; if (obj == NULL) { - PyErr_BadInternalCall(); - return NULL; + PyErr_BadInternalCall(); + return NULL; } if (PyUnicode_Check(obj)) { - PyErr_SetString(PyExc_TypeError, - "decoding str is not supported"); - return NULL; - } + PyErr_SetString(PyExc_TypeError, + "decoding str is not supported"); + return NULL; + } /* Coerce object */ if (PyBytes_Check(obj)) { @@ -1130,34 +1130,34 @@ len = PyByteArray_GET_SIZE(obj); } else if (PyObject_AsCharBuffer(obj, &s, &len)) { - /* Overwrite the error message with something more useful in - case of a TypeError. */ - if (PyErr_ExceptionMatches(PyExc_TypeError)) + /* Overwrite the error message with something more useful in + case of a TypeError. */ + if (PyErr_ExceptionMatches(PyExc_TypeError)) PyErr_Format(PyExc_TypeError, - "coercing to str: need string or buffer, " - "%.80s found", - Py_TYPE(obj)->tp_name); - goto onError; + "coercing to str: need string or buffer, " + "%.80s found", + Py_TYPE(obj)->tp_name); + goto onError; } /* Convert to Unicode */ if (len == 0) { - Py_INCREF(unicode_empty); - v = (PyObject *)unicode_empty; + Py_INCREF(unicode_empty); + v = (PyObject *)unicode_empty; } else - v = PyUnicode_Decode(s, len, encoding, errors); + v = PyUnicode_Decode(s, len, encoding, errors); return v; - onError: + onError: return NULL; } PyObject *PyUnicode_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) + Py_ssize_t size, + const char *encoding, + const char *errors) { PyObject *buffer = NULL, *unicode; Py_buffer info; @@ -1223,7 +1223,7 @@ Py_DECREF(buffer); return unicode; - onError: + onError: Py_XDECREF(buffer); return NULL; } @@ -1240,7 +1240,7 @@ } if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); + encoding = PyUnicode_GetDefaultEncoding(); /* Decode via the codec registry */ v = PyCodec_Decode(unicode, encoding, errors); @@ -1248,7 +1248,7 @@ goto onError; return v; - onError: + onError: return NULL; } @@ -1264,7 +1264,7 @@ } if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); + encoding = PyUnicode_GetDefaultEncoding(); /* Decode via the codec registry */ v = PyCodec_Decode(unicode, encoding, errors); @@ -1279,20 +1279,20 @@ } return v; - onError: + onError: return NULL; } PyObject *PyUnicode_Encode(const Py_UNICODE *s, - Py_ssize_t size, - const char *encoding, - const char *errors) + Py_ssize_t size, + const char *encoding, + const char *errors) { PyObject *v, *unicode; unicode = PyUnicode_FromUnicode(s, size); if (unicode == NULL) - return NULL; + return NULL; v = PyUnicode_AsEncodedString(unicode, encoding, errors); Py_DECREF(unicode); return v; @@ -1310,7 +1310,7 @@ } if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); + encoding = PyUnicode_GetDefaultEncoding(); /* Encode via the codec registry */ v = PyCodec_Encode(unicode, encoding, errors); @@ -1318,7 +1318,7 @@ goto onError; return v; - onError: + onError: return NULL; } @@ -1334,20 +1334,20 @@ } if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); + encoding = PyUnicode_GetDefaultEncoding(); /* Shortcuts for common default encodings */ if (errors == NULL) { - if (strcmp(encoding, "utf-8") == 0) - return PyUnicode_AsUTF8String(unicode); - else if (strcmp(encoding, "latin-1") == 0) - return PyUnicode_AsLatin1String(unicode); + if (strcmp(encoding, "utf-8") == 0) + return PyUnicode_AsUTF8String(unicode); + else if (strcmp(encoding, "latin-1") == 0) + return PyUnicode_AsLatin1String(unicode); #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) - else if (strcmp(encoding, "mbcs") == 0) - return PyUnicode_AsMBCSString(unicode); + else if (strcmp(encoding, "mbcs") == 0) + return PyUnicode_AsMBCSString(unicode); #endif - else if (strcmp(encoding, "ascii") == 0) - return PyUnicode_AsASCIIString(unicode); + else if (strcmp(encoding, "ascii") == 0) + return PyUnicode_AsASCIIString(unicode); /* During bootstrap, we may need to find the encodings package, to load the file system encoding, and require the file system encoding in order to load the encodings @@ -1360,7 +1360,7 @@ else if (Py_FileSystemDefaultEncoding && strcmp(encoding, Py_FileSystemDefaultEncoding) == 0 && !PyThreadState_GET()->interp->codecs_initialized) - return PyUnicode_AsASCIIString(unicode); + return PyUnicode_AsASCIIString(unicode); } /* Encode via the codec registry */ @@ -1408,7 +1408,7 @@ } if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); + encoding = PyUnicode_GetDefaultEncoding(); /* Encode via the codec registry */ v = PyCodec_Encode(unicode, encoding, errors); @@ -1423,12 +1423,12 @@ } return v; - onError: + onError: return NULL; } PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode, - const char *errors) + const char *errors) { PyObject *v = ((PyUnicodeObject *)unicode)->defenc; if (v) @@ -1507,7 +1507,7 @@ } return PyUnicode_AS_UNICODE(unicode); - onError: + onError: return NULL; } @@ -1519,7 +1519,7 @@ } return PyUnicode_GET_SIZE(unicode); - onError: + onError: return -1; } @@ -1548,10 +1548,10 @@ static int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler, - const char *encoding, const char *reason, - const char **input, const char **inend, Py_ssize_t *startinpos, - Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr, - PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) + const char *encoding, const char *reason, + const char **input, const char **inend, Py_ssize_t *startinpos, + Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr, + PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) { static char *argparse = "O!n;decoding error handler must return (str, int) tuple"; @@ -1567,35 +1567,35 @@ int res = -1; if (*errorHandler == NULL) { - *errorHandler = PyCodec_LookupError(errors); - if (*errorHandler == NULL) - goto onError; + *errorHandler = PyCodec_LookupError(errors); + if (*errorHandler == NULL) + goto onError; } if (*exceptionObject == NULL) { - *exceptionObject = PyUnicodeDecodeError_Create( - encoding, *input, *inend-*input, *startinpos, *endinpos, reason); - if (*exceptionObject == NULL) - goto onError; + *exceptionObject = PyUnicodeDecodeError_Create( + encoding, *input, *inend-*input, *startinpos, *endinpos, reason); + if (*exceptionObject == NULL) + goto onError; } else { - if (PyUnicodeDecodeError_SetStart(*exceptionObject, *startinpos)) - goto onError; - if (PyUnicodeDecodeError_SetEnd(*exceptionObject, *endinpos)) - goto onError; - if (PyUnicodeDecodeError_SetReason(*exceptionObject, reason)) - goto onError; + if (PyUnicodeDecodeError_SetStart(*exceptionObject, *startinpos)) + goto onError; + if (PyUnicodeDecodeError_SetEnd(*exceptionObject, *endinpos)) + goto onError; + if (PyUnicodeDecodeError_SetReason(*exceptionObject, reason)) + goto onError; } restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); if (restuple == NULL) - goto onError; + goto onError; if (!PyTuple_Check(restuple)) { - PyErr_Format(PyExc_TypeError, &argparse[4]); - goto onError; + PyErr_Format(PyExc_TypeError, &argparse[4]); + goto onError; } if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos)) - goto onError; + goto onError; /* Copy back the bytes variables, which might have been modified by the callback */ @@ -1603,7 +1603,7 @@ if (!inputobj) goto onError; if (!PyBytes_Check(inputobj)) { - PyErr_Format(PyExc_TypeError, "exception attribute object must be bytes"); + PyErr_Format(PyExc_TypeError, "exception attribute object must be bytes"); } *input = PyBytes_AS_STRING(inputobj); insize = PyBytes_GET_SIZE(inputobj); @@ -1613,10 +1613,10 @@ Py_DECREF(inputobj); if (newpos<0) - newpos = insize+newpos; + newpos = insize+newpos; if (newpos<0 || newpos>insize) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", newpos); - goto onError; + PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", newpos); + goto onError; } /* need more space? (at least enough for what we @@ -1627,11 +1627,11 @@ repsize = PyUnicode_GET_SIZE(repunicode); requiredsize = *outpos + repsize + insize-newpos; if (requiredsize > outsize) { - if (requiredsize<2*outsize) - requiredsize = 2*outsize; - if (_PyUnicode_Resize(output, requiredsize) < 0) - goto onError; - *outptr = PyUnicode_AS_UNICODE(*output) + *outpos; + if (requiredsize<2*outsize) + requiredsize = 2*outsize; + if (_PyUnicode_Resize(output, requiredsize) < 0) + goto onError; + *outptr = PyUnicode_AS_UNICODE(*output) + *outpos; } *endinpos = newpos; *inptr = *input + newpos; @@ -1642,7 +1642,7 @@ /* we made it! */ res = 0; - onError: + onError: Py_XDECREF(restuple); return res; } @@ -1655,10 +1655,10 @@ char utf7_special[128] = { /* indicate whether a UTF-7 character is special i.e. cannot be directly encoded: - 0 - not special - 1 - special - 2 - whitespace (optional) - 3 - RFC2152 Set O (optional) */ + 0 - not special + 1 - special + 2 - whitespace (optional) + 3 - RFC2152 Set O (optional) */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 1, 0, 0, 0, 1, @@ -1675,17 +1675,17 @@ utf7_special[0] is 1, we can safely make that one comparison true */ -#define SPECIAL(c, encodeO, encodeWS) \ +#define SPECIAL(c, encodeO, encodeWS) \ ((c) > 127 || (c) <= 0 || utf7_special[(c)] == 1 || \ - (encodeWS && (utf7_special[(c)] == 2)) || \ + (encodeWS && (utf7_special[(c)] == 2)) || \ (encodeO && (utf7_special[(c)] == 3))) -#define B64(n) \ +#define B64(n) \ ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(n) & 0x3f]) -#define B64CHAR(c) \ +#define B64CHAR(c) \ (ISALNUM(c) || (c) == '+' || (c) == '/') -#define UB64(c) \ - ((c) == '+' ? 62 : (c) == '/' ? 63 : (c) >= 'a' ? \ +#define UB64(c) \ + ((c) == '+' ? 62 : (c) == '/' ? 63 : (c) >= 'a' ? \ (c) - 71 : (c) >= 'A' ? (c) - 65 : (c) + 4 ) #define ENCODE(out, ch, bits) \ @@ -1714,16 +1714,16 @@ } PyObject *PyUnicode_DecodeUTF7(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { return PyUnicode_DecodeUTF7Stateful(s, size, errors, NULL); } PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) + Py_ssize_t size, + const char *errors, + Py_ssize_t *consumed) { const char *starts = s; Py_ssize_t startinpos; @@ -1754,7 +1754,7 @@ while (s < e) { Py_UNICODE ch; - restart: + restart: ch = (unsigned char) *s; if (inShift) { @@ -1788,7 +1788,7 @@ } } else if (SPECIAL(ch,0,0)) { errmsg = "unexpected special character"; - goto utf7Error; + goto utf7Error; } else { *p++ = ch; } @@ -1822,28 +1822,28 @@ s++; } continue; - utf7Error: + utf7Error: outpos = p-PyUnicode_AS_UNICODE(unicode); endinpos = s-starts; if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf7", errmsg, - &starts, &e, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) - goto onError; + errors, &errorHandler, + "utf7", errmsg, + &starts, &e, &startinpos, &endinpos, &exc, &s, + &unicode, &outpos, &p)) + goto onError; } if (inShift && !consumed) { outpos = p-PyUnicode_AS_UNICODE(unicode); endinpos = size; if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf7", "unterminated shift sequence", - &starts, &e, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) + errors, &errorHandler, + "utf7", "unterminated shift sequence", + &starts, &e, &startinpos, &endinpos, &exc, &s, + &unicode, &outpos, &p)) goto onError; if (s < e) - goto restart; + goto restart; } if (consumed) { if(inShift) @@ -1859,7 +1859,7 @@ Py_XDECREF(exc); return (PyObject *)unicode; -onError: + onError: Py_XDECREF(errorHandler); Py_XDECREF(exc); Py_DECREF(unicode); @@ -1868,10 +1868,10 @@ PyObject *PyUnicode_EncodeUTF7(const Py_UNICODE *s, - Py_ssize_t size, - int encodeSetO, - int encodeWhiteSpace, - const char *errors) + Py_ssize_t size, + int encodeSetO, + int encodeWhiteSpace, + const char *errors) { PyObject *v; /* It might be possible to tighten this worst case */ @@ -1884,7 +1884,7 @@ char * start; if (size == 0) - return PyBytes_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); if (cbAllocated / 5 != size) return PyErr_NoMemory(); @@ -1995,8 +1995,8 @@ }; PyObject *PyUnicode_DecodeUTF8(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL); } @@ -2015,9 +2015,9 @@ #endif PyObject *PyUnicode_DecodeUTF8Stateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) + Py_ssize_t size, + const char *errors, + Py_ssize_t *consumed) { const char *starts = s; int n; @@ -2099,72 +2099,72 @@ n = utf8_code_length[ch]; if (s + n > e) { - if (consumed) - break; - else { - errmsg = "unexpected end of data"; - startinpos = s-starts; - endinpos = size; - goto utf8Error; - } - } + if (consumed) + break; + else { + errmsg = "unexpected end of data"; + startinpos = s-starts; + endinpos = size; + goto utf8Error; + } + } switch (n) { case 0: errmsg = "unexpected code byte"; - startinpos = s-starts; - endinpos = startinpos+1; - goto utf8Error; + startinpos = s-starts; + endinpos = startinpos+1; + goto utf8Error; case 1: errmsg = "internal error"; - startinpos = s-starts; - endinpos = startinpos+1; - goto utf8Error; + startinpos = s-starts; + endinpos = startinpos+1; + goto utf8Error; case 2: if ((s[1] & 0xc0) != 0x80) { errmsg = "invalid data"; - startinpos = s-starts; - endinpos = startinpos+2; - goto utf8Error; - } + startinpos = s-starts; + endinpos = startinpos+2; + goto utf8Error; + } ch = ((s[0] & 0x1f) << 6) + (s[1] & 0x3f); if (ch < 0x80) { - startinpos = s-starts; - endinpos = startinpos+2; + startinpos = s-starts; + endinpos = startinpos+2; errmsg = "illegal encoding"; - goto utf8Error; - } - else - *p++ = (Py_UNICODE)ch; + goto utf8Error; + } + else + *p++ = (Py_UNICODE)ch; break; case 3: if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80) { errmsg = "invalid data"; - startinpos = s-starts; - endinpos = startinpos+3; - goto utf8Error; - } + startinpos = s-starts; + endinpos = startinpos+3; + goto utf8Error; + } ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); if (ch < 0x0800) { - /* Note: UTF-8 encodings of surrogates are considered - legal UTF-8 sequences; + /* Note: UTF-8 encodings of surrogates are considered + legal UTF-8 sequences; - XXX For wide builds (UCS-4) we should probably try - to recombine the surrogates into a single code - unit. - */ + XXX For wide builds (UCS-4) we should probably try + to recombine the surrogates into a single code + unit. + */ errmsg = "illegal encoding"; - startinpos = s-starts; - endinpos = startinpos+3; - goto utf8Error; - } - else - *p++ = (Py_UNICODE)ch; + startinpos = s-starts; + endinpos = startinpos+3; + goto utf8Error; + } + else + *p++ = (Py_UNICODE)ch; break; case 4: @@ -2172,25 +2172,25 @@ (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80) { errmsg = "invalid data"; - startinpos = s-starts; - endinpos = startinpos+4; - goto utf8Error; - } + startinpos = s-starts; + endinpos = startinpos+4; + goto utf8Error; + } ch = ((s[0] & 0x7) << 18) + ((s[1] & 0x3f) << 12) + - ((s[2] & 0x3f) << 6) + (s[3] & 0x3f); + ((s[2] & 0x3f) << 6) + (s[3] & 0x3f); /* validate and convert to UTF-16 */ if ((ch < 0x10000) /* minimum value allowed for 4 - byte encoding */ + byte encoding */ || (ch > 0x10ffff)) /* maximum value allowed for - UTF-16 */ - { + UTF-16 */ + { errmsg = "illegal encoding"; - startinpos = s-starts; - endinpos = startinpos+4; - goto utf8Error; - } + startinpos = s-starts; + endinpos = startinpos+4; + goto utf8Error; + } #ifdef Py_UNICODE_WIDE - *p++ = (Py_UNICODE)ch; + *p++ = (Py_UNICODE)ch; #else /* compute and append the two surrogates: */ @@ -2208,25 +2208,25 @@ default: /* Other sizes are only needed for UCS-4 */ errmsg = "unsupported Unicode code range"; - startinpos = s-starts; - endinpos = startinpos+n; - goto utf8Error; + startinpos = s-starts; + endinpos = startinpos+n; + goto utf8Error; } s += n; - continue; + continue; - utf8Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf8", errmsg, - &starts, &e, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) - goto onError; - aligned_end = (const char *) ((size_t) e & ~LONG_PTR_MASK); + utf8Error: + outpos = p-PyUnicode_AS_UNICODE(unicode); + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "utf8", errmsg, + &starts, &e, &startinpos, &endinpos, &exc, &s, + &unicode, &outpos, &p)) + goto onError; + aligned_end = (const char *) ((size_t) e & ~LONG_PTR_MASK); } if (consumed) - *consumed = s-starts; + *consumed = s-starts; /* Adjust length */ if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) @@ -2236,7 +2236,7 @@ Py_XDECREF(exc); return (PyObject *)unicode; -onError: + onError: Py_XDECREF(errorHandler); Py_XDECREF(exc); Py_DECREF(unicode); @@ -2253,8 +2253,8 @@ */ PyObject * PyUnicode_EncodeUTF8(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { #define MAX_SHORT_UNICHARS 300 /* largest size we'll do on the stack */ @@ -2319,8 +2319,8 @@ *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); continue; - } -encodeUCS4: + } + encodeUCS4: /* Encode UCS4 Unicode ordinals */ *p++ = (char)(0xf0 | (ch >> 18)); *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); @@ -2353,27 +2353,27 @@ return NULL; } return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); + PyUnicode_GET_SIZE(unicode), + NULL); } /* --- UTF-32 Codec ------------------------------------------------------- */ PyObject * PyUnicode_DecodeUTF32(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder) + Py_ssize_t size, + const char *errors, + int *byteorder) { return PyUnicode_DecodeUTF32Stateful(s, size, errors, byteorder, NULL); } PyObject * PyUnicode_DecodeUTF32Stateful(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder, - Py_ssize_t *consumed) + Py_ssize_t size, + const char *errors, + int *byteorder, + Py_ssize_t *consumed) { const char *starts = s; Py_ssize_t startinpos; @@ -2401,8 +2401,8 @@ codepoints => count how much extra space we need. */ #ifndef Py_UNICODE_WIDE for (i = pairs = 0; i < size/4; i++) - if (((Py_UCS4 *)s)[i] >= 0x10000) - pairs++; + if (((Py_UCS4 *)s)[i] >= 0x10000) + pairs++; #endif /* This might be one to much, because of a BOM */ @@ -2427,27 +2427,27 @@ if (bo == 0) { if (size >= 4) { const Py_UCS4 bom = (q[iorder[3]] << 24) | (q[iorder[2]] << 16) | - (q[iorder[1]] << 8) | q[iorder[0]]; + (q[iorder[1]] << 8) | q[iorder[0]]; #ifdef BYTEORDER_IS_LITTLE_ENDIAN - if (bom == 0x0000FEFF) { - q += 4; - bo = -1; - } - else if (bom == 0xFFFE0000) { - q += 4; - bo = 1; - } + if (bom == 0x0000FEFF) { + q += 4; + bo = -1; + } + else if (bom == 0xFFFE0000) { + q += 4; + bo = 1; + } #else - if (bom == 0x0000FEFF) { - q += 4; - bo = 1; - } - else if (bom == 0xFFFE0000) { - q += 4; - bo = -1; - } + if (bom == 0x0000FEFF) { + q += 4; + bo = 1; + } + else if (bom == 0xFFFE0000) { + q += 4; + bo = -1; + } #endif - } + } } if (bo == -1) { @@ -2466,54 +2466,54 @@ } while (q < e) { - Py_UCS4 ch; - /* remaining bytes at the end? (size should be divisible by 4) */ - if (e-q<4) { - if (consumed) - break; - errmsg = "truncated data"; - startinpos = ((const char *)q)-starts; - endinpos = ((const char *)e)-starts; - goto utf32Error; - /* The remaining input chars are ignored if the callback - chooses to skip the input */ - } - ch = (q[iorder[3]] << 24) | (q[iorder[2]] << 16) | - (q[iorder[1]] << 8) | q[iorder[0]]; - - if (ch >= 0x110000) - { - errmsg = "codepoint not in range(0x110000)"; - startinpos = ((const char *)q)-starts; - endinpos = startinpos+4; - goto utf32Error; - } + Py_UCS4 ch; + /* remaining bytes at the end? (size should be divisible by 4) */ + if (e-q<4) { + if (consumed) + break; + errmsg = "truncated data"; + startinpos = ((const char *)q)-starts; + endinpos = ((const char *)e)-starts; + goto utf32Error; + /* The remaining input chars are ignored if the callback + chooses to skip the input */ + } + ch = (q[iorder[3]] << 24) | (q[iorder[2]] << 16) | + (q[iorder[1]] << 8) | q[iorder[0]]; + + if (ch >= 0x110000) + { + errmsg = "codepoint not in range(0x110000)"; + startinpos = ((const char *)q)-starts; + endinpos = startinpos+4; + goto utf32Error; + } #ifndef Py_UNICODE_WIDE - if (ch >= 0x10000) - { - *p++ = 0xD800 | ((ch-0x10000) >> 10); - *p++ = 0xDC00 | ((ch-0x10000) & 0x3FF); - } - else -#endif - *p++ = ch; - q += 4; - continue; - utf32Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf32", errmsg, - &starts, (const char **)&e, &startinpos, &endinpos, &exc, (const char **)&q, - &unicode, &outpos, &p)) - goto onError; + if (ch >= 0x10000) + { + *p++ = 0xD800 | ((ch-0x10000) >> 10); + *p++ = 0xDC00 | ((ch-0x10000) & 0x3FF); + } + else +#endif + *p++ = ch; + q += 4; + continue; + utf32Error: + outpos = p-PyUnicode_AS_UNICODE(unicode); + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "utf32", errmsg, + &starts, (const char **)&e, &startinpos, &endinpos, &exc, (const char **)&q, + &unicode, &outpos, &p)) + goto onError; } if (byteorder) *byteorder = bo; if (consumed) - *consumed = (const char *)q-starts; + *consumed = (const char *)q-starts; /* Adjust length */ if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) @@ -2523,7 +2523,7 @@ Py_XDECREF(exc); return (PyObject *)unicode; -onError: + onError: Py_DECREF(unicode); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -2532,9 +2532,9 @@ PyObject * PyUnicode_EncodeUTF32(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors, - int byteorder) + Py_ssize_t size, + const char *errors, + int byteorder) { PyObject *v; unsigned char *p; @@ -2551,34 +2551,34 @@ int iorder[] = {3, 2, 1, 0}; #endif -#define STORECHAR(CH) \ - do { \ - p[iorder[3]] = ((CH) >> 24) & 0xff; \ - p[iorder[2]] = ((CH) >> 16) & 0xff; \ - p[iorder[1]] = ((CH) >> 8) & 0xff; \ - p[iorder[0]] = (CH) & 0xff; \ - p += 4; \ +#define STORECHAR(CH) \ + do { \ + p[iorder[3]] = ((CH) >> 24) & 0xff; \ + p[iorder[2]] = ((CH) >> 16) & 0xff; \ + p[iorder[1]] = ((CH) >> 8) & 0xff; \ + p[iorder[0]] = (CH) & 0xff; \ + p += 4; \ } while(0) /* In narrow builds we can output surrogate pairs as one codepoint, so we need less space. */ #ifndef Py_UNICODE_WIDE for (i = pairs = 0; i < size-1; i++) - if (0xD800 <= s[i] && s[i] <= 0xDBFF && - 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) - pairs++; + if (0xD800 <= s[i] && s[i] <= 0xDBFF && + 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) + pairs++; #endif nsize = (size - pairs + (byteorder == 0)); bytesize = nsize * 4; if (bytesize / 4 != nsize) - return PyErr_NoMemory(); + return PyErr_NoMemory(); v = PyBytes_FromStringAndSize(NULL, bytesize); if (v == NULL) return NULL; p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) - STORECHAR(0xFEFF); + STORECHAR(0xFEFF); if (size == 0) goto done; @@ -2598,16 +2598,16 @@ } while (size-- > 0) { - Py_UCS4 ch = *s++; + Py_UCS4 ch = *s++; #ifndef Py_UNICODE_WIDE - if (0xD800 <= ch && ch <= 0xDBFF && size > 0) { - Py_UCS4 ch2 = *s; - if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { - ch = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; - s++; - size--; - } - } + if (0xD800 <= ch && ch <= 0xDBFF && size > 0) { + Py_UCS4 ch2 = *s; + if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { + ch = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; + s++; + size--; + } + } #endif STORECHAR(ch); } @@ -2624,18 +2624,18 @@ return NULL; } return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL, - 0); + PyUnicode_GET_SIZE(unicode), + NULL, + 0); } /* --- UTF-16 Codec ------------------------------------------------------- */ PyObject * PyUnicode_DecodeUTF16(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder) + Py_ssize_t size, + const char *errors, + int *byteorder) { return PyUnicode_DecodeUTF16Stateful(s, size, errors, byteorder, NULL); } @@ -2646,7 +2646,7 @@ rare in most input. FAST_CHAR_MASK is used when the input is in native byte ordering, SWAPPED_FAST_CHAR_MASK when the input is in byteswapped ordering. - */ +*/ #if (SIZEOF_LONG == 8) # define FAST_CHAR_MASK 0x8000800080008000L # define SWAPPED_FAST_CHAR_MASK 0x0080008000800080L @@ -2659,10 +2659,10 @@ PyObject * PyUnicode_DecodeUTF16Stateful(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder, - Py_ssize_t *consumed) + Py_ssize_t size, + const char *errors, + int *byteorder, + Py_ssize_t *consumed) { const char *starts = s; Py_ssize_t startinpos; @@ -2707,25 +2707,25 @@ if (size >= 2) { const Py_UNICODE bom = (q[ihi] << 8) | q[ilo]; #ifdef BYTEORDER_IS_LITTLE_ENDIAN - if (bom == 0xFEFF) { - q += 2; - bo = -1; - } - else if (bom == 0xFFFE) { - q += 2; - bo = 1; - } + if (bom == 0xFEFF) { + q += 2; + bo = -1; + } + else if (bom == 0xFFFE) { + q += 2; + bo = 1; + } #else - if (bom == 0xFEFF) { - q += 2; - bo = 1; - } - else if (bom == 0xFFFE) { - q += 2; - bo = -1; - } + if (bom == 0xFEFF) { + q += 2; + bo = 1; + } + else if (bom == 0xFFFE) { + q += 2; + bo = -1; + } #endif - } + } } if (bo == -1) { @@ -2746,7 +2746,7 @@ aligned_end = (const unsigned char *) ((size_t) e & ~LONG_PTR_MASK); while (q < e) { - Py_UNICODE ch; + Py_UNICODE ch; /* First check for possible aligned read of a C 'long'. Unaligned reads are more expensive, better to defer to another iteration. */ if (!((size_t) q & LONG_PTR_MASK)) { @@ -2818,50 +2818,50 @@ if (q >= e) break; } - ch = (q[ihi] << 8) | q[ilo]; + ch = (q[ihi] << 8) | q[ilo]; + + q += 2; - q += 2; + if (ch < 0xD800 || ch > 0xDFFF) { + *p++ = ch; + continue; + } - if (ch < 0xD800 || ch > 0xDFFF) { - *p++ = ch; - continue; - } - - /* UTF-16 code pair: */ - if (q > e) { - errmsg = "unexpected end of data"; - startinpos = (((const char *)q) - 2) - starts; - endinpos = ((const char *)e) + 1 - starts; - goto utf16Error; - } - if (0xD800 <= ch && ch <= 0xDBFF) { - Py_UNICODE ch2 = (q[ihi] << 8) | q[ilo]; - q += 2; - if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { + /* UTF-16 code pair: */ + if (q > e) { + errmsg = "unexpected end of data"; + startinpos = (((const char *)q) - 2) - starts; + endinpos = ((const char *)e) + 1 - starts; + goto utf16Error; + } + if (0xD800 <= ch && ch <= 0xDBFF) { + Py_UNICODE ch2 = (q[ihi] << 8) | q[ilo]; + q += 2; + if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { #ifndef Py_UNICODE_WIDE - *p++ = ch; - *p++ = ch2; + *p++ = ch; + *p++ = ch2; #else - *p++ = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; + *p++ = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; #endif - continue; - } - else { + continue; + } + else { errmsg = "illegal UTF-16 surrogate"; - startinpos = (((const char *)q)-4)-starts; - endinpos = startinpos+2; - goto utf16Error; - } - - } - errmsg = "illegal encoding"; - startinpos = (((const char *)q)-2)-starts; - endinpos = startinpos+2; - /* Fall through to report the error */ - - utf16Error: - outpos = p - PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( + startinpos = (((const char *)q)-4)-starts; + endinpos = startinpos+2; + goto utf16Error; + } + + } + errmsg = "illegal encoding"; + startinpos = (((const char *)q)-2)-starts; + endinpos = startinpos+2; + /* Fall through to report the error */ + + utf16Error: + outpos = p - PyUnicode_AS_UNICODE(unicode); + if (unicode_decode_call_errorhandler( errors, &errorHandler, "utf16", errmsg, @@ -2874,7 +2874,7 @@ &unicode, &outpos, &p)) - goto onError; + goto onError; } /* remaining byte at the end? (size should be even) */ if (e == q) { @@ -2906,7 +2906,7 @@ *byteorder = bo; if (consumed) - *consumed = (const char *)q-starts; + *consumed = (const char *)q-starts; /* Adjust length */ if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) @@ -2916,7 +2916,7 @@ Py_XDECREF(exc); return (PyObject *)unicode; -onError: + onError: Py_DECREF(unicode); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -2928,9 +2928,9 @@ PyObject * PyUnicode_EncodeUTF16(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors, - int byteorder) + Py_ssize_t size, + const char *errors, + int byteorder) { PyObject *v; unsigned char *p; @@ -2947,33 +2947,33 @@ int ihi = 0, ilo = 1; #endif -#define STORECHAR(CH) \ - do { \ - p[ihi] = ((CH) >> 8) & 0xff; \ - p[ilo] = (CH) & 0xff; \ - p += 2; \ +#define STORECHAR(CH) \ + do { \ + p[ihi] = ((CH) >> 8) & 0xff; \ + p[ilo] = (CH) & 0xff; \ + p += 2; \ } while(0) #ifdef Py_UNICODE_WIDE for (i = pairs = 0; i < size; i++) - if (s[i] >= 0x10000) - pairs++; + if (s[i] >= 0x10000) + pairs++; #endif /* 2 * (size + pairs + (byteorder == 0)) */ if (size > PY_SSIZE_T_MAX || size > PY_SSIZE_T_MAX - pairs - (byteorder == 0)) - return PyErr_NoMemory(); + return PyErr_NoMemory(); nsize = size + pairs + (byteorder == 0); bytesize = nsize * 2; if (bytesize / 2 != nsize) - return PyErr_NoMemory(); + return PyErr_NoMemory(); v = PyBytes_FromStringAndSize(NULL, bytesize); if (v == NULL) return NULL; p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) - STORECHAR(0xFEFF); + STORECHAR(0xFEFF); if (size == 0) goto done; @@ -2989,13 +2989,13 @@ } while (size-- > 0) { - Py_UNICODE ch = *s++; - Py_UNICODE ch2 = 0; + Py_UNICODE ch = *s++; + Py_UNICODE ch2 = 0; #ifdef Py_UNICODE_WIDE - if (ch >= 0x10000) { - ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF); - ch = 0xD800 | ((ch-0x10000) >> 10); - } + if (ch >= 0x10000) { + ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF); + ch = 0xD800 | ((ch-0x10000) >> 10); + } #endif STORECHAR(ch); if (ch2) @@ -3014,9 +3014,9 @@ return NULL; } return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL, - 0); + PyUnicode_GET_SIZE(unicode), + NULL, + 0); } /* --- Unicode Escape Codec ----------------------------------------------- */ @@ -3024,8 +3024,8 @@ static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL; PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { const char *starts = s; Py_ssize_t startinpos; @@ -3073,7 +3073,7 @@ c = '\0'; /* Invalid after \ */ switch (c) { - /* \x escapes */ + /* \x escapes */ case '\n': break; case '\\': *p++ = '\\'; break; case '\'': *p++ = '\''; break; @@ -3086,7 +3086,7 @@ case 'v': *p++ = '\013'; break; /* VT */ case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - /* \OOO (octal) escapes */ + /* \OOO (octal) escapes */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': x = s[-1] - '0'; @@ -3098,20 +3098,20 @@ *p++ = x; break; - /* hex escapes */ - /* \xXX */ + /* hex escapes */ + /* \xXX */ case 'x': digits = 2; message = "truncated \\xXX escape"; goto hexescape; - /* \uXXXX */ + /* \uXXXX */ case 'u': digits = 4; message = "truncated \\uXXXX escape"; goto hexescape; - /* \UXXXXXXXX */ + /* \UXXXXXXXX */ case 'U': digits = 8; message = "truncated \\UXXXXXXXX escape"; @@ -3121,10 +3121,10 @@ if (s+digits>end) { endinpos = size; if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", "end of string in escape sequence", - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) + errors, &errorHandler, + "unicodeescape", "end of string in escape sequence", + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) goto onError; goto nextByte; } @@ -3133,10 +3133,10 @@ if (!ISXDIGIT(c)) { endinpos = (s+i+1)-starts; if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", message, - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) + errors, &errorHandler, + "unicodeescape", message, + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) goto onError; goto nextByte; } @@ -3172,15 +3172,15 @@ endinpos = s-starts; outpos = p-PyUnicode_AS_UNICODE(v); if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", "illegal Unicode character", - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) + errors, &errorHandler, + "unicodeescape", "illegal Unicode character", + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) goto onError; } break; - /* \N{name} */ + /* \N{name} */ case 'N': message = "malformed \\N character escape"; if (ucnhash_CAPI == NULL) { @@ -3214,10 +3214,10 @@ endinpos = s-starts; outpos = p-PyUnicode_AS_UNICODE(v); if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", message, - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) + errors, &errorHandler, + "unicodeescape", message, + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) goto onError; break; @@ -3228,10 +3228,10 @@ endinpos = s-starts; outpos = p-PyUnicode_AS_UNICODE(v); if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", message, - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) + errors, &errorHandler, + "unicodeescape", message, + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) goto onError; } else { @@ -3240,7 +3240,7 @@ } break; } - nextByte: + nextByte: ; } if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) @@ -3249,7 +3249,7 @@ Py_XDECREF(exc); return (PyObject *)v; -ucnhashError: + ucnhashError: PyErr_SetString( PyExc_UnicodeError, "\\N escapes not supported (can't load unicodedata module)" @@ -3259,7 +3259,7 @@ Py_XDECREF(exc); return NULL; -onError: + onError: Py_XDECREF(v); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -3274,8 +3274,8 @@ */ Py_LOCAL_INLINE(const Py_UNICODE *) findchar(const Py_UNICODE *s, - Py_ssize_t size, - Py_UNICODE ch) + Py_ssize_t size, + Py_UNICODE ch) { /* like wcschr, but doesn't stop at NULL characters */ @@ -3291,7 +3291,7 @@ static const char *hexdigits = "0123456789abcdef"; PyObject *PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, - Py_ssize_t size) + Py_ssize_t size) { PyObject *repr; char *p; @@ -3324,12 +3324,12 @@ return PyBytes_FromStringAndSize(NULL, 0); if (size > (PY_SSIZE_T_MAX - 2 - 1) / expandsize) - return PyErr_NoMemory(); + return PyErr_NoMemory(); repr = PyBytes_FromStringAndSize(NULL, - 2 - + expandsize*size - + 1); + 2 + + expandsize*size + + 1); if (repr == NULL) return NULL; @@ -3358,34 +3358,34 @@ *p++ = hexdigits[(ch >> 8) & 0x0000000F]; *p++ = hexdigits[(ch >> 4) & 0x0000000F]; *p++ = hexdigits[ch & 0x0000000F]; - continue; + continue; } #else - /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ - else if (ch >= 0xD800 && ch < 0xDC00) { - Py_UNICODE ch2; - Py_UCS4 ucs; - - ch2 = *s++; - size--; - if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigits[(ucs >> 28) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 24) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 20) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 16) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 12) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 8) & 0x0000000F]; - *p++ = hexdigits[(ucs >> 4) & 0x0000000F]; - *p++ = hexdigits[ucs & 0x0000000F]; - continue; - } - /* Fall through: isolated surrogates are copied as-is */ - s--; - size++; - } + /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ + else if (ch >= 0xD800 && ch < 0xDC00) { + Py_UNICODE ch2; + Py_UCS4 ucs; + + ch2 = *s++; + size--; + if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { + ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; + *p++ = '\\'; + *p++ = 'U'; + *p++ = hexdigits[(ucs >> 28) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 24) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 20) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 16) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 12) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 8) & 0x0000000F]; + *p++ = hexdigits[(ucs >> 4) & 0x0000000F]; + *p++ = hexdigits[ucs & 0x0000000F]; + continue; + } + /* Fall through: isolated surrogates are copied as-is */ + s--; + size++; + } #endif /* Map 16-bit characters to '\uxxxx' */ @@ -3446,8 +3446,8 @@ /* --- Raw Unicode Escape Codec ------------------------------------------- */ PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { const char *starts = s; Py_ssize_t startinpos; @@ -3466,75 +3466,75 @@ handler might have to resize the string) */ v = _PyUnicode_New(size); if (v == NULL) - goto onError; + goto onError; if (size == 0) - return (PyObject *)v; + return (PyObject *)v; p = PyUnicode_AS_UNICODE(v); end = s + size; while (s < end) { - unsigned char c; - Py_UCS4 x; - int i; + unsigned char c; + Py_UCS4 x; + int i; int count; - /* Non-escape characters are interpreted as Unicode ordinals */ - if (*s != '\\') { - *p++ = (unsigned char)*s++; - continue; - } - startinpos = s-starts; - - /* \u-escapes are only interpreted iff the number of leading - backslashes if odd */ - bs = s; - for (;s < end;) { - if (*s != '\\') - break; - *p++ = (unsigned char)*s++; - } - if (((s - bs) & 1) == 0 || - s >= end || - (*s != 'u' && *s != 'U')) { - continue; - } - p--; + /* Non-escape characters are interpreted as Unicode ordinals */ + if (*s != '\\') { + *p++ = (unsigned char)*s++; + continue; + } + startinpos = s-starts; + + /* \u-escapes are only interpreted iff the number of leading + backslashes if odd */ + bs = s; + for (;s < end;) { + if (*s != '\\') + break; + *p++ = (unsigned char)*s++; + } + if (((s - bs) & 1) == 0 || + s >= end || + (*s != 'u' && *s != 'U')) { + continue; + } + p--; count = *s=='u' ? 4 : 8; - s++; + s++; - /* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ - outpos = p-PyUnicode_AS_UNICODE(v); - for (x = 0, i = 0; i < count; ++i, ++s) { - c = (unsigned char)*s; - if (!ISXDIGIT(c)) { - endinpos = s-starts; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "rawunicodeescape", "truncated \\uXXXX", - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - goto nextByte; - } - x = (x<<4) & ~0xF; - if (c >= '0' && c <= '9') - x += c - '0'; - else if (c >= 'a' && c <= 'f') - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - } + /* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ + outpos = p-PyUnicode_AS_UNICODE(v); + for (x = 0, i = 0; i < count; ++i, ++s) { + c = (unsigned char)*s; + if (!ISXDIGIT(c)) { + endinpos = s-starts; + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "rawunicodeescape", "truncated \\uXXXX", + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) + goto onError; + goto nextByte; + } + x = (x<<4) & ~0xF; + if (c >= '0' && c <= '9') + x += c - '0'; + else if (c >= 'a' && c <= 'f') + x += 10 + c - 'a'; + else + x += 10 + c - 'A'; + } if (x <= 0xffff) - /* UCS-2 character */ - *p++ = (Py_UNICODE) x; + /* UCS-2 character */ + *p++ = (Py_UNICODE) x; else if (x <= 0x10ffff) { - /* UCS-4 character. Either store directly, or as - surrogate pair. */ + /* UCS-4 character. Either store directly, or as + surrogate pair. */ #ifdef Py_UNICODE_WIDE - *p++ = (Py_UNICODE) x; + *p++ = (Py_UNICODE) x; #else - x -= 0x10000L; - *p++ = 0xD800 + (Py_UNICODE) (x >> 10); - *p++ = 0xDC00 + (Py_UNICODE) (x & 0x03FF); + x -= 0x10000L; + *p++ = 0xD800 + (Py_UNICODE) (x >> 10); + *p++ = 0xDC00 + (Py_UNICODE) (x & 0x03FF); #endif } else { endinpos = s-starts; @@ -3542,20 +3542,20 @@ if (unicode_decode_call_errorhandler( errors, &errorHandler, "rawunicodeescape", "\\Uxxxxxxxx out of range", - &starts, &end, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; + &starts, &end, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) + goto onError; } - nextByte: - ; + nextByte: + ; } if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; + goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); return (PyObject *)v; - onError: + onError: Py_XDECREF(v); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -3563,7 +3563,7 @@ } PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, - Py_ssize_t size) + Py_ssize_t size) { PyObject *repr; char *p; @@ -3574,10 +3574,10 @@ #else const Py_ssize_t expandsize = 6; #endif - + if (size > PY_SSIZE_T_MAX / expandsize) - return PyErr_NoMemory(); - + return PyErr_NoMemory(); + repr = PyBytes_FromStringAndSize(NULL, expandsize * size); if (repr == NULL) return NULL; @@ -3588,8 +3588,8 @@ while (size-- > 0) { Py_UNICODE ch = *s++; #ifdef Py_UNICODE_WIDE - /* Map 32-bit characters to '\Uxxxxxxxx' */ - if (ch >= 0x10000) { + /* Map 32-bit characters to '\Uxxxxxxxx' */ + if (ch >= 0x10000) { *p++ = '\\'; *p++ = 'U'; *p++ = hexdigits[(ch >> 28) & 0xf]; @@ -3603,34 +3603,34 @@ } else #else - /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ - if (ch >= 0xD800 && ch < 0xDC00) { - Py_UNICODE ch2; - Py_UCS4 ucs; - - ch2 = *s++; - size--; - if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigits[(ucs >> 28) & 0xf]; - *p++ = hexdigits[(ucs >> 24) & 0xf]; - *p++ = hexdigits[(ucs >> 20) & 0xf]; - *p++ = hexdigits[(ucs >> 16) & 0xf]; - *p++ = hexdigits[(ucs >> 12) & 0xf]; - *p++ = hexdigits[(ucs >> 8) & 0xf]; - *p++ = hexdigits[(ucs >> 4) & 0xf]; - *p++ = hexdigits[ucs & 0xf]; - continue; - } - /* Fall through: isolated surrogates are copied as-is */ - s--; - size++; - } + /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ + if (ch >= 0xD800 && ch < 0xDC00) { + Py_UNICODE ch2; + Py_UCS4 ucs; + + ch2 = *s++; + size--; + if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { + ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; + *p++ = '\\'; + *p++ = 'U'; + *p++ = hexdigits[(ucs >> 28) & 0xf]; + *p++ = hexdigits[(ucs >> 24) & 0xf]; + *p++ = hexdigits[(ucs >> 20) & 0xf]; + *p++ = hexdigits[(ucs >> 16) & 0xf]; + *p++ = hexdigits[(ucs >> 12) & 0xf]; + *p++ = hexdigits[(ucs >> 8) & 0xf]; + *p++ = hexdigits[(ucs >> 4) & 0xf]; + *p++ = hexdigits[ucs & 0xf]; + continue; + } + /* Fall through: isolated surrogates are copied as-is */ + s--; + size++; + } #endif - /* Map 16-bit characters to '\uxxxx' */ - if (ch >= 256) { + /* Map 16-bit characters to '\uxxxx' */ + if (ch >= 256) { *p++ = '\\'; *p++ = 'u'; *p++ = hexdigits[(ch >> 12) & 0xf]; @@ -3638,8 +3638,8 @@ *p++ = hexdigits[(ch >> 4) & 0xf]; *p++ = hexdigits[ch & 15]; } - /* Copy everything else as-is */ - else + /* Copy everything else as-is */ + else *p++ = (char) ch; } size = p - q; @@ -3666,8 +3666,8 @@ /* --- Unicode Internal Codec ------------------------------------------- */ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { const char *starts = s; Py_ssize_t startinpos; @@ -3687,9 +3687,9 @@ /* XXX overflow detection missing */ v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); if (v == NULL) - goto onError; + goto onError; if (PyUnicode_GetSize((PyObject *)v) == 0) - return (PyObject *)v; + return (PyObject *)v; p = PyUnicode_AS_UNICODE(v); end = s + size; @@ -3698,12 +3698,12 @@ /* We have to sanity check the raw data, otherwise doom looms for some malformed UCS-4 data. */ if ( - #ifdef Py_UNICODE_WIDE +#ifdef Py_UNICODE_WIDE *p > unimax || *p < 0 || - #endif +#endif end-s < Py_UNICODE_SIZE ) - { + { startinpos = s - starts; if (end-s < Py_UNICODE_SIZE) { endinpos = end-starts; @@ -3734,7 +3734,7 @@ Py_XDECREF(exc); return (PyObject *)v; - onError: + onError: Py_XDECREF(v); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -3744,8 +3744,8 @@ /* --- Latin-1 Codec ------------------------------------------------------ */ PyObject *PyUnicode_DecodeLatin1(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { PyUnicodeObject *v; Py_UNICODE *p; @@ -3753,15 +3753,15 @@ /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ if (size == 1) { - Py_UNICODE r = *(unsigned char*)s; - return PyUnicode_FromUnicode(&r, 1); + Py_UNICODE r = *(unsigned char*)s; + return PyUnicode_FromUnicode(&r, 1); } v = _PyUnicode_New(size); if (v == NULL) - goto onError; + goto onError; if (size == 0) - return (PyObject *)v; + return (PyObject *)v; p = PyUnicode_AS_UNICODE(v); e = s + size; /* Unrolling the copy makes it much faster by reducing the looping @@ -3779,47 +3779,47 @@ *p++ = (unsigned char) *s++; return (PyObject *)v; - onError: + onError: Py_XDECREF(v); return NULL; } /* create or adjust a UnicodeEncodeError */ static void make_encode_exception(PyObject **exceptionObject, - const char *encoding, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) + const char *encoding, + const Py_UNICODE *unicode, Py_ssize_t size, + Py_ssize_t startpos, Py_ssize_t endpos, + const char *reason) { if (*exceptionObject == NULL) { - *exceptionObject = PyUnicodeEncodeError_Create( - encoding, unicode, size, startpos, endpos, reason); + *exceptionObject = PyUnicodeEncodeError_Create( + encoding, unicode, size, startpos, endpos, reason); } else { - if (PyUnicodeEncodeError_SetStart(*exceptionObject, startpos)) - goto onError; - if (PyUnicodeEncodeError_SetEnd(*exceptionObject, endpos)) - goto onError; - if (PyUnicodeEncodeError_SetReason(*exceptionObject, reason)) - goto onError; - return; - onError: - Py_DECREF(*exceptionObject); - *exceptionObject = NULL; + if (PyUnicodeEncodeError_SetStart(*exceptionObject, startpos)) + goto onError; + if (PyUnicodeEncodeError_SetEnd(*exceptionObject, endpos)) + goto onError; + if (PyUnicodeEncodeError_SetReason(*exceptionObject, reason)) + goto onError; + return; + onError: + Py_DECREF(*exceptionObject); + *exceptionObject = NULL; } } /* raises a UnicodeEncodeError */ static void raise_encode_exception(PyObject **exceptionObject, - const char *encoding, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) + const char *encoding, + const Py_UNICODE *unicode, Py_ssize_t size, + Py_ssize_t startpos, Py_ssize_t endpos, + const char *reason) { make_encode_exception(exceptionObject, - encoding, unicode, size, startpos, endpos, reason); + encoding, unicode, size, startpos, endpos, reason); if (*exceptionObject != NULL) - PyCodec_StrictErrors(*exceptionObject); + PyCodec_StrictErrors(*exceptionObject); } /* error handling callback helper: @@ -3827,11 +3827,11 @@ put the result into newpos and return the replacement string, which has to be freed by the caller */ static PyObject *unicode_encode_call_errorhandler(const char *errors, - PyObject **errorHandler, - const char *encoding, const char *reason, - const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject, - Py_ssize_t startpos, Py_ssize_t endpos, - Py_ssize_t *newpos) + PyObject **errorHandler, + const char *encoding, const char *reason, + const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject, + Py_ssize_t startpos, Py_ssize_t endpos, + Py_ssize_t *newpos) { static char *argparse = "O!n;encoding error handler must return (str, int) tuple"; @@ -3839,36 +3839,36 @@ PyObject *resunicode; if (*errorHandler == NULL) { - *errorHandler = PyCodec_LookupError(errors); + *errorHandler = PyCodec_LookupError(errors); if (*errorHandler == NULL) - return NULL; + return NULL; } make_encode_exception(exceptionObject, - encoding, unicode, size, startpos, endpos, reason); + encoding, unicode, size, startpos, endpos, reason); if (*exceptionObject == NULL) - return NULL; + return NULL; restuple = PyObject_CallFunctionObjArgs( - *errorHandler, *exceptionObject, NULL); + *errorHandler, *exceptionObject, NULL); if (restuple == NULL) - return NULL; + return NULL; if (!PyTuple_Check(restuple)) { - PyErr_Format(PyExc_TypeError, &argparse[4]); - Py_DECREF(restuple); - return NULL; + PyErr_Format(PyExc_TypeError, &argparse[4]); + Py_DECREF(restuple); + return NULL; } if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, - &resunicode, newpos)) { - Py_DECREF(restuple); - return NULL; + &resunicode, newpos)) { + Py_DECREF(restuple); + return NULL; } if (*newpos<0) - *newpos = size+*newpos; + *newpos = size+*newpos; if (*newpos<0 || *newpos>size) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); - Py_DECREF(restuple); - return NULL; + PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); + Py_DECREF(restuple); + return NULL; } Py_INCREF(resunicode); Py_DECREF(restuple); @@ -3876,9 +3876,9 @@ } static PyObject *unicode_encode_ucs1(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors, - int limit) + Py_ssize_t size, + const char *errors, + int limit) { /* output object */ PyObject *res; @@ -3910,128 +3910,128 @@ ressize = size; while (p=limit)) - ++collend; - /* cache callback name lookup (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_encode_exception(&exc, encoding, startp, size, collstart-startp, collend-startp, reason); - goto onError; - case 2: /* replace */ - while (collstart++=limit)) + ++collend; + /* cache callback name lookup (if not done yet, i.e. it's the first error) */ + if (known_errorHandler==-1) { + if ((errors==NULL) || (!strcmp(errors, "strict"))) + known_errorHandler = 1; + else if (!strcmp(errors, "replace")) + known_errorHandler = 2; + else if (!strcmp(errors, "ignore")) + known_errorHandler = 3; + else if (!strcmp(errors, "xmlcharrefreplace")) + known_errorHandler = 4; + else + known_errorHandler = 0; + } + switch (known_errorHandler) { + case 1: /* strict */ + raise_encode_exception(&exc, encoding, startp, size, collstart-startp, collend-startp, reason); + goto onError; + case 2: /* replace */ + while (collstart++ ressize) { - if (requiredsize<2*ressize) - requiredsize = 2*ressize; - if (_PyBytes_Resize(&res, requiredsize)) - goto onError; - str = PyBytes_AS_STRING(res) + respos; - ressize = requiredsize; - } - /* generate replacement (temporarily (mis)uses p) */ - for (p = collstart; p < collend; ++p) { - str += sprintf(str, "&#%d;", (int)*p); - } - p = collend; - break; - default: - repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, - encoding, reason, startp, size, &exc, - collstart-startp, collend-startp, &newpos); - if (repunicode == NULL) - goto onError; - /* need more space? (at least enough for what we - have+the replacement+the rest of the string, so - we won't have to check space for encodable characters) */ - respos = str - PyBytes_AS_STRING(res); - repsize = PyUnicode_GET_SIZE(repunicode); - requiredsize = respos+repsize+(endp-collend); - if (requiredsize > ressize) { - if (requiredsize<2*ressize) - requiredsize = 2*ressize; - if (_PyBytes_Resize(&res, requiredsize)) { - Py_DECREF(repunicode); - goto onError; - } - str = PyBytes_AS_STRING(res) + respos; - ressize = requiredsize; - } - /* check if there is anything unencodable in the replacement - and copy it to the output */ - for (uni2 = PyUnicode_AS_UNICODE(repunicode);repsize-->0; ++uni2, ++str) { - c = *uni2; - if (c >= limit) { - raise_encode_exception(&exc, encoding, startp, size, - unicodepos, unicodepos+1, reason); - Py_DECREF(repunicode); - goto onError; - } - *str = (char)c; - } - p = startp + newpos; - Py_DECREF(repunicode); - } - } + else if (*p<100000) + repsize += 2+5+1; + else if (*p<1000000) + repsize += 2+6+1; + else + repsize += 2+7+1; +#endif + } + requiredsize = respos+repsize+(endp-collend); + if (requiredsize > ressize) { + if (requiredsize<2*ressize) + requiredsize = 2*ressize; + if (_PyBytes_Resize(&res, requiredsize)) + goto onError; + str = PyBytes_AS_STRING(res) + respos; + ressize = requiredsize; + } + /* generate replacement (temporarily (mis)uses p) */ + for (p = collstart; p < collend; ++p) { + str += sprintf(str, "&#%d;", (int)*p); + } + p = collend; + break; + default: + repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, + encoding, reason, startp, size, &exc, + collstart-startp, collend-startp, &newpos); + if (repunicode == NULL) + goto onError; + /* need more space? (at least enough for what we + have+the replacement+the rest of the string, so + we won't have to check space for encodable characters) */ + respos = str - PyBytes_AS_STRING(res); + repsize = PyUnicode_GET_SIZE(repunicode); + requiredsize = respos+repsize+(endp-collend); + if (requiredsize > ressize) { + if (requiredsize<2*ressize) + requiredsize = 2*ressize; + if (_PyBytes_Resize(&res, requiredsize)) { + Py_DECREF(repunicode); + goto onError; + } + str = PyBytes_AS_STRING(res) + respos; + ressize = requiredsize; + } + /* check if there is anything unencodable in the replacement + and copy it to the output */ + for (uni2 = PyUnicode_AS_UNICODE(repunicode);repsize-->0; ++uni2, ++str) { + c = *uni2; + if (c >= limit) { + raise_encode_exception(&exc, encoding, startp, size, + unicodepos, unicodepos+1, reason); + Py_DECREF(repunicode); + goto onError; + } + *str = (char)c; + } + p = startp + newpos; + Py_DECREF(repunicode); + } + } } /* Resize if we allocated to much */ size = str - PyBytes_AS_STRING(res); @@ -4053,8 +4053,8 @@ } PyObject *PyUnicode_EncodeLatin1(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { return unicode_encode_ucs1(p, size, errors, 256); } @@ -4062,19 +4062,19 @@ PyObject *PyUnicode_AsLatin1String(PyObject *unicode) { if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; + PyErr_BadArgument(); + return NULL; } return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); + PyUnicode_GET_SIZE(unicode), + NULL); } /* --- 7-bit ASCII Codec -------------------------------------------------- */ PyObject *PyUnicode_DecodeASCII(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { const char *starts = s; PyUnicodeObject *v; @@ -4088,43 +4088,43 @@ /* ASCII is equivalent to the first 128 ordinals in Unicode. */ if (size == 1 && *(unsigned char*)s < 128) { - Py_UNICODE r = *(unsigned char*)s; - return PyUnicode_FromUnicode(&r, 1); + Py_UNICODE r = *(unsigned char*)s; + return PyUnicode_FromUnicode(&r, 1); } v = _PyUnicode_New(size); if (v == NULL) - goto onError; + goto onError; if (size == 0) - return (PyObject *)v; + return (PyObject *)v; p = PyUnicode_AS_UNICODE(v); e = s + size; while (s < e) { - register unsigned char c = (unsigned char)*s; - if (c < 128) { - *p++ = c; - ++s; - } - else { - startinpos = s-starts; - endinpos = startinpos + 1; - outpos = p - (Py_UNICODE *)PyUnicode_AS_UNICODE(v); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "ascii", "ordinal not in range(128)", - &starts, &e, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - } + register unsigned char c = (unsigned char)*s; + if (c < 128) { + *p++ = c; + ++s; + } + else { + startinpos = s-starts; + endinpos = startinpos + 1; + outpos = p - (Py_UNICODE *)PyUnicode_AS_UNICODE(v); + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "ascii", "ordinal not in range(128)", + &starts, &e, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) + goto onError; + } } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; + if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) + goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); return (PyObject *)v; - onError: + onError: Py_XDECREF(v); Py_XDECREF(errorHandler); Py_XDECREF(exc); @@ -4132,8 +4132,8 @@ } PyObject *PyUnicode_EncodeASCII(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { return unicode_encode_ucs1(p, size, errors, 128); } @@ -4141,12 +4141,12 @@ PyObject *PyUnicode_AsASCIIString(PyObject *unicode) { if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; + PyErr_BadArgument(); + return NULL; } return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); + PyUnicode_GET_SIZE(unicode), + NULL); } #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) @@ -4160,15 +4160,15 @@ /* XXX This code is limited to "true" double-byte encodings, as a) it assumes an incomplete character consists of a single byte, and b) IsDBCSLeadByte (probably) does not work for non-DBCS multi-byte - encodings, see IsDBCSLeadByteEx documentation. */ + encodings, see IsDBCSLeadByteEx documentation. */ static int is_dbcs_lead_byte(const char *s, int offset) { const char *curr = s + offset; if (IsDBCSLeadByte(*curr)) { - const char *prev = CharPrev(s, curr); - return (prev == curr) || !IsDBCSLeadByte(*prev) || (curr - prev == 2); + const char *prev = CharPrev(s, curr); + return (prev == curr) || !IsDBCSLeadByte(*prev) || (curr - prev == 2); } return 0; } @@ -4178,9 +4178,9 @@ * trailing lead-byte too. Returns consumed size if succeed, -1 otherwise. */ static int decode_mbcs(PyUnicodeObject **v, - const char *s, /* MBCS string */ - int size, /* sizeof MBCS string */ - int final) + const char *s, /* MBCS string */ + int size, /* sizeof MBCS string */ + int final) { Py_UNICODE *p; Py_ssize_t n = 0; @@ -4190,74 +4190,74 @@ /* Skip trailing lead-byte unless 'final' is set */ if (!final && size >= 1 && is_dbcs_lead_byte(s, size - 1)) - --size; + --size; /* First get the size of the result */ if (size > 0) { - usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0); - if (usize == 0) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } + usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0); + if (usize == 0) { + PyErr_SetFromWindowsErrWithFilename(0, NULL); + return -1; + } } if (*v == NULL) { - /* Create unicode object */ - *v = _PyUnicode_New(usize); - if (*v == NULL) - return -1; + /* Create unicode object */ + *v = _PyUnicode_New(usize); + if (*v == NULL) + return -1; } else { - /* Extend unicode object */ - n = PyUnicode_GET_SIZE(*v); - if (_PyUnicode_Resize(v, n + usize) < 0) - return -1; + /* Extend unicode object */ + n = PyUnicode_GET_SIZE(*v); + if (_PyUnicode_Resize(v, n + usize) < 0) + return -1; } /* Do the conversion */ if (size > 0) { - p = PyUnicode_AS_UNICODE(*v) + n; - if (0 == MultiByteToWideChar(CP_ACP, 0, s, size, p, usize)) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } + p = PyUnicode_AS_UNICODE(*v) + n; + if (0 == MultiByteToWideChar(CP_ACP, 0, s, size, p, usize)) { + PyErr_SetFromWindowsErrWithFilename(0, NULL); + return -1; + } } return size; } PyObject *PyUnicode_DecodeMBCSStateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) + Py_ssize_t size, + const char *errors, + Py_ssize_t *consumed) { PyUnicodeObject *v = NULL; int done; if (consumed) - *consumed = 0; + *consumed = 0; #ifdef NEED_RETRY retry: if (size > INT_MAX) - done = decode_mbcs(&v, s, INT_MAX, 0); + done = decode_mbcs(&v, s, INT_MAX, 0); else #endif - done = decode_mbcs(&v, s, (int)size, !consumed); + done = decode_mbcs(&v, s, (int)size, !consumed); if (done < 0) { Py_XDECREF(v); - return NULL; + return NULL; } if (consumed) - *consumed += done; + *consumed += done; #ifdef NEED_RETRY if (size > INT_MAX) { - s += done; - size -= done; - goto retry; + s += done; + size -= done; + goto retry; } #endif @@ -4265,8 +4265,8 @@ } PyObject *PyUnicode_DecodeMBCS(const char *s, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { return PyUnicode_DecodeMBCSStateful(s, size, errors, NULL); } @@ -4276,8 +4276,8 @@ * Returns 0 if succeed, -1 otherwise. */ static int encode_mbcs(PyObject **repr, - const Py_UNICODE *p, /* unicode */ - int size) /* size of unicode */ + const Py_UNICODE *p, /* unicode */ + int size) /* size of unicode */ { int mbcssize = 0; Py_ssize_t n = 0; @@ -4286,63 +4286,63 @@ /* First get the size of the result */ if (size > 0) { - mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL); - if (mbcssize == 0) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } + mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL); + if (mbcssize == 0) { + PyErr_SetFromWindowsErrWithFilename(0, NULL); + return -1; + } } if (*repr == NULL) { - /* Create string object */ - *repr = PyBytes_FromStringAndSize(NULL, mbcssize); - if (*repr == NULL) - return -1; + /* Create string object */ + *repr = PyBytes_FromStringAndSize(NULL, mbcssize); + if (*repr == NULL) + return -1; } else { - /* Extend string object */ - n = PyBytes_Size(*repr); - if (_PyBytes_Resize(repr, n + mbcssize) < 0) - return -1; + /* Extend string object */ + n = PyBytes_Size(*repr); + if (_PyBytes_Resize(repr, n + mbcssize) < 0) + return -1; } /* Do the conversion */ if (size > 0) { - char *s = PyBytes_AS_STRING(*repr) + n; - if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } + char *s = PyBytes_AS_STRING(*repr) + n; + if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { + PyErr_SetFromWindowsErrWithFilename(0, NULL); + return -1; + } } return 0; } PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) + Py_ssize_t size, + const char *errors) { PyObject *repr = NULL; int ret; #ifdef NEED_RETRY - retry: + retry: if (size > INT_MAX) - ret = encode_mbcs(&repr, p, INT_MAX); + ret = encode_mbcs(&repr, p, INT_MAX); else #endif - ret = encode_mbcs(&repr, p, (int)size); + ret = encode_mbcs(&repr, p, (int)size); if (ret < 0) { - Py_XDECREF(repr); - return NULL; + Py_XDECREF(repr); + return NULL; } #ifdef NEED_RETRY if (size > INT_MAX) { - p += INT_MAX; - size -= INT_MAX; - goto retry; + p += INT_MAX; + size -= INT_MAX; + goto retry; } #endif @@ -4356,8 +4356,8 @@ return NULL; } return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); + PyUnicode_GET_SIZE(unicode), + NULL); } #undef NEED_RETRY @@ -4367,9 +4367,9 @@ /* --- Character Mapping Codec -------------------------------------------- */ PyObject *PyUnicode_DecodeCharmap(const char *s, - Py_ssize_t size, - PyObject *mapping, - const char *errors) + Py_ssize_t size, + PyObject *mapping, + const char *errors) { const char *starts = s; Py_ssize_t startinpos; @@ -4386,141 +4386,141 @@ /* Default to Latin-1 */ if (mapping == NULL) - return PyUnicode_DecodeLatin1(s, size, errors); + return PyUnicode_DecodeLatin1(s, size, errors); v = _PyUnicode_New(size); if (v == NULL) - goto onError; + goto onError; if (size == 0) - return (PyObject *)v; + return (PyObject *)v; p = PyUnicode_AS_UNICODE(v); e = s + size; if (PyUnicode_CheckExact(mapping)) { - mapstring = PyUnicode_AS_UNICODE(mapping); - maplen = PyUnicode_GET_SIZE(mapping); - while (s < e) { - unsigned char ch = *s; - Py_UNICODE x = 0xfffe; /* illegal value */ - - if (ch < maplen) - x = mapstring[ch]; - - if (x == 0xfffe) { - /* undefined mapping */ - outpos = p-PyUnicode_AS_UNICODE(v); - startinpos = s-starts; - endinpos = startinpos+1; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "charmap", "character maps to ", - &starts, &e, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) { - goto onError; - } - continue; - } - *p++ = x; - ++s; - } + mapstring = PyUnicode_AS_UNICODE(mapping); + maplen = PyUnicode_GET_SIZE(mapping); + while (s < e) { + unsigned char ch = *s; + Py_UNICODE x = 0xfffe; /* illegal value */ + + if (ch < maplen) + x = mapstring[ch]; + + if (x == 0xfffe) { + /* undefined mapping */ + outpos = p-PyUnicode_AS_UNICODE(v); + startinpos = s-starts; + endinpos = startinpos+1; + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "charmap", "character maps to ", + &starts, &e, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) { + goto onError; + } + continue; + } + *p++ = x; + ++s; + } } else { - while (s < e) { - unsigned char ch = *s; - PyObject *w, *x; - - /* Get mapping (char ordinal -> integer, Unicode char or None) */ - w = PyLong_FromLong((long)ch); - if (w == NULL) - goto onError; - x = PyObject_GetItem(mapping, w); - Py_DECREF(w); - if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: mapping is undefined. */ - PyErr_Clear(); - x = Py_None; - Py_INCREF(x); - } else - goto onError; - } - - /* Apply mapping */ - if (PyLong_Check(x)) { - long value = PyLong_AS_LONG(x); - if (value < 0 || value > 65535) { - PyErr_SetString(PyExc_TypeError, - "character mapping must be in range(65536)"); - Py_DECREF(x); - goto onError; - } - *p++ = (Py_UNICODE)value; - } - else if (x == Py_None) { - /* undefined mapping */ - outpos = p-PyUnicode_AS_UNICODE(v); - startinpos = s-starts; - endinpos = startinpos+1; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "charmap", "character maps to ", - &starts, &e, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) { - Py_DECREF(x); - goto onError; - } - Py_DECREF(x); - continue; - } - else if (PyUnicode_Check(x)) { - Py_ssize_t targetsize = PyUnicode_GET_SIZE(x); - - if (targetsize == 1) - /* 1-1 mapping */ - *p++ = *PyUnicode_AS_UNICODE(x); - - else if (targetsize > 1) { - /* 1-n mapping */ - if (targetsize > extrachars) { - /* resize first */ - Py_ssize_t oldpos = p - PyUnicode_AS_UNICODE(v); - Py_ssize_t needed = (targetsize - extrachars) + \ - (targetsize << 2); - extrachars += needed; - /* XXX overflow detection missing */ - if (_PyUnicode_Resize(&v, - PyUnicode_GET_SIZE(v) + needed) < 0) { - Py_DECREF(x); - goto onError; - } - p = PyUnicode_AS_UNICODE(v) + oldpos; - } - Py_UNICODE_COPY(p, - PyUnicode_AS_UNICODE(x), - targetsize); - p += targetsize; - extrachars -= targetsize; - } - /* 1-0 mapping: skip the character */ - } - else { - /* wrong return value */ - PyErr_SetString(PyExc_TypeError, - "character mapping must return integer, None or str"); - Py_DECREF(x); - goto onError; - } - Py_DECREF(x); - ++s; - } + while (s < e) { + unsigned char ch = *s; + PyObject *w, *x; + + /* Get mapping (char ordinal -> integer, Unicode char or None) */ + w = PyLong_FromLong((long)ch); + if (w == NULL) + goto onError; + x = PyObject_GetItem(mapping, w); + Py_DECREF(w); + if (x == NULL) { + if (PyErr_ExceptionMatches(PyExc_LookupError)) { + /* No mapping found means: mapping is undefined. */ + PyErr_Clear(); + x = Py_None; + Py_INCREF(x); + } else + goto onError; + } + + /* Apply mapping */ + if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); + if (value < 0 || value > 65535) { + PyErr_SetString(PyExc_TypeError, + "character mapping must be in range(65536)"); + Py_DECREF(x); + goto onError; + } + *p++ = (Py_UNICODE)value; + } + else if (x == Py_None) { + /* undefined mapping */ + outpos = p-PyUnicode_AS_UNICODE(v); + startinpos = s-starts; + endinpos = startinpos+1; + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "charmap", "character maps to ", + &starts, &e, &startinpos, &endinpos, &exc, &s, + &v, &outpos, &p)) { + Py_DECREF(x); + goto onError; + } + Py_DECREF(x); + continue; + } + else if (PyUnicode_Check(x)) { + Py_ssize_t targetsize = PyUnicode_GET_SIZE(x); + + if (targetsize == 1) + /* 1-1 mapping */ + *p++ = *PyUnicode_AS_UNICODE(x); + + else if (targetsize > 1) { + /* 1-n mapping */ + if (targetsize > extrachars) { + /* resize first */ + Py_ssize_t oldpos = p - PyUnicode_AS_UNICODE(v); + Py_ssize_t needed = (targetsize - extrachars) + \ + (targetsize << 2); + extrachars += needed; + /* XXX overflow detection missing */ + if (_PyUnicode_Resize(&v, + PyUnicode_GET_SIZE(v) + needed) < 0) { + Py_DECREF(x); + goto onError; + } + p = PyUnicode_AS_UNICODE(v) + oldpos; + } + Py_UNICODE_COPY(p, + PyUnicode_AS_UNICODE(x), + targetsize); + p += targetsize; + extrachars -= targetsize; + } + /* 1-0 mapping: skip the character */ + } + else { + /* wrong return value */ + PyErr_SetString(PyExc_TypeError, + "character mapping must return integer, None or str"); + Py_DECREF(x); + goto onError; + } + Py_DECREF(x); + ++s; + } } if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; + if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) + goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); return (PyObject *)v; - onError: + onError: Py_XDECREF(errorHandler); Py_XDECREF(exc); Py_XDECREF(v); @@ -4530,74 +4530,74 @@ /* Charmap encoding: the lookup table */ struct encoding_map{ - PyObject_HEAD - unsigned char level1[32]; - int count2, count3; - unsigned char level23[1]; + PyObject_HEAD + unsigned char level1[32]; + int count2, count3; + unsigned char level23[1]; }; static PyObject* encoding_map_size(PyObject *obj, PyObject* args) { struct encoding_map *map = (struct encoding_map*)obj; - return PyLong_FromLong(sizeof(*map) - 1 + 16*map->count2 + - 128*map->count3); + return PyLong_FromLong(sizeof(*map) - 1 + 16*map->count2 + + 128*map->count3); } static PyMethodDef encoding_map_methods[] = { - {"size", encoding_map_size, METH_NOARGS, - PyDoc_STR("Return the size (in bytes) of this object") }, - { 0 } + {"size", encoding_map_size, METH_NOARGS, + PyDoc_STR("Return the size (in bytes) of this object") }, + { 0 } }; static void encoding_map_dealloc(PyObject* o) { - PyObject_FREE(o); + PyObject_FREE(o); } static PyTypeObject EncodingMapType = { - PyVarObject_HEAD_INIT(NULL, 0) - "EncodingMap", /*tp_name*/ - sizeof(struct encoding_map), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - encoding_map_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - encoding_map_methods, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ + PyVarObject_HEAD_INIT(NULL, 0) + "EncodingMap", /*tp_name*/ + sizeof(struct encoding_map), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + encoding_map_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + encoding_map_methods, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ }; PyObject* @@ -4629,10 +4629,10 @@ for (i = 1; i < 256; i++) { int l1, l2; if (decode[i] == 0 - #ifdef Py_UNICODE_WIDE +#ifdef Py_UNICODE_WIDE || decode[i] > 0xFFFF - #endif - ) { +#endif + ) { need_dict = 1; break; } @@ -4644,7 +4644,7 @@ if (level1[l1] == 0xFF) level1[l1] = count2++; if (level2[l2] == 0xFF) - level2[l2] = count3++; + level2[l2] = count3++; } if (count2 >= 0xFF || count3 >= 0xFF) @@ -4718,7 +4718,7 @@ #ifdef Py_UNICODE_WIDE if (c > 0xFFFF) { - return -1; + return -1; } #endif if (c == 0) @@ -4750,57 +4750,57 @@ PyObject *x; if (w == NULL) - return NULL; + return NULL; x = PyObject_GetItem(mapping, w); Py_DECREF(w); if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: mapping is undefined. */ - PyErr_Clear(); - x = Py_None; - Py_INCREF(x); - return x; - } else - return NULL; + if (PyErr_ExceptionMatches(PyExc_LookupError)) { + /* No mapping found means: mapping is undefined. */ + PyErr_Clear(); + x = Py_None; + Py_INCREF(x); + return x; + } else + return NULL; } else if (x == Py_None) - return x; + return x; else if (PyLong_Check(x)) { - long value = PyLong_AS_LONG(x); - if (value < 0 || value > 255) { - PyErr_SetString(PyExc_TypeError, - "character mapping must be in range(256)"); - Py_DECREF(x); - return NULL; - } - return x; + long value = PyLong_AS_LONG(x); + if (value < 0 || value > 255) { + PyErr_SetString(PyExc_TypeError, + "character mapping must be in range(256)"); + Py_DECREF(x); + return NULL; + } + return x; } else if (PyBytes_Check(x)) - return x; + return x; else { - /* wrong return value */ - PyErr_Format(PyExc_TypeError, - "character mapping must return integer, bytes or None, not %.400s", - x->ob_type->tp_name); - Py_DECREF(x); - return NULL; + /* wrong return value */ + PyErr_Format(PyExc_TypeError, + "character mapping must return integer, bytes or None, not %.400s", + x->ob_type->tp_name); + Py_DECREF(x); + return NULL; } } static int charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) { - Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); - /* exponentially overallocate to minimize reallocations */ - if (requiredsize < 2*outsize) - requiredsize = 2*outsize; - if (_PyBytes_Resize(outobj, requiredsize)) - return -1; - return 0; + Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); + /* exponentially overallocate to minimize reallocations */ + if (requiredsize < 2*outsize) + requiredsize = 2*outsize; + if (_PyBytes_Resize(outobj, requiredsize)) + return -1; + return 0; } -typedef enum charmapencode_result { - enc_SUCCESS, enc_FAILED, enc_EXCEPTION +typedef enum charmapencode_result { + enc_SUCCESS, enc_FAILED, enc_EXCEPTION }charmapencode_result; /* lookup the character, put the result in the output string and adjust various state variables. Resize the output bytes object if not enough @@ -4810,7 +4810,7 @@ reallocation error occurred. The caller must decref the result */ static charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping, - PyObject **outobj, Py_ssize_t *outpos) + PyObject **outobj, Py_ssize_t *outpos) { PyObject *rep; char *outstart; @@ -4818,47 +4818,47 @@ if (Py_TYPE(mapping) == &EncodingMapType) { int res = encoding_map_lookup(c, mapping); - Py_ssize_t requiredsize = *outpos+1; + Py_ssize_t requiredsize = *outpos+1; if (res == -1) return enc_FAILED; - if (outsize0; ++uni2) { - x = charmapencode_output(*uni2, mapping, res, respos); - if (x==enc_EXCEPTION) { - return -1; - } - else if (x==enc_FAILED) { - Py_DECREF(repunicode); - raise_encode_exception(exceptionObject, encoding, p, size, collstartpos, collendpos, reason); - return -1; - } - } - *inpos = newpos; - Py_DECREF(repunicode); + case 1: /* strict */ + raise_encode_exception(exceptionObject, encoding, p, size, collstartpos, collendpos, reason); + return -1; + case 2: /* replace */ + for (collpos = collstartpos; collpos0; ++uni2) { + x = charmapencode_output(*uni2, mapping, res, respos); + if (x==enc_EXCEPTION) { + return -1; + } + else if (x==enc_FAILED) { + Py_DECREF(repunicode); + raise_encode_exception(exceptionObject, encoding, p, size, collstartpos, collendpos, reason); + return -1; + } + } + *inpos = newpos; + Py_DECREF(repunicode); } return 0; } PyObject *PyUnicode_EncodeCharmap(const Py_UNICODE *p, - Py_ssize_t size, - PyObject *mapping, - const char *errors) + Py_ssize_t size, + PyObject *mapping, + const char *errors) { /* output object */ PyObject *res = NULL; @@ -5002,7 +5002,7 @@ /* Default to Latin-1 */ if (mapping == NULL) - return PyUnicode_EncodeLatin1(p, size, errors); + return PyUnicode_EncodeLatin1(p, size, errors); /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ @@ -5010,24 +5010,24 @@ if (res == NULL) goto onError; if (size == 0) - return res; + return res; while (inpos adjust input position */ - ++inpos; + /* try to encode it */ + charmapencode_result x = charmapencode_output(p[inpos], mapping, &res, &respos); + if (x==enc_EXCEPTION) /* error */ + goto onError; + if (x==enc_FAILED) { /* unencodable character */ + if (charmap_encoding_error(p, size, &inpos, mapping, + &exc, + &known_errorHandler, &errorHandler, errors, + &res, &respos)) { + goto onError; + } + } + else + /* done with this character => adjust input position */ + ++inpos; } /* Resize if we allocated to much */ @@ -5039,7 +5039,7 @@ Py_XDECREF(errorHandler); return res; - onError: + onError: Py_XDECREF(res); Py_XDECREF(exc); Py_XDECREF(errorHandler); @@ -5047,52 +5047,52 @@ } PyObject *PyUnicode_AsCharmapString(PyObject *unicode, - PyObject *mapping) + PyObject *mapping) { if (!PyUnicode_Check(unicode) || mapping == NULL) { - PyErr_BadArgument(); - return NULL; + PyErr_BadArgument(); + return NULL; } return PyUnicode_EncodeCharmap(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - mapping, - NULL); + PyUnicode_GET_SIZE(unicode), + mapping, + NULL); } /* create or adjust a UnicodeTranslateError */ static void make_translate_exception(PyObject **exceptionObject, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) + const Py_UNICODE *unicode, Py_ssize_t size, + Py_ssize_t startpos, Py_ssize_t endpos, + const char *reason) { if (*exceptionObject == NULL) { - *exceptionObject = PyUnicodeTranslateError_Create( - unicode, size, startpos, endpos, reason); + *exceptionObject = PyUnicodeTranslateError_Create( + unicode, size, startpos, endpos, reason); } else { - if (PyUnicodeTranslateError_SetStart(*exceptionObject, startpos)) - goto onError; - if (PyUnicodeTranslateError_SetEnd(*exceptionObject, endpos)) - goto onError; - if (PyUnicodeTranslateError_SetReason(*exceptionObject, reason)) - goto onError; - return; - onError: - Py_DECREF(*exceptionObject); - *exceptionObject = NULL; + if (PyUnicodeTranslateError_SetStart(*exceptionObject, startpos)) + goto onError; + if (PyUnicodeTranslateError_SetEnd(*exceptionObject, endpos)) + goto onError; + if (PyUnicodeTranslateError_SetReason(*exceptionObject, reason)) + goto onError; + return; + onError: + Py_DECREF(*exceptionObject); + *exceptionObject = NULL; } } /* raises a UnicodeTranslateError */ static void raise_translate_exception(PyObject **exceptionObject, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) + const Py_UNICODE *unicode, Py_ssize_t size, + Py_ssize_t startpos, Py_ssize_t endpos, + const char *reason) { make_translate_exception(exceptionObject, - unicode, size, startpos, endpos, reason); + unicode, size, startpos, endpos, reason); if (*exceptionObject != NULL) - PyCodec_StrictErrors(*exceptionObject); + PyCodec_StrictErrors(*exceptionObject); } /* error handling callback helper: @@ -5100,11 +5100,11 @@ put the result into newpos and return the replacement string, which has to be freed by the caller */ static PyObject *unicode_translate_call_errorhandler(const char *errors, - PyObject **errorHandler, - const char *reason, - const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject, - Py_ssize_t startpos, Py_ssize_t endpos, - Py_ssize_t *newpos) + PyObject **errorHandler, + const char *reason, + const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject, + Py_ssize_t startpos, Py_ssize_t endpos, + Py_ssize_t *newpos) { static char *argparse = "O!n;translating error handler must return (str, int) tuple"; @@ -5113,38 +5113,38 @@ PyObject *resunicode; if (*errorHandler == NULL) { - *errorHandler = PyCodec_LookupError(errors); + *errorHandler = PyCodec_LookupError(errors); if (*errorHandler == NULL) - return NULL; + return NULL; } make_translate_exception(exceptionObject, - unicode, size, startpos, endpos, reason); + unicode, size, startpos, endpos, reason); if (*exceptionObject == NULL) - return NULL; + return NULL; restuple = PyObject_CallFunctionObjArgs( - *errorHandler, *exceptionObject, NULL); + *errorHandler, *exceptionObject, NULL); if (restuple == NULL) - return NULL; + return NULL; if (!PyTuple_Check(restuple)) { - PyErr_Format(PyExc_TypeError, &argparse[4]); - Py_DECREF(restuple); - return NULL; + PyErr_Format(PyExc_TypeError, &argparse[4]); + Py_DECREF(restuple); + return NULL; } if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, - &resunicode, &i_newpos)) { - Py_DECREF(restuple); - return NULL; + &resunicode, &i_newpos)) { + Py_DECREF(restuple); + return NULL; } if (i_newpos<0) - *newpos = size+i_newpos; + *newpos = size+i_newpos; else *newpos = i_newpos; if (*newpos<0 || *newpos>size) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); - Py_DECREF(restuple); - return NULL; + PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); + Py_DECREF(restuple); + return NULL; } Py_INCREF(resunicode); Py_DECREF(restuple); @@ -5161,63 +5161,63 @@ PyObject *x; if (w == NULL) - return -1; + return -1; x = PyObject_GetItem(mapping, w); Py_DECREF(w); if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: use 1:1 mapping. */ - PyErr_Clear(); - *result = NULL; - return 0; - } else - return -1; + if (PyErr_ExceptionMatches(PyExc_LookupError)) { + /* No mapping found means: use 1:1 mapping. */ + PyErr_Clear(); + *result = NULL; + return 0; + } else + return -1; } else if (x == Py_None) { - *result = x; - return 0; + *result = x; + return 0; } else if (PyLong_Check(x)) { - long value = PyLong_AS_LONG(x); - long max = PyUnicode_GetMax(); - if (value < 0 || value > max) { - PyErr_Format(PyExc_TypeError, + long value = PyLong_AS_LONG(x); + long max = PyUnicode_GetMax(); + if (value < 0 || value > max) { + PyErr_Format(PyExc_TypeError, "character mapping must be in range(0x%x)", max+1); - Py_DECREF(x); - return -1; - } - *result = x; - return 0; + Py_DECREF(x); + return -1; + } + *result = x; + return 0; } else if (PyUnicode_Check(x)) { - *result = x; - return 0; + *result = x; + return 0; } else { - /* wrong return value */ - PyErr_SetString(PyExc_TypeError, - "character mapping must return integer, None or str"); - Py_DECREF(x); - return -1; + /* wrong return value */ + PyErr_SetString(PyExc_TypeError, + "character mapping must return integer, None or str"); + Py_DECREF(x); + return -1; } } /* ensure that *outobj is at least requiredsize characters long, -if not reallocate and adjust various state variables. -Return 0 on success, -1 on error */ + if not reallocate and adjust various state variables. + Return 0 on success, -1 on error */ static int charmaptranslate_makespace(PyObject **outobj, Py_UNICODE **outp, - Py_ssize_t requiredsize) + Py_ssize_t requiredsize) { Py_ssize_t oldsize = PyUnicode_GET_SIZE(*outobj); if (requiredsize > oldsize) { - /* remember old output position */ - Py_ssize_t outpos = *outp-PyUnicode_AS_UNICODE(*outobj); - /* exponentially overallocate to minimize reallocations */ - if (requiredsize < 2 * oldsize) - requiredsize = 2 * oldsize; - if (PyUnicode_Resize(outobj, requiredsize) < 0) - return -1; - *outp = PyUnicode_AS_UNICODE(*outobj) + outpos; + /* remember old output position */ + Py_ssize_t outpos = *outp-PyUnicode_AS_UNICODE(*outobj); + /* exponentially overallocate to minimize reallocations */ + if (requiredsize < 2 * oldsize) + requiredsize = 2 * oldsize; + if (PyUnicode_Resize(outobj, requiredsize) < 0) + return -1; + *outp = PyUnicode_AS_UNICODE(*outobj) + outpos; } return 0; } @@ -5229,47 +5229,47 @@ Return 0 on success, -1 on error. */ static int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp, - Py_ssize_t insize, PyObject *mapping, PyObject **outobj, Py_UNICODE **outp, - PyObject **res) + Py_ssize_t insize, PyObject *mapping, PyObject **outobj, Py_UNICODE **outp, + PyObject **res) { if (charmaptranslate_lookup(*curinp, mapping, res)) - return -1; + return -1; if (*res==NULL) { - /* not found => default to 1:1 mapping */ - *(*outp)++ = *curinp; + /* not found => default to 1:1 mapping */ + *(*outp)++ = *curinp; } else if (*res==Py_None) - ; + ; else if (PyLong_Check(*res)) { - /* no overflow check, because we know that the space is enough */ - *(*outp)++ = (Py_UNICODE)PyLong_AS_LONG(*res); + /* no overflow check, because we know that the space is enough */ + *(*outp)++ = (Py_UNICODE)PyLong_AS_LONG(*res); } else if (PyUnicode_Check(*res)) { - Py_ssize_t repsize = PyUnicode_GET_SIZE(*res); - if (repsize==1) { - /* no overflow check, because we know that the space is enough */ - *(*outp)++ = *PyUnicode_AS_UNICODE(*res); - } - else if (repsize!=0) { - /* more than one character */ - Py_ssize_t requiredsize = (*outp-PyUnicode_AS_UNICODE(*outobj)) + - (insize - (curinp-startinp)) + - repsize - 1; - if (charmaptranslate_makespace(outobj, outp, requiredsize)) - return -1; - memcpy(*outp, PyUnicode_AS_UNICODE(*res), sizeof(Py_UNICODE)*repsize); - *outp += repsize; - } + Py_ssize_t repsize = PyUnicode_GET_SIZE(*res); + if (repsize==1) { + /* no overflow check, because we know that the space is enough */ + *(*outp)++ = *PyUnicode_AS_UNICODE(*res); + } + else if (repsize!=0) { + /* more than one character */ + Py_ssize_t requiredsize = (*outp-PyUnicode_AS_UNICODE(*outobj)) + + (insize - (curinp-startinp)) + + repsize - 1; + if (charmaptranslate_makespace(outobj, outp, requiredsize)) + return -1; + memcpy(*outp, PyUnicode_AS_UNICODE(*res), sizeof(Py_UNICODE)*repsize); + *outp += repsize; + } } else - return -1; + return -1; return 0; } PyObject *PyUnicode_TranslateCharmap(const Py_UNICODE *p, - Py_ssize_t size, - PyObject *mapping, - const char *errors) + Py_ssize_t size, + PyObject *mapping, + const char *errors) { /* output object */ PyObject *res = NULL; @@ -5289,119 +5289,119 @@ int known_errorHandler = -1; if (mapping == NULL) { - PyErr_BadArgument(); - return NULL; + PyErr_BadArgument(); + return NULL; } /* allocate enough for a simple 1:1 translation without replacements, if we need more, we'll resize */ res = PyUnicode_FromUnicode(NULL, size); if (res == NULL) - goto onError; + goto onError; if (size == 0) - return res; + return res; str = PyUnicode_AS_UNICODE(res); while (p adjust input pointer */ - ++p; - else { /* untranslatable character */ - PyObject *repunicode = NULL; /* initialize to prevent gcc warning */ - Py_ssize_t repsize; - Py_ssize_t newpos; - Py_UNICODE *uni2; - /* startpos for collecting untranslatable chars */ - const Py_UNICODE *collstart = p; - const Py_UNICODE *collend = p+1; - const Py_UNICODE *coll; - - /* find all untranslatable characters */ - while (collend < endp) { - if (charmaptranslate_lookup(*collend, mapping, &x)) - goto onError; - Py_XDECREF(x); - if (x!=Py_None) - break; - ++collend; - } - /* cache callback name lookup - * (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_translate_exception(&exc, startp, size, collstart-startp, collend-startp, reason); - goto onError; - case 2: /* replace */ - /* No need to check for space, this is a 1:1 replacement */ - for (coll = collstart; coll0; ++uni2) - *str++ = *uni2; - p = startp + newpos; - Py_DECREF(repunicode); - } - } + /* try to encode it */ + PyObject *x = NULL; + if (charmaptranslate_output(startp, p, size, mapping, &res, &str, &x)) { + Py_XDECREF(x); + goto onError; + } + Py_XDECREF(x); + if (x!=Py_None) /* it worked => adjust input pointer */ + ++p; + else { /* untranslatable character */ + PyObject *repunicode = NULL; /* initialize to prevent gcc warning */ + Py_ssize_t repsize; + Py_ssize_t newpos; + Py_UNICODE *uni2; + /* startpos for collecting untranslatable chars */ + const Py_UNICODE *collstart = p; + const Py_UNICODE *collend = p+1; + const Py_UNICODE *coll; + + /* find all untranslatable characters */ + while (collend < endp) { + if (charmaptranslate_lookup(*collend, mapping, &x)) + goto onError; + Py_XDECREF(x); + if (x!=Py_None) + break; + ++collend; + } + /* cache callback name lookup + * (if not done yet, i.e. it's the first error) */ + if (known_errorHandler==-1) { + if ((errors==NULL) || (!strcmp(errors, "strict"))) + known_errorHandler = 1; + else if (!strcmp(errors, "replace")) + known_errorHandler = 2; + else if (!strcmp(errors, "ignore")) + known_errorHandler = 3; + else if (!strcmp(errors, "xmlcharrefreplace")) + known_errorHandler = 4; + else + known_errorHandler = 0; + } + switch (known_errorHandler) { + case 1: /* strict */ + raise_translate_exception(&exc, startp, size, collstart-startp, collend-startp, reason); + goto onError; + case 2: /* replace */ + /* No need to check for space, this is a 1:1 replacement */ + for (coll = collstart; coll0; ++uni2) + *str++ = *uni2; + p = startp + newpos; + Py_DECREF(repunicode); + } + } } /* Resize if we allocated to much */ respos = str-PyUnicode_AS_UNICODE(res); if (respos= 0) { - *output++ = '0' + decimal; - ++p; - continue; - } - if (0 < ch && ch < 256) { - *output++ = (char)ch; - ++p; - continue; - } - /* All other characters are considered unencodable */ - collstart = p; - collend = p+1; - while (collend < end) { - if ((0 < *collend && *collend < 256) || - !Py_UNICODE_ISSPACE(*collend) || - Py_UNICODE_TODECIMAL(*collend)) - break; - } - /* cache callback name lookup - * (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_encode_exception(&exc, encoding, s, length, collstart-s, collend-s, reason); - goto onError; - case 2: /* replace */ - for (p = collstart; p < collend; ++p) - *output++ = '?'; - /* fall through */ - case 3: /* ignore */ - p = collend; - break; - case 4: /* xmlcharrefreplace */ - /* generate replacement (temporarily (mis)uses p) */ - for (p = collstart; p < collend; ++p) - output += sprintf(output, "&#%d;", (int)*p); - p = collend; - break; - default: - repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, - encoding, reason, s, length, &exc, - collstart-s, collend-s, &newpos); - if (repunicode == NULL) - goto onError; - /* generate replacement */ - repsize = PyUnicode_GET_SIZE(repunicode); - for (uni2 = PyUnicode_AS_UNICODE(repunicode); repsize-->0; ++uni2) { - Py_UNICODE ch = *uni2; - if (Py_UNICODE_ISSPACE(ch)) - *output++ = ' '; - else { - decimal = Py_UNICODE_TODECIMAL(ch); - if (decimal >= 0) - *output++ = '0' + decimal; - else if (0 < ch && ch < 256) - *output++ = (char)ch; - else { - Py_DECREF(repunicode); - raise_encode_exception(&exc, encoding, - s, length, collstart-s, collend-s, reason); - goto onError; - } - } - } - p = s + newpos; - Py_DECREF(repunicode); - } + register Py_UNICODE ch = *p; + int decimal; + PyObject *repunicode; + Py_ssize_t repsize; + Py_ssize_t newpos; + Py_UNICODE *uni2; + Py_UNICODE *collstart; + Py_UNICODE *collend; + + if (Py_UNICODE_ISSPACE(ch)) { + *output++ = ' '; + ++p; + continue; + } + decimal = Py_UNICODE_TODECIMAL(ch); + if (decimal >= 0) { + *output++ = '0' + decimal; + ++p; + continue; + } + if (0 < ch && ch < 256) { + *output++ = (char)ch; + ++p; + continue; + } + /* All other characters are considered unencodable */ + collstart = p; + collend = p+1; + while (collend < end) { + if ((0 < *collend && *collend < 256) || + !Py_UNICODE_ISSPACE(*collend) || + Py_UNICODE_TODECIMAL(*collend)) + break; + } + /* cache callback name lookup + * (if not done yet, i.e. it's the first error) */ + if (known_errorHandler==-1) { + if ((errors==NULL) || (!strcmp(errors, "strict"))) + known_errorHandler = 1; + else if (!strcmp(errors, "replace")) + known_errorHandler = 2; + else if (!strcmp(errors, "ignore")) + known_errorHandler = 3; + else if (!strcmp(errors, "xmlcharrefreplace")) + known_errorHandler = 4; + else + known_errorHandler = 0; + } + switch (known_errorHandler) { + case 1: /* strict */ + raise_encode_exception(&exc, encoding, s, length, collstart-s, collend-s, reason); + goto onError; + case 2: /* replace */ + for (p = collstart; p < collend; ++p) + *output++ = '?'; + /* fall through */ + case 3: /* ignore */ + p = collend; + break; + case 4: /* xmlcharrefreplace */ + /* generate replacement (temporarily (mis)uses p) */ + for (p = collstart; p < collend; ++p) + output += sprintf(output, "&#%d;", (int)*p); + p = collend; + break; + default: + repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, + encoding, reason, s, length, &exc, + collstart-s, collend-s, &newpos); + if (repunicode == NULL) + goto onError; + /* generate replacement */ + repsize = PyUnicode_GET_SIZE(repunicode); + for (uni2 = PyUnicode_AS_UNICODE(repunicode); repsize-->0; ++uni2) { + Py_UNICODE ch = *uni2; + if (Py_UNICODE_ISSPACE(ch)) + *output++ = ' '; + else { + decimal = Py_UNICODE_TODECIMAL(ch); + if (decimal >= 0) + *output++ = '0' + decimal; + else if (0 < ch && ch < 256) + *output++ = (char)ch; + else { + Py_DECREF(repunicode); + raise_encode_exception(&exc, encoding, + s, length, collstart-s, collend-s, reason); + goto onError; + } + } + } + p = s + newpos; + Py_DECREF(repunicode); + } } /* 0-terminate the output string */ *output++ = '\0'; @@ -5554,7 +5554,7 @@ Py_XDECREF(errorHandler); return 0; - onError: + onError: Py_XDECREF(exc); Py_XDECREF(errorHandler); return -1; @@ -5597,11 +5597,11 @@ str_obj = (PyUnicodeObject*) PyUnicode_FromObject(str); if (!str_obj) - return -1; + return -1; sub_obj = (PyUnicodeObject*) PyUnicode_FromObject(substr); if (!sub_obj) { - Py_DECREF(str_obj); - return -1; + Py_DECREF(str_obj); + return -1; } FIX_START_END(str_obj); @@ -5626,11 +5626,11 @@ str = PyUnicode_FromObject(str); if (!str) - return -2; + return -2; sub = PyUnicode_FromObject(sub); if (!sub) { - Py_DECREF(str); - return -2; + Py_DECREF(str); + return -2; } if (direction > 0) @@ -5654,10 +5654,10 @@ static int tailmatch(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t start, - Py_ssize_t end, - int direction) + PyUnicodeObject *substring, + Py_ssize_t start, + Py_ssize_t end, + int direction) { if (substring->length == 0) return 1; @@ -5666,39 +5666,39 @@ end -= substring->length; if (end < start) - return 0; + return 0; if (direction > 0) { - if (Py_UNICODE_MATCH(self, end, substring)) - return 1; + if (Py_UNICODE_MATCH(self, end, substring)) + return 1; } else { if (Py_UNICODE_MATCH(self, start, substring)) - return 1; + return 1; } return 0; } Py_ssize_t PyUnicode_Tailmatch(PyObject *str, - PyObject *substr, - Py_ssize_t start, - Py_ssize_t end, - int direction) + PyObject *substr, + Py_ssize_t start, + Py_ssize_t end, + int direction) { Py_ssize_t result; str = PyUnicode_FromObject(str); if (str == NULL) - return -1; + return -1; substr = PyUnicode_FromObject(substr); if (substr == NULL) { - Py_DECREF(str); - return -1; + Py_DECREF(str); + return -1; } result = tailmatch((PyUnicodeObject *)str, - (PyUnicodeObject *)substr, - start, end, direction); + (PyUnicodeObject *)substr, + start, end, direction); Py_DECREF(str); Py_DECREF(substr); return result; @@ -5709,24 +5709,24 @@ static PyObject *fixup(PyUnicodeObject *self, - int (*fixfct)(PyUnicodeObject *s)) + int (*fixfct)(PyUnicodeObject *s)) { PyUnicodeObject *u; u = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, self->length); if (u == NULL) - return NULL; + return NULL; Py_UNICODE_COPY(u->str, self->str, self->length); if (!fixfct(u) && PyUnicode_CheckExact(self)) { - /* fixfct should return TRUE if it modified the buffer. If - FALSE, return a reference to the original buffer instead - (to save space, not time) */ - Py_INCREF(self); - Py_DECREF(u); - return (PyObject*) self; + /* fixfct should return TRUE if it modified the buffer. If + FALSE, return a reference to the original buffer instead + (to save space, not time) */ + Py_INCREF(self); + Py_DECREF(u); + return (PyObject*) self; } return (PyObject*) u; } @@ -5739,13 +5739,13 @@ int status = 0; while (len-- > 0) { - register Py_UNICODE ch; + register Py_UNICODE ch; - ch = Py_UNICODE_TOUPPER(*s); - if (ch != *s) { + ch = Py_UNICODE_TOUPPER(*s); + if (ch != *s) { status = 1; - *s = ch; - } + *s = ch; + } s++; } @@ -5760,13 +5760,13 @@ int status = 0; while (len-- > 0) { - register Py_UNICODE ch; + register Py_UNICODE ch; - ch = Py_UNICODE_TOLOWER(*s); - if (ch != *s) { + ch = Py_UNICODE_TOLOWER(*s); + if (ch != *s) { status = 1; - *s = ch; - } + *s = ch; + } s++; } @@ -5802,10 +5802,10 @@ int status = 0; if (len == 0) - return 0; + return 0; if (Py_UNICODE_ISLOWER(*s)) { - *s = Py_UNICODE_TOUPPER(*s); - status = 1; + *s = Py_UNICODE_TOUPPER(*s); + status = 1; } s++; while (--len > 0) { @@ -5827,31 +5827,31 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) { - Py_UNICODE ch = Py_UNICODE_TOTITLE(*p); - if (*p != ch) { - *p = ch; - return 1; - } - else - return 0; + Py_UNICODE ch = Py_UNICODE_TOTITLE(*p); + if (*p != ch) { + *p = ch; + return 1; + } + else + return 0; } e = p + PyUnicode_GET_SIZE(self); previous_is_cased = 0; for (; p < e; p++) { - register const Py_UNICODE ch = *p; + register const Py_UNICODE ch = *p; - if (previous_is_cased) - *p = Py_UNICODE_TOLOWER(ch); - else - *p = Py_UNICODE_TOTITLE(ch); - - if (Py_UNICODE_ISLOWER(ch) || - Py_UNICODE_ISUPPER(ch) || - Py_UNICODE_ISTITLE(ch)) - previous_is_cased = 1; - else - previous_is_cased = 0; + if (previous_is_cased) + *p = Py_UNICODE_TOLOWER(ch); + else + *p = Py_UNICODE_TOTITLE(ch); + + if (Py_UNICODE_ISLOWER(ch) || + Py_UNICODE_ISUPPER(ch) || + Py_UNICODE_ISTITLE(ch)) + previous_is_cased = 1; + else + previous_is_cased = 0; } return 1; } @@ -5872,7 +5872,7 @@ fseq = PySequence_Fast(seq, ""); if (fseq == NULL) { - return NULL; + return NULL; } /* NOTE: the following code can't call back into Python code, @@ -5882,18 +5882,18 @@ seqlen = PySequence_Fast_GET_SIZE(fseq); /* If empty sequence, return u"". */ if (seqlen == 0) { - res = _PyUnicode_New(0); /* empty sequence; return u"" */ - goto Done; + res = _PyUnicode_New(0); /* empty sequence; return u"" */ + goto Done; } items = PySequence_Fast_ITEMS(fseq); /* If singleton sequence with an exact Unicode, return that. */ if (seqlen == 1) { - item = items[0]; - if (PyUnicode_CheckExact(item)) { - Py_INCREF(item); - res = (PyUnicodeObject *)item; - goto Done; - } + item = items[0]; + if (PyUnicode_CheckExact(item)) { + Py_INCREF(item); + res = (PyUnicodeObject *)item; + goto Done; + } } else { /* Set up sep and seplen */ @@ -5923,19 +5923,19 @@ for (i = 0; i < seqlen; i++) { const Py_ssize_t old_sz = sz; item = items[i]; - if (!PyUnicode_Check(item)) { - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected str instance," - " %.80s found", - i, Py_TYPE(item)->tp_name); - goto onError; - } + if (!PyUnicode_Check(item)) { + PyErr_Format(PyExc_TypeError, + "sequence item %zd: expected str instance," + " %.80s found", + i, Py_TYPE(item)->tp_name); + goto onError; + } sz += PyUnicode_GET_SIZE(item); if (i != 0) sz += seplen; if (sz < old_sz || sz > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "join() result is too long for a Python string"); + "join() result is too long for a Python string"); goto onError; } } @@ -5950,20 +5950,20 @@ Py_ssize_t itemlen; item = items[i]; itemlen = PyUnicode_GET_SIZE(item); - /* Copy item, and maybe the separator. */ - if (i) { - Py_UNICODE_COPY(res_p, sep, seplen); - res_p += seplen; - } - Py_UNICODE_COPY(res_p, PyUnicode_AS_UNICODE(item), itemlen); - res_p += itemlen; + /* Copy item, and maybe the separator. */ + if (i) { + Py_UNICODE_COPY(res_p, sep, seplen); + res_p += seplen; + } + Py_UNICODE_COPY(res_p, PyUnicode_AS_UNICODE(item), itemlen); + res_p += itemlen; } - Done: + Done: Py_DECREF(fseq); return (PyObject *)res; - onError: + onError: Py_DECREF(fseq); Py_XDECREF(res); return NULL; @@ -5971,9 +5971,9 @@ static PyUnicodeObject *pad(PyUnicodeObject *self, - Py_ssize_t left, - Py_ssize_t right, - Py_UNICODE fill) + Py_ssize_t left, + Py_ssize_t right, + Py_UNICODE fill) { PyUnicodeObject *u; @@ -6004,21 +6004,21 @@ return u; } -#define SPLIT_APPEND(data, left, right) \ - str = PyUnicode_FromUnicode((data) + (left), (right) - (left)); \ - if (!str) \ - goto onError; \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); +#define SPLIT_APPEND(data, left, right) \ + str = PyUnicode_FromUnicode((data) + (left), (right) - (left)); \ + if (!str) \ + goto onError; \ + if (PyList_Append(list, str)) { \ + Py_DECREF(str); \ + goto onError; \ + } \ + else \ + Py_DECREF(str); static PyObject *split_whitespace(PyUnicodeObject *self, - PyObject *list, - Py_ssize_t maxcount) + PyObject *list, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6027,33 +6027,33 @@ register const Py_UNICODE *buf = self->str; for (i = j = 0; i < len; ) { - /* find a token */ - while (i < len && Py_UNICODE_ISSPACE(buf[i])) - i++; - j = i; - while (i < len && !Py_UNICODE_ISSPACE(buf[i])) - i++; - if (j < i) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(buf, j, i); - while (i < len && Py_UNICODE_ISSPACE(buf[i])) - i++; - j = i; - } + /* find a token */ + while (i < len && Py_UNICODE_ISSPACE(buf[i])) + i++; + j = i; + while (i < len && !Py_UNICODE_ISSPACE(buf[i])) + i++; + if (j < i) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(buf, j, i); + while (i < len && Py_UNICODE_ISSPACE(buf[i])) + i++; + j = i; + } } if (j < len) { - SPLIT_APPEND(buf, j, len); + SPLIT_APPEND(buf, j, len); } return list; - onError: + onError: Py_DECREF(list); return NULL; } PyObject *PyUnicode_Splitlines(PyObject *string, - int keepends) + int keepends) { register Py_ssize_t i; register Py_ssize_t j; @@ -6064,7 +6064,7 @@ string = PyUnicode_FromObject(string); if (string == NULL) - return NULL; + return NULL; data = PyUnicode_AS_UNICODE(string); len = PyUnicode_GET_SIZE(string); @@ -6073,34 +6073,34 @@ goto onError; for (i = j = 0; i < len; ) { - Py_ssize_t eol; + Py_ssize_t eol; - /* Find a line and append it */ - while (i < len && !BLOOM_LINEBREAK(data[i])) - i++; - - /* Skip the line break reading CRLF as one line break */ - eol = i; - if (i < len) { - if (data[i] == '\r' && i + 1 < len && - data[i+1] == '\n') - i += 2; - else - i++; - if (keepends) - eol = i; - } - SPLIT_APPEND(data, j, eol); - j = i; + /* Find a line and append it */ + while (i < len && !BLOOM_LINEBREAK(data[i])) + i++; + + /* Skip the line break reading CRLF as one line break */ + eol = i; + if (i < len) { + if (data[i] == '\r' && i + 1 < len && + data[i+1] == '\n') + i += 2; + else + i++; + if (keepends) + eol = i; + } + SPLIT_APPEND(data, j, eol); + j = i; } if (j < len) { - SPLIT_APPEND(data, j, len); + SPLIT_APPEND(data, j, len); } Py_DECREF(string); return list; - onError: + onError: Py_XDECREF(list); Py_DECREF(string); return NULL; @@ -6108,9 +6108,9 @@ static PyObject *split_char(PyUnicodeObject *self, - PyObject *list, - Py_UNICODE ch, - Py_ssize_t maxcount) + PyObject *list, + Py_UNICODE ch, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6119,29 +6119,29 @@ register const Py_UNICODE *buf = self->str; for (i = j = 0; i < len; ) { - if (buf[i] == ch) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(buf, j, i); - i = j = i + 1; - } else - i++; + if (buf[i] == ch) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(buf, j, i); + i = j = i + 1; + } else + i++; } if (j <= len) { - SPLIT_APPEND(buf, j, len); + SPLIT_APPEND(buf, j, len); } return list; - onError: + onError: Py_DECREF(list); return NULL; } static PyObject *split_substring(PyUnicodeObject *self, - PyObject *list, - PyUnicodeObject *substring, - Py_ssize_t maxcount) + PyObject *list, + PyUnicodeObject *substring, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6150,28 +6150,28 @@ PyObject *str; for (i = j = 0; i <= len - sublen; ) { - if (Py_UNICODE_MATCH(self, i, substring)) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(self->str, j, i); - i = j = i + sublen; - } else - i++; + if (Py_UNICODE_MATCH(self, i, substring)) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(self->str, j, i); + i = j = i + sublen; + } else + i++; } if (j <= len) { - SPLIT_APPEND(self->str, j, len); + SPLIT_APPEND(self->str, j, len); } return list; - onError: + onError: Py_DECREF(list); return NULL; } static PyObject *rsplit_whitespace(PyUnicodeObject *self, - PyObject *list, - Py_ssize_t maxcount) + PyObject *list, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6180,38 +6180,38 @@ register const Py_UNICODE *buf = self->str; for (i = j = len - 1; i >= 0; ) { - /* find a token */ - while (i >= 0 && Py_UNICODE_ISSPACE(buf[i])) - i--; - j = i; - while (i >= 0 && !Py_UNICODE_ISSPACE(buf[i])) - i--; - if (j > i) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(buf, i + 1, j + 1); - while (i >= 0 && Py_UNICODE_ISSPACE(buf[i])) - i--; - j = i; - } + /* find a token */ + while (i >= 0 && Py_UNICODE_ISSPACE(buf[i])) + i--; + j = i; + while (i >= 0 && !Py_UNICODE_ISSPACE(buf[i])) + i--; + if (j > i) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(buf, i + 1, j + 1); + while (i >= 0 && Py_UNICODE_ISSPACE(buf[i])) + i--; + j = i; + } } if (j >= 0) { - SPLIT_APPEND(buf, 0, j + 1); + SPLIT_APPEND(buf, 0, j + 1); } if (PyList_Reverse(list) < 0) goto onError; return list; - onError: + onError: Py_DECREF(list); return NULL; } -static +static PyObject *rsplit_char(PyUnicodeObject *self, - PyObject *list, - Py_UNICODE ch, - Py_ssize_t maxcount) + PyObject *list, + Py_UNICODE ch, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6220,31 +6220,31 @@ register const Py_UNICODE *buf = self->str; for (i = j = len - 1; i >= 0; ) { - if (buf[i] == ch) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(buf, i + 1, j + 1); - j = i = i - 1; - } else - i--; + if (buf[i] == ch) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(buf, i + 1, j + 1); + j = i = i - 1; + } else + i--; } if (j >= -1) { - SPLIT_APPEND(buf, 0, j + 1); + SPLIT_APPEND(buf, 0, j + 1); } if (PyList_Reverse(list) < 0) goto onError; return list; - onError: + onError: Py_DECREF(list); return NULL; } -static +static PyObject *rsplit_substring(PyUnicodeObject *self, - PyObject *list, - PyUnicodeObject *substring, - Py_ssize_t maxcount) + PyObject *list, + PyUnicodeObject *substring, + Py_ssize_t maxcount) { register Py_ssize_t i; register Py_ssize_t j; @@ -6253,23 +6253,23 @@ PyObject *str; for (i = len - sublen, j = len; i >= 0; ) { - if (Py_UNICODE_MATCH(self, i, substring)) { - if (maxcount-- <= 0) - break; - SPLIT_APPEND(self->str, i + sublen, j); - j = i; - i -= sublen; - } else - i--; + if (Py_UNICODE_MATCH(self, i, substring)) { + if (maxcount-- <= 0) + break; + SPLIT_APPEND(self->str, i + sublen, j); + j = i; + i -= sublen; + } else + i--; } if (j >= 0) { - SPLIT_APPEND(self->str, 0, j); + SPLIT_APPEND(self->str, 0, j); } if (PyList_Reverse(list) < 0) goto onError; return list; - onError: + onError: Py_DECREF(list); return NULL; } @@ -6278,8 +6278,8 @@ static PyObject *split(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t maxcount) + PyUnicodeObject *substring, + Py_ssize_t maxcount) { PyObject *list; @@ -6291,24 +6291,24 @@ return NULL; if (substring == NULL) - return split_whitespace(self,list,maxcount); + return split_whitespace(self,list,maxcount); else if (substring->length == 1) - return split_char(self,list,substring->str[0],maxcount); + return split_char(self,list,substring->str[0],maxcount); else if (substring->length == 0) { - Py_DECREF(list); - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; + Py_DECREF(list); + PyErr_SetString(PyExc_ValueError, "empty separator"); + return NULL; } else - return split_substring(self,list,substring,maxcount); + return split_substring(self,list,substring,maxcount); } static PyObject *rsplit(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t maxcount) + PyUnicodeObject *substring, + Py_ssize_t maxcount) { PyObject *list; @@ -6320,30 +6320,30 @@ return NULL; if (substring == NULL) - return rsplit_whitespace(self,list,maxcount); + return rsplit_whitespace(self,list,maxcount); else if (substring->length == 1) - return rsplit_char(self,list,substring->str[0],maxcount); + return rsplit_char(self,list,substring->str[0],maxcount); else if (substring->length == 0) { - Py_DECREF(list); - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; + Py_DECREF(list); + PyErr_SetString(PyExc_ValueError, "empty separator"); + return NULL; } else - return rsplit_substring(self,list,substring,maxcount); + return rsplit_substring(self,list,substring,maxcount); } static PyObject *replace(PyUnicodeObject *self, - PyUnicodeObject *str1, - PyUnicodeObject *str2, - Py_ssize_t maxcount) + PyUnicodeObject *str1, + PyUnicodeObject *str2, + Py_ssize_t maxcount) { PyUnicodeObject *u; if (maxcount < 0) - maxcount = PY_SSIZE_T_MAX; + maxcount = PY_SSIZE_T_MAX; if (str1->length == str2->length) { /* same length */ @@ -6429,7 +6429,7 @@ break; j++; } - if (j > i) { + if (j > i) { if (j > e) break; /* copy unchanged part [i:j] */ @@ -6460,7 +6460,7 @@ } return (PyObject *) u; -nothing: + nothing: /* nothing to replace; return original string (when possible) */ if (PyUnicode_CheckExact(self)) { Py_INCREF(self); @@ -6472,7 +6472,7 @@ /* --- Unicode Object Methods --------------------------------------------- */ PyDoc_STRVAR(title__doc__, -"S.title() -> str\n\ + "S.title() -> str\n\ \n\ Return a titlecased version of S, i.e. words start with title case\n\ characters, all remaining cased characters have lower case."); @@ -6484,7 +6484,7 @@ } PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> str\n\ + "S.capitalize() -> str\n\ \n\ Return a capitalized version of S, i.e. make the first character\n\ have upper case."); @@ -6497,7 +6497,7 @@ #if 0 PyDoc_STRVAR(capwords__doc__, -"S.capwords() -> str\n\ + "S.capwords() -> str\n\ \n\ Apply .capitalize() to all words in S and return the result with\n\ normalized whitespace (all whitespace strings are replaced by ' ')."); @@ -6517,7 +6517,7 @@ /* Capitalize each word */ for (i = 0; i < PyList_GET_SIZE(list); i++) { item = fixup((PyUnicodeObject *)PyList_GET_ITEM(list, i), - fixcapitalize); + fixcapitalize); if (item == NULL) goto onError; Py_DECREF(PyList_GET_ITEM(list, i)); @@ -6527,7 +6527,7 @@ /* Join the words to form a new string */ item = PyUnicode_Join(NULL, list); -onError: + onError: Py_DECREF(list); return (PyObject *)item; } @@ -6538,30 +6538,30 @@ static int convert_uc(PyObject *obj, void *addr) { - Py_UNICODE *fillcharloc = (Py_UNICODE *)addr; - PyObject *uniobj; - Py_UNICODE *unistr; - - uniobj = PyUnicode_FromObject(obj); - if (uniobj == NULL) { - PyErr_SetString(PyExc_TypeError, - "The fill character cannot be converted to Unicode"); - return 0; - } - if (PyUnicode_GET_SIZE(uniobj) != 1) { - PyErr_SetString(PyExc_TypeError, - "The fill character must be exactly one character long"); - Py_DECREF(uniobj); - return 0; - } - unistr = PyUnicode_AS_UNICODE(uniobj); - *fillcharloc = unistr[0]; - Py_DECREF(uniobj); - return 1; + Py_UNICODE *fillcharloc = (Py_UNICODE *)addr; + PyObject *uniobj; + Py_UNICODE *unistr; + + uniobj = PyUnicode_FromObject(obj); + if (uniobj == NULL) { + PyErr_SetString(PyExc_TypeError, + "The fill character cannot be converted to Unicode"); + return 0; + } + if (PyUnicode_GET_SIZE(uniobj) != 1) { + PyErr_SetString(PyExc_TypeError, + "The fill character must be exactly one character long"); + Py_DECREF(uniobj); + return 0; + } + unistr = PyUnicode_AS_UNICODE(uniobj); + *fillcharloc = unistr[0]; + Py_DECREF(uniobj); + return 1; } PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> str\n\ + "S.center(width[, fillchar]) -> str\n\ \n\ Return S centered in a string of length width. Padding is\n\ done using the specified fill character (default is a space)"); @@ -6622,9 +6622,9 @@ c1 = *s1++; c2 = *s2++; - if (c1 > (1<<11) * 26) - c1 += utf16Fixup[c1>>11]; - if (c2 > (1<<11) * 26) + if (c1 > (1<<11) * 26) + c1 += utf16Fixup[c1>>11]; + if (c2 > (1<<11) * 26) c2 += utf16Fixup[c2>>11]; /* now c1 and c2 are in UTF-32-compatible order */ @@ -6668,7 +6668,7 @@ #endif int PyUnicode_Compare(PyObject *left, - PyObject *right) + PyObject *right) { if (PyUnicode_Check(left) && PyUnicode_Check(right)) return unicode_compare((PyUnicodeObject *)left, @@ -6689,25 +6689,25 @@ id = PyUnicode_AS_UNICODE(uni); /* Compare Unicode string and source character set string */ for (i = 0; id[i] && str[i]; i++) - if (id[i] != str[i]) - return ((int)id[i] < (int)str[i]) ? -1 : 1; + if (id[i] != str[i]) + return ((int)id[i] < (int)str[i]) ? -1 : 1; if (id[i]) - return 1; /* uni is longer */ + return 1; /* uni is longer */ if (str[i]) - return -1; /* str is longer */ + return -1; /* str is longer */ return 0; } -#define TEST_COND(cond) \ - ((cond) ? Py_True : Py_False) +#define TEST_COND(cond) \ + ((cond) ? Py_True : Py_False) PyObject *PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) { int result; - + if (PyUnicode_Check(left) && PyUnicode_Check(right)) { PyObject *v; if (((PyUnicodeObject *) left)->length != @@ -6726,7 +6726,7 @@ else result = unicode_compare((PyUnicodeObject *)left, (PyUnicodeObject *)right); - + /* Convert the return value to a Boolean */ switch (op) { case Py_EQ: @@ -6754,13 +6754,13 @@ Py_INCREF(v); return v; } - + Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } int PyUnicode_Contains(PyObject *container, - PyObject *element) + PyObject *element) { PyObject *str, *sub; int result; @@ -6768,9 +6768,9 @@ /* Coerce the two arguments */ sub = PyUnicode_FromObject(element); if (!sub) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, not %s", - element->ob_type->tp_name); + PyErr_Format(PyExc_TypeError, + "'in ' requires string as left operand, not %s", + element->ob_type->tp_name); return -1; } @@ -6791,32 +6791,32 @@ /* Concat to string or Unicode object giving a new Unicode object. */ PyObject *PyUnicode_Concat(PyObject *left, - PyObject *right) + PyObject *right) { PyUnicodeObject *u = NULL, *v = NULL, *w; /* Coerce the two arguments */ u = (PyUnicodeObject *)PyUnicode_FromObject(left); if (u == NULL) - goto onError; + goto onError; v = (PyUnicodeObject *)PyUnicode_FromObject(right); if (v == NULL) - goto onError; + goto onError; /* Shortcuts */ if (v == unicode_empty) { - Py_DECREF(v); - return (PyObject *)u; + Py_DECREF(v); + return (PyObject *)u; } if (u == unicode_empty) { - Py_DECREF(u); - return (PyObject *)v; + Py_DECREF(u); + return (PyObject *)v; } /* Concat the two Unicode strings */ w = _PyUnicode_New(u->length + v->length); if (w == NULL) - goto onError; + goto onError; Py_UNICODE_COPY(w->str, u->str, u->length); Py_UNICODE_COPY(w->str + u->length, v->str, v->length); @@ -6824,7 +6824,7 @@ Py_DECREF(v); return (PyObject *)w; -onError: + onError: Py_XDECREF(u); Py_XDECREF(v); return NULL; @@ -6833,28 +6833,28 @@ void PyUnicode_Append(PyObject **pleft, PyObject *right) { - PyObject *new; - if (*pleft == NULL) - return; - if (right == NULL || !PyUnicode_Check(*pleft)) { - Py_DECREF(*pleft); - *pleft = NULL; - return; - } - new = PyUnicode_Concat(*pleft, right); - Py_DECREF(*pleft); - *pleft = new; + PyObject *new; + if (*pleft == NULL) + return; + if (right == NULL || !PyUnicode_Check(*pleft)) { + Py_DECREF(*pleft); + *pleft = NULL; + return; + } + new = PyUnicode_Concat(*pleft, right); + Py_DECREF(*pleft); + *pleft = new; } void PyUnicode_AppendAndDel(PyObject **pleft, PyObject *right) { - PyUnicode_Append(pleft, right); - Py_XDECREF(right); + PyUnicode_Append(pleft, right); + Py_XDECREF(right); } PyDoc_STRVAR(count__doc__, -"S.count(sub[, start[, end]]) -> int\n\ + "S.count(sub[, start[, end]]) -> int\n\ \n\ Return the number of non-overlapping occurrences of substring sub in\n\ string S[start:end]. Optional arguments start and end are\n\ @@ -6869,13 +6869,13 @@ PyObject *result; if (!PyArg_ParseTuple(args, "O|O&O&:count", &substring, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) + _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) return NULL; substring = (PyUnicodeObject *)PyUnicode_FromObject( (PyObject *)substring); if (substring == NULL) - return NULL; + return NULL; FIX_START_END(self); @@ -6890,7 +6890,7 @@ } PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[, errors]]) -> bytes\n\ + "S.encode([encoding[, errors]]) -> bytes\n\ \n\ Encode S using the codec registered for encoding. encoding defaults\n\ to the default encoding. errors may be given to set a different error\n\ @@ -6921,12 +6921,12 @@ } return v; - onError: + onError: return NULL; } PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> str\n\ + "S.expandtabs([tabsize]) -> str\n\ \n\ Return a copy of S where all tab characters are expanded using spaces.\n\ If tabsize is not given, a tab size of 8 characters is assumed."); @@ -6943,7 +6943,7 @@ int tabsize = 8; if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; + return NULL; /* First pass: determine size of output string */ i = 0; /* chars up to and including most recent \n or \r */ @@ -6951,27 +6951,27 @@ e = self->str + self->length; /* end of input */ for (p = self->str; p < e; p++) if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); /* cannot overflow */ - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; + if (tabsize > 0) { + incr = tabsize - (j % tabsize); /* cannot overflow */ + if (j > PY_SSIZE_T_MAX - incr) + goto overflow1; + j += incr; } - } + } else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; + if (j > PY_SSIZE_T_MAX - 1) + goto overflow1; j++; if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; + if (i > PY_SSIZE_T_MAX - j) + goto overflow1; i += j; j = 0; } } if (i > PY_SSIZE_T_MAX - j) - goto overflow1; + goto overflow1; /* Second pass: create output string and fill it */ u = _PyUnicode_New(i + j); @@ -6984,20 +6984,20 @@ for (p = self->str; p < e; p++) if (*p == '\t') { - if (tabsize > 0) { - i = tabsize - (j % tabsize); - j += i; - while (i--) { - if (q >= qe) - goto overflow2; - *q++ = ' '; - } - } - } - else { - if (q >= qe) - goto overflow2; - *q++ = *p; + if (tabsize > 0) { + i = tabsize - (j % tabsize); + j += i; + while (i--) { + if (q >= qe) + goto overflow2; + *q++ = ' '; + } + } + } + else { + if (q >= qe) + goto overflow2; + *q++ = *p; j++; if (*p == '\n' || *p == '\r') j = 0; @@ -7013,7 +7013,7 @@ } PyDoc_STRVAR(find__doc__, -"S.find(sub[, start[, end]]) -> int\n\ + "S.find(sub[, start[, end]]) -> int\n\ \n\ Return the lowest index in S where substring sub is found,\n\ such that sub is contained within s[start:end]. Optional\n\ @@ -7078,7 +7078,7 @@ } PyDoc_STRVAR(index__doc__, -"S.index(sub[, start[, end]]) -> int\n\ + "S.index(sub[, start[, end]]) -> int\n\ \n\ Like S.find() but raise ValueError when the substring is not found."); @@ -7110,7 +7110,7 @@ } PyDoc_STRVAR(islower__doc__, -"S.islower() -> bool\n\ + "S.islower() -> bool\n\ \n\ Return True if all cased characters in S are lowercase and there is\n\ at least one cased character in S, False otherwise."); @@ -7124,27 +7124,27 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong(Py_UNICODE_ISLOWER(*p)); + return PyBool_FromLong(Py_UNICODE_ISLOWER(*p)); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); cased = 0; for (; p < e; p++) { - register const Py_UNICODE ch = *p; + register const Py_UNICODE ch = *p; - if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) - return PyBool_FromLong(0); - else if (!cased && Py_UNICODE_ISLOWER(ch)) - cased = 1; + if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) + return PyBool_FromLong(0); + else if (!cased && Py_UNICODE_ISLOWER(ch)) + cased = 1; } return PyBool_FromLong(cased); } PyDoc_STRVAR(isupper__doc__, -"S.isupper() -> bool\n\ + "S.isupper() -> bool\n\ \n\ Return True if all cased characters in S are uppercase and there is\n\ at least one cased character in S, False otherwise."); @@ -7158,27 +7158,27 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0); + return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); cased = 0; for (; p < e; p++) { - register const Py_UNICODE ch = *p; + register const Py_UNICODE ch = *p; - if (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISTITLE(ch)) - return PyBool_FromLong(0); - else if (!cased && Py_UNICODE_ISUPPER(ch)) - cased = 1; + if (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISTITLE(ch)) + return PyBool_FromLong(0); + else if (!cased && Py_UNICODE_ISUPPER(ch)) + cased = 1; } return PyBool_FromLong(cased); } PyDoc_STRVAR(istitle__doc__, -"S.istitle() -> bool\n\ + "S.istitle() -> bool\n\ \n\ Return True if S is a titlecased string and there is at least one\n\ character in S, i.e. upper- and titlecase characters may only\n\ @@ -7194,39 +7194,39 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong((Py_UNICODE_ISTITLE(*p) != 0) || - (Py_UNICODE_ISUPPER(*p) != 0)); + return PyBool_FromLong((Py_UNICODE_ISTITLE(*p) != 0) || + (Py_UNICODE_ISUPPER(*p) != 0)); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); cased = 0; previous_is_cased = 0; for (; p < e; p++) { - register const Py_UNICODE ch = *p; + register const Py_UNICODE ch = *p; - if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (Py_UNICODE_ISLOWER(ch)) { - if (!previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else - previous_is_cased = 0; + if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) { + if (previous_is_cased) + return PyBool_FromLong(0); + previous_is_cased = 1; + cased = 1; + } + else if (Py_UNICODE_ISLOWER(ch)) { + if (!previous_is_cased) + return PyBool_FromLong(0); + previous_is_cased = 1; + cased = 1; + } + else + previous_is_cased = 0; } return PyBool_FromLong(cased); } PyDoc_STRVAR(isspace__doc__, -"S.isspace() -> bool\n\ + "S.isspace() -> bool\n\ \n\ Return True if all characters in S are whitespace\n\ and there is at least one character in S, False otherwise."); @@ -7239,23 +7239,23 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISSPACE(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISSPACE(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISSPACE(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISSPACE(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } PyDoc_STRVAR(isalpha__doc__, -"S.isalpha() -> bool\n\ + "S.isalpha() -> bool\n\ \n\ Return True if all characters in S are alphabetic\n\ and there is at least one character in S, False otherwise."); @@ -7268,23 +7268,23 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISALPHA(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISALPHA(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISALPHA(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISALPHA(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } PyDoc_STRVAR(isalnum__doc__, -"S.isalnum() -> bool\n\ + "S.isalnum() -> bool\n\ \n\ Return True if all characters in S are alphanumeric\n\ and there is at least one character in S, False otherwise."); @@ -7297,23 +7297,23 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISALNUM(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISALNUM(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISALNUM(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISALNUM(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } PyDoc_STRVAR(isdecimal__doc__, -"S.isdecimal() -> bool\n\ + "S.isdecimal() -> bool\n\ \n\ Return True if there are only decimal characters in S,\n\ False otherwise."); @@ -7326,23 +7326,23 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISDECIMAL(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISDECIMAL(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISDECIMAL(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISDECIMAL(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } PyDoc_STRVAR(isdigit__doc__, -"S.isdigit() -> bool\n\ + "S.isdigit() -> bool\n\ \n\ Return True if all characters in S are digits\n\ and there is at least one character in S, False otherwise."); @@ -7355,23 +7355,23 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISDIGIT(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISDIGIT(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISDIGIT(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISDIGIT(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } PyDoc_STRVAR(isnumeric__doc__, -"S.isnumeric() -> bool\n\ + "S.isnumeric() -> bool\n\ \n\ Return True if there are only numeric characters in S,\n\ False otherwise."); @@ -7384,17 +7384,17 @@ /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISNUMERIC(*p)) - return PyBool_FromLong(1); + Py_UNICODE_ISNUMERIC(*p)) + return PyBool_FromLong(1); /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); + return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { - if (!Py_UNICODE_ISNUMERIC(*p)) - return PyBool_FromLong(0); + if (!Py_UNICODE_ISNUMERIC(*p)) + return PyBool_FromLong(0); } return PyBool_FromLong(1); } @@ -7407,12 +7407,12 @@ /* Special case for empty strings */ if (PyUnicode_GET_SIZE(self) == 0) - return 0; + return 0; /* PEP 3131 says that the first character must be in XID_Start and subsequent characters in XID_Continue, and for the ASCII range, the 2.x rules apply (i.e - start with letters and underscore, continue with + start with letters and underscore, continue with letters, digits, underscore). However, given the current definition of XID_Start and XID_Continue, it is sufficient to check just for these, except that _ must be allowed @@ -7422,14 +7422,14 @@ e = p + PyUnicode_GET_SIZE(self); for (p++; p < e; p++) { - if (!_PyUnicode_IsXidContinue(*p)) - return 0; + if (!_PyUnicode_IsXidContinue(*p)) + return 0; } return 1; } PyDoc_STRVAR(isidentifier__doc__, -"S.isidentifier() -> bool\n\ + "S.isidentifier() -> bool\n\ \n\ Return True if S is a valid identifier according\n\ to the language definition."); @@ -7441,7 +7441,7 @@ } PyDoc_STRVAR(isprintable__doc__, -"S.isprintable() -> bool\n\ + "S.isprintable() -> bool\n\ \n\ Return True if all characters in S are considered\n\ printable in repr() or S is empty, False otherwise."); @@ -7467,7 +7467,7 @@ } PyDoc_STRVAR(join__doc__, -"S.join(sequence) -> str\n\ + "S.join(sequence) -> str\n\ \n\ Return a string which is the concatenation of the strings in the\n\ sequence. The separator between elements is S."); @@ -7485,7 +7485,7 @@ } PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> str\n\ + "S.ljust(width[, fillchar]) -> str\n\ \n\ Return S left-justified in a Unicode string of length width. Padding is\n\ done using the specified fill character (default is a space)."); @@ -7508,7 +7508,7 @@ } PyDoc_STRVAR(lower__doc__, -"S.lower() -> str\n\ + "S.lower() -> str\n\ \n\ Return a copy of the string S converted to lowercase."); @@ -7531,93 +7531,93 @@ PyObject * _PyUnicode_XStrip(PyUnicodeObject *self, int striptype, PyObject *sepobj) { - Py_UNICODE *s = PyUnicode_AS_UNICODE(self); - Py_ssize_t len = PyUnicode_GET_SIZE(self); - Py_UNICODE *sep = PyUnicode_AS_UNICODE(sepobj); - Py_ssize_t seplen = PyUnicode_GET_SIZE(sepobj); - Py_ssize_t i, j; - - BLOOM_MASK sepmask = make_bloom_mask(sep, seplen); - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && BLOOM_MEMBER(sepmask, s[i], sep, seplen)) { - i++; - } - } + Py_UNICODE *s = PyUnicode_AS_UNICODE(self); + Py_ssize_t len = PyUnicode_GET_SIZE(self); + Py_UNICODE *sep = PyUnicode_AS_UNICODE(sepobj); + Py_ssize_t seplen = PyUnicode_GET_SIZE(sepobj); + Py_ssize_t i, j; - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && BLOOM_MEMBER(sepmask, s[j], sep, seplen)); - j++; - } + BLOOM_MASK sepmask = make_bloom_mask(sep, seplen); - if (i == 0 && j == len && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyUnicode_FromUnicode(s+i, j-i); + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && BLOOM_MEMBER(sepmask, s[i], sep, seplen)) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && BLOOM_MEMBER(sepmask, s[j], sep, seplen)); + j++; + } + + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); } static PyObject * do_strip(PyUnicodeObject *self, int striptype) { - Py_UNICODE *s = PyUnicode_AS_UNICODE(self); - Py_ssize_t len = PyUnicode_GET_SIZE(self), i, j; + Py_UNICODE *s = PyUnicode_AS_UNICODE(self); + Py_ssize_t len = PyUnicode_GET_SIZE(self), i, j; + + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && Py_UNICODE_ISSPACE(s[i])) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && Py_UNICODE_ISSPACE(s[j])); + j++; + } - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && Py_UNICODE_ISSPACE(s[i])) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && Py_UNICODE_ISSPACE(s[j])); - j++; - } - - if (i == 0 && j == len && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyUnicode_FromUnicode(s+i, j-i); + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); } static PyObject * do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args) { - PyObject *sep = NULL; + PyObject *sep = NULL; - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; + if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) + return NULL; - if (sep != NULL && sep != Py_None) { - if (PyUnicode_Check(sep)) - return _PyUnicode_XStrip(self, striptype, sep); - else { - PyErr_Format(PyExc_TypeError, - "%s arg must be None or str", - STRIPNAME(striptype)); - return NULL; - } - } + if (sep != NULL && sep != Py_None) { + if (PyUnicode_Check(sep)) + return _PyUnicode_XStrip(self, striptype, sep); + else { + PyErr_Format(PyExc_TypeError, + "%s arg must be None or str", + STRIPNAME(striptype)); + return NULL; + } + } - return do_strip(self, striptype); + return do_strip(self, striptype); } PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> str\n\ + "S.strip([chars]) -> str\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ @@ -7626,15 +7626,15 @@ static PyObject * unicode_strip(PyUnicodeObject *self, PyObject *args) { - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, BOTHSTRIP); /* Common case */ - else - return do_argstrip(self, BOTHSTRIP, args); + if (PyTuple_GET_SIZE(args) == 0) + return do_strip(self, BOTHSTRIP); /* Common case */ + else + return do_argstrip(self, BOTHSTRIP, args); } PyDoc_STRVAR(lstrip__doc__, -"S.lstrip([chars]) -> str\n\ + "S.lstrip([chars]) -> str\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ If chars is given and not None, remove characters in chars instead."); @@ -7642,15 +7642,15 @@ static PyObject * unicode_lstrip(PyUnicodeObject *self, PyObject *args) { - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, LEFTSTRIP); /* Common case */ - else - return do_argstrip(self, LEFTSTRIP, args); + if (PyTuple_GET_SIZE(args) == 0) + return do_strip(self, LEFTSTRIP); /* Common case */ + else + return do_argstrip(self, LEFTSTRIP, args); } PyDoc_STRVAR(rstrip__doc__, -"S.rstrip([chars]) -> str\n\ + "S.rstrip([chars]) -> str\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ If chars is given and not None, remove characters in chars instead."); @@ -7658,10 +7658,10 @@ static PyObject * unicode_rstrip(PyUnicodeObject *self, PyObject *args) { - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); + if (PyTuple_GET_SIZE(args) == 0) + return do_strip(self, RIGHTSTRIP); /* Common case */ + else + return do_argstrip(self, RIGHTSTRIP, args); } @@ -7706,25 +7706,25 @@ if (str->length == 1 && len > 0) { Py_UNICODE_FILL(p, str->str[0], len); } else { - Py_ssize_t done = 0; /* number of characters copied this far */ - if (done < nchars) { + Py_ssize_t done = 0; /* number of characters copied this far */ + if (done < nchars) { Py_UNICODE_COPY(p, str->str, str->length); done = str->length; - } - while (done < nchars) { + } + while (done < nchars) { Py_ssize_t n = (done <= nchars-done) ? done : nchars-done; Py_UNICODE_COPY(p+done, p, n); done += n; - } + } } return (PyObject*) u; } PyObject *PyUnicode_Replace(PyObject *obj, - PyObject *subobj, - PyObject *replobj, - Py_ssize_t maxcount) + PyObject *subobj, + PyObject *replobj, + Py_ssize_t maxcount) { PyObject *self; PyObject *str1; @@ -7733,22 +7733,22 @@ self = PyUnicode_FromObject(obj); if (self == NULL) - return NULL; + return NULL; str1 = PyUnicode_FromObject(subobj); if (str1 == NULL) { - Py_DECREF(self); - return NULL; + Py_DECREF(self); + return NULL; } str2 = PyUnicode_FromObject(replobj); if (str2 == NULL) { - Py_DECREF(self); - Py_DECREF(str1); - return NULL; + Py_DECREF(self); + Py_DECREF(str1); + return NULL; } result = replace((PyUnicodeObject *)self, - (PyUnicodeObject *)str1, - (PyUnicodeObject *)str2, - maxcount); + (PyUnicodeObject *)str1, + (PyUnicodeObject *)str2, + maxcount); Py_DECREF(self); Py_DECREF(str1); Py_DECREF(str2); @@ -7756,7 +7756,7 @@ } PyDoc_STRVAR(replace__doc__, -"S.replace (old, new[, count]) -> str\n\ + "S.replace (old, new[, count]) -> str\n\ \n\ Return a copy of S with all occurrences of substring\n\ old replaced by new. If the optional argument count is\n\ @@ -7774,11 +7774,11 @@ return NULL; str1 = (PyUnicodeObject *)PyUnicode_FromObject((PyObject *)str1); if (str1 == NULL) - return NULL; + return NULL; str2 = (PyUnicodeObject *)PyUnicode_FromObject((PyObject *)str2); if (str2 == NULL) { - Py_DECREF(str1); - return NULL; + Py_DECREF(str1); + return NULL; } result = replace(self, str1, str2, maxcount); @@ -7815,13 +7815,13 @@ */ repr = PyUnicode_FromUnicode(NULL, - 2 /* quotes */ + 2 /* quotes */ #ifdef Py_UNICODE_WIDE - + 10*size + + 10*size #else - + 6*size + + 6*size #endif - + 1); + + 1); if (repr == NULL) return NULL; @@ -7840,7 +7840,7 @@ continue; } - /* Map special whitespace to '\t', \n', '\r' */ + /* Map special whitespace to '\t', \n', '\r' */ if (ch == '\t') { *p++ = '\\'; *p++ = 't'; @@ -7867,7 +7867,7 @@ *p++ = ch; } - /* Non-ASCII characters */ + /* Non-ASCII characters */ else { Py_UCS4 ucs = ch; @@ -7877,15 +7877,15 @@ if (size > 0) { ch2 = *s; if (ch >= 0xD800 && ch < 0xDC00 && ch2 >= 0xDC00 - && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) - + 0x00010000; - s++; + && ch2 <= 0xDFFF) { + ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + + 0x00010000; + s++; size--; } } #endif - /* Map Unicode whitespace and control characters + /* Map Unicode whitespace and control characters (categories Z* and C* except ASCII space) */ if (!Py_UNICODE_ISPRINTABLE(ucs)) { @@ -7938,7 +7938,7 @@ } PyDoc_STRVAR(rfind__doc__, -"S.rfind(sub[, start[, end]]) -> int\n\ + "S.rfind(sub[, start[, end]]) -> int\n\ \n\ Return the highest index in S where substring sub is found,\n\ such that sub is contained within s[start:end]. Optional\n\ @@ -7955,7 +7955,7 @@ Py_ssize_t result; if (!_ParseTupleFinds(args, &substring, &start, &end)) - return NULL; + return NULL; result = stringlib_rfind_slice( PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), @@ -7969,7 +7969,7 @@ } PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub[, start[, end]]) -> int\n\ + "S.rindex(sub[, start[, end]]) -> int\n\ \n\ Like S.rfind() but raise ValueError when the substring is not found."); @@ -7982,7 +7982,7 @@ Py_ssize_t result; if (!_ParseTupleFinds(args, &substring, &start, &end)) - return NULL; + return NULL; result = stringlib_rfind_slice( PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), @@ -8000,7 +8000,7 @@ } PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> str\n\ + "S.rjust(width[, fillchar]) -> str\n\ \n\ Return S right-justified in a string of length width. Padding is\n\ done using the specified fill character (default is a space)."); @@ -8023,20 +8023,20 @@ } PyObject *PyUnicode_Split(PyObject *s, - PyObject *sep, - Py_ssize_t maxsplit) + PyObject *sep, + Py_ssize_t maxsplit) { PyObject *result; s = PyUnicode_FromObject(s); if (s == NULL) - return NULL; + return NULL; if (sep != NULL) { - sep = PyUnicode_FromObject(sep); - if (sep == NULL) { - Py_DECREF(s); - return NULL; - } + sep = PyUnicode_FromObject(sep); + if (sep == NULL) { + Py_DECREF(s); + return NULL; + } } result = split((PyUnicodeObject *)s, (PyUnicodeObject *)sep, maxsplit); @@ -8047,7 +8047,7 @@ } PyDoc_STRVAR(split__doc__, -"S.split([sep[, maxsplit]]) -> list of strings\n\ + "S.split([sep[, maxsplit]]) -> list of strings\n\ \n\ Return a list of the words in S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ @@ -8065,11 +8065,11 @@ return NULL; if (substring == Py_None) - return split(self, NULL, maxcount); + return split(self, NULL, maxcount); else if (PyUnicode_Check(substring)) - return split(self, (PyUnicodeObject *)substring, maxcount); + return split(self, (PyUnicodeObject *)substring, maxcount); else - return PyUnicode_Split((PyObject *)self, substring, maxcount); + return PyUnicode_Split((PyObject *)self, substring, maxcount); } PyObject * @@ -8081,7 +8081,7 @@ str_obj = PyUnicode_FromObject(str_in); if (!str_obj) - return NULL; + return NULL; sep_obj = PyUnicode_FromObject(sep_in); if (!sep_obj) { Py_DECREF(str_obj); @@ -8109,7 +8109,7 @@ str_obj = PyUnicode_FromObject(str_in); if (!str_obj) - return NULL; + return NULL; sep_obj = PyUnicode_FromObject(sep_in); if (!sep_obj) { Py_DECREF(str_obj); @@ -8128,7 +8128,7 @@ } PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ + "S.partition(sep) -> (head, sep, tail)\n\ \n\ Search for the separator sep in S, and return the part before it,\n\ the separator itself, and the part after it. If the separator is not\n\ @@ -8141,7 +8141,7 @@ } PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (tail, sep, head)\n\ + "S.rpartition(sep) -> (tail, sep, head)\n\ \n\ Search for the separator sep in S, starting at the end of S, and return\n\ the part before it, the separator itself, and the part after it. If the\n\ @@ -8154,20 +8154,20 @@ } PyObject *PyUnicode_RSplit(PyObject *s, - PyObject *sep, - Py_ssize_t maxsplit) + PyObject *sep, + Py_ssize_t maxsplit) { PyObject *result; - + s = PyUnicode_FromObject(s); if (s == NULL) - return NULL; + return NULL; if (sep != NULL) { - sep = PyUnicode_FromObject(sep); - if (sep == NULL) { - Py_DECREF(s); - return NULL; - } + sep = PyUnicode_FromObject(sep); + if (sep == NULL) { + Py_DECREF(s); + return NULL; + } } result = rsplit((PyUnicodeObject *)s, (PyUnicodeObject *)sep, maxsplit); @@ -8178,7 +8178,7 @@ } PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep[, maxsplit]]) -> list of strings\n\ + "S.rsplit([sep[, maxsplit]]) -> list of strings\n\ \n\ Return a list of the words in S, using sep as the\n\ delimiter string, starting at the end of the string and\n\ @@ -8196,15 +8196,15 @@ return NULL; if (substring == Py_None) - return rsplit(self, NULL, maxcount); + return rsplit(self, NULL, maxcount); else if (PyUnicode_Check(substring)) - return rsplit(self, (PyUnicodeObject *)substring, maxcount); + return rsplit(self, (PyUnicodeObject *)substring, maxcount); else - return PyUnicode_RSplit((PyObject *)self, substring, maxcount); + return PyUnicode_RSplit((PyObject *)self, substring, maxcount); } PyDoc_STRVAR(splitlines__doc__, -"S.splitlines([keepends]) -> list of strings\n\ + "S.splitlines([keepends]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ @@ -8234,7 +8234,7 @@ } PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> str\n\ + "S.swapcase() -> str\n\ \n\ Return a copy of S with uppercase characters converted to lowercase\n\ and vice versa."); @@ -8246,7 +8246,7 @@ } PyDoc_STRVAR(maketrans__doc__, -"str.maketrans(x[, y[, z]]) -> dict (static method)\n\ + "str.maketrans(x[, y[, z]]) -> dict (static method)\n\ \n\ Return a translation table usable for str.translate().\n\ If there is only one argument, it must be a dictionary mapping Unicode\n\ @@ -8264,7 +8264,7 @@ PyObject *new = NULL, *key, *value; Py_ssize_t i = 0; int res; - + if (!PyArg_ParseTuple(args, "O|UU:maketrans", &x, &y, &z)) return NULL; new = PyDict_New(); @@ -8349,7 +8349,7 @@ } PyDoc_STRVAR(translate__doc__, -"S.translate(table) -> str\n\ + "S.translate(table) -> str\n\ \n\ Return a copy of the string S, where all characters have been mapped\n\ through the given translation table, which must be a mapping of\n\ @@ -8364,7 +8364,7 @@ } PyDoc_STRVAR(upper__doc__, -"S.upper() -> str\n\ + "S.upper() -> str\n\ \n\ Return a copy of S converted to uppercase."); @@ -8375,7 +8375,7 @@ } PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> str\n\ + "S.zfill(width) -> str\n\ \n\ Pad a numeric string S with zeros on the left, to fill a field\n\ of the specified width. The string S is never truncated."); @@ -8399,7 +8399,7 @@ return PyUnicode_FromUnicode( PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self) - ); + ); } fill = width - self->length; @@ -8427,7 +8427,7 @@ #endif PyDoc_STRVAR(startswith__doc__, -"S.startswith(prefix[, start[, end]]) -> bool\n\ + "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ Return True if S starts with the specified prefix, False otherwise.\n\ With optional start, test S beginning at that position.\n\ @@ -8436,7 +8436,7 @@ static PyObject * unicode_startswith(PyUnicodeObject *self, - PyObject *args) + PyObject *args) { PyObject *subobj; PyUnicodeObject *substring; @@ -8445,13 +8445,13 @@ int result; if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; + _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) + return NULL; if (PyTuple_Check(subobj)) { Py_ssize_t i; for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { substring = (PyUnicodeObject *)PyUnicode_FromObject( - PyTuple_GET_ITEM(subobj, i)); + PyTuple_GET_ITEM(subobj, i)); if (substring == NULL) return NULL; result = tailmatch(self, substring, start, end, -1); @@ -8465,7 +8465,7 @@ } substring = (PyUnicodeObject *)PyUnicode_FromObject(subobj); if (substring == NULL) - return NULL; + return NULL; result = tailmatch(self, substring, start, end, -1); Py_DECREF(substring); return PyBool_FromLong(result); @@ -8473,7 +8473,7 @@ PyDoc_STRVAR(endswith__doc__, -"S.endswith(suffix[, start[, end]]) -> bool\n\ + "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ Return True if S ends with the specified suffix, False otherwise.\n\ With optional start, test S beginning at that position.\n\ @@ -8482,7 +8482,7 @@ static PyObject * unicode_endswith(PyUnicodeObject *self, - PyObject *args) + PyObject *args) { PyObject *subobj; PyUnicodeObject *substring; @@ -8491,15 +8491,15 @@ int result; if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; + _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) + return NULL; if (PyTuple_Check(subobj)) { Py_ssize_t i; for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { substring = (PyUnicodeObject *)PyUnicode_FromObject( - PyTuple_GET_ITEM(subobj, i)); + PyTuple_GET_ITEM(subobj, i)); if (substring == NULL) - return NULL; + return NULL; result = tailmatch(self, substring, start, end, +1); Py_DECREF(substring); if (result) { @@ -8510,7 +8510,7 @@ } substring = (PyUnicodeObject *)PyUnicode_FromObject(subobj); if (substring == NULL) - return NULL; + return NULL; result = tailmatch(self, substring, start, end, +1); Py_DECREF(substring); @@ -8520,7 +8520,7 @@ #include "stringlib/string_format.h" PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> str\n\ + "S.format(*args, **kwargs) -> str\n\ \n\ "); @@ -8538,7 +8538,7 @@ } PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> str\n\ + "S.__format__(format_spec) -> str\n\ \n\ "); @@ -8550,12 +8550,12 @@ } PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in memory, in bytes"); + "S.__sizeof__() -> size of S in memory, in bytes"); static PyObject * unicode_getnewargs(PyUnicodeObject *v) { - return Py_BuildValue("(u#)", v->str, v->length); + return Py_BuildValue("(u#)", v->str, v->length); } @@ -8620,36 +8620,36 @@ {"freelistsize", (PyCFunction) unicode_freelistsize, METH_NOARGS}, #endif - {"__getnewargs__", (PyCFunction)unicode_getnewargs, METH_NOARGS}, + {"__getnewargs__", (PyCFunction)unicode_getnewargs, METH_NOARGS}, {NULL, NULL} }; static PyObject * unicode_mod(PyObject *v, PyObject *w) { - if (!PyUnicode_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyUnicode_Format(v, w); + if (!PyUnicode_Check(v)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + return PyUnicode_Format(v, w); } static PyNumberMethods unicode_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - unicode_mod, /*nb_remainder*/ + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + unicode_mod, /*nb_remainder*/ }; static PySequenceMethods unicode_as_sequence = { - (lenfunc) unicode_length, /* sq_length */ - PyUnicode_Concat, /* sq_concat */ - (ssizeargfunc) unicode_repeat, /* sq_repeat */ - (ssizeargfunc) unicode_getitem, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - PyUnicode_Contains, /* sq_contains */ + (lenfunc) unicode_length, /* sq_length */ + PyUnicode_Concat, /* sq_concat */ + (ssizeargfunc) unicode_repeat, /* sq_repeat */ + (ssizeargfunc) unicode_getitem, /* sq_item */ + 0, /* sq_slice */ + 0, /* sq_ass_item */ + 0, /* sq_ass_slice */ + PyUnicode_Contains, /* sq_contains */ }; static PyObject* @@ -8669,7 +8669,7 @@ PyObject* result; if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + &start, &stop, &step, &slicelength) < 0) { return NULL; } @@ -8685,9 +8685,9 @@ source_buf = PyUnicode_AS_UNICODE((PyObject*)self); result_buf = (Py_UNICODE *)PyObject_MALLOC(slicelength* sizeof(Py_UNICODE)); - - if (result_buf == NULL) - return PyErr_NoMemory(); + + if (result_buf == NULL) + return PyErr_NoMemory(); for (cur = start, i = 0; i < slicelength; cur += step, i++) { result_buf[i] = source_buf[cur]; @@ -8704,9 +8704,9 @@ } static PyMappingMethods unicode_as_mapping = { - (lenfunc)unicode_length, /* mp_length */ - (binaryfunc)unicode_subscript, /* mp_subscript */ - (objobjargproc)0, /* mp_ass_subscript */ + (lenfunc)unicode_length, /* mp_length */ + (binaryfunc)unicode_subscript, /* mp_subscript */ + (objobjargproc)0, /* mp_ass_subscript */ }; @@ -8717,14 +8717,14 @@ { Py_ssize_t argidx = *p_argidx; if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); + (*p_argidx)++; + if (arglen < 0) + return args; + else + return PyTuple_GetItem(args, argidx); } PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); + "not enough arguments for format string"); return NULL; } @@ -8734,7 +8734,7 @@ register Py_ssize_t i; Py_ssize_t len = strlen(charbuffer); for (i = len - 1; i >= 0; i--) - buffer[i] = (Py_UNICODE) charbuffer[i]; + buffer[i] = (Py_UNICODE) charbuffer[i]; return len; } @@ -8749,7 +8749,7 @@ return Py_SAFE_DOWNCAST(result, Py_ssize_t, int); } -#if 0 +#if 0 static int longtounicode(Py_UNICODE *buffer, size_t len, const char *format, long x) { @@ -8767,11 +8767,11 @@ static int formatfloat(Py_UNICODE *buf, - size_t buflen, - int flags, - int prec, - int type, - PyObject *v) + size_t buflen, + int flags, + int prec, + int type, + PyObject *v) { /* fmt = '%#.' + `prec` + `type` worst case length = 3 + 10 (len of INT_MAX) + 1 = 14 (use 20)*/ @@ -8780,64 +8780,64 @@ x = PyFloat_AsDouble(v); if (x == -1.0 && PyErr_Occurred()) - return -1; + return -1; if (prec < 0) - prec = 6; + prec = 6; if (type == 'f' && (fabs(x) / 1e25) >= 1e25) - type = 'g'; + type = 'g'; /* Worst case length calc to ensure no buffer overrun: 'g' formats: - fmt = %#.g - buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp - for any double rep.) - len = 1 + prec + 1 + 2 + 5 = 9 + prec + fmt = %#.g + buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp + for any double rep.) + len = 1 + prec + 1 + 2 + 5 = 9 + prec 'f' formats: - buf = '-' + [0-9]*x + '.' + [0-9]*prec (with x < 50) - len = 1 + 50 + 1 + prec = 52 + prec + buf = '-' + [0-9]*x + '.' + [0-9]*prec (with x < 50) + len = 1 + 50 + 1 + prec = 52 + prec If prec=0 the effective precision is 1 (the leading digit is always given), therefore increase the length by one. */ - if (((type == 'g' || type == 'G') && - buflen <= (size_t)10 + (size_t)prec) || - (type == 'f' && buflen <= (size_t)53 + (size_t)prec)) { - PyErr_SetString(PyExc_OverflowError, - "formatted float is too long (precision too large?)"); - return -1; + if (((type == 'g' || type == 'G') && + buflen <= (size_t)10 + (size_t)prec) || + (type == 'f' && buflen <= (size_t)53 + (size_t)prec)) { + PyErr_SetString(PyExc_OverflowError, + "formatted float is too long (precision too large?)"); + return -1; } PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); + (flags&F_ALT) ? "#" : "", + prec, type); return doubletounicode(buf, buflen, fmt, x); } static PyObject* formatlong(PyObject *val, int flags, int prec, int type) { - char *buf; - int len; - PyObject *str; /* temporary string object. */ - PyObject *result; - - str = _PyBytes_FormatLong(val, flags, prec, type, &buf, &len); - if (!str) - return NULL; - result = PyUnicode_FromStringAndSize(buf, len); - Py_DECREF(str); - return result; + char *buf; + int len; + PyObject *str; /* temporary string object. */ + PyObject *result; + + str = _PyBytes_FormatLong(val, flags, prec, type, &buf, &len); + if (!str) + return NULL; + result = PyUnicode_FromStringAndSize(buf, len); + Py_DECREF(str); + return result; } #if 0 static int formatint(Py_UNICODE *buf, - size_t buflen, - int flags, - int prec, - int type, - PyObject *v) + size_t buflen, + int flags, + int prec, + int type, + PyObject *v) { /* fmt = '%#.' + `prec` + 'l' + `type` * worst case length = 3 + 19 (worst len of INT_MAX on 64-bit machine) @@ -8866,7 +8866,7 @@ */ if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); + "formatted integer is too long (precision too large?)"); return -1; } @@ -8874,7 +8874,7 @@ (type == 'x' || type == 'X' || type == 'o')) { /* When converting under %#o, %#x or %#X, there are a number * of issues that cause pain: - * - for %#o, we want a different base marker than C + * - for %#o, we want a different base marker than C * - when 0 is being converted, the C standard leaves off * the '0x' or '0X', which is inconsistent with other * %#x/%#X conversions and inconsistent with Python's @@ -8915,56 +8915,56 @@ { /* presume that the buffer is at least 3 characters long */ if (PyUnicode_Check(v)) { - if (PyUnicode_GET_SIZE(v) == 1) { - buf[0] = PyUnicode_AS_UNICODE(v)[0]; - buf[1] = '\0'; - return 1; - } + if (PyUnicode_GET_SIZE(v) == 1) { + buf[0] = PyUnicode_AS_UNICODE(v)[0]; + buf[1] = '\0'; + return 1; + } #ifndef Py_UNICODE_WIDE - if (PyUnicode_GET_SIZE(v) == 2) { - /* Decode a valid surrogate pair */ - int c0 = PyUnicode_AS_UNICODE(v)[0]; - int c1 = PyUnicode_AS_UNICODE(v)[1]; - if (0xD800 <= c0 && c0 <= 0xDBFF && - 0xDC00 <= c1 && c1 <= 0xDFFF) { - buf[0] = c0; - buf[1] = c1; - buf[2] = '\0'; - return 2; - } - } + if (PyUnicode_GET_SIZE(v) == 2) { + /* Decode a valid surrogate pair */ + int c0 = PyUnicode_AS_UNICODE(v)[0]; + int c1 = PyUnicode_AS_UNICODE(v)[1]; + if (0xD800 <= c0 && c0 <= 0xDBFF && + 0xDC00 <= c1 && c1 <= 0xDFFF) { + buf[0] = c0; + buf[1] = c1; + buf[2] = '\0'; + return 2; + } + } #endif - goto onError; + goto onError; } else { - /* Integer input truncated to a character */ + /* Integer input truncated to a character */ long x; - x = PyLong_AsLong(v); - if (x == -1 && PyErr_Occurred()) - goto onError; - - if (x < 0 || x > 0x10ffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000)"); - return -1; - } + x = PyLong_AsLong(v); + if (x == -1 && PyErr_Occurred()) + goto onError; + + if (x < 0 || x > 0x10ffff) { + PyErr_SetString(PyExc_OverflowError, + "%c arg not in range(0x110000)"); + return -1; + } #ifndef Py_UNICODE_WIDE - if (x > 0xffff) { - x -= 0x10000; - buf[0] = (Py_UNICODE)(0xD800 | (x >> 10)); - buf[1] = (Py_UNICODE)(0xDC00 | (x & 0x3FF)); - return 2; - } -#endif - buf[0] = (Py_UNICODE) x; - buf[1] = '\0'; - return 1; + if (x > 0xffff) { + x -= 0x10000; + buf[0] = (Py_UNICODE)(0xD800 | (x >> 10)); + buf[1] = (Py_UNICODE)(0xDC00 | (x & 0x3FF)); + return 2; + } +#endif + buf[0] = (Py_UNICODE) x; + buf[1] = '\0'; + return 1; } - onError: + onError: PyErr_SetString(PyExc_TypeError, - "%c requires int or char"); + "%c requires int or char"); return -1; } @@ -8979,7 +8979,7 @@ #define FORMATBUFLEN (size_t)120 PyObject *PyUnicode_Format(PyObject *format, - PyObject *args) + PyObject *args) { Py_UNICODE *fmt, *res; Py_ssize_t fmtcnt, rescnt, reslen, arglen, argidx; @@ -8989,433 +8989,433 @@ PyObject *uformat; if (format == NULL || args == NULL) { - PyErr_BadInternalCall(); - return NULL; + PyErr_BadInternalCall(); + return NULL; } uformat = PyUnicode_FromObject(format); if (uformat == NULL) - return NULL; + return NULL; fmt = PyUnicode_AS_UNICODE(uformat); fmtcnt = PyUnicode_GET_SIZE(uformat); reslen = rescnt = fmtcnt + 100; result = _PyUnicode_New(reslen); if (result == NULL) - goto onError; + goto onError; res = PyUnicode_AS_UNICODE(result); if (PyTuple_Check(args)) { - arglen = PyTuple_Size(args); - argidx = 0; + arglen = PyTuple_Size(args); + argidx = 0; } else { - arglen = -1; - argidx = -2; + arglen = -1; + argidx = -2; } if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && !PyUnicode_Check(args)) - dict = args; + dict = args; while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyUnicode_Resize(&result, reslen) < 0) - goto onError; - res = PyUnicode_AS_UNICODE(result) + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - Py_UNICODE c = '\0'; - Py_UNICODE fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - Py_UNICODE *pbuf; - Py_UNICODE sign; - Py_ssize_t len; - Py_UNICODE formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ - - fmt++; - if (*fmt == '(') { - Py_UNICODE *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto onError; - } - ++fmt; - --fmtcnt; - keystart = fmt; - /* Skip over balanced parentheses */ - while (pcount > 0 && --fmtcnt >= 0) { - if (*fmt == ')') - --pcount; - else if (*fmt == '(') - ++pcount; - fmt++; - } - keylen = fmt - keystart - 1; - if (fmtcnt < 0 || pcount > 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format key"); - goto onError; - } + if (*fmt != '%') { + if (--rescnt < 0) { + rescnt = fmtcnt + 100; + reslen += rescnt; + if (_PyUnicode_Resize(&result, reslen) < 0) + goto onError; + res = PyUnicode_AS_UNICODE(result) + reslen - rescnt; + --rescnt; + } + *res++ = *fmt++; + } + else { + /* Got a format specifier */ + int flags = 0; + Py_ssize_t width = -1; + int prec = -1; + Py_UNICODE c = '\0'; + Py_UNICODE fill; + int isnumok; + PyObject *v = NULL; + PyObject *temp = NULL; + Py_UNICODE *pbuf; + Py_UNICODE sign; + Py_ssize_t len; + Py_UNICODE formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ + + fmt++; + if (*fmt == '(') { + Py_UNICODE *keystart; + Py_ssize_t keylen; + PyObject *key; + int pcount = 1; + + if (dict == NULL) { + PyErr_SetString(PyExc_TypeError, + "format requires a mapping"); + goto onError; + } + ++fmt; + --fmtcnt; + keystart = fmt; + /* Skip over balanced parentheses */ + while (pcount > 0 && --fmtcnt >= 0) { + if (*fmt == ')') + --pcount; + else if (*fmt == '(') + ++pcount; + fmt++; + } + keylen = fmt - keystart - 1; + if (fmtcnt < 0 || pcount > 0) { + PyErr_SetString(PyExc_ValueError, + "incomplete format key"); + goto onError; + } #if 0 - /* keys are converted to strings using UTF-8 and - then looked up since Python uses strings to hold - variables names etc. in its namespaces and we - wouldn't want to break common idioms. */ - key = PyUnicode_EncodeUTF8(keystart, - keylen, - NULL); + /* keys are converted to strings using UTF-8 and + then looked up since Python uses strings to hold + variables names etc. in its namespaces and we + wouldn't want to break common idioms. */ + key = PyUnicode_EncodeUTF8(keystart, + keylen, + NULL); #else - key = PyUnicode_FromUnicode(keystart, keylen); + key = PyUnicode_FromUnicode(keystart, keylen); #endif - if (key == NULL) - goto onError; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto onError; - } - args_owned = 1; - arglen = -1; - argidx = -2; - } - while (--fmtcnt >= 0) { - switch (c = *fmt++) { - case '-': flags |= F_LJUST; continue; - case '+': flags |= F_SIGN; continue; - case ' ': flags |= F_BLANK; continue; - case '#': flags |= F_ALT; continue; - case '0': flags |= F_ZERO; continue; - } - break; - } - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - if (!PyLong_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto onError; - } - width = PyLong_AsLong(v); - if (width == -1 && PyErr_Occurred()) - goto onError; - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= '0' && c <= '9') { - width = c - '0'; - while (--fmtcnt >= 0) { - c = *fmt++; - if (c < '0' || c > '9') - break; - if ((width*10) / 10 != width) { - PyErr_SetString(PyExc_ValueError, - "width too big"); - goto onError; - } - width = width*10 + (c - '0'); - } - } - if (c == '.') { - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - if (!PyLong_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto onError; - } - prec = PyLong_AsLong(v); - if (prec == -1 && PyErr_Occurred()) - goto onError; - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= '0' && c <= '9') { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (c < '0' || c > '9') - break; - if ((prec*10) / 10 != prec) { - PyErr_SetString(PyExc_ValueError, - "prec too big"); - goto onError; - } - prec = prec*10 + (c - '0'); - } - } - } /* prec */ - if (fmtcnt >= 0) { - if (c == 'h' || c == 'l' || c == 'L') { - if (--fmtcnt >= 0) - c = *fmt++; - } - } - if (fmtcnt < 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format"); - goto onError; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - } - sign = 0; - fill = ' '; - switch (c) { - - case '%': - pbuf = formatbuf; - /* presume that buffer length is at least 1 */ - pbuf[0] = '%'; - len = 1; - break; - - case 's': - case 'r': - case 'a': - if (PyUnicode_Check(v) && c == 's') { - temp = v; - Py_INCREF(temp); - } - else { - if (c == 's') - temp = PyObject_Str(v); - else if (c == 'r') - temp = PyObject_Repr(v); - else - temp = PyObject_ASCII(v); - if (temp == NULL) - goto onError; + if (key == NULL) + goto onError; + if (args_owned) { + Py_DECREF(args); + args_owned = 0; + } + args = PyObject_GetItem(dict, key); + Py_DECREF(key); + if (args == NULL) { + goto onError; + } + args_owned = 1; + arglen = -1; + argidx = -2; + } + while (--fmtcnt >= 0) { + switch (c = *fmt++) { + case '-': flags |= F_LJUST; continue; + case '+': flags |= F_SIGN; continue; + case ' ': flags |= F_BLANK; continue; + case '#': flags |= F_ALT; continue; + case '0': flags |= F_ZERO; continue; + } + break; + } + if (c == '*') { + v = getnextarg(args, arglen, &argidx); + if (v == NULL) + goto onError; + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, + "* wants int"); + goto onError; + } + width = PyLong_AsLong(v); + if (width == -1 && PyErr_Occurred()) + goto onError; + if (width < 0) { + flags |= F_LJUST; + width = -width; + } + if (--fmtcnt >= 0) + c = *fmt++; + } + else if (c >= '0' && c <= '9') { + width = c - '0'; + while (--fmtcnt >= 0) { + c = *fmt++; + if (c < '0' || c > '9') + break; + if ((width*10) / 10 != width) { + PyErr_SetString(PyExc_ValueError, + "width too big"); + goto onError; + } + width = width*10 + (c - '0'); + } + } + if (c == '.') { + prec = 0; + if (--fmtcnt >= 0) + c = *fmt++; + if (c == '*') { + v = getnextarg(args, arglen, &argidx); + if (v == NULL) + goto onError; + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, + "* wants int"); + goto onError; + } + prec = PyLong_AsLong(v); + if (prec == -1 && PyErr_Occurred()) + goto onError; + if (prec < 0) + prec = 0; + if (--fmtcnt >= 0) + c = *fmt++; + } + else if (c >= '0' && c <= '9') { + prec = c - '0'; + while (--fmtcnt >= 0) { + c = Py_CHARMASK(*fmt++); + if (c < '0' || c > '9') + break; + if ((prec*10) / 10 != prec) { + PyErr_SetString(PyExc_ValueError, + "prec too big"); + goto onError; + } + prec = prec*10 + (c - '0'); + } + } + } /* prec */ + if (fmtcnt >= 0) { + if (c == 'h' || c == 'l' || c == 'L') { + if (--fmtcnt >= 0) + c = *fmt++; + } + } + if (fmtcnt < 0) { + PyErr_SetString(PyExc_ValueError, + "incomplete format"); + goto onError; + } + if (c != '%') { + v = getnextarg(args, arglen, &argidx); + if (v == NULL) + goto onError; + } + sign = 0; + fill = ' '; + switch (c) { + + case '%': + pbuf = formatbuf; + /* presume that buffer length is at least 1 */ + pbuf[0] = '%'; + len = 1; + break; + + case 's': + case 'r': + case 'a': + if (PyUnicode_Check(v) && c == 's') { + temp = v; + Py_INCREF(temp); + } + else { + if (c == 's') + temp = PyObject_Str(v); + else if (c == 'r') + temp = PyObject_Repr(v); + else + temp = PyObject_ASCII(v); + if (temp == NULL) + goto onError; if (PyUnicode_Check(temp)) /* nothing to do */; - else { - Py_DECREF(temp); - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - goto onError; - } - } - pbuf = PyUnicode_AS_UNICODE(temp); - len = PyUnicode_GET_SIZE(temp); - if (prec >= 0 && len > prec) - len = prec; - break; - - case 'i': - case 'd': - case 'u': - case 'o': - case 'x': - case 'X': - if (c == 'i') - c = 'd'; - isnumok = 0; - if (PyNumber_Check(v)) { - PyObject *iobj=NULL; - - if (PyLong_Check(v)) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyLong_Check(iobj)) { - isnumok = 1; - temp = formatlong(iobj, flags, prec, c); - Py_DECREF(iobj); - if (!temp) - goto onError; - pbuf = PyUnicode_AS_UNICODE(temp); - len = PyUnicode_GET_SIZE(temp); - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", (char)c, Py_TYPE(v)->tp_name); - goto onError; - } - if (flags & F_ZERO) - fill = '0'; - break; - - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - if (c == 'F') - c = 'f'; - pbuf = formatbuf; - len = formatfloat(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), - flags, prec, c, v); - if (len < 0) - goto onError; - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - - case 'c': - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), v); - if (len < 0) - goto onError; - break; - - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - (31<=c && c<=126) ? (char)c : '?', + else { + Py_DECREF(temp); + PyErr_SetString(PyExc_TypeError, + "%s argument has non-string str()"); + goto onError; + } + } + pbuf = PyUnicode_AS_UNICODE(temp); + len = PyUnicode_GET_SIZE(temp); + if (prec >= 0 && len > prec) + len = prec; + break; + + case 'i': + case 'd': + case 'u': + case 'o': + case 'x': + case 'X': + if (c == 'i') + c = 'd'; + isnumok = 0; + if (PyNumber_Check(v)) { + PyObject *iobj=NULL; + + if (PyLong_Check(v)) { + iobj = v; + Py_INCREF(iobj); + } + else { + iobj = PyNumber_Long(v); + } + if (iobj!=NULL) { + if (PyLong_Check(iobj)) { + isnumok = 1; + temp = formatlong(iobj, flags, prec, c); + Py_DECREF(iobj); + if (!temp) + goto onError; + pbuf = PyUnicode_AS_UNICODE(temp); + len = PyUnicode_GET_SIZE(temp); + sign = 1; + } + else { + Py_DECREF(iobj); + } + } + } + if (!isnumok) { + PyErr_Format(PyExc_TypeError, + "%%%c format: a number is required, " + "not %.200s", (char)c, Py_TYPE(v)->tp_name); + goto onError; + } + if (flags & F_ZERO) + fill = '0'; + break; + + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + if (c == 'F') + c = 'f'; + pbuf = formatbuf; + len = formatfloat(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), + flags, prec, c, v); + if (len < 0) + goto onError; + sign = 1; + if (flags & F_ZERO) + fill = '0'; + break; + + case 'c': + pbuf = formatbuf; + len = formatchar(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), v); + if (len < 0) + goto onError; + break; + + default: + PyErr_Format(PyExc_ValueError, + "unsupported format character '%c' (0x%x) " + "at index %zd", + (31<=c && c<=126) ? (char)c : '?', (int)c, - (Py_ssize_t)(fmt - 1 - - PyUnicode_AS_UNICODE(uformat))); - goto onError; - } - if (sign) { - if (*pbuf == '-' || *pbuf == '+') { - sign = *pbuf++; - len--; - } - else if (flags & F_SIGN) - sign = '+'; - else if (flags & F_BLANK) - sign = ' '; - else - sign = 0; - } - if (width < len) - width = len; - if (rescnt - (sign != 0) < width) { - reslen -= rescnt; - rescnt = width + fmtcnt + 100; - reslen += rescnt; - if (reslen < 0) { - Py_XDECREF(temp); - PyErr_NoMemory(); - goto onError; - } - if (_PyUnicode_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - goto onError; - } - res = PyUnicode_AS_UNICODE(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X' || c == 'o')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - if (fill != ' ') { - *res++ = *pbuf++; - *res++ = *pbuf++; - } - rescnt -= 2; - width -= 2; - if (width < 0) - width = 0; - len -= 2; - } - if (width > len && !(flags & F_LJUST)) { - do { - --rescnt; - *res++ = fill; - } while (--width > len); - } - if (fill == ' ') { - if (sign) - *res++ = sign; - if ((flags & F_ALT) && (c == 'x' || c == 'X' || c == 'o')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_UNICODE_COPY(res, pbuf, len); - res += len; - rescnt -= len; - while (--width >= len) { - --rescnt; - *res++ = ' '; - } - if (dict && (argidx < arglen) && c != '%') { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); + (Py_ssize_t)(fmt - 1 - + PyUnicode_AS_UNICODE(uformat))); + goto onError; + } + if (sign) { + if (*pbuf == '-' || *pbuf == '+') { + sign = *pbuf++; + len--; + } + else if (flags & F_SIGN) + sign = '+'; + else if (flags & F_BLANK) + sign = ' '; + else + sign = 0; + } + if (width < len) + width = len; + if (rescnt - (sign != 0) < width) { + reslen -= rescnt; + rescnt = width + fmtcnt + 100; + reslen += rescnt; + if (reslen < 0) { + Py_XDECREF(temp); + PyErr_NoMemory(); + goto onError; + } + if (_PyUnicode_Resize(&result, reslen) < 0) { + Py_XDECREF(temp); + goto onError; + } + res = PyUnicode_AS_UNICODE(result) + + reslen - rescnt; + } + if (sign) { + if (fill != ' ') + *res++ = sign; + rescnt--; + if (width > len) + width--; + } + if ((flags & F_ALT) && (c == 'x' || c == 'X' || c == 'o')) { + assert(pbuf[0] == '0'); + assert(pbuf[1] == c); + if (fill != ' ') { + *res++ = *pbuf++; + *res++ = *pbuf++; + } + rescnt -= 2; + width -= 2; + if (width < 0) + width = 0; + len -= 2; + } + if (width > len && !(flags & F_LJUST)) { + do { + --rescnt; + *res++ = fill; + } while (--width > len); + } + if (fill == ' ') { + if (sign) + *res++ = sign; + if ((flags & F_ALT) && (c == 'x' || c == 'X' || c == 'o')) { + assert(pbuf[0] == '0'); + assert(pbuf[1] == c); + *res++ = *pbuf++; + *res++ = *pbuf++; + } + } + Py_UNICODE_COPY(res, pbuf, len); + res += len; + rescnt -= len; + while (--width >= len) { + --rescnt; + *res++ = ' '; + } + if (dict && (argidx < arglen) && c != '%') { + PyErr_SetString(PyExc_TypeError, + "not all arguments converted during string formatting"); Py_XDECREF(temp); - goto onError; - } - Py_XDECREF(temp); - } /* '%' */ + goto onError; + } + Py_XDECREF(temp); + } /* '%' */ } /* until end */ if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto onError; + PyErr_SetString(PyExc_TypeError, + "not all arguments converted during string formatting"); + goto onError; } if (_PyUnicode_Resize(&result, reslen - rescnt) < 0) - goto onError; + goto onError; if (args_owned) { - Py_DECREF(args); + Py_DECREF(args); } Py_DECREF(uformat); return (PyObject *)result; - onError: + onError: Py_XDECREF(result); Py_DECREF(uformat); if (args_owned) { - Py_DECREF(args); + Py_DECREF(args); } return NULL; } @@ -9426,56 +9426,56 @@ static PyObject * unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyObject *x = NULL; - static char *kwlist[] = {"object", "encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - - if (type != &PyUnicode_Type) - return unicode_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:str", - kwlist, &x, &encoding, &errors)) - return NULL; - if (x == NULL) - return (PyObject *)_PyUnicode_New(0); - if (encoding == NULL && errors == NULL) - return PyObject_Str(x); - else - return PyUnicode_FromEncodedObject(x, encoding, errors); + PyObject *x = NULL; + static char *kwlist[] = {"object", "encoding", "errors", 0}; + char *encoding = NULL; + char *errors = NULL; + + if (type != &PyUnicode_Type) + return unicode_subtype_new(type, args, kwds); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:str", + kwlist, &x, &encoding, &errors)) + return NULL; + if (x == NULL) + return (PyObject *)_PyUnicode_New(0); + if (encoding == NULL && errors == NULL) + return PyObject_Str(x); + else + return PyUnicode_FromEncodedObject(x, encoding, errors); } static PyObject * unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyUnicodeObject *tmp, *pnew; - Py_ssize_t n; + PyUnicodeObject *tmp, *pnew; + Py_ssize_t n; - assert(PyType_IsSubtype(type, &PyUnicode_Type)); - tmp = (PyUnicodeObject *)unicode_new(&PyUnicode_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyUnicode_Check(tmp)); - pnew = (PyUnicodeObject *) type->tp_alloc(type, n = tmp->length); - if (pnew == NULL) { - Py_DECREF(tmp); - return NULL; - } - pnew->str = (Py_UNICODE*) PyObject_MALLOC(sizeof(Py_UNICODE) * (n+1)); - if (pnew->str == NULL) { - _Py_ForgetReference((PyObject *)pnew); - PyObject_Del(pnew); - Py_DECREF(tmp); - return PyErr_NoMemory(); - } - Py_UNICODE_COPY(pnew->str, tmp->str, n+1); - pnew->length = n; - pnew->hash = tmp->hash; - Py_DECREF(tmp); - return (PyObject *)pnew; + assert(PyType_IsSubtype(type, &PyUnicode_Type)); + tmp = (PyUnicodeObject *)unicode_new(&PyUnicode_Type, args, kwds); + if (tmp == NULL) + return NULL; + assert(PyUnicode_Check(tmp)); + pnew = (PyUnicodeObject *) type->tp_alloc(type, n = tmp->length); + if (pnew == NULL) { + Py_DECREF(tmp); + return NULL; + } + pnew->str = (Py_UNICODE*) PyObject_MALLOC(sizeof(Py_UNICODE) * (n+1)); + if (pnew->str == NULL) { + _Py_ForgetReference((PyObject *)pnew); + PyObject_Del(pnew); + Py_DECREF(tmp); + return PyErr_NoMemory(); + } + Py_UNICODE_COPY(pnew->str, tmp->str, n+1); + pnew->length = n; + pnew->hash = tmp->hash; + Py_DECREF(tmp); + return (PyObject *)pnew; } PyDoc_STRVAR(unicode_doc, -"str(string[, encoding[, errors]]) -> str\n\ + "str(string[, encoding[, errors]]) -> str\n\ \n\ Create a new string object from the given encoded string.\n\ encoding defaults to the current default string encoding.\n\ @@ -9485,46 +9485,46 @@ PyTypeObject PyUnicode_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", /* tp_name */ - sizeof(PyUnicodeObject), /* tp_size */ - 0, /* tp_itemsize */ + "str", /* tp_name */ + sizeof(PyUnicodeObject), /* tp_size */ + 0, /* tp_itemsize */ /* Slots */ - (destructor)unicode_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - unicode_repr, /* tp_repr */ - &unicode_as_number, /* tp_as_number */ - &unicode_as_sequence, /* tp_as_sequence */ - &unicode_as_mapping, /* tp_as_mapping */ - (hashfunc) unicode_hash, /* tp_hash*/ - 0, /* tp_call*/ - (reprfunc) unicode_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_UNICODE_SUBCLASS, /* tp_flags */ - unicode_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - PyUnicode_RichCompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - unicode_iter, /* tp_iter */ - 0, /* tp_iternext */ - unicode_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseObject_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - unicode_new, /* tp_new */ - PyObject_Del, /* tp_free */ + (destructor)unicode_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + unicode_repr, /* tp_repr */ + &unicode_as_number, /* tp_as_number */ + &unicode_as_sequence, /* tp_as_sequence */ + &unicode_as_mapping, /* tp_as_mapping */ + (hashfunc) unicode_hash, /* tp_hash*/ + 0, /* tp_call*/ + (reprfunc) unicode_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + Py_TPFLAGS_UNICODE_SUBCLASS, /* tp_flags */ + unicode_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + PyUnicode_RichCompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + unicode_iter, /* tp_iter */ + 0, /* tp_iternext */ + unicode_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyBaseObject_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + unicode_new, /* tp_new */ + PyObject_Del, /* tp_free */ }; /* Initialize the Unicode implementation */ @@ -9550,12 +9550,12 @@ numfree = 0; unicode_empty = _PyUnicode_New(0); if (!unicode_empty) - return; + return; for (i = 0; i < 256; i++) - unicode_latin1[i] = NULL; + unicode_latin1[i] = NULL; if (PyType_Ready(&PyUnicode_Type) < 0) - Py_FatalError("Can't initialize 'unicode'"); + Py_FatalError("Can't initialize 'unicode'"); /* initialize the linebreak bloom filter */ bloom_linebreak = make_bloom_mask( @@ -9574,13 +9574,13 @@ PyUnicodeObject *u; for (u = free_list; u != NULL;) { - PyUnicodeObject *v = u; - u = *(PyUnicodeObject **)u; - if (v->str) - PyObject_DEL(v->str); - Py_XDECREF(v->defenc); - PyObject_Del(v); - numfree--; + PyUnicodeObject *v = u; + u = *(PyUnicodeObject **)u; + if (v->str) + PyObject_DEL(v->str); + Py_XDECREF(v->defenc); + PyObject_Del(v); + numfree--; } free_list = NULL; assert(numfree == 0); @@ -9596,10 +9596,10 @@ unicode_empty = NULL; for (i = 0; i < 256; i++) { - if (unicode_latin1[i]) { - Py_DECREF(unicode_latin1[i]); - unicode_latin1[i] = NULL; - } + if (unicode_latin1[i]) { + Py_DECREF(unicode_latin1[i]); + unicode_latin1[i] = NULL; + } } (void)PyUnicode_ClearFreeList(); } @@ -9607,238 +9607,238 @@ void PyUnicode_InternInPlace(PyObject **p) { - register PyUnicodeObject *s = (PyUnicodeObject *)(*p); - PyObject *t; - if (s == NULL || !PyUnicode_Check(s)) - Py_FatalError( - "PyUnicode_InternInPlace: unicode strings only please!"); - /* If it's a subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyUnicode_CheckExact(s)) - return; - if (PyUnicode_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - /* It might be that the GetItem call fails even - though the key is present in the dictionary, - namely when this happens during a stack overflow. */ - Py_ALLOW_RECURSION - t = PyDict_GetItem(interned, (PyObject *)s); - Py_END_ALLOW_RECURSION - - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - PyThreadState_GET()->recursion_critical = 1; - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - PyThreadState_GET()->recursion_critical = 0; - return; - } - PyThreadState_GET()->recursion_critical = 0; - /* The two references in interned are not counted by refcnt. - The deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; + register PyUnicodeObject *s = (PyUnicodeObject *)(*p); + PyObject *t; + if (s == NULL || !PyUnicode_Check(s)) + Py_FatalError( + "PyUnicode_InternInPlace: unicode strings only please!"); + /* If it's a subclass, we don't really know what putting + it in the interned dict might do. */ + if (!PyUnicode_CheckExact(s)) + return; + if (PyUnicode_CHECK_INTERNED(s)) + return; + if (interned == NULL) { + interned = PyDict_New(); + if (interned == NULL) { + PyErr_Clear(); /* Don't leave an exception */ + return; + } + } + /* It might be that the GetItem call fails even + though the key is present in the dictionary, + namely when this happens during a stack overflow. */ + Py_ALLOW_RECURSION + t = PyDict_GetItem(interned, (PyObject *)s); + Py_END_ALLOW_RECURSION + + if (t) { + Py_INCREF(t); + Py_DECREF(*p); + *p = t; + return; + } + + PyThreadState_GET()->recursion_critical = 1; + if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { + PyErr_Clear(); + PyThreadState_GET()->recursion_critical = 0; + return; + } + PyThreadState_GET()->recursion_critical = 0; + /* The two references in interned are not counted by refcnt. + The deallocator will take care of this */ + Py_REFCNT(s) -= 2; + PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; } void PyUnicode_InternImmortal(PyObject **p) { - PyUnicode_InternInPlace(p); - if (PyUnicode_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyUnicode_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } + PyUnicode_InternInPlace(p); + if (PyUnicode_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { + PyUnicode_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; + Py_INCREF(*p); + } } PyObject * PyUnicode_InternFromString(const char *cp) { - PyObject *s = PyUnicode_FromString(cp); - if (s == NULL) - return NULL; - PyUnicode_InternInPlace(&s); - return s; + PyObject *s = PyUnicode_FromString(cp); + if (s == NULL) + return NULL; + PyUnicode_InternInPlace(&s); + return s; } void _Py_ReleaseInternedUnicodeStrings(void) { - PyObject *keys; - PyUnicodeObject *s; - Py_ssize_t i, n; - Py_ssize_t immortal_size = 0, mortal_size = 0; - - if (interned == NULL || !PyDict_Check(interned)) - return; - keys = PyDict_Keys(interned); - if (keys == NULL || !PyList_Check(keys)) { - PyErr_Clear(); - return; - } - - /* Since _Py_ReleaseInternedUnicodeStrings() is intended to help a leak - detector, interned unicode strings are not forcibly deallocated; - rather, we give them their stolen references back, and then clear - and DECREF the interned dict. */ - - n = PyList_GET_SIZE(keys); - fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n", - n); - for (i = 0; i < n; i++) { - s = (PyUnicodeObject *) PyList_GET_ITEM(keys, i); - switch (s->state) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += s->length; - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += s->length; - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->state = SSTATE_NOT_INTERNED; - } - fprintf(stderr, "total size of all interned strings: " - "%" PY_FORMAT_SIZE_T "d/%" PY_FORMAT_SIZE_T "d " - "mortal/immortal\n", mortal_size, immortal_size); - Py_DECREF(keys); - PyDict_Clear(interned); - Py_DECREF(interned); - interned = NULL; + PyObject *keys; + PyUnicodeObject *s; + Py_ssize_t i, n; + Py_ssize_t immortal_size = 0, mortal_size = 0; + + if (interned == NULL || !PyDict_Check(interned)) + return; + keys = PyDict_Keys(interned); + if (keys == NULL || !PyList_Check(keys)) { + PyErr_Clear(); + return; + } + + /* Since _Py_ReleaseInternedUnicodeStrings() is intended to help a leak + detector, interned unicode strings are not forcibly deallocated; + rather, we give them their stolen references back, and then clear + and DECREF the interned dict. */ + + n = PyList_GET_SIZE(keys); + fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n", + n); + for (i = 0; i < n; i++) { + s = (PyUnicodeObject *) PyList_GET_ITEM(keys, i); + switch (s->state) { + case SSTATE_NOT_INTERNED: + /* XXX Shouldn't happen */ + break; + case SSTATE_INTERNED_IMMORTAL: + Py_REFCNT(s) += 1; + immortal_size += s->length; + break; + case SSTATE_INTERNED_MORTAL: + Py_REFCNT(s) += 2; + mortal_size += s->length; + break; + default: + Py_FatalError("Inconsistent interned string state."); + } + s->state = SSTATE_NOT_INTERNED; + } + fprintf(stderr, "total size of all interned strings: " + "%" PY_FORMAT_SIZE_T "d/%" PY_FORMAT_SIZE_T "d " + "mortal/immortal\n", mortal_size, immortal_size); + Py_DECREF(keys); + PyDict_Clear(interned); + Py_DECREF(interned); + interned = NULL; } /********************* Unicode Iterator **************************/ typedef struct { - PyObject_HEAD - Py_ssize_t it_index; - PyUnicodeObject *it_seq; /* Set to NULL when iterator is exhausted */ + PyObject_HEAD + Py_ssize_t it_index; + PyUnicodeObject *it_seq; /* Set to NULL when iterator is exhausted */ } unicodeiterobject; static void unicodeiter_dealloc(unicodeiterobject *it) { - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); + _PyObject_GC_UNTRACK(it); + Py_XDECREF(it->it_seq); + PyObject_GC_Del(it); } static int unicodeiter_traverse(unicodeiterobject *it, visitproc visit, void *arg) { - Py_VISIT(it->it_seq); - return 0; + Py_VISIT(it->it_seq); + return 0; } static PyObject * unicodeiter_next(unicodeiterobject *it) { - PyUnicodeObject *seq; - PyObject *item; + PyUnicodeObject *seq; + PyObject *item; + + assert(it != NULL); + seq = it->it_seq; + if (seq == NULL) + return NULL; + assert(PyUnicode_Check(seq)); + + if (it->it_index < PyUnicode_GET_SIZE(seq)) { + item = PyUnicode_FromUnicode( + PyUnicode_AS_UNICODE(seq)+it->it_index, 1); + if (item != NULL) + ++it->it_index; + return item; + } - assert(it != NULL); - seq = it->it_seq; - if (seq == NULL) - return NULL; - assert(PyUnicode_Check(seq)); - - if (it->it_index < PyUnicode_GET_SIZE(seq)) { - item = PyUnicode_FromUnicode( - PyUnicode_AS_UNICODE(seq)+it->it_index, 1); - if (item != NULL) - ++it->it_index; - return item; - } - - Py_DECREF(seq); - it->it_seq = NULL; - return NULL; + Py_DECREF(seq); + it->it_seq = NULL; + return NULL; } static PyObject * unicodeiter_len(unicodeiterobject *it) { - Py_ssize_t len = 0; - if (it->it_seq) - len = PyUnicode_GET_SIZE(it->it_seq) - it->it_index; - return PyLong_FromSsize_t(len); + Py_ssize_t len = 0; + if (it->it_seq) + len = PyUnicode_GET_SIZE(it->it_seq) - it->it_index; + return PyLong_FromSsize_t(len); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); static PyMethodDef unicodeiter_methods[] = { - {"__length_hint__", (PyCFunction)unicodeiter_len, METH_NOARGS, - length_hint_doc}, - {NULL, NULL} /* sentinel */ + {"__length_hint__", (PyCFunction)unicodeiter_len, METH_NOARGS, + length_hint_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PyUnicodeIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str_iterator", /* tp_name */ - sizeof(unicodeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)unicodeiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)unicodeiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)unicodeiter_next, /* tp_iternext */ - unicodeiter_methods, /* tp_methods */ - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) + "str_iterator", /* tp_name */ + sizeof(unicodeiterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)unicodeiter_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ + 0, /* tp_doc */ + (traverseproc)unicodeiter_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)unicodeiter_next, /* tp_iternext */ + unicodeiter_methods, /* tp_methods */ + 0, }; static PyObject * unicode_iter(PyObject *seq) { - unicodeiterobject *it; + unicodeiterobject *it; - if (!PyUnicode_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_GC_New(unicodeiterobject, &PyUnicodeIter_Type); - if (it == NULL) - return NULL; - it->it_index = 0; - Py_INCREF(seq); - it->it_seq = (PyUnicodeObject *)seq; - _PyObject_GC_TRACK(it); - return (PyObject *)it; + if (!PyUnicode_Check(seq)) { + PyErr_BadInternalCall(); + return NULL; + } + it = PyObject_GC_New(unicodeiterobject, &PyUnicodeIter_Type); + if (it == NULL) + return NULL; + it->it_index = 0; + Py_INCREF(seq); + it->it_seq = (PyUnicodeObject *)seq; + _PyObject_GC_TRACK(it); + return (PyObject *)it; } size_t @@ -9899,8 +9899,8 @@ /* -Local variables: -c-basic-offset: 4 -indent-tabs-mode: nil -End: + Local variables: + c-basic-offset: 4 + indent-tabs-mode: nil + End: */ Modified: python/branches/py3k-issue1717/Python/makeopcodetargets.py ============================================================================== --- python/branches/py3k-issue1717/Python/makeopcodetargets.py (original) +++ python/branches/py3k-issue1717/Python/makeopcodetargets.py Sun Feb 1 11:54:55 2009 @@ -3,6 +3,9 @@ (for compilers supporting computed gotos or "labels-as-values", such as gcc). """ +# This code should stay compatible with Python 2.3, at least while +# some of the buildbots have Python 2.3 as their system Python. + import imp import os @@ -25,7 +28,7 @@ continue targets[op] = "TARGET_%s" % opname f.write("static void *opcode_targets[256] = {\n") - f.write(",\n".join("\t&&%s" % s for s in targets)) + f.write(",\n".join(["\t&&%s" % s for s in targets])) f.write("\n};\n") From buildbot at python.org Sun Feb 1 12:57:14 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 11:57:14 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090201115714.C4B741E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/114 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: gregory.p.smith,mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 13:13:56 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 13:13:56 +0100 (CET) Subject: [Python-checkins] r69184 - in python/branches/py3k: Doc/c-api/object.rst Include/abstract.h Lib/test/test_builtin.py Misc/NEWS Objects/abstract.c Objects/object.c Objects/typeobject.c Python/bltinmodule.c Message-ID: <20090201121356.CE0421E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 13:13:56 2009 New Revision: 69184 Log: Issue #1717: remove the cmp builtin function, the C-API functions PyObject_Cmp, PyObject_Compare, and various support functions. Modified: python/branches/py3k/Doc/c-api/object.rst python/branches/py3k/Include/abstract.h python/branches/py3k/Lib/test/test_builtin.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/abstract.c python/branches/py3k/Objects/object.c python/branches/py3k/Objects/typeobject.c python/branches/py3k/Python/bltinmodule.c Modified: python/branches/py3k/Doc/c-api/object.rst ============================================================================== --- python/branches/py3k/Doc/c-api/object.rst (original) +++ python/branches/py3k/Doc/c-api/object.rst Sun Feb 1 13:13:56 2009 @@ -89,27 +89,6 @@ *opid*. -.. cfunction:: int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. The result of the comparison - is returned in *result*. Returns ``-1`` on failure. This is the equivalent of - the Python statement ``result = cmp(o1, o2)``. - - -.. cfunction:: int PyObject_Compare(PyObject *o1, PyObject *o2) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. Returns the result of the - comparison on success. On error, the value returned is undefined; use - :cfunc:`PyErr_Occurred` to detect an error. This is equivalent to the Python - expression ``cmp(o1, o2)``. - - .. cfunction:: PyObject* PyObject_Repr(PyObject *o) .. index:: builtin: repr Modified: python/branches/py3k/Include/abstract.h ============================================================================== --- python/branches/py3k/Include/abstract.h (original) +++ python/branches/py3k/Include/abstract.h Sun Feb 1 13:13:56 2009 @@ -228,29 +228,6 @@ */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) - PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); - - /* - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - The result of the comparison is returned in result. Returns - -1 on failure. This is the equivalent of the Python - statement: result=cmp(o1,o2). - - */ - - /* Implemented elsewhere: - - int PyObject_Compare(PyObject *o1, PyObject *o2); - - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - Returns the result of the comparison on success. On error, - the value returned is undefined. This is equivalent to the - Python expression: cmp(o1,o2). - - */ - /* Implemented elsewhere: PyObject *PyObject_Repr(PyObject *o); Modified: python/branches/py3k/Lib/test/test_builtin.py ============================================================================== --- python/branches/py3k/Lib/test/test_builtin.py (original) +++ python/branches/py3k/Lib/test/test_builtin.py Sun Feb 1 13:13:56 2009 @@ -220,9 +220,7 @@ self.assertRaises((OverflowError, ValueError), chr, 2**32) def test_cmp(self): - # uncomment the following line once cmp has been removed - #self.assert_(not hasattr(builtins, "cmp")) - pass + self.assert_(not hasattr(builtins, "cmp")) def test_compile(self): compile('print(1)\n', '', 'exec') Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Feb 1 13:13:56 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #1717: Remove builtin cmp() function, C-API functions + PyObject_Cmp and PyObject_Compare, and the support function + Py_CmpToRich. + - Issue #4707: round(x, n) now returns an integer if x is an integer. Previously it returned a float. Modified: python/branches/py3k/Objects/abstract.c ============================================================================== --- python/branches/py3k/Objects/abstract.c (original) +++ python/branches/py3k/Objects/abstract.c Sun Feb 1 13:13:56 2009 @@ -27,22 +27,6 @@ /* Operations on any object */ -int -PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) -{ - int r; - - if (o1 == NULL || o2 == NULL) { - null_error(); - return -1; - } - r = PyObject_Compare(o1, o2); - if (PyErr_Occurred()) - return -1; - *result = r; - return 0; -} - PyObject * PyObject_Type(PyObject *o) { Modified: python/branches/py3k/Objects/object.c ============================================================================== --- python/branches/py3k/Objects/object.c (original) +++ python/branches/py3k/Objects/object.c Sun Feb 1 13:13:56 2009 @@ -549,68 +549,6 @@ */ -/* Forward */ -static PyObject *do_richcompare(PyObject *v, PyObject *w, int op); - -/* Perform a three-way comparison, raising TypeError if three-way comparison - is not supported. */ -static int -do_compare(PyObject *v, PyObject *w) -{ - cmpfunc f; - int ok; - - if (v->ob_type == w->ob_type && - (f = v->ob_type->tp_compare) != NULL) { - return (*f)(v, w); - } - - /* Now try three-way compare before giving up. This is intentionally - elaborate; if you have a it will raise TypeError if it detects two - objects that aren't ordered with respect to each other. */ - ok = PyObject_RichCompareBool(v, w, Py_LT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return -1; /* Less than */ - ok = PyObject_RichCompareBool(v, w, Py_GT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 1; /* Greater than */ - ok = PyObject_RichCompareBool(v, w, Py_EQ); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 0; /* Equal */ - - /* Give up */ - PyErr_Format(PyExc_TypeError, - "unorderable types: '%.100s' != '%.100s'", - v->ob_type->tp_name, - w->ob_type->tp_name); - return -1; -} - -/* Perform a three-way comparison. This wraps do_compare() with a check for - NULL arguments and a recursion check. */ -int -PyObject_Compare(PyObject *v, PyObject *w) -{ - int res; - - if (v == NULL || w == NULL) { - if (!PyErr_Occurred()) - PyErr_BadInternalCall(); - return -1; - } - if (Py_EnterRecursiveCall(" in cmp")) - return -1; - res = do_compare(v, w); - Py_LeaveRecursiveCall(); - return res < 0 ? -1 : res; -} - /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE}; @@ -715,44 +653,6 @@ return ok; } -/* Turn the result of a three-way comparison into the result expected by a - rich comparison. */ -PyObject * -Py_CmpToRich(int op, int cmp) -{ - PyObject *res; - int ok; - - if (PyErr_Occurred()) - return NULL; - switch (op) { - case Py_LT: - ok = cmp < 0; - break; - case Py_LE: - ok = cmp <= 0; - break; - case Py_EQ: - ok = cmp == 0; - break; - case Py_NE: - ok = cmp != 0; - break; - case Py_GT: - ok = cmp > 0; - break; - case Py_GE: - ok = cmp >= 0; - break; - default: - PyErr_BadArgument(); - return NULL; - } - res = ok ? Py_True : Py_False; - Py_INCREF(res); - return res; -} - /* Set of hash utility functions to help maintaining the invariant that if a==b then hash(a)==hash(b) Modified: python/branches/py3k/Objects/typeobject.c ============================================================================== --- python/branches/py3k/Objects/typeobject.c (original) +++ python/branches/py3k/Objects/typeobject.c Sun Feb 1 13:13:56 2009 @@ -2897,7 +2897,7 @@ slots_a = ((PyHeapTypeObject *)a)->ht_slots; slots_b = ((PyHeapTypeObject *)b)->ht_slots; if (slots_a && slots_b) { - if (PyObject_Compare(slots_a, slots_b) != 0) + if (PyObject_RichCompareBool(slots_a, slots_b, Py_EQ) != 1) return 0; size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); } Modified: python/branches/py3k/Python/bltinmodule.c ============================================================================== --- python/branches/py3k/Python/bltinmodule.c (original) +++ python/branches/py3k/Python/bltinmodule.c Sun Feb 1 13:13:56 2009 @@ -493,25 +493,6 @@ ; -static PyObject * -builtin_cmp(PyObject *self, PyObject *args) -{ - PyObject *a, *b; - int c; - - if (!PyArg_UnpackTuple(args, "cmp", 2, 2, &a, &b)) - return NULL; - if (PyObject_Cmp(a, b, &c) < 0) - return NULL; - return PyLong_FromLong((long)c); -} - -PyDoc_STRVAR(cmp_doc, -"cmp(x, y) -> integer\n\ -\n\ -Return negative if xy."); - - static char * source_as_string(PyObject *cmd, char *funcname, char *what) { @@ -2230,7 +2211,6 @@ {"ascii", builtin_ascii, METH_O, ascii_doc}, {"bin", builtin_bin, METH_O, bin_doc}, {"chr", builtin_chr, METH_VARARGS, chr_doc}, - {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, {"dir", builtin_dir, METH_VARARGS, dir_doc}, From python-checkins at python.org Sun Feb 1 13:31:56 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 13:31:56 +0100 (CET) Subject: [Python-checkins] r69185 - in python/branches/release30-maint: Doc/c-api/object.rst Include/abstract.h Lib/test/test_builtin.py Misc/NEWS Objects/abstract.c Objects/object.c Objects/typeobject.c Python/bltinmodule.c Message-ID: <20090201123156.F41F11E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 13:31:56 2009 New Revision: 69185 Log: Merged revisions 69184 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69184 | mark.dickinson | 2009-02-01 12:13:56 +0000 (Sun, 01 Feb 2009) | 3 lines Issue #1717: remove the cmp builtin function, the C-API functions PyObject_Cmp, PyObject_Compare, and various support functions. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/c-api/object.rst python/branches/release30-maint/Include/abstract.h python/branches/release30-maint/Lib/test/test_builtin.py python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Objects/abstract.c python/branches/release30-maint/Objects/object.c python/branches/release30-maint/Objects/typeobject.c python/branches/release30-maint/Python/bltinmodule.c Modified: python/branches/release30-maint/Doc/c-api/object.rst ============================================================================== --- python/branches/release30-maint/Doc/c-api/object.rst (original) +++ python/branches/release30-maint/Doc/c-api/object.rst Sun Feb 1 13:31:56 2009 @@ -89,27 +89,6 @@ *opid*. -.. cfunction:: int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. The result of the comparison - is returned in *result*. Returns ``-1`` on failure. This is the equivalent of - the Python statement ``result = cmp(o1, o2)``. - - -.. cfunction:: int PyObject_Compare(PyObject *o1, PyObject *o2) - - .. index:: builtin: cmp - - Compare the values of *o1* and *o2* using a routine provided by *o1*, if one - exists, otherwise with a routine provided by *o2*. Returns the result of the - comparison on success. On error, the value returned is undefined; use - :cfunc:`PyErr_Occurred` to detect an error. This is equivalent to the Python - expression ``cmp(o1, o2)``. - - .. cfunction:: PyObject* PyObject_Repr(PyObject *o) .. index:: builtin: repr Modified: python/branches/release30-maint/Include/abstract.h ============================================================================== --- python/branches/release30-maint/Include/abstract.h (original) +++ python/branches/release30-maint/Include/abstract.h Sun Feb 1 13:31:56 2009 @@ -228,29 +228,6 @@ */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) - PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); - - /* - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - The result of the comparison is returned in result. Returns - -1 on failure. This is the equivalent of the Python - statement: result=cmp(o1,o2). - - */ - - /* Implemented elsewhere: - - int PyObject_Compare(PyObject *o1, PyObject *o2); - - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - Returns the result of the comparison on success. On error, - the value returned is undefined. This is equivalent to the - Python expression: cmp(o1,o2). - - */ - /* Implemented elsewhere: PyObject *PyObject_Repr(PyObject *o); Modified: python/branches/release30-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_builtin.py (original) +++ python/branches/release30-maint/Lib/test/test_builtin.py Sun Feb 1 13:31:56 2009 @@ -220,9 +220,7 @@ self.assertRaises((OverflowError, ValueError), chr, 2**32) def test_cmp(self): - # uncomment the following line once cmp has been removed - #self.assert_(not hasattr(builtins, "cmp")) - pass + self.assert_(not hasattr(builtins, "cmp")) def test_compile(self): compile('print(1)\n', '', 'exec') Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sun Feb 1 13:31:56 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #1717: Remove builtin cmp() function, C-API functions + PyObject_Cmp and PyObject_Compare, and the support function + Py_CmpToRich. + - Issue #4707: round(x, n) now returns an integer if x is an integer. Previously it returned a float. Modified: python/branches/release30-maint/Objects/abstract.c ============================================================================== --- python/branches/release30-maint/Objects/abstract.c (original) +++ python/branches/release30-maint/Objects/abstract.c Sun Feb 1 13:31:56 2009 @@ -27,22 +27,6 @@ /* Operations on any object */ -int -PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) -{ - int r; - - if (o1 == NULL || o2 == NULL) { - null_error(); - return -1; - } - r = PyObject_Compare(o1, o2); - if (PyErr_Occurred()) - return -1; - *result = r; - return 0; -} - PyObject * PyObject_Type(PyObject *o) { Modified: python/branches/release30-maint/Objects/object.c ============================================================================== --- python/branches/release30-maint/Objects/object.c (original) +++ python/branches/release30-maint/Objects/object.c Sun Feb 1 13:31:56 2009 @@ -544,68 +544,6 @@ */ -/* Forward */ -static PyObject *do_richcompare(PyObject *v, PyObject *w, int op); - -/* Perform a three-way comparison, raising TypeError if three-way comparison - is not supported. */ -static int -do_compare(PyObject *v, PyObject *w) -{ - cmpfunc f; - int ok; - - if (v->ob_type == w->ob_type && - (f = v->ob_type->tp_compare) != NULL) { - return (*f)(v, w); - } - - /* Now try three-way compare before giving up. This is intentionally - elaborate; if you have a it will raise TypeError if it detects two - objects that aren't ordered with respect to each other. */ - ok = PyObject_RichCompareBool(v, w, Py_LT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return -1; /* Less than */ - ok = PyObject_RichCompareBool(v, w, Py_GT); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 1; /* Greater than */ - ok = PyObject_RichCompareBool(v, w, Py_EQ); - if (ok < 0) - return -1; /* Error */ - if (ok) - return 0; /* Equal */ - - /* Give up */ - PyErr_Format(PyExc_TypeError, - "unorderable types: '%.100s' != '%.100s'", - v->ob_type->tp_name, - w->ob_type->tp_name); - return -1; -} - -/* Perform a three-way comparison. This wraps do_compare() with a check for - NULL arguments and a recursion check. */ -int -PyObject_Compare(PyObject *v, PyObject *w) -{ - int res; - - if (v == NULL || w == NULL) { - if (!PyErr_Occurred()) - PyErr_BadInternalCall(); - return -1; - } - if (Py_EnterRecursiveCall(" in cmp")) - return -1; - res = do_compare(v, w); - Py_LeaveRecursiveCall(); - return res < 0 ? -1 : res; -} - /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE}; @@ -710,44 +648,6 @@ return ok; } -/* Turn the result of a three-way comparison into the result expected by a - rich comparison. */ -PyObject * -Py_CmpToRich(int op, int cmp) -{ - PyObject *res; - int ok; - - if (PyErr_Occurred()) - return NULL; - switch (op) { - case Py_LT: - ok = cmp < 0; - break; - case Py_LE: - ok = cmp <= 0; - break; - case Py_EQ: - ok = cmp == 0; - break; - case Py_NE: - ok = cmp != 0; - break; - case Py_GT: - ok = cmp > 0; - break; - case Py_GE: - ok = cmp >= 0; - break; - default: - PyErr_BadArgument(); - return NULL; - } - res = ok ? Py_True : Py_False; - Py_INCREF(res); - return res; -} - /* Set of hash utility functions to help maintaining the invariant that if a==b then hash(a)==hash(b) Modified: python/branches/release30-maint/Objects/typeobject.c ============================================================================== --- python/branches/release30-maint/Objects/typeobject.c (original) +++ python/branches/release30-maint/Objects/typeobject.c Sun Feb 1 13:31:56 2009 @@ -2897,7 +2897,7 @@ slots_a = ((PyHeapTypeObject *)a)->ht_slots; slots_b = ((PyHeapTypeObject *)b)->ht_slots; if (slots_a && slots_b) { - if (PyObject_Compare(slots_a, slots_b) != 0) + if (PyObject_RichCompareBool(slots_a, slots_b, Py_EQ) != 1) return 0; size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); } Modified: python/branches/release30-maint/Python/bltinmodule.c ============================================================================== --- python/branches/release30-maint/Python/bltinmodule.c (original) +++ python/branches/release30-maint/Python/bltinmodule.c Sun Feb 1 13:31:56 2009 @@ -494,25 +494,6 @@ ; -static PyObject * -builtin_cmp(PyObject *self, PyObject *args) -{ - PyObject *a, *b; - int c; - - if (!PyArg_UnpackTuple(args, "cmp", 2, 2, &a, &b)) - return NULL; - if (PyObject_Cmp(a, b, &c) < 0) - return NULL; - return PyLong_FromLong((long)c); -} - -PyDoc_STRVAR(cmp_doc, -"cmp(x, y) -> integer\n\ -\n\ -Return negative if xy."); - - static char * source_as_string(PyObject *cmd, char *funcname, char *what) { @@ -2233,7 +2214,6 @@ {"ascii", builtin_ascii, METH_O, ascii_doc}, {"bin", builtin_bin, METH_O, bin_doc}, {"chr", builtin_chr, METH_VARARGS, chr_doc}, - {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, {"dir", builtin_dir, METH_VARARGS, dir_doc}, From python-checkins at python.org Sun Feb 1 13:42:37 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 13:42:37 +0100 (CET) Subject: [Python-checkins] r69186 - in python/branches/py3k-issue1717: Objects/abstract.c Objects/typeobject.c Message-ID: <20090201124237.8868A1E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 13:42:37 2009 New Revision: 69186 Log: Merged revisions 69184 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69184 | mark.dickinson | 2009-02-01 12:13:56 +0000 (Sun, 01 Feb 2009) | 3 lines Issue #1717: remove the cmp builtin function, the C-API functions PyObject_Cmp, PyObject_Compare, and various support functions. ........ Modified: python/branches/py3k-issue1717/ (props changed) python/branches/py3k-issue1717/Objects/abstract.c python/branches/py3k-issue1717/Objects/typeobject.c Modified: python/branches/py3k-issue1717/Objects/abstract.c ============================================================================== --- python/branches/py3k-issue1717/Objects/abstract.c (original) +++ python/branches/py3k-issue1717/Objects/abstract.c Sun Feb 1 13:42:37 2009 @@ -25,6 +25,8 @@ return NULL; } +/* Operations on any object */ + PyObject * PyObject_Type(PyObject *o) { Modified: python/branches/py3k-issue1717/Objects/typeobject.c ============================================================================== --- python/branches/py3k-issue1717/Objects/typeobject.c (original) +++ python/branches/py3k-issue1717/Objects/typeobject.c Sun Feb 1 13:42:37 2009 @@ -2897,7 +2897,7 @@ slots_a = ((PyHeapTypeObject *)a)->ht_slots; slots_b = ((PyHeapTypeObject *)b)->ht_slots; if (slots_a && slots_b) { - if (PyObject_RichCompareBool(slots_a, slots_b, Py_NE) == 1) + if (PyObject_RichCompareBool(slots_a, slots_b, Py_EQ) != 1) return 0; size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); } From python-checkins at python.org Sun Feb 1 14:01:16 2009 From: python-checkins at python.org (nick.coghlan) Date: Sun, 1 Feb 2009 14:01:16 +0100 (CET) Subject: [Python-checkins] r69187 - peps/trunk/pep-0366.txt Message-ID: <20090201130116.CBFB71E4002@bag.python.org> Author: nick.coghlan Date: Sun Feb 1 14:01:16 2009 New Revision: 69187 Log: Add explicit note regarding __package__ in top level modules Modified: peps/trunk/pep-0366.txt Modified: peps/trunk/pep-0366.txt ============================================================================== --- peps/trunk/pep-0366.txt (original) +++ peps/trunk/pep-0366.txt Sun Feb 1 14:01:16 2009 @@ -72,6 +72,12 @@ manually. It has the advantage that this change need only be made once per file, regardless of the number of relative imports. +Note that setting ``__package__`` to the empty string explicitly is +permitted, and has the effect of disabling all relative imports from +that module (since the import machinery will consider it to be a +top level module in that case). This means that tools like ``runpy`` +do not need to provide special case handling for top level modules +when setting ``__package__``. Rationale for Change ==================== From ncoghlan at gmail.com Sun Feb 1 14:03:27 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 01 Feb 2009 23:03:27 +1000 Subject: [Python-checkins] r69167 - in python/branches/py3k/Lib/importlib: NOTES _bootstrap.py test/frozen/test_loader.py In-Reply-To: References: <20090201013414.2FEB41E4002@bag.python.org> <49855066.60507@gmail.com> Message-ID: <49859D9F.1080701@gmail.com> Brett Cannon wrote: > On Sat, Jan 31, 2009 at 23:33, Nick Coghlan wrote: >> 1. When determining a package name, rpartition is your friend (see the >> relevant code in runpy.py) > > I guess I could, but the semantics are the same. Although I see you > hard-coded using rpartition in PEP 366. =) I find partition to be such a handy addition to the string API I like to promote it whenever I can :) >> 2. It's OK to set __package__ even in a top-level module (just set it to >> the empty string). That is why rpartition works so well for the application. > > The PEP doesn't say that, although I guess your > ``__name__.rpartition('.')[0]`` line makes that implicit. Could you > edit the PEP to mention that the empty string is okay? Done - should show up on the website shortly. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From buildbot at python.org Sun Feb 1 14:06:03 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 13:06:03 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090201130603.79E081E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/216 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_subprocess.py", line 149, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 14:59:23 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 14:59:23 +0100 (CET) Subject: [Python-checkins] r69188 - in python/branches/py3k: Include/code.h Include/object.h Misc/NEWS Objects/object.c Objects/typeobject.c Message-ID: <20090201135923.0961F1E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 14:59:22 2009 New Revision: 69188 Log: Issue #1717, continued: remove PyObject_Compare and Py_CmpToRich declarations from object.h; don't inherit tp_compare slot on subclasses; and raise TypeError when initializing a type that has a nonzero tp_compare slot. Fix up comparison-related comments in object.c and code.h. Modified: python/branches/py3k/Include/code.h python/branches/py3k/Include/object.h python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/object.c python/branches/py3k/Objects/typeobject.c Modified: python/branches/py3k/Include/code.h ============================================================================== --- python/branches/py3k/Include/code.h (original) +++ python/branches/py3k/Include/code.h Sun Feb 1 14:59:22 2009 @@ -20,7 +20,7 @@ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest doesn't count for hash/cmp */ + /* The rest doesn't count for hash or comparisons */ PyObject *co_filename; /* unicode (where it was loaded from) */ PyObject *co_name; /* unicode (name, for reference) */ int co_firstlineno; /* first source line number */ Modified: python/branches/py3k/Include/object.h ============================================================================== --- python/branches/py3k/Include/object.h (original) +++ python/branches/py3k/Include/object.h Sun Feb 1 14:59:22 2009 @@ -426,10 +426,8 @@ PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Bytes(PyObject *); -PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); -PyAPI_FUNC(PyObject *) Py_CmpToRich(int op, int cmp); PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Feb 1 14:59:22 2009 @@ -12,9 +12,11 @@ Core and Builtins ----------------- -- Issue #1717: Remove builtin cmp() function, C-API functions - PyObject_Cmp and PyObject_Compare, and the support function - Py_CmpToRich. +- Issue #1717: Removed builtin cmp() function, dropped tp_compare + slot, the C API functions PyObject_Compare and PyUnicode_Compare and + the type definition cmpfunc. The tp_compare slot is reserved for + future usage. An attempt to initialize a type with a nonzero + tp_compare slot will raise TypeError. - Issue #4707: round(x, n) now returns an integer if x is an integer. Previously it returned a float. Modified: python/branches/py3k/Objects/object.c ============================================================================== --- python/branches/py3k/Objects/object.c (original) +++ python/branches/py3k/Objects/object.c Sun Feb 1 14:59:22 2009 @@ -500,35 +500,19 @@ return PyBytes_FromObject(v); } -/* The new comparison philosophy is: we completely separate three-way - comparison from rich comparison. That is, PyObject_Compare() and - PyObject_Cmp() *just* use the tp_compare slot. And PyObject_RichCompare() - and PyObject_RichCompareBool() *just* use the tp_richcompare slot. +/* For Python 3.0.1 and later, the old three-way comparison has been + completely removed in favour of rich comparisons. PyObject_Compare() and + PyObject_Cmp() are gone, and the builtin cmp function no longer exists. + The old tp_compare slot will be renamed to tp_reserved, and should no + longer be used. Use tp_richcompare instead. See (*) below for practical amendments. - IOW, only cmp() uses tp_compare; the comparison operators (==, !=, <=, <, - >=, >) only use tp_richcompare. Note that list.sort() only uses <. + tp_richcompare gets called with a first argument of the appropriate type + and a second object of an arbitrary type. We never do any kind of + coercion. - (And yes, eventually we'll rip out cmp() and tp_compare.) - - The calling conventions are different: tp_compare only gets called with two - objects of the appropriate type; tp_richcompare gets called with a first - argument of the appropriate type and a second object of an arbitrary type. - We never do any kind of coercion. - - The return conventions are also different. - - The tp_compare slot should return a C int, as follows: - - -1 if a < b or if an exception occurred - 0 if a == b - +1 if a > b - - No other return values are allowed. PyObject_Compare() has the same - calling convention. - - The tp_richcompare slot should return an object, as follows: + The tp_richcompare slot should return an object, as follows: NULL if an exception occurred NotImplemented if the requested comparison is not implemented @@ -544,9 +528,6 @@ comparing the object pointer (i.e. falling back to the base object implementation). - - If three-way comparison is not implemented, it falls back on rich - comparison (but not the other way around!). - */ /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ Modified: python/branches/py3k/Objects/typeobject.c ============================================================================== --- python/branches/py3k/Objects/typeobject.c (original) +++ python/branches/py3k/Objects/typeobject.c Sun Feb 1 14:59:22 2009 @@ -3662,7 +3662,7 @@ type->tp_setattr = base->tp_setattr; type->tp_setattro = base->tp_setattro; } - /* tp_compare see tp_richcompare */ + /* tp_compare is ignored, see tp_richcompare */ COPYSLOT(tp_repr); /* tp_hash see tp_richcompare */ COPYSLOT(tp_call); @@ -3670,12 +3670,10 @@ { /* Copy comparison-related slots only when not overriding them anywhere */ - if (type->tp_compare == NULL && - type->tp_richcompare == NULL && + if (type->tp_richcompare == NULL && type->tp_hash == NULL && !overrides_hash(type)) { - type->tp_compare = base->tp_compare; type->tp_richcompare = base->tp_richcompare; type->tp_hash = base->tp_hash; } @@ -3888,6 +3886,13 @@ goto error; } + /* Check reserved slots */ + if (type->tp_compare) { + PyErr_Format(PyExc_TypeError, + "type %s has tp_compare", + type->tp_name); + } + /* All done -- set the ready flag */ assert(type->tp_dict != NULL); type->tp_flags = From ggpolo at gmail.com Sun Feb 1 15:00:55 2009 From: ggpolo at gmail.com (Guilherme Polo) Date: Sun, 1 Feb 2009 12:00:55 -0200 Subject: [Python-checkins] r69131 - python/trunk/Doc/library/ttk.rst In-Reply-To: <20090131032602.ADC491E4002@bag.python.org> References: <20090131032602.ADC491E4002@bag.python.org> Message-ID: Thanks for taking a look into it Andrew, On Sat, Jan 31, 2009 at 1:26 AM, andrew. kuchling wrote: > Author: andrew.kuchling > Date: Sat Jan 31 04:26:02 2009 > New Revision: 69131 > > Log: > Text edits and markup fixes > > Modified: > python/trunk/Doc/library/ttk.rst > > Modified: python/trunk/Doc/library/ttk.rst > ============================================================================== > --- python/trunk/Doc/library/ttk.rst (original) > +++ python/trunk/Doc/library/ttk.rst Sat Jan 31 04:26:02 2009 > @@ -44,9 +44,9 @@ > And then several :mod:`ttk` widgets (:class:`Button`, :class:`Checkbutton`, > :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, > :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale` > -and :class:`Scrollbar`) will automatically substitute the Tk widgets. > +and :class:`Scrollbar`) will automatically substitute for the Tk widgets. > > -This has the direct benefit of using the new widgets which gives better > +This has the direct benefit of using the new widgets, giving better > look & feel across platforms, but you should be aware that they are not > totally compatible. The main difference you will find out is that widget > options such as "fg", "bg" and others related to widget styling are no > @@ -57,21 +57,22 @@ > > `Converting existing applications to use the Tile widgets `_ > A text which talks in Tcl terms about differences typically found when > - moving applications to use the new widgets. > + converting applications to use the new widgets. > > > Ttk Widgets > ----------- > > -Ttk comes with 17 widgets, where 11 of these already existed in Tkinter: > +Ttk comes with 17 widgets, 11 of which already exist in Tkinter: > :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, > -:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, > -:class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`. The others 6 are > -new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, > -:class:`Separator`, :class:`Sizegrip` and :class:`Treeview`. And all them are > +:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, > +:class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale` and > +:class:`Scrollbar`. The 6 new widget classes are: :class:`Combobox`, > +:class:`Notebook`, :class:`Progressbar`, :class:`Separator`, > +:class:`Sizegrip` and :class:`Treeview`. All of these classes are > subclasses of :class:`Widget`. > > -Like it was told before, you will notice changes in look & feel as well in the > +As said previously, you will notice changes in look-and-feel as well in the > styling code. To demonstrate the latter, a very simple example is shown below. > > Tk code:: > @@ -80,7 +81,7 @@ > l2 = Tkinter.Label(text="Test", fg="black", bg="white") > > > -Ttk code:: > +Corresponding Ttk code:: > > style = ttk.Style() > style.configure("BW.TLabel", foreground="black", background="white") > @@ -101,7 +102,7 @@ > Standard Options > ^^^^^^^^^^^^^^^^ > > -All the :mod:`ttk` Widgets accepts the following options: > +All the :mod:`ttk` widgets accept the following options: > > +-----------+--------------------------------------------------------------+ > | Option | Description | > @@ -110,18 +111,19 @@ > | | the option database for the window's other options, to | > | | determine the default bindtags for the window, and to select | > | | the widget's default layout and style. This is a read-only | > - | | which may only be specified when the window is created | > + | | option which may only be specified when the window is | > + | | created. | > +-----------+--------------------------------------------------------------+ > | cursor | Specifies the mouse cursor to be used for the widget. If set | > | | to the empty string (the default), the cursor is inherited | > - | | for the parent widget. | > + | | from the parent widget. | > +-----------+--------------------------------------------------------------+ > | takefocus | Determines whether the window accepts the focus during | > - | | keyboard traversal. 0, 1 or an empty is return. If 0 is | > - | | returned, it means that the window should be skipped entirely| > - | | during keyboard traversal. If 1, it means that the window | > - | | should receive the input focus as long as it is viewable. And| > - | | an empty string means that the traversal scripts make the | > + | | keyboard traversal. 0, 1 or an empty string is returned. | > + | | If 0, the window should be skipped entirely | > + | | during keyboard traversal. If 1, the window | > + | | should receive the input focus as long as it is viewable. | > + | | An empty string means that the traversal scripts make the | > | | decision about whether or not to focus on the window. | > +-----------+--------------------------------------------------------------+ > | style | May be used to specify a custom widget style. | > @@ -137,18 +139,19 @@ > +----------------+---------------------------------------------------------+ > | option | description | > +================+=========================================================+ > - | xscrollcommand | Used to comunicate with horizontal scrollbars. | > + | xscrollcommand | Used to communicate with horizontal scrollbars. | > | | | > - | | When the view in the widget's window change, the widget | > + | | When the view in the widget's window changes, the widget| > | | will generate a Tcl command based on the scrollcommand. | > | | | > - | | Usually this option consists of the method | > - | | :meth:`Scrollbar.set` of some scrollbar. This will cause| > + | | Usually this option consists of the | > + | | :meth:`Scrollbar.set` method of some scrollbar. This | > + | | will cause | > | | the scrollbar to be updated whenever the view in the | > | | window changes. | > +----------------+---------------------------------------------------------+ > - | yscrollcommand | Used to comunicate with vertical scrollbars. | > - | | For some more information, see above. | > + | yscrollcommand | Used to communicate with vertical scrollbars. | > + | | For more information, see above. | > +----------------+---------------------------------------------------------+ > > > @@ -172,14 +175,14 @@ > +--------------+-----------------------------------------------------------+ > | image | Specifies an image to display. This is a list of 1 or more| > | | elements. The first element is the default image name. The| > - | | rest of the list if a sequence of statespec/value pairs as| > + | | rest of the list is a sequence of statespec/value pairs as| > | | defined by :meth:`Style.map`, specifying different images | > | | to use when the widget is in a particular state or a | > | | combination of states. All images in the list should have | > | | the same size. | > +--------------+-----------------------------------------------------------+ > | compound | Specifies how to display the image relative to the text, | > - | | in the case both text and images options are present. | > + | | in the case both text and image options are present. | > | | Valid values are: | > | | | > | | * text: display text only | > @@ -190,7 +193,7 @@ > | | otherwise the text. | > +--------------+-----------------------------------------------------------+ > | width | If greater than zero, specifies how much space, in | > - | | character widths, to allocate for the text label, if less | > + | | character widths, to allocate for the text label; if less | > | | than zero, specifies a minimum width. If zero or | > | | unspecified, the natural width of the text label is used. | > +--------------+-----------------------------------------------------------+ > @@ -217,27 +220,27 @@ > | flag | description | > +============+=============================================================+ > | active | The mouse cursor is over the widget and pressing a mouse | > - | | button will cause some action to occur | > + | | button will cause some action to occur. | > +------------+-------------------------------------------------------------+ > - | disabled | Widget is disabled under program control | > + | disabled | Widget is disabled under program control. | > +------------+-------------------------------------------------------------+ > - | focus | Widget has keyboard focus | > + | focus | Widget has keyboard focus. | > +------------+-------------------------------------------------------------+ > - | pressed | Widget is being pressed | > + | pressed | Widget is being pressed. | > +------------+-------------------------------------------------------------+ > | selected | "On", "true", or "current" for things like Checkbuttons and | > - | | radiobuttons | > + | | radiobuttons. | > +------------+-------------------------------------------------------------+ > | background | Windows and Mac have a notion of an "active" or foreground | > | | window. The *background* state is set for widgets in a | > | | background window, and cleared for those in the foreground | > - | | window | > + | | window. | > +------------+-------------------------------------------------------------+ > - | readonly | Widget should not allow user modification | > + | readonly | Widget should not allow user modification. | > +------------+-------------------------------------------------------------+ > - | alternate | A widget-specific alternate display format | > + | alternate | A widget-specific alternate display format. | > +------------+-------------------------------------------------------------+ > - | invalid | The widget's value is invalid | > + | invalid | The widget's value is invalid. | > +------------+-------------------------------------------------------------+ > > A state specification is a sequence of state names, optionally prefixed with > @@ -248,7 +251,7 @@ > ^^^^^^^^^^ > > Besides the methods described below, the class :class:`ttk.Widget` supports the > -methods :meth:`Tkinter.Widget.cget` and :meth:`Tkinter.Widget.configure`. > +:meth:`Tkinter.Widget.cget` and :meth:`Tkinter.Widget.configure` methods. > > .. class:: Widget > > @@ -264,14 +267,14 @@ > > Test the widget's state. If a callback is not specified, returns True > if the widget state matches *statespec* and False otherwise. If callback > - is specified then it is called with args if widget state matches > + is specified then it is called with *args* if widget state matches > *statespec*. > > > .. method:: state([statespec=None]) > > - Modify or inquire widget state. If *statespec* is specified, sets the > - widget state according to it and return a new *statespec* indicating > + Modify or read widget state. If *statespec* is specified, sets the > + widget state accordingly and returns a new *statespec* indicating > which flags were changed. If *statespec* is not specified, returns > the currently-enabled state flags. > > @@ -284,39 +287,40 @@ > The :class:`ttk.Combobox` widget combines a text field with a pop-down list of > values. This widget is a subclass of :class:`Entry`. > > -Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, > +Besides the methods inherited from :class:`Widget` (:meth:`Widget.cget`, > :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` > -and :meth:`Widget.state`, and the following inherited from :class:`Entry`: > -:meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, > +and :meth:`Widget.state`) and those inherited from :class:`Entry` > +(:meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, > :meth:`Entry.index`, :meth:`Entry.inset`, :meth:`Entry.selection`, > -:meth:`Entry.xview`, it has some other methods, described at > +:meth:`Entry.xview`), this class has some other methods, described at > :class:`ttk.Combobox`. > > > Options > ^^^^^^^ > > -This widget accepts the following specific options: > +This widget accepts the following options: This is the only modification I'm not happy with. This widget accepts other options beyond these mentioned below, but the ones mentioned below are really specific to this widget. > > +-----------------+--------------------------------------------------------+ > | option | description | > +=================+========================================================+ > | exportselection | Boolean value. If set, the widget selection is linked | > | | to the Window Manager selection (which can be returned | > - | | by invoking Misc.selection_get, for example). | > + | | by invoking :meth:`Misc.selection_get`, for example). | > +-----------------+--------------------------------------------------------+ > | justify | Specifies how the text is aligned within the widget. | > | | One of "left", "center", or "right". | > +-----------------+--------------------------------------------------------+ > | height | Specifies the height of the pop-down listbox, in rows. | > +-----------------+--------------------------------------------------------+ > - | postcommand | A script (possibly registered with Misc.register) that | > + | postcommand | A script (possibly registered with | > + | | :meth:`Misc.register`) that | > | | is called immediately before displaying the values. It | > | | may specify which values to display. | > +-----------------+--------------------------------------------------------+ > | state | One of "normal", "readonly", or "disabled". In the | > | | "readonly" state, the value may not be edited directly,| > - | | and the user can only selection of the values from the | > + | | and the user can only select one of the values from the| > | | dropdown list. In the "normal" state, the text field is| > | | directly editable. In the "disabled" state, no | > | | interaction is possible. | > @@ -338,7 +342,7 @@ > Virtual events > ^^^^^^^^^^^^^^ > > -The combobox widgets generates a **<>** virtual event > +The combobox widget generates a **<>** virtual event > when the user selects an element from the list of values. > > > @@ -367,7 +371,7 @@ > Notebook > -------- > > -Ttk Notebook widget manages a collection of windows and displays a single > +The Ttk Notebook widget manages a collection of windows and displays a single > one at a time. Each child window is associated with a tab, which the user > may select to change the currently-displayed window. > > @@ -385,12 +389,12 @@ > | | Otherwise, the maximum height of all panes is used. | > +---------+----------------------------------------------------------------+ > | padding | Specifies the amount of extra space to add around the outside | > - | | of the notebook. The padding is a list up to four length | > - | | specifications left top right bottom. If fewer than four | > + | | of the notebook. The padding is a list of up to four length | > + | | specifications: left top right bottom. If fewer than four | > | | elements are specified, bottom defaults to top, right defaults | > | | to left, and top defaults to left. | > +---------+----------------------------------------------------------------+ > - | width | If present and greater than zero, specified the desired width | > + | width | If present and greater than zero, specifies the desired width | > | | of the pane area (not including internal padding). Otherwise, | > | | the maximum width of all panes is used. | > +---------+----------------------------------------------------------------+ > @@ -424,7 +428,7 @@ > | | image described in :class:`Widget`. | > +-----------+--------------------------------------------------------------+ > | compound | Specifies how to display the image relative to the text, in | > - | | the case both options text and image are present. See | > + | | the case both text and image options are present. See | > | | `Label Options`_ for legal values. | > +-----------+--------------------------------------------------------------+ > | underline | Specifies the index (0-based) of a character to underline in | > @@ -437,15 +441,15 @@ > Tab Identifiers > ^^^^^^^^^^^^^^^ > > -The tab_id present in several methods of :class:`ttk.Notebook` may take any > +The *tab_id* present in several methods of :class:`ttk.Notebook` may take any > of the following forms: > > -* An integer between zero and the number of tabs > -* The name of a child window > -* A positional specification of the form "@x,y", which identifies the tab > -* The literal string "current", which identifies the currently-selected tab > +* An integer between zero and the number of tabs. > +* The name of a child window. > +* A positional specification of the form "@x,y", which identifies the tab. > +* The literal string "current", which identifies the currently-selected tab. > * The literal string "end", which returns the number of tabs (only valid for > - :meth:`Notebook.index`) > + :meth:`Notebook.index`). > > > Virtual Events > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- -- Guilherme H. Polo Goncalves From python-checkins at python.org Sun Feb 1 15:09:05 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 15:09:05 +0100 (CET) Subject: [Python-checkins] r69189 - in python/branches/release30-maint: Include/code.h Include/object.h Misc/NEWS Objects/object.c Objects/typeobject.c Message-ID: <20090201140905.1821B1E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 15:09:04 2009 New Revision: 69189 Log: Merged revisions 69188 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69188 | mark.dickinson | 2009-02-01 13:59:22 +0000 (Sun, 01 Feb 2009) | 6 lines Issue #1717, continued: remove PyObject_Compare and Py_CmpToRich declarations from object.h; don't inherit tp_compare slot on subclasses; and raise TypeError when initializing a type that has a nonzero tp_compare slot. Fix up comparison-related comments in object.c and code.h. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Include/code.h python/branches/release30-maint/Include/object.h python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Objects/object.c python/branches/release30-maint/Objects/typeobject.c Modified: python/branches/release30-maint/Include/code.h ============================================================================== --- python/branches/release30-maint/Include/code.h (original) +++ python/branches/release30-maint/Include/code.h Sun Feb 1 15:09:04 2009 @@ -20,7 +20,7 @@ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest doesn't count for hash/cmp */ + /* The rest doesn't count for hash or comparisons */ PyObject *co_filename; /* unicode (where it was loaded from) */ PyObject *co_name; /* unicode (name, for reference) */ int co_firstlineno; /* first source line number */ Modified: python/branches/release30-maint/Include/object.h ============================================================================== --- python/branches/release30-maint/Include/object.h (original) +++ python/branches/release30-maint/Include/object.h Sun Feb 1 15:09:04 2009 @@ -426,10 +426,8 @@ PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Bytes(PyObject *); -PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); -PyAPI_FUNC(PyObject *) Py_CmpToRich(int op, int cmp); PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sun Feb 1 15:09:04 2009 @@ -12,9 +12,11 @@ Core and Builtins ----------------- -- Issue #1717: Remove builtin cmp() function, C-API functions - PyObject_Cmp and PyObject_Compare, and the support function - Py_CmpToRich. +- Issue #1717: Removed builtin cmp() function, dropped tp_compare + slot, the C API functions PyObject_Compare and PyUnicode_Compare and + the type definition cmpfunc. The tp_compare slot is reserved for + future usage. An attempt to initialize a type with a nonzero + tp_compare slot will raise TypeError. - Issue #4707: round(x, n) now returns an integer if x is an integer. Previously it returned a float. Modified: python/branches/release30-maint/Objects/object.c ============================================================================== --- python/branches/release30-maint/Objects/object.c (original) +++ python/branches/release30-maint/Objects/object.c Sun Feb 1 15:09:04 2009 @@ -495,35 +495,19 @@ return PyBytes_FromObject(v); } -/* The new comparison philosophy is: we completely separate three-way - comparison from rich comparison. That is, PyObject_Compare() and - PyObject_Cmp() *just* use the tp_compare slot. And PyObject_RichCompare() - and PyObject_RichCompareBool() *just* use the tp_richcompare slot. +/* For Python 3.0.1 and later, the old three-way comparison has been + completely removed in favour of rich comparisons. PyObject_Compare() and + PyObject_Cmp() are gone, and the builtin cmp function no longer exists. + The old tp_compare slot will be renamed to tp_reserved, and should no + longer be used. Use tp_richcompare instead. See (*) below for practical amendments. - IOW, only cmp() uses tp_compare; the comparison operators (==, !=, <=, <, - >=, >) only use tp_richcompare. Note that list.sort() only uses <. + tp_richcompare gets called with a first argument of the appropriate type + and a second object of an arbitrary type. We never do any kind of + coercion. - (And yes, eventually we'll rip out cmp() and tp_compare.) - - The calling conventions are different: tp_compare only gets called with two - objects of the appropriate type; tp_richcompare gets called with a first - argument of the appropriate type and a second object of an arbitrary type. - We never do any kind of coercion. - - The return conventions are also different. - - The tp_compare slot should return a C int, as follows: - - -1 if a < b or if an exception occurred - 0 if a == b - +1 if a > b - - No other return values are allowed. PyObject_Compare() has the same - calling convention. - - The tp_richcompare slot should return an object, as follows: + The tp_richcompare slot should return an object, as follows: NULL if an exception occurred NotImplemented if the requested comparison is not implemented @@ -539,9 +523,6 @@ comparing the object pointer (i.e. falling back to the base object implementation). - - If three-way comparison is not implemented, it falls back on rich - comparison (but not the other way around!). - */ /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ Modified: python/branches/release30-maint/Objects/typeobject.c ============================================================================== --- python/branches/release30-maint/Objects/typeobject.c (original) +++ python/branches/release30-maint/Objects/typeobject.c Sun Feb 1 15:09:04 2009 @@ -3662,7 +3662,7 @@ type->tp_setattr = base->tp_setattr; type->tp_setattro = base->tp_setattro; } - /* tp_compare see tp_richcompare */ + /* tp_compare is ignored, see tp_richcompare */ COPYSLOT(tp_repr); /* tp_hash see tp_richcompare */ COPYSLOT(tp_call); @@ -3670,12 +3670,10 @@ { /* Copy comparison-related slots only when not overriding them anywhere */ - if (type->tp_compare == NULL && - type->tp_richcompare == NULL && + if (type->tp_richcompare == NULL && type->tp_hash == NULL && !overrides_hash(type)) { - type->tp_compare = base->tp_compare; type->tp_richcompare = base->tp_richcompare; type->tp_hash = base->tp_hash; } @@ -3888,6 +3886,13 @@ goto error; } + /* Check reserved slots */ + if (type->tp_compare) { + PyErr_Format(PyExc_TypeError, + "type %s has tp_compare", + type->tp_name); + } + /* All done -- set the ready flag */ assert(type->tp_dict != NULL); type->tp_flags = From python-checkins at python.org Sun Feb 1 15:18:11 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 15:18:11 +0100 (CET) Subject: [Python-checkins] r69190 - in python/branches/py3k/Doc: includes/sqlite3/collation_reverse.py library/locale.rst library/operator.rst library/unittest.rst reference/expressions.rst tutorial/modules.rst Message-ID: <20090201141811.3EC381E4014@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 15:18:10 2009 New Revision: 69190 Log: Issue #1717: documentation fixes related to the cmp removal. Modified: python/branches/py3k/Doc/includes/sqlite3/collation_reverse.py python/branches/py3k/Doc/library/locale.rst python/branches/py3k/Doc/library/operator.rst python/branches/py3k/Doc/library/unittest.rst python/branches/py3k/Doc/reference/expressions.rst python/branches/py3k/Doc/tutorial/modules.rst Modified: python/branches/py3k/Doc/includes/sqlite3/collation_reverse.py ============================================================================== --- python/branches/py3k/Doc/includes/sqlite3/collation_reverse.py (original) +++ python/branches/py3k/Doc/includes/sqlite3/collation_reverse.py Sun Feb 1 15:18:10 2009 @@ -1,7 +1,12 @@ import sqlite3 def collate_reverse(string1, string2): - return -cmp(string1, string2) + if string1 == string2: + return 0 + elif string1 < string2: + return 1 + else: + return -1 con = sqlite3.connect(":memory:") con.create_collation("reverse", collate_reverse) Modified: python/branches/py3k/Doc/library/locale.rst ============================================================================== --- python/branches/py3k/Doc/library/locale.rst (original) +++ python/branches/py3k/Doc/library/locale.rst Sun Feb 1 15:18:10 2009 @@ -225,12 +225,11 @@ .. function:: strxfrm(string) - .. index:: builtin: cmp - - Transforms a string to one that can be used for the built-in function - :func:`cmp`, and still returns locale-aware results. This function can be used - when the same string is compared repeatedly, e.g. when collating a sequence of - strings. + Transforms a string to one that can be used in locale-aware + comparisons. For example, ``strxfrm(s1) < strxfrm(s2)`` is + equivalent to ``strcoll(s1, s2) < 0``. This function can be used + when the same string is compared repeatedly, e.g. when collating a + sequence of strings. .. function:: format(format, val[, grouping[, monetary]]) Modified: python/branches/py3k/Doc/library/operator.rst ============================================================================== --- python/branches/py3k/Doc/library/operator.rst (original) +++ python/branches/py3k/Doc/library/operator.rst Sun Feb 1 15:18:10 2009 @@ -43,9 +43,9 @@ equivalent to ``a < b``, ``le(a, b)`` is equivalent to ``a <= b``, ``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a != b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is equivalent to ``a - >= b``. Note that unlike the built-in :func:`cmp`, these functions can - return any value, which may or may not be interpretable as a Boolean value. - See :ref:`comparisons` for more information about rich comparisons. + >= b``. Note that these functions can return any value, which may + or may not be interpretable as a Boolean value. See + :ref:`comparisons` for more information about rich comparisons. The logical operations are also generally applicable to all objects, and support Modified: python/branches/py3k/Doc/library/unittest.rst ============================================================================== --- python/branches/py3k/Doc/library/unittest.rst (original) +++ python/branches/py3k/Doc/library/unittest.rst Sun Feb 1 15:18:10 2009 @@ -327,8 +327,9 @@ ``WidgetTestCase.testResize``. :class:`TestLoader` uses the ``'test'`` method name prefix to identify test methods automatically. -Note that the order in which the various test cases will be run is determined by -sorting the test function names with the built-in :func:`cmp` function. +Note that the order in which the various test cases will be run is +determined by sorting the test function names with respect to the +built-in ordering for strings. Often it is desirable to group suites of test cases together, so as to run tests for the whole system at once. This is easy, since :class:`TestSuite` instances @@ -921,9 +922,13 @@ .. attribute:: TestLoader.sortTestMethodsUsing Function to be used to compare method names when sorting them in - :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` methods. The - default value is the built-in :func:`cmp` function; the attribute can also be - set to :const:`None` to disable the sort. + :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` + methods. This should be a function that takes two arguments + ``self`` and ``other``, and returns ``-1`` if ``self`` precedes + ``other`` in the desired ordering, ``1`` if ``other`` precedes + ``self``, and ``0`` if ``self`` and ``other`` are equal. The + default ordering is the built-in ordering for strings. This + attribute can also be set to :const:`None` to disable the sort. .. attribute:: TestLoader.suiteClass Modified: python/branches/py3k/Doc/reference/expressions.rst ============================================================================== --- python/branches/py3k/Doc/reference/expressions.rst (original) +++ python/branches/py3k/Doc/reference/expressions.rst Sun Feb 1 15:18:10 2009 @@ -1022,8 +1022,8 @@ length. If not equal, the sequences are ordered the same as their first differing - elements. For example, ``cmp([1,2,x], [1,2,y])`` returns the same as - ``cmp(x,y)``. If the corresponding element does not exist, the shorter + elements. For example, ``[1,2,x] <= [1,2,y]`` has the same value as + ``x <= y``. If the corresponding element does not exist, the shorter sequence is ordered first (for example, ``[1,2] < [1,2,3]``). * Mappings (dictionaries) compare equal if and only if their sorted ``(key, Modified: python/branches/py3k/Doc/tutorial/modules.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/modules.rst (original) +++ python/branches/py3k/Doc/tutorial/modules.rst Sun Feb 1 15:18:10 2009 @@ -317,25 +317,25 @@ >>> dir(builtins) ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer - Error', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Excep - tion', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError - ', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', - 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImp - lemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecatio - nWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StopIteration', - 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', - 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', ' - UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueE - rror', 'Warning', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__' - , '__import__', '__name__', 'abs', 'all', 'any', 'basestring', 'bin', 'bool', 'b - uffer', 'bytes', 'chr', 'chr8', 'classmethod', 'cmp', 'compile', 'complex', 'cop - yright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'ex - ec', 'exit', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'h - ash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', ' - len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'o - bject', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr - ', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'st - r', 'str8', 'sum', 'super', 'trunc', 'tuple', 'type', 'vars', 'zip'] + Error', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'Environme + ntError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato + rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexErr + or', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', + 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P + endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', ' + StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'Ta + bError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'Unicod + eEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserW + arning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__deb + ug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', + 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'chr', 'classmethod', 'compile', ' + complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate + ', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', + 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', + 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memory + view', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property' + , 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sort + ed', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip'] .. _tut-packages: From python-checkins at python.org Sun Feb 1 15:19:33 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 15:19:33 +0100 (CET) Subject: [Python-checkins] r69191 - in python/branches/release30-maint: Doc/includes/sqlite3/collation_reverse.py Doc/library/locale.rst Doc/library/operator.rst Doc/library/unittest.rst Doc/reference/expressions.rst Doc/tutorial/modules.rst Message-ID: <20090201141933.5C64E1E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 15:19:33 2009 New Revision: 69191 Log: Merged revisions 69190 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69190 | mark.dickinson | 2009-02-01 14:18:10 +0000 (Sun, 01 Feb 2009) | 2 lines Issue #1717: documentation fixes related to the cmp removal. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/includes/sqlite3/collation_reverse.py python/branches/release30-maint/Doc/library/locale.rst python/branches/release30-maint/Doc/library/operator.rst python/branches/release30-maint/Doc/library/unittest.rst python/branches/release30-maint/Doc/reference/expressions.rst python/branches/release30-maint/Doc/tutorial/modules.rst Modified: python/branches/release30-maint/Doc/includes/sqlite3/collation_reverse.py ============================================================================== --- python/branches/release30-maint/Doc/includes/sqlite3/collation_reverse.py (original) +++ python/branches/release30-maint/Doc/includes/sqlite3/collation_reverse.py Sun Feb 1 15:19:33 2009 @@ -1,7 +1,12 @@ import sqlite3 def collate_reverse(string1, string2): - return -cmp(string1, string2) + if string1 == string2: + return 0 + elif string1 < string2: + return 1 + else: + return -1 con = sqlite3.connect(":memory:") con.create_collation("reverse", collate_reverse) Modified: python/branches/release30-maint/Doc/library/locale.rst ============================================================================== --- python/branches/release30-maint/Doc/library/locale.rst (original) +++ python/branches/release30-maint/Doc/library/locale.rst Sun Feb 1 15:19:33 2009 @@ -225,12 +225,11 @@ .. function:: strxfrm(string) - .. index:: builtin: cmp - - Transforms a string to one that can be used for the built-in function - :func:`cmp`, and still returns locale-aware results. This function can be used - when the same string is compared repeatedly, e.g. when collating a sequence of - strings. + Transforms a string to one that can be used in locale-aware + comparisons. For example, ``strxfrm(s1) < strxfrm(s2)`` is + equivalent to ``strcoll(s1, s2) < 0``. This function can be used + when the same string is compared repeatedly, e.g. when collating a + sequence of strings. .. function:: format(format, val[, grouping[, monetary]]) Modified: python/branches/release30-maint/Doc/library/operator.rst ============================================================================== --- python/branches/release30-maint/Doc/library/operator.rst (original) +++ python/branches/release30-maint/Doc/library/operator.rst Sun Feb 1 15:19:33 2009 @@ -43,9 +43,9 @@ equivalent to ``a < b``, ``le(a, b)`` is equivalent to ``a <= b``, ``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a != b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is equivalent to ``a - >= b``. Note that unlike the built-in :func:`cmp`, these functions can - return any value, which may or may not be interpretable as a Boolean value. - See :ref:`comparisons` for more information about rich comparisons. + >= b``. Note that these functions can return any value, which may + or may not be interpretable as a Boolean value. See + :ref:`comparisons` for more information about rich comparisons. The logical operations are also generally applicable to all objects, and support Modified: python/branches/release30-maint/Doc/library/unittest.rst ============================================================================== --- python/branches/release30-maint/Doc/library/unittest.rst (original) +++ python/branches/release30-maint/Doc/library/unittest.rst Sun Feb 1 15:19:33 2009 @@ -327,8 +327,9 @@ ``WidgetTestCase.testResize``. :class:`TestLoader` uses the ``'test'`` method name prefix to identify test methods automatically. -Note that the order in which the various test cases will be run is determined by -sorting the test function names with the built-in :func:`cmp` function. +Note that the order in which the various test cases will be run is +determined by sorting the test function names with respect to the +built-in ordering for strings. Often it is desirable to group suites of test cases together, so as to run tests for the whole system at once. This is easy, since :class:`TestSuite` instances @@ -916,9 +917,13 @@ .. attribute:: TestLoader.sortTestMethodsUsing Function to be used to compare method names when sorting them in - :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` methods. The - default value is the built-in :func:`cmp` function; the attribute can also be - set to :const:`None` to disable the sort. + :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` + methods. This should be a function that takes two arguments + ``self`` and ``other``, and returns ``-1`` if ``self`` precedes + ``other`` in the desired ordering, ``1`` if ``other`` precedes + ``self``, and ``0`` if ``self`` and ``other`` are equal. The + default ordering is the built-in ordering for strings. This + attribute can also be set to :const:`None` to disable the sort. .. attribute:: TestLoader.suiteClass Modified: python/branches/release30-maint/Doc/reference/expressions.rst ============================================================================== --- python/branches/release30-maint/Doc/reference/expressions.rst (original) +++ python/branches/release30-maint/Doc/reference/expressions.rst Sun Feb 1 15:19:33 2009 @@ -1022,8 +1022,8 @@ length. If not equal, the sequences are ordered the same as their first differing - elements. For example, ``cmp([1,2,x], [1,2,y])`` returns the same as - ``cmp(x,y)``. If the corresponding element does not exist, the shorter + elements. For example, ``[1,2,x] <= [1,2,y]`` has the same value as + ``x <= y``. If the corresponding element does not exist, the shorter sequence is ordered first (for example, ``[1,2] < [1,2,3]``). * Mappings (dictionaries) compare equal if and only if their sorted ``(key, Modified: python/branches/release30-maint/Doc/tutorial/modules.rst ============================================================================== --- python/branches/release30-maint/Doc/tutorial/modules.rst (original) +++ python/branches/release30-maint/Doc/tutorial/modules.rst Sun Feb 1 15:19:33 2009 @@ -317,25 +317,25 @@ >>> dir(builtins) ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer - Error', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Excep - tion', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError - ', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', - 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImp - lemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecatio - nWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StopIteration', - 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', - 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', ' - UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueE - rror', 'Warning', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__' - , '__import__', '__name__', 'abs', 'all', 'any', 'basestring', 'bin', 'bool', 'b - uffer', 'bytes', 'chr', 'chr8', 'classmethod', 'cmp', 'compile', 'complex', 'cop - yright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'ex - ec', 'exit', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'h - ash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', ' - len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'o - bject', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr - ', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'st - r', 'str8', 'sum', 'super', 'trunc', 'tuple', 'type', 'vars', 'zip'] + Error', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'Environme + ntError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato + rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexErr + or', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', + 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P + endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', ' + StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'Ta + bError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'Unicod + eEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserW + arning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__deb + ug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', + 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'chr', 'classmethod', 'compile', ' + complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate + ', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', + 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', + 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memory + view', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property' + , 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sort + ed', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip'] .. _tut-packages: From buildbot at python.org Sun Feb 1 15:49:49 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 14:49:49 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.x Message-ID: <20090201144949.C138D1E4002@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.x/builds/203 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_timeout ====================================================================== ERROR: testRecvTimeout (test.test_timeout.TimeoutTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/test/test_timeout.py", line 133, in testRecvTimeout self.sock.connect(self.addr_remote) socket.error: [Errno 110] Connection timed out make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 15:53:16 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 14:53:16 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20090201145316.901361E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/123 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1082, in http_open return self.do_open(http.client.HTTPConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: 1 test failed: test_robotparser ====================================================================== ERROR: testPythonOrg (test.test_robotparser.NetworkTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1068, in do_open h.request(req.get_method(), req.get_selector(), req.data, headers) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 856, in request self._send_request(method, url, body, headers) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 900, in _send_request self.endheaders() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 851, in endheaders self._send_output(message_body) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 709, in _send_output self.send(msg) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 663, in send self.connect() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/http/client.py", line 647, in connect self.timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/socket.py", line 307, in create_connection raise error(msg) socket.error: [Errno 101] Network is unreachable Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1082, in http_open return self.do_open(http.client.HTTPConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1082, in http_open return self.do_open(http.client.HTTPConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 16:08:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 15:08:50 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.x Message-ID: <20090201150850.5FC281E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.x/builds/234 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 16:37:24 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 15:37:24 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090201153724.D4F241E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/116 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_distutils test_posix test_subprocess ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 17:44:05 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 16:44:05 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: <20090201164405.4C8441E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.0/builds/89 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_urllibnet.py", line 108, in test_getcode open_url = urllib.request.FancyURLopener().open(URL) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\urllib\request.py", line 1448, in open raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\urllib\request.py", line 1444, in open return getattr(self, name)(url) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\urllib\request.py", line 1618, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\urllib\request.py", line 1598, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 856, in request self._send_request(method, url, body, headers) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 900, in _send_request self.endheaders() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 851, in endheaders self._send_output(message_body) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 709, in _send_output self.send(msg) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 663, in send self.connect() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 647, in connect self.timeout) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 307, in create_connection raise error(msg) IOError: [Errno socket error] [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 1 test failed: test_urllibnet sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 21:36:08 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 21:36:08 +0100 (CET) Subject: [Python-checkins] r69192 - python/branches/py3k/Objects/typeobject.c Message-ID: <20090201203608.817E81E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 21:36:08 2009 New Revision: 69192 Log: Remove exception for non-NULL tp_compare that was introduced in r69188. Modified: python/branches/py3k/Objects/typeobject.c Modified: python/branches/py3k/Objects/typeobject.c ============================================================================== --- python/branches/py3k/Objects/typeobject.c (original) +++ python/branches/py3k/Objects/typeobject.c Sun Feb 1 21:36:08 2009 @@ -3886,13 +3886,6 @@ goto error; } - /* Check reserved slots */ - if (type->tp_compare) { - PyErr_Format(PyExc_TypeError, - "type %s has tp_compare", - type->tp_name); - } - /* All done -- set the ready flag */ assert(type->tp_dict != NULL); type->tp_flags = From python-checkins at python.org Sun Feb 1 21:37:23 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 1 Feb 2009 21:37:23 +0100 (CET) Subject: [Python-checkins] r69193 - in python/branches/release30-maint: Objects/typeobject.c Message-ID: <20090201203723.4CA251E4002@bag.python.org> Author: mark.dickinson Date: Sun Feb 1 21:37:23 2009 New Revision: 69193 Log: Merged revisions 69192 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r69192 | mark.dickinson | 2009-02-01 20:36:08 +0000 (Sun, 01 Feb 2009) | 2 lines Remove exception for non-NULL tp_compare that was introduced in r69188. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Objects/typeobject.c Modified: python/branches/release30-maint/Objects/typeobject.c ============================================================================== --- python/branches/release30-maint/Objects/typeobject.c (original) +++ python/branches/release30-maint/Objects/typeobject.c Sun Feb 1 21:37:23 2009 @@ -3886,13 +3886,6 @@ goto error; } - /* Check reserved slots */ - if (type->tp_compare) { - PyErr_Format(PyExc_TypeError, - "type %s has tp_compare", - type->tp_name); - } - /* All done -- set the ready flag */ assert(type->tp_dict != NULL); type->tp_flags = From buildbot at python.org Sun Feb 1 22:21:24 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 21:21:24 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090201212125.058031E400C@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/218 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_posix ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Sun Feb 1 23:15:24 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Feb 2009 22:15:24 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090201221524.A435B1E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/118 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Sun Feb 1 23:57:18 2009 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 1 Feb 2009 23:57:18 +0100 (CET) Subject: [Python-checkins] r69194 - python/branches/io-c/Modules/_bufferedio.c Message-ID: <20090201225718.948BD1E4002@bag.python.org> Author: antoine.pitrou Date: Sun Feb 1 23:57:18 2009 New Revision: 69194 Log: Fix downcasting warnings in 32-bit mode with 64-bit offsets (Windows) Modified: python/branches/io-c/Modules/_bufferedio.c Modified: python/branches/io-c/Modules/_bufferedio.c ============================================================================== --- python/branches/io-c/Modules/_bufferedio.c (original) +++ python/branches/io-c/Modules/_bufferedio.c Sun Feb 1 23:57:18 2009 @@ -742,7 +742,7 @@ all `n` bytes asked by the caller (and possibly more, so as to fill our buffer for the next reads). */ - have = READAHEAD(self); + have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); if (have > 0) { if (n > have) n = have; @@ -810,7 +810,7 @@ ENTER_BUFFERED(self) /* First, try to find a line in the buffer */ - n = READAHEAD(self); + n = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); if (limit >= 0 && n > limit) n = limit; start = self->buffer + self->pos; @@ -1167,7 +1167,7 @@ { Py_ssize_t start, len, n; if (VALID_READ_BUFFER(self)) - start = self->read_end; + start = Py_SAFE_DOWNCAST(self->read_end, Py_off_t, Py_ssize_t); else start = 0; len = self->buffer_size - start; @@ -1194,7 +1194,7 @@ return NULL; /* First copy what we have in the current buffer. */ - current_size = READAHEAD(self); + current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); data = NULL; if (current_size) { data = PyBytes_FromStringAndSize( @@ -1263,7 +1263,7 @@ } /* The number of bytes to read is specified, return at most n bytes. */ - current_size = READAHEAD(self); + current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); if (n <= current_size) { /* Fast path: the data to read is fully buffered. */ res = PyBytes_FromStringAndSize(self->buffer + self->pos, n); @@ -1358,7 +1358,7 @@ { Py_ssize_t have, r; - have = READAHEAD(self); + have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); /* Constraints: 1. we don't want to advance the file position. 2. we don't want to lose block alignment, so we can't shift the buffer @@ -1560,7 +1560,8 @@ while (self->write_pos < self->write_end) { n = _BufferedWriter_raw_write(self, self->buffer + self->write_pos, - self->write_end - self->write_pos); + Py_SAFE_DOWNCAST(self->write_end - self->write_pos, + Py_off_t, Py_ssize_t)); if (n == -1) { Py_ssize_t *w = _Buffered_check_blocking_error(); if (w == NULL) @@ -1574,7 +1575,7 @@ } self->write_pos += n; self->raw_pos = self->write_pos; - written += n; + written += Py_SAFE_DOWNCAST(n, Py_off_t, Py_ssize_t); } if (restore_pos) { @@ -1621,7 +1622,7 @@ self->pos = 0; self->raw_pos = 0; } - avail = self->buffer_size - self->pos; + avail = Py_SAFE_DOWNCAST(self->buffer_size - self->pos, Py_off_t, Py_ssize_t); if (buf.len <= avail) { memcpy(self->buffer + self->pos, buf.buf, buf.len); if (!VALID_WRITE_BUFFER(self)) { @@ -1645,12 +1646,14 @@ /* Make some place by shifting the buffer. */ assert(VALID_WRITE_BUFFER(self)); memmove(self->buffer, self->buffer + self->write_pos, - self->write_end - self->write_pos); + Py_SAFE_DOWNCAST(self->write_end - self->write_pos, + Py_off_t, Py_ssize_t)); self->write_end -= self->write_pos; self->raw_pos -= self->write_pos; self->pos -= self->write_pos; self->write_pos = 0; - avail = self->buffer_size - self->write_end; + avail = Py_SAFE_DOWNCAST(self->buffer_size - self->write_end, + Py_off_t, Py_ssize_t); if (buf.len <= avail) { /* Everything can be buffered */ PyErr_Clear(); From python-checkins at python.org Mon Feb 2 01:38:54 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 2 Feb 2009 01:38:54 +0100 (CET) Subject: [Python-checkins] r69195 - in python/trunk/Lib/lib-tk/test/test_ttk: support.py test_extensions.py test_style.py test_widgets.py Message-ID: <20090202003854.B2AA81E4002@bag.python.org> Author: guilherme.polo Date: Mon Feb 2 01:38:54 2009 New Revision: 69195 Log: Use a single Tcl interpreter through all these tests, this may help some failing buildbots. Modified: python/trunk/Lib/lib-tk/test/test_ttk/support.py python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py python/trunk/Lib/lib-tk/test/test_ttk/test_style.py python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py Modified: python/trunk/Lib/lib-tk/test/test_ttk/support.py ============================================================================== --- python/trunk/Lib/lib-tk/test/test_ttk/support.py (original) +++ python/trunk/Lib/lib-tk/test/test_ttk/support.py Mon Feb 2 01:38:54 2009 @@ -15,6 +15,14 @@ return root +def root_deiconify(): + root = get_tk_root() + root.deiconify() + +def root_withdraw(): + root = get_tk_root() + root.withdraw() + def simulate_mouse_click(widget, x, y): """Generate proper events to click at the x, y position (tries to act Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py ============================================================================== --- python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py (original) +++ python/trunk/Lib/lib-tk/test/test_ttk/test_extensions.py Mon Feb 2 01:38:54 2009 @@ -10,6 +10,13 @@ class LabeledScaleTest(unittest.TestCase): + def setUp(self): + support.root_deiconify() + + def tearDown(self): + support.root_withdraw() + + def test_widget_destroy(self): # automatically created variable x = ttk.LabeledScale() @@ -175,12 +182,12 @@ class OptionMenuTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.textvar = Tkinter.StringVar(self.root) + support.root_deiconify() + self.textvar = Tkinter.StringVar() def tearDown(self): del self.textvar - self.root.destroy() + support.root_withdraw() def test_widget_destroy(self): Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_style.py ============================================================================== --- python/trunk/Lib/lib-tk/test/test_ttk/test_style.py (original) +++ python/trunk/Lib/lib-tk/test/test_ttk/test_style.py Mon Feb 2 01:38:54 2009 @@ -10,15 +10,7 @@ class StyleTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.style = ttk.Style(self.root) - - def tearDown(self): - # As tests have shown, these tests are likely to deliver - # <> events after the root is destroyed, so - # lets let them happen now. - self.root.update_idletasks() - self.root.destroy() + self.style = ttk.Style() def test_configure(self): Modified: python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py ============================================================================== --- python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py (original) +++ python/trunk/Lib/lib-tk/test/test_ttk/test_widgets.py Mon Feb 2 01:38:54 2009 @@ -12,12 +12,14 @@ """Tests methods available in every ttk widget.""" def setUp(self): + support.root_deiconify() self.widget = ttk.Button() self.widget.pack() self.widget.wait_visibility() def tearDown(self): self.widget.destroy() + support.root_withdraw() def test_identify(self): @@ -107,10 +109,12 @@ class ComboboxTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.combo = ttk.Combobox() def tearDown(self): self.combo.destroy() + support.root_withdraw() def _show_drop_down_listbox(self): width = self.combo.winfo_width() @@ -195,10 +199,12 @@ class EntryTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.entry = ttk.Entry() def tearDown(self): self.entry.destroy() + support.root_withdraw() def test_bbox(self): @@ -297,10 +303,12 @@ class PanedwindowTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.paned = ttk.Panedwindow() def tearDown(self): self.paned.destroy() + support.root_withdraw() def test_add(self): @@ -445,12 +453,14 @@ class ScaleTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.scale = ttk.Scale() self.scale.pack() self.scale.update() def tearDown(self): self.scale.destroy() + support.root_withdraw() def test_custom_event(self): @@ -519,6 +529,7 @@ class NotebookTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.nb = ttk.Notebook() self.child1 = ttk.Label() self.child2 = ttk.Label() @@ -529,6 +540,7 @@ self.child1.destroy() self.child2.destroy() self.nb.destroy() + support.root_withdraw() def test_tab_identifiers(self): @@ -708,13 +720,12 @@ class TreeviewTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.tv = ttk.Treeview(self.root) + support.root_deiconify() + self.tv = ttk.Treeview() def tearDown(self): self.tv.destroy() - self.root.update_idletasks() - self.root.destroy() + support.root_withdraw() def test_bbox(self): From python-checkins at python.org Mon Feb 2 01:42:09 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 2 Feb 2009 01:42:09 +0100 (CET) Subject: [Python-checkins] r69196 - python/branches/release26-maint Message-ID: <20090202004209.6F3F21E4002@bag.python.org> Author: guilherme.polo Date: Mon Feb 2 01:42:09 2009 New Revision: 69196 Log: Blocked revisions 69169,69195 via svnmerge ........ r69169 | guilherme.polo | 2009-02-01 00:56:16 -0200 (Sun, 01 Feb 2009) | 3 lines Restore Tkinter.Tk._loadtk so this test doesn't fail for problems related to ttk. ........ r69195 | guilherme.polo | 2009-02-01 22:38:54 -0200 (Sun, 01 Feb 2009) | 3 lines Use a single Tcl interpreter through all these tests, this may help some failing buildbots. ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Mon Feb 2 02:02:20 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 2 Feb 2009 02:02:20 +0100 (CET) Subject: [Python-checkins] r69197 - in python/branches/py3k: Lib/tkinter/test/support.py Lib/tkinter/test/test_ttk/test_extensions.py Lib/tkinter/test/test_ttk/test_style.py Lib/tkinter/test/test_ttk/test_widgets.py Message-ID: <20090202010220.BBE421E4002@bag.python.org> Author: guilherme.polo Date: Mon Feb 2 02:02:20 2009 New Revision: 69197 Log: Recorded merge of revisions 69195 via svnmerge from svn+ssh://pythondev/python/trunk ........ r69195 | guilherme.polo | 2009-02-01 22:38:54 -0200 (Sun, 01 Feb 2009) | 3 lines Use a single Tcl interpreter through all these tests, this may help some failing buildbots. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/tkinter/test/support.py python/branches/py3k/Lib/tkinter/test/test_ttk/test_extensions.py python/branches/py3k/Lib/tkinter/test/test_ttk/test_style.py python/branches/py3k/Lib/tkinter/test/test_ttk/test_widgets.py Modified: python/branches/py3k/Lib/tkinter/test/support.py ============================================================================== --- python/branches/py3k/Lib/tkinter/test/support.py (original) +++ python/branches/py3k/Lib/tkinter/test/support.py Mon Feb 2 02:02:20 2009 @@ -15,6 +15,14 @@ return root +def root_deiconify(): + root = get_tk_root() + root.deiconify() + +def root_withdraw(): + root = get_tk_root() + root.withdraw() + def simulate_mouse_click(widget, x, y): """Generate proper events to click at the x, y position (tries to act Modified: python/branches/py3k/Lib/tkinter/test/test_ttk/test_extensions.py ============================================================================== --- python/branches/py3k/Lib/tkinter/test/test_ttk/test_extensions.py (original) +++ python/branches/py3k/Lib/tkinter/test/test_ttk/test_extensions.py Mon Feb 2 02:02:20 2009 @@ -10,6 +10,13 @@ class LabeledScaleTest(unittest.TestCase): + def setUp(self): + support.root_deiconify() + + def tearDown(self): + support.root_withdraw() + + def test_widget_destroy(self): # automatically created variable x = ttk.LabeledScale() @@ -175,12 +182,12 @@ class OptionMenuTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.textvar = tkinter.StringVar(self.root) + support.root_deiconify() + self.textvar = tkinter.StringVar() def tearDown(self): del self.textvar - self.root.destroy() + support.root_withdraw() def test_widget_destroy(self): Modified: python/branches/py3k/Lib/tkinter/test/test_ttk/test_style.py ============================================================================== --- python/branches/py3k/Lib/tkinter/test/test_ttk/test_style.py (original) +++ python/branches/py3k/Lib/tkinter/test/test_ttk/test_style.py Mon Feb 2 02:02:20 2009 @@ -10,15 +10,7 @@ class StyleTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.style = ttk.Style(self.root) - - def tearDown(self): - # As tests have shown, these tests are likely to deliver - # <> events after the root is destroyed, so - # lets let them happen now. - self.root.update_idletasks() - self.root.destroy() + self.style = ttk.Style() def test_configure(self): Modified: python/branches/py3k/Lib/tkinter/test/test_ttk/test_widgets.py ============================================================================== --- python/branches/py3k/Lib/tkinter/test/test_ttk/test_widgets.py (original) +++ python/branches/py3k/Lib/tkinter/test/test_ttk/test_widgets.py Mon Feb 2 02:02:20 2009 @@ -12,12 +12,14 @@ """Tests methods available in every ttk widget.""" def setUp(self): + support.root_deiconify() self.widget = ttk.Button() self.widget.pack() self.widget.wait_visibility() def tearDown(self): self.widget.destroy() + support.root_withdraw() def test_identify(self): @@ -107,10 +109,12 @@ class ComboboxTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.combo = ttk.Combobox() def tearDown(self): self.combo.destroy() + support.root_withdraw() def _show_drop_down_listbox(self): width = self.combo.winfo_width() @@ -195,10 +199,12 @@ class EntryTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.entry = ttk.Entry() def tearDown(self): self.entry.destroy() + support.root_withdraw() def test_bbox(self): @@ -297,10 +303,12 @@ class PanedwindowTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.paned = ttk.Panedwindow() def tearDown(self): self.paned.destroy() + support.root_withdraw() def test_add(self): @@ -445,12 +453,14 @@ class ScaleTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.scale = ttk.Scale() self.scale.pack() self.scale.update() def tearDown(self): self.scale.destroy() + support.root_withdraw() def test_custom_event(self): @@ -519,6 +529,7 @@ class NotebookTest(unittest.TestCase): def setUp(self): + support.root_deiconify() self.nb = ttk.Notebook() self.child1 = ttk.Label() self.child2 = ttk.Label() @@ -529,6 +540,7 @@ self.child1.destroy() self.child2.destroy() self.nb.destroy() + support.root_withdraw() def test_tab_identifiers(self): @@ -708,13 +720,12 @@ class TreeviewTest(unittest.TestCase): def setUp(self): - self.root = support.get_tk_root() - self.tv = ttk.Treeview(self.root) + support.root_deiconify() + self.tv = ttk.Treeview() def tearDown(self): self.tv.destroy() - self.root.update_idletasks() - self.root.destroy() + support.root_withdraw() def test_bbox(self): From buildbot at python.org Mon Feb 2 02:09:11 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 01:09:11 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090202010911.8547B1E4002@bag.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/580 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asynchat make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 03:01:32 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 02:01:32 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 2.6 Message-ID: <20090202020132.EE0071E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%202.6/builds/83 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: gregory.p.smith,guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 Traceback (most recent call last): File "/home/pybot/buildarea/2.6.klose-debian-ppc/build/Lib/threading.py", line 522, in __bootstrap_inner self.run() File "/home/pybot/buildarea/2.6.klose-debian-ppc/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/2.6.klose-debian-ppc/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/2.6.klose-debian-ppc/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30994, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 04:16:23 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 03:16:23 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.x Message-ID: <20090202031623.2EB6A1E4002@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.x/builds/205 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/test/test_http_cookiejar.py", line 1438, in test_rejection c.load(filename, ignore_discard=True) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/http/cookiejar.py", line 1756, in load f.close() File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/io.py", line 1469, in close self.buffer.close() File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/io.py", line 749, in close self.raw.close() File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/io.py", line 625, in close _fileio._FileIO.close(self) IOError: [Errno 9] Bad file descriptor 1 test failed: test_http_cookiejar make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 06:29:37 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 05:29:37 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 2.6 Message-ID: <20090202052938.8041E1E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%202.6/builds/73 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: gregory.p.smith,guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 21, in test01_badpointer dbs = dbshelve.open(self.filename) File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\dbshelve.py", line 106, in open d.open(filename, dbname, filetype, flags, mode) File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\dbshelve.py", line 171, in open self.db.open(*args, **kwargs) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 37, in test03_repr_closed_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test04_repr_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 43, in test04_repr_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test05_double_free_make_key_dbt (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 65, in test05_double_free_make_key_dbt db.DB_CREATE | db.DB_THREAD) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test06_key_with_null_bytes (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 77, in test06_key_with_null_bytes db1.open(self.filename, None, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test07_DB_set_flags_persists (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.6.bolen-windows\build\lib\bsddb\test\test_misc.py", line 101, in test07_DB_set_flags_persists db1.open(self.filename, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') sincerely, -The Buildbot From python-checkins at python.org Mon Feb 2 06:58:30 2009 From: python-checkins at python.org (brett.cannon) Date: Mon, 2 Feb 2009 06:58:30 +0100 (CET) Subject: [Python-checkins] r69198 - python/branches/py3k/Lib/importlib/NOTES Message-ID: <20090202055830.6C0C11E4002@bag.python.org> Author: brett.cannon Date: Mon Feb 2 06:58:30 2009 New Revision: 69198 Log: Note to move __package__ stuff over to rpartition to make Nick happy. Also make sure that accepting the empty string for top-level modules is okay. Modified: python/branches/py3k/Lib/importlib/NOTES Modified: python/branches/py3k/Lib/importlib/NOTES ============================================================================== --- python/branches/py3k/Lib/importlib/NOTES (original) +++ python/branches/py3k/Lib/importlib/NOTES Mon Feb 2 06:58:30 2009 @@ -1,6 +1,10 @@ to do ///// +* Use rpartition for getting the package of a module. + + + Make sure that an empty string is acceptable for __package__. + * Create meta_path importer for sys.path. + Create hook. From buildbot at python.org Mon Feb 2 07:32:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 06:32:09 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090202063209.7DACD1E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/168 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 07:38:21 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 06:38:21 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.x Message-ID: <20090202063822.4D2121E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.x/builds/268 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 07:43:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 06:43:09 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090202064310.2E23B1E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/220 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_posix ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Feb 2 07:49:12 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 2 Feb 2009 07:49:12 +0100 (CET) Subject: [Python-checkins] r69199 - sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Message-ID: <20090202064912.89E711E4002@bag.python.org> Author: raymond.hettinger Date: Mon Feb 2 07:49:12 2009 New Revision: 69199 Log: Add a fragmentation step and a vacuum step. Record the results. Modified: sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Modified: sandbox/trunk/dbm_sqlite/alt/time_sqlite.py ============================================================================== --- sandbox/trunk/dbm_sqlite/alt/time_sqlite.py (original) +++ sandbox/trunk/dbm_sqlite/alt/time_sqlite.py Mon Feb 2 07:49:12 2009 @@ -1,16 +1,8 @@ ''' Testbench and timing routines to figure-out the fastest schema for shelves. -With unique index or primary key or no index. - Insertion speed (do we pay a high price for reindexing on every commit) - Individual Lookup speed (regular value, masked key, uncommitted key) - Speed of replacing vs inserting. - Speed of: - 'select *' - 'select * order by key' - 'select * order by rowid' - Do 'select key', 'select *', and 'select value' all produce the same order? +Todo: Delayed commits: How much insertion speed is gained by n-period commits @@ -19,19 +11,10 @@ Do 'select key', 'select *', and 'select value' all produce the same order? -Same tests, but first fragment the snot out of the db. - -What about deletions and fragmentation? -Cost and effects of vacuuming. -BLOB vs TEXT - ------------------------------------------------------------------ -no diff twixt "select *" and "select k,v" # prefer latter for specificity -no diff twixt "select *" and "select * by rowid" # prefer latter for specificity -no diff for "select *" whether unindexed, primary key, and indexed -? do those results hold after fragmenting -"order by key" is twice as slow as unordered, even with indexing -effect of "primary key" and a unique index is the same +With unique index or primary key or no index. + Insertion speed (do we pay a high price for reindexing on every commit) + Individual Lookup speed (regular value, masked key, uncommitted key) + ''' from random import * @@ -54,6 +37,22 @@ CREATE UNIQUE INDEX IF NOT EXISTS keyndx ON shelf (key); ''', 'UNIQ') + +MAKE_shelf = (''' + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key BLOB NOT NULL, value BLOB NOT NULL); +''', 'UNINDEXED') +MAKE_shelf_PRIMARY = (''' + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key BLOB PRIMARY KEY, value BLOB NOT NULL); +''', 'PRIMARY') +MAKE_shelf_UNIQUE = (''' + DROP INDEX IF EXISTS keyndx; DROP TABLE IF EXISTS shelf; + CREATE TABLE IF NOT EXISTS shelf (key BLOB NOT NULL, value BLOB NOT NULL); + CREATE UNIQUE INDEX IF NOT EXISTS keyndx ON shelf (key); +''', 'UNIQ') + + SELECTORS = [ 'SELECT * FROM shelf', 'SELECT * FROM shelf ORDER BY key', @@ -88,6 +87,18 @@ conn.commit() return conn +def fragmentit(conn, addlist, dellist, n=20): + # Make random adds and deletes, n at time + addlist = addlist[:] + dellist = dellist[:] + while len(addlist) >= n and len(dellist) >= n: + for i in range(n): + conn.execute('DELETE FROM shelf WHERE ROWID = ?', dellist.pop()) + conn.commit() + for i in range(n): + conn.execute('REPLACE INTO shelf (key, value) VALUES (?, ?)', addlist.pop()) + conn.commit() + def timeit(conn, stmt, n=20): conn.execute(stmt) # precompile start = clock() @@ -95,15 +106,133 @@ conn.execute(stmt).fetchall() return '%.2f' % (clock() - start) - +n, m = 2000, 6000 +fragment, vacuum = True, True seed('xyzpdqbingo') -items = populate(2000) +items = populate(n) +dellist = [(randrange(n),) for i in range(m)] +addlist = populate(m) for stmt in SELECTORS: print(stmt) for builder, name in [MAKE_shelf, MAKE_shelf_PRIMARY, MAKE_shelf_UNIQUE]: conn = setup(builder, items) + if fragment: + fragmentit(conn, addlist, dellist) + if vacuum: + conn.execute('VACUUM') print(sorted(timeit(conn, stmt, n=100) for i in range(6)), name) print() + - +''' Results: + +No difference between 'select *', 'select k,v', and 'select * by rowid' + Doesn't matter if the tables are unindexed, have a primary key, or a unique index. +Fragmented leaves timing ratios the same but takes 3.34 times longer. +Running a VACUUM after fragmenting doesn't speed things up. +"order by key" is twice as slow as unordered, even with indexing. +The effect of "primary key" and a unique index is the same +BLOB and TEXT types have the same timing + + + +Results for unfragmented: n, m = 2000, 6000 + +SELECT * FROM shelf +['0.38', '0.38', '0.38', '0.39', '0.39', '0.47'] UNINDEXED +['0.38', '0.38', '0.39', '0.39', '0.39', '0.41'] PRIMARY +['0.38', '0.38', '0.39', '0.39', '0.41', '0.42'] UNIQ + +SELECT * FROM shelf ORDER BY key +['1.63', '1.63', '1.63', '1.64', '1.64', '1.74'] UNINDEXED +['0.57', '0.57', '0.57', '0.58', '0.58', '0.63'] PRIMARY +['0.57', '0.57', '0.57', '0.58', '0.58', '0.71'] UNIQ + +SELECT * FROM shelf ORDER BY rowid +['0.38', '0.39', '0.39', '0.39', '0.39', '0.47'] UNINDEXED +['0.38', '0.38', '0.39', '0.39', '0.40', '0.43'] PRIMARY +['0.38', '0.38', '0.39', '0.39', '0.39', '0.44'] UNIQ + +SELECT key FROM shelf +['0.26', '0.26', '0.26', '0.26', '0.26', '0.29'] UNINDEXED +['0.26', '0.26', '0.26', '0.26', '0.26', '0.29'] PRIMARY +['0.26', '0.26', '0.26', '0.26', '0.27', '0.35'] UNIQ + +SELECT value FROM shelf +['0.26', '0.26', '0.26', '0.27', '0.27', '0.30'] UNINDEXED +['0.26', '0.26', '0.26', '0.26', '0.27', '0.28'] PRIMARY +['0.26', '0.26', '0.26', '0.26', '0.26', '0.32'] UNIQ + +SELECT key, value FROM shelf +['0.38', '0.38', '0.38', '0.38', '0.39', '0.44'] UNINDEXED +['0.38', '0.38', '0.38', '0.39', '0.40', '0.43'] PRIMARY +['0.38', '0.38', '0.38', '0.39', '0.39', '0.47'] UNIQ + + +----- Fragmented: n, m = 2000, 6000 + +SELECT * FROM shelf +['1.27', '1.28', '1.29', '1.30', '1.32', '1.39'] UNINDEXED +['1.29', '1.30', '1.31', '1.31', '1.31', '1.45'] PRIMARY +['1.29', '1.29', '1.29', '1.30', '1.31', '1.45'] UNIQ + +SELECT * FROM shelf ORDER BY key +['5.55', '5.58', '5.58', '5.59', '5.70', '5.75'] UNINDEXED +['1.91', '1.92', '1.92', '1.92', '1.93', '2.02'] PRIMARY +['1.91', '1.92', '1.94', '1.94', '2.08', '2.10'] UNIQ + +SELECT * FROM shelf ORDER BY rowid +['1.30', '1.30', '1.30', '1.31', '1.42', '1.48'] UNINDEXED +['1.28', '1.29', '1.29', '1.30', '1.30', '1.42'] PRIMARY +['1.29', '1.30', '1.31', '1.31', '1.39', '1.40'] UNIQ + +SELECT key FROM shelf +['0.90', '0.91', '0.91', '0.92', '0.92', '1.07'] UNINDEXED +['0.89', '0.91', '0.91', '0.91', '0.91', '1.02'] PRIMARY +['0.90', '0.91', '0.91', '0.92', '0.93', '1.06'] UNIQ + +SELECT value FROM shelf +['0.90', '0.91', '0.91', '0.91', '0.93', '1.06'] UNINDEXED +['0.89', '0.91', '0.91', '0.91', '0.92', '1.00'] PRIMARY +['0.90', '0.91', '0.91', '0.91', '0.92', '0.99'] UNIQ + +SELECT key, value FROM shelf +['1.29', '1.30', '1.30', '1.30', '1.31', '1.45'] UNINDEXED +['1.29', '1.29', '1.29', '1.29', '1.30', '1.41'] PRIMARY +['1.29', '1.29', '1.30', '1.30', '1.30', '1.45'] UNIQ + + +----- Fragmented, then vacuumed: n, m = 2000, 6000 + +SELECT * FROM shelf +['1.29', '1.29', '1.31', '1.31', '1.40', '1.49'] UNINDEXED +['1.32', '1.32', '1.32', '1.33', '1.33', '1.52'] PRIMARY +['1.28', '1.29', '1.31', '1.31', '1.32', '1.47'] UNIQ + +SELECT * FROM shelf ORDER BY key +['5.76', '5.77', '5.77', '5.77', '5.77', '5.81'] UNINDEXED +['1.91', '1.91', '1.91', '1.91', '1.92', '2.02'] PRIMARY +['1.89', '1.90', '1.91', '1.92', '1.92', '2.07'] UNIQ + +SELECT * FROM shelf ORDER BY rowid +['1.35', '1.37', '1.38', '1.51', '1.53', '1.56'] UNINDEXED +['1.28', '1.29', '1.30', '1.30', '1.30', '1.42'] PRIMARY +['1.32', '1.33', '1.33', '1.34', '1.34', '1.50'] UNIQ + +SELECT key FROM shelf +['0.88', '0.89', '0.90', '0.90', '0.90', '1.09'] UNINDEXED +['0.90', '0.91', '0.91', '0.92', '0.92', '1.02'] PRIMARY +['0.89', '0.89', '0.89', '0.89', '0.90', '1.01'] UNIQ + +SELECT value FROM shelf +['0.89', '0.90', '0.91', '0.91', '0.91', '1.10'] UNINDEXED +['0.91', '0.91', '0.91', '0.91', '1.03', '1.08'] PRIMARY +['0.90', '0.91', '0.92', '0.92', '0.92', '1.00'] UNIQ + +SELECT key, value FROM shelf +['1.29', '1.30', '1.30', '1.30', '1.31', '1.46'] UNINDEXED +['1.29', '1.29', '1.30', '1.30', '1.31', '1.38'] PRIMARY +['1.28', '1.30', '1.30', '1.30', '1.33', '1.40'] UNIQ + +''' From python-checkins at python.org Mon Feb 2 09:01:18 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 2 Feb 2009 09:01:18 +0100 (CET) Subject: [Python-checkins] r69200 - in python/trunk/Doc: c-api/allocation.rst c-api/arg.rst c-api/bool.rst c-api/buffer.rst c-api/bytearray.rst c-api/cell.rst c-api/class.rst c-api/cobject.rst c-api/complex.rst c-api/conversion.rst c-api/datetime.rst c-api/descriptor.rst c-api/dict.rst c-api/file.rst c-api/float.rst c-api/function.rst c-api/gcsupport.rst c-api/gen.rst c-api/import.rst c-api/int.rst c-api/iter.rst c-api/iterator.rst c-api/list.rst c-api/long.rst c-api/mapping.rst c-api/marshal.rst c-api/method.rst c-api/module.rst c-api/none.rst c-api/number.rst c-api/objbuffer.rst c-api/object.rst c-api/reflection.rst c-api/sequence.rst c-api/set.rst c-api/slice.rst c-api/string.rst c-api/structures.rst c-api/sys.rst c-api/tuple.rst c-api/type.rst c-api/typeobj.rst c-api/unicode.rst c-api/weakref.rst library/abc.rst library/ast.rst library/fractions.rst library/future_builtins.rst library/importlib.rst library/io.rst library/json.rst library/multiprocessing.rst library/plistlib.rst library/repr.rst library/scrolledtext.rst library/tix.rst library/turtle.rst reference/grammar.rst whatsnew/2.7.rst Message-ID: <20090202080118.318051E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Feb 2 09:01:17 2009 New Revision: 69200 Log: Set native svn:eol-style property for text files. Modified: python/trunk/Doc/c-api/allocation.rst (props changed) python/trunk/Doc/c-api/arg.rst (props changed) python/trunk/Doc/c-api/bool.rst (props changed) python/trunk/Doc/c-api/buffer.rst (props changed) python/trunk/Doc/c-api/bytearray.rst (props changed) python/trunk/Doc/c-api/cell.rst (props changed) python/trunk/Doc/c-api/class.rst (props changed) python/trunk/Doc/c-api/cobject.rst (props changed) python/trunk/Doc/c-api/complex.rst (props changed) python/trunk/Doc/c-api/conversion.rst (props changed) python/trunk/Doc/c-api/datetime.rst (props changed) python/trunk/Doc/c-api/descriptor.rst (props changed) python/trunk/Doc/c-api/dict.rst (props changed) python/trunk/Doc/c-api/file.rst (props changed) python/trunk/Doc/c-api/float.rst (props changed) python/trunk/Doc/c-api/function.rst (props changed) python/trunk/Doc/c-api/gcsupport.rst (props changed) python/trunk/Doc/c-api/gen.rst (props changed) python/trunk/Doc/c-api/import.rst (props changed) python/trunk/Doc/c-api/int.rst (props changed) python/trunk/Doc/c-api/iter.rst (props changed) python/trunk/Doc/c-api/iterator.rst (props changed) python/trunk/Doc/c-api/list.rst (props changed) python/trunk/Doc/c-api/long.rst (props changed) python/trunk/Doc/c-api/mapping.rst (props changed) python/trunk/Doc/c-api/marshal.rst (props changed) python/trunk/Doc/c-api/method.rst (props changed) python/trunk/Doc/c-api/module.rst (props changed) python/trunk/Doc/c-api/none.rst (props changed) python/trunk/Doc/c-api/number.rst (props changed) python/trunk/Doc/c-api/objbuffer.rst (props changed) python/trunk/Doc/c-api/object.rst (props changed) python/trunk/Doc/c-api/reflection.rst (props changed) python/trunk/Doc/c-api/sequence.rst (props changed) python/trunk/Doc/c-api/set.rst (props changed) python/trunk/Doc/c-api/slice.rst (props changed) python/trunk/Doc/c-api/string.rst (props changed) python/trunk/Doc/c-api/structures.rst (props changed) python/trunk/Doc/c-api/sys.rst (props changed) python/trunk/Doc/c-api/tuple.rst (props changed) python/trunk/Doc/c-api/type.rst (props changed) python/trunk/Doc/c-api/typeobj.rst (props changed) python/trunk/Doc/c-api/unicode.rst (props changed) python/trunk/Doc/c-api/weakref.rst (props changed) python/trunk/Doc/library/abc.rst (props changed) python/trunk/Doc/library/ast.rst (props changed) python/trunk/Doc/library/fractions.rst (props changed) python/trunk/Doc/library/future_builtins.rst (props changed) python/trunk/Doc/library/importlib.rst (props changed) python/trunk/Doc/library/io.rst (props changed) python/trunk/Doc/library/json.rst (props changed) python/trunk/Doc/library/multiprocessing.rst (props changed) python/trunk/Doc/library/plistlib.rst (props changed) python/trunk/Doc/library/repr.rst (props changed) python/trunk/Doc/library/scrolledtext.rst (props changed) python/trunk/Doc/library/tix.rst (props changed) python/trunk/Doc/library/turtle.rst (props changed) python/trunk/Doc/reference/grammar.rst (props changed) python/trunk/Doc/whatsnew/2.7.rst (props changed) From python-checkins at python.org Mon Feb 2 09:27:16 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 2 Feb 2009 09:27:16 +0100 (CET) Subject: [Python-checkins] r69201 - in python/branches/release26-maint: Doc/c-api/allocation.rst Doc/c-api/arg.rst Doc/c-api/bool.rst Doc/c-api/buffer.rst Doc/c-api/bytearray.rst Doc/c-api/cell.rst Doc/c-api/class.rst Doc/c-api/cobject.rst Doc/c-api/complex.rst Doc/c-api/conversion.rst Doc/c-api/datetime.rst Doc/c-api/descriptor.rst Doc/c-api/dict.rst Doc/c-api/file.rst Doc/c-api/float.rst Doc/c-api/function.rst Doc/c-api/gcsupport.rst Doc/c-api/gen.rst Doc/c-api/import.rst Doc/c-api/int.rst Doc/c-api/iter.rst Doc/c-api/iterator.rst Doc/c-api/list.rst Doc/c-api/long.rst Doc/c-api/mapping.rst Doc/c-api/marshal.rst Doc/c-api/method.rst Doc/c-api/module.rst Doc/c-api/none.rst Doc/c-api/number.rst Doc/c-api/objbuffer.rst Doc/c-api/object.rst Doc/c-api/reflection.rst Doc/c-api/sequence.rst Doc/c-api/set.rst Doc/c-api/slice.rst Doc/c-api/string.rst Doc/c-api/structures.rst Doc/c-api/sys.rst Doc/c-api/tuple.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst Doc/c-api/unicode.rst Doc/c-api/weakref.rst Doc/library/abc.rst Doc/library/ast.rst Doc/library/fractions.rst Doc/library/future_builtins.rst Doc/library/io.rst Doc/library/json.rst Doc/library/multiprocessing.rst Doc/library/plistlib.rst Doc/library/repr.rst Doc/library/scrolledtext.rst Doc/library/tix.rst Doc/library/turtle.rst Doc/reference/grammar.rst Message-ID: <20090202082716.A51971E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Feb 2 09:27:16 2009 New Revision: 69201 Log: Merged revisions 69200 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r69200 | hirokazu.yamamoto | 2009-02-02 17:01:17 +0900 | 1 line Set native svn:eol-style property for text files. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/c-api/allocation.rst (props changed) python/branches/release26-maint/Doc/c-api/arg.rst (props changed) python/branches/release26-maint/Doc/c-api/bool.rst (props changed) python/branches/release26-maint/Doc/c-api/buffer.rst (props changed) python/branches/release26-maint/Doc/c-api/bytearray.rst (props changed) python/branches/release26-maint/Doc/c-api/cell.rst (props changed) python/branches/release26-maint/Doc/c-api/class.rst (props changed) python/branches/release26-maint/Doc/c-api/cobject.rst (props changed) python/branches/release26-maint/Doc/c-api/complex.rst (props changed) python/branches/release26-maint/Doc/c-api/conversion.rst (props changed) python/branches/release26-maint/Doc/c-api/datetime.rst (props changed) python/branches/release26-maint/Doc/c-api/descriptor.rst (props changed) python/branches/release26-maint/Doc/c-api/dict.rst (props changed) python/branches/release26-maint/Doc/c-api/file.rst (props changed) python/branches/release26-maint/Doc/c-api/float.rst (props changed) python/branches/release26-maint/Doc/c-api/function.rst (props changed) python/branches/release26-maint/Doc/c-api/gcsupport.rst (props changed) python/branches/release26-maint/Doc/c-api/gen.rst (props changed) python/branches/release26-maint/Doc/c-api/import.rst (props changed) python/branches/release26-maint/Doc/c-api/int.rst (props changed) python/branches/release26-maint/Doc/c-api/iter.rst (props changed) python/branches/release26-maint/Doc/c-api/iterator.rst (props changed) python/branches/release26-maint/Doc/c-api/list.rst (props changed) python/branches/release26-maint/Doc/c-api/long.rst (props changed) python/branches/release26-maint/Doc/c-api/mapping.rst (props changed) python/branches/release26-maint/Doc/c-api/marshal.rst (props changed) python/branches/release26-maint/Doc/c-api/method.rst (props changed) python/branches/release26-maint/Doc/c-api/module.rst (props changed) python/branches/release26-maint/Doc/c-api/none.rst (props changed) python/branches/release26-maint/Doc/c-api/number.rst (props changed) python/branches/release26-maint/Doc/c-api/objbuffer.rst (props changed) python/branches/release26-maint/Doc/c-api/object.rst (props changed) python/branches/release26-maint/Doc/c-api/reflection.rst (props changed) python/branches/release26-maint/Doc/c-api/sequence.rst (props changed) python/branches/release26-maint/Doc/c-api/set.rst (props changed) python/branches/release26-maint/Doc/c-api/slice.rst (props changed) python/branches/release26-maint/Doc/c-api/string.rst (props changed) python/branches/release26-maint/Doc/c-api/structures.rst (props changed) python/branches/release26-maint/Doc/c-api/sys.rst (props changed) python/branches/release26-maint/Doc/c-api/tuple.rst (props changed) python/branches/release26-maint/Doc/c-api/type.rst (props changed) python/branches/release26-maint/Doc/c-api/typeobj.rst (props changed) python/branches/release26-maint/Doc/c-api/unicode.rst (props changed) python/branches/release26-maint/Doc/c-api/weakref.rst (props changed) python/branches/release26-maint/Doc/library/abc.rst (props changed) python/branches/release26-maint/Doc/library/ast.rst (props changed) python/branches/release26-maint/Doc/library/fractions.rst (props changed) python/branches/release26-maint/Doc/library/future_builtins.rst (props changed) python/branches/release26-maint/Doc/library/io.rst (props changed) python/branches/release26-maint/Doc/library/json.rst (props changed) python/branches/release26-maint/Doc/library/multiprocessing.rst (props changed) python/branches/release26-maint/Doc/library/plistlib.rst (props changed) python/branches/release26-maint/Doc/library/repr.rst (props changed) python/branches/release26-maint/Doc/library/scrolledtext.rst (props changed) python/branches/release26-maint/Doc/library/tix.rst (props changed) python/branches/release26-maint/Doc/library/turtle.rst (props changed) python/branches/release26-maint/Doc/reference/grammar.rst (props changed) From buildbot at python.org Mon Feb 2 09:56:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 08:56:52 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 2.6 Message-ID: <20090202085652.805051E4010@bag.python.org> The Buildbot has detected a new failure of OS X x86 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%202.6/builds/37 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_docxmlrpc test_exceptions make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Feb 2 10:07:57 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 09:07:57 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.6 Message-ID: <20090202090757.8A1171E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%202.6/builds/56 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Feb 2 10:15:41 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 2 Feb 2009 10:15:41 +0100 (CET) Subject: [Python-checkins] r69202 - in python/branches/py3k: Doc/c-api/allocation.rst Doc/c-api/arg.rst Doc/c-api/bool.rst Doc/c-api/buffer.rst Doc/c-api/bytearray.rst Doc/c-api/bytes.rst Doc/c-api/cell.rst Doc/c-api/cobject.rst Doc/c-api/complex.rst Doc/c-api/conversion.rst Doc/c-api/datetime.rst Doc/c-api/descriptor.rst Doc/c-api/dict.rst Doc/c-api/file.rst Doc/c-api/float.rst Doc/c-api/function.rst Doc/c-api/gcsupport.rst Doc/c-api/gen.rst Doc/c-api/import.rst Doc/c-api/iter.rst Doc/c-api/iterator.rst Doc/c-api/list.rst Doc/c-api/long.rst Doc/c-api/mapping.rst Doc/c-api/marshal.rst Doc/c-api/method.rst Doc/c-api/module.rst Doc/c-api/none.rst Doc/c-api/number.rst Doc/c-api/objbuffer.rst Doc/c-api/object.rst Doc/c-api/objimpl.rst Doc/c-api/reflection.rst Doc/c-api/sequence.rst Doc/c-api/set.rst Doc/c-api/slice.rst Doc/c-api/structures.rst Doc/c-api/sys.rst Doc/c-api/tuple.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst Doc/c-api/unicode.rst Doc/c-api/weakref.rst Doc/library/ast.rst Doc/library/copyreg.rst Doc/library/fractions.rst Doc/library/html.entities.rst Doc/library/importlib.rst Doc/library/io.rst Doc/library/json.rst Doc/library/multiprocessing.rst Doc/library/plistlib.rst Doc/library/reprlib.rst Doc/reference/grammar.rst Doc/whatsnew/2.7.rst Message-ID: <20090202091541.BC9061E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Feb 2 10:15:41 2009 New Revision: 69202 Log: Merged revisions 69200 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r69200 | hirokazu.yamamoto | 2009-02-02 17:01:17 +0900 | 1 line Set native svn:eol-style property for text files. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/c-api/allocation.rst (props changed) python/branches/py3k/Doc/c-api/arg.rst (props changed) python/branches/py3k/Doc/c-api/bool.rst (props changed) python/branches/py3k/Doc/c-api/buffer.rst (props changed) python/branches/py3k/Doc/c-api/bytearray.rst (props changed) python/branches/py3k/Doc/c-api/bytes.rst (props changed) python/branches/py3k/Doc/c-api/cell.rst (props changed) python/branches/py3k/Doc/c-api/cobject.rst (props changed) python/branches/py3k/Doc/c-api/complex.rst (props changed) python/branches/py3k/Doc/c-api/conversion.rst (props changed) python/branches/py3k/Doc/c-api/datetime.rst (props changed) python/branches/py3k/Doc/c-api/descriptor.rst (props changed) python/branches/py3k/Doc/c-api/dict.rst (props changed) python/branches/py3k/Doc/c-api/file.rst (props changed) python/branches/py3k/Doc/c-api/float.rst (props changed) python/branches/py3k/Doc/c-api/function.rst (props changed) python/branches/py3k/Doc/c-api/gcsupport.rst (props changed) python/branches/py3k/Doc/c-api/gen.rst (props changed) python/branches/py3k/Doc/c-api/import.rst (props changed) python/branches/py3k/Doc/c-api/iter.rst (props changed) python/branches/py3k/Doc/c-api/iterator.rst (props changed) python/branches/py3k/Doc/c-api/list.rst (props changed) python/branches/py3k/Doc/c-api/long.rst (props changed) python/branches/py3k/Doc/c-api/mapping.rst (props changed) python/branches/py3k/Doc/c-api/marshal.rst (props changed) python/branches/py3k/Doc/c-api/method.rst (props changed) python/branches/py3k/Doc/c-api/module.rst (props changed) python/branches/py3k/Doc/c-api/none.rst (props changed) python/branches/py3k/Doc/c-api/number.rst (props changed) python/branches/py3k/Doc/c-api/objbuffer.rst (props changed) python/branches/py3k/Doc/c-api/object.rst (props changed) python/branches/py3k/Doc/c-api/objimpl.rst (props changed) python/branches/py3k/Doc/c-api/reflection.rst (props changed) python/branches/py3k/Doc/c-api/sequence.rst (props changed) python/branches/py3k/Doc/c-api/set.rst (props changed) python/branches/py3k/Doc/c-api/slice.rst (props changed) python/branches/py3k/Doc/c-api/structures.rst (props changed) python/branches/py3k/Doc/c-api/sys.rst (props changed) python/branches/py3k/Doc/c-api/tuple.rst (props changed) python/branches/py3k/Doc/c-api/type.rst (props changed) python/branches/py3k/Doc/c-api/typeobj.rst (props changed) python/branches/py3k/Doc/c-api/unicode.rst (props changed) python/branches/py3k/Doc/c-api/weakref.rst (props changed) python/branches/py3k/Doc/library/ast.rst (props changed) python/branches/py3k/Doc/library/copyreg.rst (props changed) python/branches/py3k/Doc/library/fractions.rst (props changed) python/branches/py3k/Doc/library/html.entities.rst (props changed) python/branches/py3k/Doc/library/importlib.rst (props changed) python/branches/py3k/Doc/library/io.rst (props changed) python/branches/py3k/Doc/library/json.rst (props changed) python/branches/py3k/Doc/library/multiprocessing.rst (props changed) python/branches/py3k/Doc/library/plistlib.rst (props changed) python/branches/py3k/Doc/library/reprlib.rst (props changed) python/branches/py3k/Doc/reference/grammar.rst (props changed) python/branches/py3k/Doc/whatsnew/2.7.rst (props changed) From buildbot at python.org Mon Feb 2 10:25:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 09:25:20 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 2.6 Message-ID: <20090202092520.5FD8A1E4002@bag.python.org> The Buildbot has detected a new failure of x86 osx.5 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%202.6/builds/85 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Mon Feb 2 10:46:30 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 2 Feb 2009 10:46:30 +0100 (CET) Subject: [Python-checkins] r69203 - in python/branches/release30-maint: Doc/c-api/allocation.rst Doc/c-api/arg.rst Doc/c-api/bool.rst Doc/c-api/buffer.rst Doc/c-api/bytearray.rst Doc/c-api/bytes.rst Doc/c-api/cell.rst Doc/c-api/cobject.rst Doc/c-api/complex.rst Doc/c-api/conversion.rst Doc/c-api/datetime.rst Doc/c-api/descriptor.rst Doc/c-api/dict.rst Doc/c-api/file.rst Doc/c-api/float.rst Doc/c-api/function.rst Doc/c-api/gcsupport.rst Doc/c-api/gen.rst Doc/c-api/import.rst Doc/c-api/iter.rst Doc/c-api/iterator.rst Doc/c-api/list.rst Doc/c-api/long.rst Doc/c-api/mapping.rst Doc/c-api/marshal.rst Doc/c-api/method.rst Doc/c-api/module.rst Doc/c-api/none.rst Doc/c-api/number.rst Doc/c-api/objbuffer.rst Doc/c-api/object.rst Doc/c-api/objimpl.rst Doc/c-api/reflection.rst Doc/c-api/sequence.rst Doc/c-api/set.rst Doc/c-api/slice.rst Doc/c-api/structures.rst Doc/c-api/sys.rst Doc/c-api/tuple.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst Doc/c-api/unicode.rst Doc/c-api/weakref.rst Doc/library/ast.rst Doc/library/copyreg.rst Doc/library/fractions.rst Doc/library/html.entities.rst Doc/library/io.rst Doc/library/json.rst Doc/library/multiprocessing.rst Doc/library/plistlib.rst Doc/library/reprlib.rst Doc/reference/grammar.rst Doc/whatsnew/2.7.rst Message-ID: <20090202094630.C1A921E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Feb 2 10:46:30 2009 New Revision: 69203 Log: Merged revisions 69202 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r69202 | hirokazu.yamamoto | 2009-02-02 18:15:41 +0900 | 9 lines Merged revisions 69200 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r69200 | hirokazu.yamamoto | 2009-02-02 17:01:17 +0900 | 1 line Set native svn:eol-style property for text files. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/c-api/allocation.rst (props changed) python/branches/release30-maint/Doc/c-api/arg.rst (props changed) python/branches/release30-maint/Doc/c-api/bool.rst (props changed) python/branches/release30-maint/Doc/c-api/buffer.rst (props changed) python/branches/release30-maint/Doc/c-api/bytearray.rst (props changed) python/branches/release30-maint/Doc/c-api/bytes.rst (props changed) python/branches/release30-maint/Doc/c-api/cell.rst (props changed) python/branches/release30-maint/Doc/c-api/cobject.rst (props changed) python/branches/release30-maint/Doc/c-api/complex.rst (props changed) python/branches/release30-maint/Doc/c-api/conversion.rst (props changed) python/branches/release30-maint/Doc/c-api/datetime.rst (props changed) python/branches/release30-maint/Doc/c-api/descriptor.rst (props changed) python/branches/release30-maint/Doc/c-api/dict.rst (props changed) python/branches/release30-maint/Doc/c-api/file.rst (props changed) python/branches/release30-maint/Doc/c-api/float.rst (props changed) python/branches/release30-maint/Doc/c-api/function.rst (props changed) python/branches/release30-maint/Doc/c-api/gcsupport.rst (props changed) python/branches/release30-maint/Doc/c-api/gen.rst (props changed) python/branches/release30-maint/Doc/c-api/import.rst (props changed) python/branches/release30-maint/Doc/c-api/iter.rst (props changed) python/branches/release30-maint/Doc/c-api/iterator.rst (props changed) python/branches/release30-maint/Doc/c-api/list.rst (props changed) python/branches/release30-maint/Doc/c-api/long.rst (props changed) python/branches/release30-maint/Doc/c-api/mapping.rst (props changed) python/branches/release30-maint/Doc/c-api/marshal.rst (props changed) python/branches/release30-maint/Doc/c-api/method.rst (props changed) python/branches/release30-maint/Doc/c-api/module.rst (props changed) python/branches/release30-maint/Doc/c-api/none.rst (props changed) python/branches/release30-maint/Doc/c-api/number.rst (props changed) python/branches/release30-maint/Doc/c-api/objbuffer.rst (props changed) python/branches/release30-maint/Doc/c-api/object.rst (props changed) python/branches/release30-maint/Doc/c-api/objimpl.rst (props changed) python/branches/release30-maint/Doc/c-api/reflection.rst (props changed) python/branches/release30-maint/Doc/c-api/sequence.rst (props changed) python/branches/release30-maint/Doc/c-api/set.rst (props changed) python/branches/release30-maint/Doc/c-api/slice.rst (props changed) python/branches/release30-maint/Doc/c-api/structures.rst (props changed) python/branches/release30-maint/Doc/c-api/sys.rst (props changed) python/branches/release30-maint/Doc/c-api/tuple.rst (props changed) python/branches/release30-maint/Doc/c-api/type.rst (props changed) python/branches/release30-maint/Doc/c-api/typeobj.rst (props changed) python/branches/release30-maint/Doc/c-api/unicode.rst (props changed) python/branches/release30-maint/Doc/c-api/weakref.rst (props changed) python/branches/release30-maint/Doc/library/ast.rst (props changed) python/branches/release30-maint/Doc/library/copyreg.rst (props changed) python/branches/release30-maint/Doc/library/fractions.rst (props changed) python/branches/release30-maint/Doc/library/html.entities.rst (props changed) python/branches/release30-maint/Doc/library/io.rst (props changed) python/branches/release30-maint/Doc/library/json.rst (props changed) python/branches/release30-maint/Doc/library/multiprocessing.rst (props changed) python/branches/release30-maint/Doc/library/plistlib.rst (props changed) python/branches/release30-maint/Doc/library/reprlib.rst (props changed) python/branches/release30-maint/Doc/reference/grammar.rst (props changed) python/branches/release30-maint/Doc/whatsnew/2.7.rst (props changed) From buildbot at python.org Mon Feb 2 11:44:05 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Feb 2009 10:44:05 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20090202104406.8E5B61E4002@bag.python.org> The Buildbot has detected a new failure of x86 osx.5 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.0/builds/101 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 51 tests failed: test__locale test_bool test_builtin test_cmath test_cmd_line test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_tw test_coding test_compile test_contextlib test_csv test_decimal test_defaultdict test_distutils test_doctest test_email test_fileinput test_http_cookiejar test_inspect test_iter test_lib2to3 test_list test_logging test_mailbox test_math test_mmap test_modulefinder test_multiprocessing test_mutants test_pep352 test_pipes test_platform test_popen test_posix test_runpy test_sax test_site test_ssl test_subprocess test_sundry test_tarfile test_tcl test_tempfile test_traceback test_xml_etree_c test_xmlrpc test_zipfile test_zipimport test_zipimport_support Traceback (most recent call last): File "./Lib/test/regrtest.py", line 596, in runtest_inner File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test__locale.py", line 7, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/platform.py", line 1152, in uname File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/platform.py", line 908, in _syscmd_uname File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_print (test.test_bool.BoolTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_bool.py", line 30, in test_print File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_input (test.test_builtin.BuiltinTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_builtin.py", line 972, in test_input File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_builtin.py", line 789, in write_testfile File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_open (test.test_builtin.BuiltinTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_builtin.py", line 800, in test_open File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_builtin.py", line 789, in write_testfile File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_specific_values (test.test_cmath.CMathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_cmath.py", line 309, in test_specific_values File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_math.py", line 31, in parse_testfile File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_site_flag (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_cmd_line.py", line 69, in test_site_flag File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/util.py", line 119, in get_platform File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_cn.TestGB18030Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 289, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 326, in _test_mapping_file_ucm File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_cn.TestGB2312Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_cn.TestGBKMap) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_hk.TestBig5HKSCSMap) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_jp.TestCP932Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_jp.TestEUCJISX0213Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_jp.TestEUCJPCOMPATMap) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_jp.TestSJISCOMPATMap) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_jp.TestSJISX0213Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_tw.TestBIG5Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mapping_file (test.test_codecmaps_tw.TestCP950Map) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 291, in test_mapping_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_multibytecodec_support.py", line 297, in _test_mapping_file_plain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_file_parse (test.test_coding.CodingTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_coding.py", line 39, in test_file_parse File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_compile_ast (test.test_compile.TestSpecifics) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_compile.py", line 385, in test_compile_ast File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: testWithOpen (test.test_contextlib.FileContextTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_contextlib.py", line 264, in testWithOpen File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_char_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 683, in test_char_write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_double_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 661, in test_double_write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_float_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 672, in test_float_write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_int_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 650, in test_int_write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_blankline (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 406, in test_blankline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_dubious_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 473, in test_dubious_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_empty_fields (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 409, in test_empty_fields File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_inline_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 427, in test_inline_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_inline_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 430, in test_inline_quotes File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_lone_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 438, in test_lone_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_newlines (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 491, in test_newlines File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_null (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 476, in test_null File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 394, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_quote_and_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): ====================================================================== ERROR: test_quote_fieldsep (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 488, in test_quote_fieldsep File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quoted (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 452, in test_quoted File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quoted_nl (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 470, in test_quoted_nl File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quoted_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 458, in test_quoted_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quoted_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 424, in test_quoted_quotes File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 485, in test_quotes File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_quotes_and_more (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 435, in test_quotes_and_more File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_simple (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 482, in test_simple File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_single (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 479, in test_single File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_single_quoted_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 421, in test_single_quoted_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_singlequoted (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 412, in test_singlequoted File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_singlequoted_left_empty (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 415, in test_singlequoted_left_empty File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_singlequoted_right_empty (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 418, in test_singlequoted_right_empty File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_space_and_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 446, in test_space_and_quote File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_space_dialect (test.test_csv.TestDialectRegistry) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 333, in test_space_dialect File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_dict_fieldnames_chain (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 563, in test_read_dict_fieldnames_chain File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_dict_fieldnames_from_file (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 553, in test_read_dict_fieldnames_from_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_dict_fields (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 535, in test_read_dict_fields File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_dict_no_fieldnames (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 543, in test_read_dict_no_fieldnames File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_long (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 573, in test_read_long File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_long_with_rest (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 582, in test_read_long_with_rest File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_long_with_rest_no_fieldnames (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 591, in test_read_long_with_rest_no_fieldnames File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_short (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 600, in test_read_short File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_simple_dict (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 525, in test_write_simple_dict File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/csv.py", line 139, in writerow File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_escape_fieldsep (test.test_csv.TestEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 501, in test_escape_fieldsep File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_escape_fieldsep (test.test_csv.TestEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 504, in test_read_escape_fieldsep File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_read_escape_fieldsep (test.test_csv.TestQuotedEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 517, in test_read_escape_fieldsep File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 383, in readerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_escape_fieldsep (test.test_csv.TestQuotedEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 514, in test_write_escape_fieldsep File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 392, in writerAssertEqual File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_arg_valid (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 130, in test_write_arg_valid File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 123, in _write_test File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_bigfield (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 151, in test_write_bigfield File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 123, in _write_test File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_escape (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 168, in test_write_escape File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 123, in _write_test File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_write_quoting (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 154, in test_write_quoting File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 123, in _write_test File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_writerows (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_csv.py", line 195, in test_writerows File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_abs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_add (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_and (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_base (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_clamp (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_class (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_compare (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_comparetotal (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_comparetotmag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_copy (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_copyabs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_copynegate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_copysign (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddAbs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddAdd (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddAnd (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddBase (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCanonical (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddClass (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCompare (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCompareSig (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCompareTotal (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCompareTotalMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCopy (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCopyAbs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCopyNegate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddCopySign (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddDivide (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddDivideInt (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddEncode (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddFMA (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddInvert (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddLogB (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMax (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMaxMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMin (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMinMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMinus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddMultiply (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddNextMinus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddNextPlus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddNextToward (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddOr (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddPlus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddQuantize (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddReduce (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddRemainder (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddRemainderNear (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddRotate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddSameQuantum (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddScaleB (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddShift (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddSubtract (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddToIntegral (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ddXor (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_decDouble (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_decQuad (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_decSingle (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_divide (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_divideint (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqAbs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqAdd (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqAnd (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqBase (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCanonical (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqClass (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCompare (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCompareSig (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCompareTotal (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCompareTotalMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCopy (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCopyAbs (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCopyNegate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqCopySign (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqDivide (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqDivideInt (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqEncode (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqFMA (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqInvert (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqLogB (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMax (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMaxMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMin (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMinMag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMinus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqMultiply (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqNextMinus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqNextPlus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqNextToward (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqOr (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqPlus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqQuantize (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqReduce (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqRemainder (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqRemainderNear (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqRotate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqSameQuantum (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqScaleB (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqShift (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqSubtract (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqToIntegral (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dqXor (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dsBase (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dsEncode (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_exp (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_extra (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_fma (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_inexact (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_invert (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_ln (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_log10 (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_logb (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_max (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_maxmag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_min (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_minmag (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_minus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_multiply (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_nextminus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_nextplus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_nexttoward (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_or (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_plus (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_power (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_powersqrt (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_quantize (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_randomBound32 (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_randoms (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_reduce (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_remainder (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_remainderNear (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_rescale (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_rotate (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_rounding (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_samequantum (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_scaleb (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_shift (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_squareroot (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_subtract (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_testall (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_tointegral (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_tointegralx (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_xor (test.test_decimal.DecimalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 1556, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_decimal.py", line 199, in eval_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1746, in __next__ File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1819, in readline File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_print (test.test_defaultdict.TestDefaultDict) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_defaultdict.py", line 86, in test_print File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' ====================================================================== ERROR: test_recursive_repr (test.test_defaultdict.TestDefaultDict) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_defaultdict.py", line 162, in test_recursive_repr File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1496, in write File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 19, in encode AttributeError: 'NoneType' object has no attribute 'charmap_encode' Traceback (most recent call last): File "./Lib/test/regrtest.py", line 603, in runtest_inner File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_distutils.py", line 13, in test_main File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/tests/__init__.py", line 28, in test_suite File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/tests/test_build_ext.py", line 8, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/command/build_ext.py", line 34, in File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/command/build_ext.py", line 64, in build_ext File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/distutils/util.py", line 119, in get_platform File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_MIME_digest (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1944, in test_MIME_digest File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_MIME_digest_with_part_headers (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1952, in test_MIME_digest_with_part_headers File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_content_type (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2007, in test_content_type File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dsn (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1964, in test_dsn File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_long_header (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1948, in test_long_header File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_message_external_body_idempotent (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2000, in test_message_external_body_idempotent File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mixed_with_image (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1956, in test_mixed_with_image File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_more_rfc2231_parameters (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1988, in test_more_rfc2231_parameters File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_multipart_no_parts (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1976, in test_multipart_no_parts File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_multipart_one_part (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1972, in test_multipart_one_part File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_multipart_report (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1960, in test_multipart_report File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_nested_multipart_mixeds (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1996, in test_nested_multipart_mixeds File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_no_start_boundary (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1980, in test_no_start_boundary File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_parse_text_message (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1921, in test_parse_text_message File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_parse_untyped_message (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1933, in test_parse_untyped_message File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_parser (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2038, in test_parser File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_preamble_epilogue (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1968, in test_preamble_epilogue File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_rfc2231_charset (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1984, in test_rfc2231_charset File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_simple_multipart (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1940, in test_simple_multipart File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_text_plain_in_a_multipart_digest (email.test.test_email.TestIdempotent) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1992, in test_text_plain_in_a_multipart_digest File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1908, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_body_line_iterator (email.test.test_email.TestIterators) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2353, in test_body_line_iterator File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 67, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/__init__.py", line 46, in message_from_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/parser.py", line 68, in parse File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1739, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_typed_subpart_iterator (email.test.test_email.TestIterators) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2368, in test_typed_subpart_iterator File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 67, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/__init__.py", line 46, in message_from_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/parser.py", line 68, in parse File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1739, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_typed_subpart_iterator_default_type (email.test.test_email.TestIterators) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 2385, in test_typed_subpart_iterator_default_type File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 67, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/__init__.py", line 46, in message_from_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/parser.py", line 68, in parse File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1739, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_bad_multipart (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_default_multipart_constructor (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_default_type (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_default_type_non_parsed (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_default_type_with_explicit_container_type (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_dsn (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_epilogue (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_generate (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_mime_attachments_in_constructor (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_no_nl_preamble (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_parse_message_rfc822 (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_type_error (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_valid_argument (email.test.test_email.TestMIMEMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 1603, in setUp File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1730, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ====================================================================== ERROR: test_as_string (email.test.test_email.TestMessageAPI) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 234, in test_as_string File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/test/test_email.py", line 67, in _msgobj File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/__init__.py", line 46, in message_from_file File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/email/parser.py", line 68, in parse File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1739, in read File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1567, in _read_chunk File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/io.py", line 1301, in decode File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/encodings/mac_roman.py", line 23, in decode AttributeError: 'NoneType' object has no attribute 'charmap_decode' ========================================